@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  /* Brand */
  --ink: #17140F;
  --ink-soft: #2A241C;
  --gold: #B8860B;
  --gold-light: #D9A93E;
  --gold-pale: #F4E6C1;
  --cream: #FAF8F4;
  --cream-deep: #F1ECE1;
  --paper: #FFFFFF;
  --line: #E6DFCF;

  /* Signal colors */
  --signal-normal: #6B7280;
  --signal-orange: #D97706;
  --signal-orange-bg: #FEF3C7;
  --signal-red: #DC2626;
  --signal-red-bg: #FEE2E2;
  --signal-green: #16A34A;
  --signal-green-bg: #DCFCE7;
  --signal-yellow: #CA8A04;
  --signal-yellow-bg: #FEF9C3;

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 10px;
  --shadow-card: 0 1px 2px rgba(23,20,15,0.06), 0 1px 12px rgba(23,20,15,0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

a { color: inherit; }
button { font-family: var(--font-body); cursor: pointer; }

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--ink);
  color: #EFE9DC;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo img { height: 32px; width: auto; }
.sidebar-logo .tagline { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-light); opacity: 0.9; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #C9C2B0;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--gold); color: var(--ink); font-weight: 600; }
.nav-item .icon { width: 16px; text-align: center; opacity: 0.85; }

.nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8A8168;
  padding: 16px 12px 6px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: #8A8168;
}
.sidebar-footer .user-name { color: #EFE9DC; font-weight: 600; font-size: 13px; }
.sidebar-footer .role-pill {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(184,134,11,0.25);
  color: var(--gold-light);
  padding: 2px 8px;
  border-radius: 100px;
  margin-top: 4px;
}
.logout-btn {
  margin-top: 10px;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: #C9C2B0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  width: 100%;
}
.logout-btn:hover { border-color: var(--gold); color: var(--gold-light); }

.main {
  padding: 28px 36px 60px;
  max-width: 1400px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header h1 { font-size: 26px; }
.page-header .subtitle { color: #6B6455; font-size: 13px; margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: opacity 0.12s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { opacity: 0.9; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--gold); }
.btn-danger { background: var(--signal-red-bg); color: var(--signal-red); }
.btn-danger:hover { opacity: 0.85; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: 20px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}
.stat-card .stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 600; }
.stat-card .stat-label { font-size: 11.5px; color: #6B6455; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }
.stat-card.accent-gold { border-top: 3px solid var(--gold); }
.stat-card.accent-orange { border-top: 3px solid var(--signal-orange); }
.stat-card.accent-red { border-top: 3px solid var(--signal-red); }
.stat-card.accent-green { border-top: 3px solid var(--signal-green); }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  min-width: 220px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 13.5px;
}
.search-box input:focus { outline: none; border-color: var(--gold); }
.search-box::before {
  content: '⌕';
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  color: #8A8168;
  font-size: 15px;
}

select, input[type=text], input[type=date], input[type=password], input[type=email], textarea {
  font-family: var(--font-body);
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  font-size: 13px;
  background: var(--paper);
  color: var(--ink);
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--gold); }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 500;
  background: var(--paper);
  color: #6B6455;
}
.filter-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; }
.table-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
thead th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #8A8168;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--cream-deep);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
thead th:hover { color: var(--ink); }
tbody tr { border-bottom: 1px solid var(--line); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--cream); cursor: pointer; }
tbody td { padding: 12px 14px; font-size: 13px; vertical-align: middle; }

.pnr-cell { font-family: var(--font-mono); font-weight: 600; letter-spacing: 0.03em; }
.mark-new { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em; background: var(--gold-pale); color: var(--gold); padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }

/* Status pills */
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-NEW { background: #EEF2FF; color: #4338CA; }
.status-ON-HOLD { background: var(--signal-yellow-bg); color: var(--signal-yellow); }
.status-ISSUED { background: var(--signal-green-bg); color: var(--signal-green); }
.status-CANCELLED { background: var(--signal-red-bg); color: var(--signal-red); }
.status-TRAVELED { background: #F1F5F9; color: #475569; }
.status-RETURNED { background: #F1F5F9; color: #334155; }

/* Date indicator pill - the signature element: a departure/return
   countdown chip that shifts color as the date approaches, echoing
   the flight path in the logo. */
.date-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.date-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.date-chip.normal .dot { background: var(--signal-normal); }
.date-chip.orange .dot { background: var(--signal-orange); box-shadow: 0 0 0 3px var(--signal-orange-bg); }
.date-chip.red .dot { background: var(--signal-red); box-shadow: 0 0 0 3px var(--signal-red-bg); }
.date-chip.green .dot { background: var(--signal-green); box-shadow: 0 0 0 3px var(--signal-green-bg); }
.date-chip.orange { color: var(--signal-orange); font-weight: 700; }
.date-chip.red { color: var(--signal-red); font-weight: 700; }

.hold-alert { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px; margin-left: 6px; }
.hold-yellow { background: var(--signal-yellow-bg); color: var(--signal-yellow); }
.hold-orange { background: var(--signal-orange-bg); color: var(--signal-orange); }
.hold-red { background: var(--signal-red-bg); color: var(--signal-red); }

/* ---------- Modal / drawer ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(23,20,15,0.45);
  display: flex; justify-content: flex-end; z-index: 100;
}
.drawer {
  background: var(--cream);
  width: 560px; max-width: 92vw;
  height: 100vh; overflow-y: auto;
  padding: 28px 30px 60px;
  box-shadow: -8px 0 30px rgba(0,0,0,0.15);
}
.modal-center {
  position: fixed; inset: 0; background: rgba(23,20,15,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal-box {
  background: var(--paper); border-radius: 12px; padding: 26px;
  width: 420px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.field-group { margin-bottom: 14px; }
.field-group label { display: block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #6B6455; margin-bottom: 5px; }
.field-group input, .field-group select, .field-group textarea { width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.timeline-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: none; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-top: 6px; flex-shrink: 0; }
.timeline-event { font-weight: 600; font-size: 13px; }
.timeline-meta { font-size: 11.5px; color: #8A8168; margin-top: 2px; }

.empty-state { text-align: center; padding: 60px 20px; color: #8A8168; }
.empty-state .icon { font-size: 32px; margin-bottom: 10px; }

.badge-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; }
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); animation: slideIn 0.2s ease-out; }
.toast.error { background: var(--signal-red); }
.toast.success { background: var(--signal-green); }
@keyframes slideIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); }
.login-card { background: var(--cream); width: 380px; padding: 40px 34px; border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,0.4); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { height: 56px; }
.login-title { text-align: center; font-size: 13px; color: #6B6455; margin-bottom: 24px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }

.pill-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.pill-toggle button { padding: 6px 14px; border: none; background: var(--paper); font-size: 12.5px; font-weight: 600; color: #6B6455; }
.pill-toggle button.active { background: var(--ink); color: #fff; }

.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.help-text { font-size: 11.5px; color: #8A8168; margin-top: 4px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
