/* ────────── Reset & Base ────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f0f2f5; color: #1a1a2e; font-size: 14px; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ────────── Login Page ────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1a6b4e 0%, #0d9668 50%, #059669 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 400px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.login-logo { text-align: center; margin-bottom: 30px; }
.logo-icon { font-size: 48px; }
.login-logo h1 { font-size: 22px; color: #1a6b4e; margin-top: 8px; }
.login-logo p { font-size: 12px; color: #6b7280; letter-spacing: 2px; }
.login-form .form-group { margin-bottom: 16px; }
.login-form label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.login-form input { width: 100%; padding: 10px 14px; border: 1px solid #d1d5db; border-radius: 8px; transition: border-color 0.2s; }
.login-form input:focus { outline: none; border-color: #0d9668; box-shadow: 0 0 0 3px rgba(13,150,104,0.1); }
.login-error { color: #dc2626; font-size: 13px; margin-bottom: 12px; padding: 8px 12px; background: #fef2f2; border-radius: 6px; }
.login-hint { margin-top: 24px; padding-top: 20px; border-top: 1px solid #e5e7eb; text-align: center; }
.login-hint p { font-size: 12px; color: #6b7280; margin-bottom: 8px; }
.login-hint small { display: block; font-size: 11px; color: #9ca3af; margin: 2px 0; }

/* ────────── Buttons ────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s; background: #e5e7eb; color: #374151; }
.btn:hover { opacity: 0.85; }
.btn-primary { background: #0d9668; color: #fff; }
.btn-success { background: #2563eb; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-warning { background: #d97706; color: #fff; }
.btn-info { background: #0891b2; color: #fff; }

/* ────────── Topbar ────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; background: #fff; height: 56px; padding: 0 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); position: sticky; top: 0; z-index: 100; }
.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-title { font-size: 16px; font-weight: 700; color: #1a6b4e; }
.topbar-nav { display: flex; gap: 4px; }
.nav-link { padding: 6px 14px; font-size: 14px; color: #6b7280; border-radius: 6px; cursor: pointer; transition: all 0.15s; }
.nav-link:hover { background: #f0f2f5; color: #1a6b4e; }
.nav-link.active { background: #0d9668; color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-badge { font-size: 13px; color: #374151; }
.user-badge .role-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; margin-left: 6px; }
.role-tag.admin { background: #dbeafe; color: #1e40af; }
.role-tag.finance { background: #fef3c7; color: #92400e; }
.role-tag.user { background: #d1fae5; color: #065f46; }

/* ────────── Main Content ────────── */
.main-content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

/* ────────── Cards ────────── */
.card { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card-title { font-size: 15px; font-weight: 600; color: #1f2937; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid #f0f2f5; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid #f0f2f5; }
.card-header-row .card-title { margin-bottom: 0; padding-bottom: 0; border: none; }

/* ────────── Stats Grid ────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-card .stat-label { font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #1f2937; }
.stat-card .stat-value.eur { color: #0d9668; }
.stat-card .stat-value.profit { color: #2563eb; }

/* ────────── Tables ────────── */
.table-wrap { overflow-x: auto; background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 14px; text-align: left; font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; background: #f9fafb; border-bottom: 2px solid #e5e7eb; white-space: nowrap; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid #f0f2f5; font-size: 13px; }
.data-table tbody tr:hover { background: #f9fafb; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ────────── Forms ────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-group { margin-bottom: 0; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #0d9668; box-shadow: 0 0 0 2px rgba(13,150,104,0.1); }
.form-group input[type="number"] { width: 100%; }

/* ─────────── Page Header ─────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-header h2 { font-size: 20px; font-weight: 700; color: #1f2937; }
.section-title { font-size: 16px; font-weight: 600; color: #374151; margin: 20px 0 12px; }

/* ─────────── Filter Bar ─────────── */
.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; }
.filter-input { flex: 1; padding: 8px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13px; }
.filter-select { padding: 8px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13px; background: #fff; }

/* ─────────── Editor ─────────── */
.editor-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.editor-header h2 { font-size: 20px; font-weight: 700; }
.editor-actions { display: flex; gap: 8px; }

/* ─────────── Day Cards ─────────── */
.day-card { border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.day-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #f9fafb; border-bottom: 1px solid #e5e7eb; cursor: pointer; }
.day-header:hover { background: #f0f2f5; }
.day-number { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: #0d9668; color: #fff; border-radius: 50%; font-weight: 700; font-size: 14px; }
.day-summary { flex: 1; font-size: 13px; color: #6b7280; }
.day-cost { font-weight: 600; color: #0d9668; font-size: 14px; }
.day-actions { display: flex; gap: 4px; }
.day-body { padding: 16px; display: none; }
.day-card.expanded .day-body { display: block; }
.day-card.expanded .day-header { border-bottom: 2px solid #0d9668; }

/* Day form fields */
.day-form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.day-form-grid .form-group label { font-size: 11px; }
.day-form-grid input { padding: 6px 10px; font-size: 12px; }

/* Item tabs */
.item-tabs { display: flex; gap: 2px; margin-bottom: 12px; border-bottom: 2px solid #e5e7eb; }
.item-tab { padding: 8px 16px; font-size: 13px; color: #6b7280; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.item-tab:hover { color: #0d9668; }
.item-tab.active { color: #0d9668; border-bottom-color: #0d9668; font-weight: 600; }

/* Item list */
.item-list { margin-bottom: 12px; }
.item-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0f2f5; }
.item-row:last-child { border-bottom: none; }
.item-row select { flex: 1; padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 12px; }
.item-row .item-qty { width: 60px; }
.item-row .item-cost { width: 90px; text-align: right; font-weight: 600; color: #0d9668; }
.item-row .item-name { flex: 1; font-size: 13px; }

/* Add item row */
.add-item-row { display: flex; gap: 8px; align-items: center; padding: 8px 0; }
.add-item-row select { flex: 1; }
.add-item-row input { width: 60px; }

/* ─────────── Summary Card ─────────── */
.summary-card { background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%); border: 2px solid #d1fae5; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.summary-item { text-align: center; }
.summary-item .label { font-size: 12px; color: #6b7280; margin-bottom: 4px; }
.summary-item .value { font-size: 22px; font-weight: 700; }
.summary-item .value.cost { color: #dc2626; }
.summary-item .value.price { color: #0d9668; }
.summary-item .value.profit { color: #2563eb; }
.summary-item .value.margin { color: #d97706; }
.summary-item .value.perpax { color: #7c3aed; }

/* ─────────── Status Badges ─────────── */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-draft { background: #f3f4f6; color: #6b7280; }
.badge-confirmed { background: #d1fae5; color: #065f46; }
.badge-archived { background: #fef3c7; color: #92400e; }

/* ─────────── Admin Tabs ─────────── */
.admin-tabs { display: flex; gap: 2px; margin-bottom: 20px; flex-wrap: wrap; border-bottom: 2px solid #e5e7eb; }
.admin-tab { padding: 10px 20px; font-size: 14px; color: #6b7280; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; background: none; border-left: none; border-right: none; border-top: none; }
.admin-tab:hover { color: #0d9668; }
.admin-tab.active { color: #0d9668; border-bottom-color: #0d9668; font-weight: 600; }

/* Admin table */
.admin-table th, .admin-table td { font-size: 12px; padding: 8px 10px; }
.admin-table input, .admin-table select { padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 12px; width: 100%; }
.admin-edit-row { background: #fefdf2; }

/* ─────────── Customer Quote (Print) ─────────── */
.customer-toolbar { display: flex; justify-content: space-between; margin-bottom: 16px; align-items: center; }
.customer-doc { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); max-width: 800px; margin: 0 auto; }
.customer-doc .c-header { text-align: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 3px solid #0d9668; }
.customer-doc .c-header h1 { font-size: 24px; color: #0d9668; margin-bottom: 4px; }
.customer-doc .c-header .c-sub { font-size: 12px; color: #6b7280; letter-spacing: 2px; }
.customer-doc .c-title { font-size: 18px; font-weight: 700; margin: 24px 0 12px; color: #1f2937; }
.customer-doc .c-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 24px; }
.customer-doc .c-info-item { display: flex; gap: 8px; font-size: 13px; }
.customer-doc .c-info-item .lbl { color: #6b7280; min-width: 80px; }
.customer-doc .c-info-item .val { font-weight: 600; }
.customer-doc table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.customer-doc table th { background: #f0fdf4; padding: 8px 10px; font-size: 12px; text-align: left; border: 1px solid #d1d5db; }
.customer-doc table td { padding: 8px 10px; font-size: 12px; border: 1px solid #d1d5db; }
.customer-doc .c-cost-table th { background: #ecfdf5; }
.customer-doc .c-total-row td { font-weight: 700; background: #f0fdf4; }
.customer-doc .c-payment { margin-top: 24px; padding: 16px; background: #f9fafb; border-radius: 8px; }
.customer-doc .c-bank { margin-top: 16px; }
.customer-doc .c-bank-item { padding: 10px 0; border-bottom: 1px dashed #d1d5db; font-size: 12px; }
.customer-doc .c-bank-item:last-child { border: none; }
.customer-doc .c-bank-item .bank-name { font-weight: 700; color: #1f2937; }

/* ─────────── Customer: Attractions list ─────────── */
.customer-doc .c-attr-row { display: flex; align-items: flex-start; gap: 4px; line-height: 1.3; margin-bottom: 2px; }
.customer-doc .c-attr-row:last-child { margin-bottom: 0; }
.customer-doc .c-attr-dot { color: #0d9668; font-size: 10px; line-height: 1.6; flex-shrink: 0; }
.customer-doc .c-attr-name { font-weight: 500; color: #1f2937; }
.customer-doc .c-attr-desc { color: #6b7280; font-size: 11px; margin-left: 4px; }
.customer-doc .c-meal-label { font-weight: 600; color: #56886A; flex-shrink: 0; }

/* ── Meal slot tags (editor) ── */
.meal-slot-tag { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 6px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; font-size: 13px; font-weight: 600; color: #15803d; flex-shrink: 0; }
.meal-auto-hint { flex: 1; padding: 6px 10px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; font-size: 12px; color: #15803d; }
.meal-slot-row { align-items: center; }

/* ─────────── Print ─────────── */
@media print {
  body { background: #fff; }
  .topbar, .no-print, .customer-toolbar { display: none !important; }
  .main-content { padding: 0; max-width: none; }
  .view { display: block !important; }
  .view:not(#view-customer) { display: none !important; }
  .customer-doc { box-shadow: none; padding: 20px; max-width: none; }
  @page { margin: 1.5cm; }
}

/* ─────────── Responsive ─────────── */
@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .topbar-nav { order: 3; width: 100%; overflow-x: auto; }
  .nav-link { white-space: nowrap; }
  .main-content { padding: 12px; }
  .form-grid, .day-form-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .editor-header { flex-wrap: wrap; }
}

/* ─────────── Misc ─────────── */
.empty-state { text-align: center; padding: 40px 20px; color: #9ca3af; }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.action-cell { display: flex; gap: 4px; }
.section-divider { height: 1px; background: #e5e7eb; margin: 16px 0; }
.dashboard-actions { margin-bottom: 20px; }

/* ─────────── Customer Doc: Text Sections ─────────── */
.c-section-box {
  margin-top: 20px;
  padding: 16px 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.c-text-block {
  font-size: 12px;
  line-height: 1.7;
  color: #374151;
  white-space: pre-wrap;
  word-break: break-word;
}
.c-duration-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.c-duration-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}
.c-duration-table .c-dur-region {
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  padding-right: 16px;
}
.c-duration-table .c-dur-time {
  color: #6b7280;
  white-space: nowrap;
  text-align: right;
}

/* ─────────── Pro-Invoice / Invoice Editor ─────────── */
.inv-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f2f5;
}
.inv-item-row:last-child { border-bottom: none; }
.inv-item-row .inv-desc {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
}
.inv-item-row .inv-price {
  width: 90px;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  text-align: right;
}
.inv-item-row .inv-qty {
  width: 60px;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
}
.inv-item-row .inv-amount {
  width: 100px;
  text-align: right;
  font-weight: 600;
  color: #0d9668;
  font-size: 12px;
}
.inv-account-chk:hover {
  border-color: #0d9668 !important;
  background: #f0fdf4 !important;
}

/* ─────────── Customer Doc: Invoice Sections ─────────── */
.c-invoice-section {
  margin-top: 30px;
  padding: 24px;
  border: 2px solid #0d9668;
  border-radius: 10px;
  background: #fff;
  page-break-inside: avoid;
}
.c-invoice-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #0d9668;
}
.c-invoice-company {
  font-size: 18px;
  font-weight: 700;
  color: #0d9668;
  margin-bottom: 4px;
}
.c-invoice-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}
.c-invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
.c-invoice-table th {
  background: #f0fdf4;
  padding: 8px 10px;
  font-size: 12px;
  text-align: left;
  border: 1px solid #d1d5db;
  font-weight: 600;
}
.c-invoice-table td {
  padding: 8px 10px;
  font-size: 12px;
  border: 1px solid #d1d5db;
}
.c-invoice-subtotal td {
  background: #f9fafb;
  font-weight: 600;
}
.c-invoice-total td {
  background: #f0fdf4;
  font-size: 14px;
  font-weight: 700;
  color: #0d9668;
}
.c-invoice-financial {
  padding: 12px 16px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.c-invoice-financial .lbl {
  font-size: 12px;
  color: #6b7280;
}
.c-invoice-financial .val {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}
.c-invoice-payable {
  padding: 12px 16px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: #92400e;
  margin-bottom: 12px;
}
.c-invoice-payment {
  margin-bottom: 12px;
}
.c-invoice-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 6px;
}
.c-invoice-note {
  padding: 8px 12px;
  background: #fef2f2;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.5;
  color: #991b1b;
  margin-bottom: 12px;
}
.c-invoice-banks .c-bank-item {
  padding: 8px 0;
  border-bottom: 1px dashed #d1d5db;
  font-size: 11px;
  line-height: 1.5;
}
