/* === Admin Dashboard === */

/* --- Theme Variables --- */

:root {
  /* Page */
  --bg-page: #f5f5f3;
  --bg-card: #fff;
  --bg-card-alt: #fafaf8;
  --text-primary: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #888;
  --text-faint: #aaa;
  --text-label: #666;

  /* Accent */
  --accent: #F1BB36;
  --accent-hover: #e5ad20;
  --accent-subtle: rgba(241,187,54,0.15);

  /* Borders & shadows */
  --border: #d0d0d0;
  --border-light: #f0f0ee;
  --shadow: rgba(0,0,0,0.04);
  --shadow-md: rgba(0,0,0,0.06);
  --shadow-lg: rgba(0,0,0,0.08);

  /* Sidebar */
  --sidebar-bg: #1a1a1a;
  --sidebar-text: #fff;
  --sidebar-border: #333;
  --sidebar-nav: #bbb;
  --sidebar-nav-hover-bg: #2a2a2a;
  --sidebar-muted: #888;

  /* Table */
  --table-hover: #fdf8e8;

  /* Code */
  --bg-code: #f5f5f3;

  /* Buttons */
  --btn-bg: #fff;
  --btn-text: #333;
  --btn-hover-bg: #f5f5f3;
  --btn-primary-bg: #1a1a1a;
  --btn-primary-text: #fff;
  --btn-primary-hover: #333;
  --btn-danger-bg: #fff;
  --btn-danger-text: #dc2626;
  --btn-danger-border: #fecaca;
  --btn-danger-hover-bg: #fef2f2;

  /* Login button */
  --login-btn-bg: #1a1a1a;
  --login-btn-text: #fff;
  --login-btn-hover: #333;

  /* Error */
  --error-text: #b91c1c;
  --error-bg: #fef2f2;
  --error-border: #fecaca;

  /* Badges */
  --badge-confirmed-bg: #ecfdf5;
  --badge-confirmed-text: #065f46;
  --badge-cancelled-bg: #fef2f2;
  --badge-cancelled-text: #991b1b;
}

[data-theme="dark"] {
  --bg-page: #121212;
  --bg-card: #1e1e1e;
  --bg-card-alt: #252525;
  --text-primary: #e0e0e0;
  --text-secondary: #aaa;
  --text-muted: #777;
  --text-faint: #555;
  --text-label: #999;

  --accent: #F1BB36;
  --accent-hover: #d4a12e;
  --accent-subtle: rgba(241,187,54,0.2);

  --border: #333;
  --border-light: #2a2a2a;
  --shadow: rgba(0,0,0,0.2);
  --shadow-md: rgba(0,0,0,0.3);
  --shadow-lg: rgba(0,0,0,0.4);

  --sidebar-bg: #0d0d0d;
  --sidebar-text: #e0e0e0;
  --sidebar-border: #2a2a2a;
  --sidebar-nav: #999;
  --sidebar-nav-hover-bg: #1a1a1a;
  --sidebar-muted: #666;

  --table-hover: #2a2518;

  --bg-code: #2a2a2a;

  --btn-bg: #2a2a2a;
  --btn-text: #e0e0e0;
  --btn-hover-bg: #333;
  --btn-primary-bg: #F1BB36;
  --btn-primary-text: #1a1a1a;
  --btn-primary-hover: #d4a12e;
  --btn-danger-bg: #1e1e1e;
  --btn-danger-text: #f87171;
  --btn-danger-border: #5c2020;
  --btn-danger-hover-bg: #2d1515;

  --login-btn-bg: #F1BB36;
  --login-btn-text: #1a1a1a;
  --login-btn-hover: #d4a12e;

  --error-text: #f87171;
  --error-bg: #2d1515;
  --error-border: #5c2020;

  --badge-confirmed-bg: #0d2818;
  --badge-confirmed-text: #6ee7b7;
  --badge-cancelled-bg: #2d1515;
  --badge-cancelled-text: #fca5a5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Red Hat Display', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
}

/* --- Login Page --- */

.admin-login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-page);
}

.admin-login-card {
  background: var(--bg-card);
  padding: 40px 36px;
  border-radius: 14px;
  box-shadow: 0 4px 24px var(--shadow-md);
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.admin-login-logo {
  height: 60px;
  margin-bottom: 16px;
}

.admin-login-card h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text-secondary);
}

.admin-login-card label {
  display: block;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 12px;
}

.admin-login-card input {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Red Hat Display', sans-serif;
  background: var(--bg-card);
  color: var(--text-primary);
}

.admin-login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.admin-login-card button {
  width: 100%;
  margin-top: 20px;
  padding: 11px;
  background: var(--login-btn-bg);
  color: var(--login-btn-text);
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Red Hat Display', sans-serif;
  transition: background 0.2s;
}

.admin-login-card button:hover {
  background: var(--login-btn-hover);
}

.error-message {
  color: var(--error-text);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 12px;
  font-size: 13px;
}

/* --- Shell: Sidebar + Main --- */

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 12px;
}

.admin-logo {
  height: 36px;
  border-radius: 4px;
}

.admin-brand span {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.admin-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.admin-nav-item {
  display: block;
  padding: 10px 16px;
  color: var(--sidebar-nav);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.admin-nav-item:hover {
  background: var(--sidebar-nav-hover-bg);
  color: var(--sidebar-text);
}

.admin-nav-item.active {
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
}

.admin-logout {
  margin: 0 8px;
  border-top: 1px solid var(--sidebar-border);
  padding-top: 12px;
  margin-top: 8px;
  color: var(--sidebar-muted);
}

.admin-logout:hover {
  color: var(--sidebar-text);
}

/* --- Dev Section (collapsible) --- */

.dev-section {
  margin: 0 8px;
  border-top: 1px solid var(--sidebar-border);
  padding-top: 8px;
  margin-top: auto;
}

.dev-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--sidebar-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dev-toggle:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-nav-hover-bg);
}

.dev-toggle svg {
  opacity: 0.5;
  flex-shrink: 0;
}

.dev-arrow {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.2s ease;
}

.dev-section--open .dev-arrow {
  transform: rotate(180deg);
}

.dev-nav {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-top: 2px;
}

.dev-section--open .dev-nav {
  display: flex;
}

.dev-nav .admin-nav-item {
  font-size: 13px;
  padding: 8px 16px;
}

/* --- Theme Toggle --- */

.theme-toggle {
  margin: 0 8px 0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sidebar-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  border-radius: 6px;
  font-family: 'Red Hat Display', sans-serif;
  transition: all 0.15s ease;
  width: calc(100% - 16px);
  text-align: left;
}

.theme-toggle:hover {
  background: var(--sidebar-nav-hover-bg);
  color: var(--sidebar-text);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.admin-main {
  flex: 1;
  margin-left: 220px;
  padding: 32px 40px;
}

/* --- Page Headers --- */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

/* --- View Toggle --- */

.view-toggle {
  display: inline-flex;
  gap: 0;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.view-toggle-btn {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.view-toggle-btn:hover {
  background: var(--bg-card-alt);
}
.view-toggle-btn.active {
  background: var(--accent);
  color: #1a1a1a;
}

/* --- Stats Grid --- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 6px var(--shadow);
  text-decoration: none;
  color: var(--text-primary);
  transition: box-shadow 0.15s ease, transform 0.1s ease;
  text-align: center;
}

.stat-card:hover {
  box-shadow: 0 4px 16px var(--shadow-lg);
  transform: translateY(-1px);
}

.stat-number {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 14px;
  color: var(--text-label);
  margin-top: 4px;
  font-weight: 500;
}

/* --- Tables --- */

.table-wrap {
  background: var(--bg-card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 6px var(--shadow);
  margin-bottom: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 11px 14px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
}

th {
  background: var(--bg-card-alt);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 11px;
}

tbody tr:hover {
  background: var(--table-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

.actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
}

.empty {
  text-align: center;
  padding: 28px !important;
  color: var(--text-muted);
  font-style: italic;
}

.text-muted { color: var(--text-faint); }

/* Activity indicator dots */
.activity-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.activity-dot--online { background: #22c55e; }
.activity-dot--recent { background: #F1BB36; }
.activity-dot--week { background: #fb923c; }
.activity-dot--inactive { background: var(--text-faint); }

/* Sortable table headers */
.sortable-th { cursor: pointer; user-select: none; position: relative; padding-right: 18px !important; }
.sortable-th::after { content: '⇅'; position: absolute; right: 4px; opacity: 0.3; font-size: 12px; }
.sortable-th.sort-asc::after { content: '↑'; opacity: 0.8; }
.sortable-th.sort-desc::after { content: '↓'; opacity: 0.8; }

code {
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Red Hat Display', sans-serif;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--btn-hover-bg);
}

.btn--small {
  padding: 5px 10px;
  font-size: 12px;
}

.btn--primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-bg);
}

.btn--primary:hover {
  background: var(--btn-primary-hover);
}

.btn--accent {
  background: var(--accent);
  color: #1a1a1a;
  border-color: var(--accent);
}

.btn--accent:hover {
  background: var(--accent-hover);
}

.btn--danger {
  background: var(--btn-danger-bg);
  color: var(--btn-danger-text);
  border-color: var(--btn-danger-border);
}

.btn--danger:hover {
  background: var(--btn-danger-hover-bg);
}

/* --- Forms --- */

.admin-form {
  background: var(--bg-card);
  padding: 28px;
  border-radius: 10px;
  box-shadow: 0 1px 6px var(--shadow);
  max-width: 600px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Red Hat Display', sans-serif;
  transition: border-color 0.15s ease;
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.filter-form select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Red Hat Display', sans-serif;
  background: var(--bg-card);
  color: var(--text-primary);
}

.filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.filter-checkbox input[type="checkbox"] {
  accent-color: var(--accent, #F1BB36);
}

/* --- QR Code --- */

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.qr-pdf-preview {
  width: 480px;
  height: 732px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}

.qr-info {
  text-align: center;
}

.qr-url {
  margin-bottom: 16px;
}

.qr-url code {
  font-size: 11px;
  word-break: break-all;
}

.qr-pdf-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.qr-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* --- Inline Edit --- */

.inline-edit-form {
  padding: 12px 4px;
}

.inline-edit-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.inline-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  flex: 1;
}

.inline-field--wide {
  flex: 2;
  min-width: 240px;
}

.inline-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.inline-field input,
.inline-field select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  font-family: 'Red Hat Display', sans-serif;
  background: var(--bg-card);
  color: var(--text-primary);
}

.inline-field input:focus,
.inline-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.inline-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.new-form-card {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

.color-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-picker {
  width: 36px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  background: none;
}

.color-text {
  width: 100px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  font-family: monospace;
  background: var(--bg-card);
  color: var(--text-primary);
}

.color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

tr.edit-row td {
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border-light);
}

/* --- Sections --- */

.admin-section {
  margin-bottom: 32px;
}

/* --- Badges --- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge--confirmed { background: var(--badge-confirmed-bg); color: var(--badge-confirmed-text); }
.badge--cancelled { background: var(--badge-cancelled-bg); color: var(--badge-cancelled-text); }
.badge--duplicate { background: var(--accent-subtle); color: var(--accent-hover); }
.badge--warning { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .badge--warning { background: #422006; color: #fbbf24; }

/* --- Webhook Log --- */

.error-col {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.webhook-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.webhook-modal {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 24px;
  max-width: 720px;
  width: 90%;
  max-height: 80vh;
  overflow: auto;
  box-shadow: 0 8px 32px var(--shadow-lg, rgba(0,0,0,0.2));
  position: relative;
}

.webhook-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

.webhook-modal-pre {
  background: var(--bg-card-alt);
  padding: 16px;
  border-radius: 6px;
  font-size: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 60vh;
  overflow-y: auto;
  color: var(--text-primary);
}

/* --- Toggle Switch --- */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 20px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #22c55e;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* --- Invoices --- */

.invoice-filters {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 24px 28px;
  box-shadow: 0 1px 6px var(--shadow);
  margin-bottom: 24px;
}

.invoice-form-fields {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.invoice-form-fields .form-group {
  margin-bottom: 0;
  min-width: 180px;
}

.form-group--btn {
  min-width: auto !important;
}

.invoice-preview {
  margin-top: 0;
}

.invoice-summary {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 20px 28px;
  box-shadow: 0 1px 6px var(--shadow);
  margin-bottom: 20px;
  display: flex;
  gap: 32px;
  align-items: center;
  flex-wrap: wrap;
}

.invoice-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.invoice-summary-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.invoice-summary-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.invoice-summary-total {
  margin-left: auto;
}

.invoice-summary-total .invoice-summary-value {
  color: var(--accent);
}

.invoice-details {
  background: var(--bg-card);
  border-radius: 10px;
  box-shadow: 0 1px 6px var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.invoice-details-toggle {
  padding: 14px 28px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.invoice-details-toggle::-webkit-details-marker {
  display: none;
}

.invoice-details-toggle::before {
  content: '\25B6';
  font-size: 10px;
  transition: transform 0.15s ease;
}

.invoice-details[open] > .invoice-details-toggle::before {
  transform: rotate(90deg);
}

.invoice-details-toggle:hover {
  color: var(--text-primary);
}

.invoice-details .table-wrap {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--border-light);
}

.btn--download {
  margin-bottom: 20px;
  padding: 10px 24px;
  font-size: 14px;
  display: inline-flex;
  gap: 6px;
}

.invoice-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.invoice-editor-fields {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 24px 28px;
  box-shadow: 0 1px 6px var(--shadow);
}

.invoice-editor-fields textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Red Hat Display', sans-serif;
  resize: vertical;
  transition: border-color 0.15s ease;
  background: var(--bg-card);
  color: var(--text-primary);
}

.invoice-editor-fields textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.invoice-editor-actions {
  margin-top: 12px;
}

.invoice-editor-preview {
  background: var(--bg-card);
  border-radius: 10px;
  box-shadow: 0 1px 6px var(--shadow);
  overflow: hidden;
  min-height: 500px;
}

.invoice-editor-preview iframe {
  width: 100%;
  height: 100%;
  min-height: 500px;
  border: none;
}

.invoice-save-form {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 20px 28px;
  box-shadow: 0 1px 6px var(--shadow);
  margin-bottom: 24px;
}

.invoice-save-fields {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.invoice-save-fields .form-group {
  margin-bottom: 0;
  flex: 1;
  max-width: 300px;
}

/* --- Charts --- */

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.chart-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 6px var(--shadow);
}

.chart-card h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 16px 0;
}

.chart-container {
  position: relative;
  width: 100%;
}

.chart-card--small {
  max-width: 320px;
  flex-shrink: 0;
}

.chart-card--flex {
  flex: 1;
  min-width: 0;
}

.bookings-charts {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.stat-trend {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 600;
}

.stat-trend--up { color: var(--badge-confirmed-text); }
.stat-trend--down { color: var(--badge-cancelled-text); }
.stat-trend--flat { color: var(--text-muted); }

/* --- Hotel Progression Cards --- */

.hotel-prog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.hotel-prog-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 6px var(--shadow);
}

.hotel-prog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.hotel-prog-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.hotel-prog-header .stat-trend {
  margin-top: 0;
}

.hotel-prog-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.hotel-prog-stats strong {
  color: var(--text-primary);
}

/* --- Table Toolbar (search, filters) --- */

.table-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.table-search {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Red Hat Display', sans-serif;
  background: var(--bg-card);
  color: var(--text-primary);
  min-width: 240px;
  transition: border-color 0.15s ease;
}

.table-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.table-search::placeholder {
  color: var(--text-muted);
}

.table-filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Red Hat Display', sans-serif;
  background: var(--bg-card);
  color: var(--text-primary);
}

.table-toolbar-info {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- Sortable Headers --- */

th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px;
  transition: color 0.15s;
}

th.sortable:hover {
  color: var(--text-primary);
}

th.sortable::after {
  content: '\2195';
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-faint);
}

th.sortable.sort-asc::after {
  content: '\2191';
  color: var(--accent);
}

th.sortable.sort-desc::after {
  content: '\2193';
  color: var(--accent);
}

/* --- Pagination --- */

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-buttons {
  display: flex;
  gap: 4px;
}

.pg-btn {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: 'Red Hat Display', sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 34px;
  text-align: center;
}

.pg-btn:hover:not(:disabled) {
  background: var(--bg-card-alt);
  border-color: var(--accent);
}

.pg-btn--active {
  background: var(--accent);
  color: #1a1a1a;
  border-color: var(--accent);
  font-weight: 600;
}

.pg-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* --- Responsive --- */

@media (max-width: 768px) {
  .admin-sidebar {
    display: none;
  }
  .admin-main {
    margin-left: 0;
    padding: 20px 16px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .invoice-editor {
    grid-template-columns: 1fr;
  }
  .invoice-save-fields {
    flex-direction: column;
    align-items: stretch;
  }
  .invoice-save-fields .form-group {
    max-width: none;
  }
  .chart-row {
    grid-template-columns: 1fr;
  }
  .bookings-charts {
    flex-direction: column;
  }
  .chart-card--small {
    max-width: none;
  }
  .hotel-prog-grid {
    grid-template-columns: 1fr;
  }
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .table-search {
    min-width: 0;
  }
  .table-toolbar-info {
    margin-left: 0;
  }
}
