/* ============ Travel CRM — UI ============ */
:root {
  --sidebar-bg: #101828;
  --sidebar-fg: #cbd2e0;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e4e8f0;
  --text: #1a2233;
  --muted: #68738a;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---- Sidebar ---- */
.sidebar {
  width: 240px; flex: 0 0 240px; background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid #1d2939; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 9px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700;
}
.brand-name { font-weight: 700; color: #fff; font-size: 15px; }
.brand-sub { font-size: 11px; color: #8a94a8; }
.nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin: 2px 0;
  color: var(--sidebar-fg); border-radius: 8px; font-size: 13.5px;
}
.nav a:hover { background: #1d2939; text-decoration: none; color: #fff; }
.nav a.on { background: var(--accent); color: #fff; }
.nav-sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #67718a; padding: 14px 12px 4px; }
.pill { margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; }
.sidebar-foot { border-top: 1px solid #1d2939; padding: 12px; }
.userchip { display: flex; gap: 10px; align-items: center; color: var(--sidebar-fg); padding: 6px; border-radius: 8px; }
.userchip:hover { background: #1d2939; text-decoration: none; }
.userchip b { color: #fff; font-size: 13px; }
.userchip small { color: #8a94a8; }
.avatar {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: #334155; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.logout { display: block; margin-top: 8px; font-size: 12.5px; color: #8a94a8; padding-left: 6px; }

/* ---- Main / topbar ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 24px; background: var(--card);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; margin: 0; flex: 1; }
.hamburger { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; }
.globalsearch input {
  width: 280px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
}
.content { padding: 22px 24px; }

/* ---- Cards, grids ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card h2 .sub { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr; } }

/* ---- Stat tiles ---- */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat.alert .n { color: var(--bad); }
.stat.good .n { color: var(--ok); }
.stat.warn .n { color: var(--warn); }

/* ---- Tables ---- */
table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 10px 12px; background: #fafbfd; border-bottom: 1px solid var(--line);
}
.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list tr:last-child td { border-bottom: 0; }
.list tr:hover td { background: #f8faff; }
.list .num { text-align: right; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

/* ---- Badges ---- */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; border-radius: 99px; padding: 2px 10px; white-space: nowrap; }
.badge-new, .badge-docs_pending { background: #eef2ff; color: #4338ca; }
.badge-contacted, .badge-docs_received { background: #e0f2fe; color: #0369a1; }
.badge-qualified, .badge-appointment { background: #fef9c3; color: #854d0e; }
.badge-proposal_sent, .badge-submitted { background: #fce7f3; color: #9d174d; }
.badge-won, .badge-approved, .badge-done, .badge-delivered { background: #dcfce7; color: #166534; }
.badge-lost, .badge-rejected, .badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-skipped { background: #f1f5f9; color: #475569; }
.badge-admin { background: #ede9fe; color: #5b21b6; }
.badge-manager { background: #e0f2fe; color: #0369a1; }
.badge-agent { background: #f1f5f9; color: #334155; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-muted { background: #f1f5f9; color: #64748b; }

/* ---- Forms ---- */
form.stack label, .field label { display: block; font-size: 12.5px; font-weight: 600; margin: 12px 0 4px; color: #334155; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=datetime-local],
input[type=number], input[type=password], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bfd3ff; border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
.formgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
.formgrid .full { grid-column: 1 / -1; }
@media (max-width: 800px) { .formgrid { grid-template-columns: 1fr; } }
.form-actions { margin-top: 18px; display: flex; gap: 10px; align-items: center; }

/* ---- Buttons ---- */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--line); }
.btn.danger { background: #fff; color: var(--bad); border-color: #fecaca; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }

/* ---- Flash messages ---- */
.flash { margin: 14px 24px -6px; padding: 11px 14px; border-radius: 8px; font-weight: 500; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-info { background: #e0f2fe; color: #0369a1; }

/* ---- Toolbar / filters ---- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar select, .toolbar input { width: auto; }

/* ---- Kanban ---- */
.kanban { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: start; }
@media (max-width: 1200px) { .kanban { grid-template-columns: repeat(3, 1fr); } }
.kcol { background: #edf0f7; border-radius: var(--radius); padding: 10px; }
.kcol h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 2px 4px 10px; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.kcard b { display: block; }
.kcard .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ---- Detail pages ---- */
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.detail-head h2 { margin: 0; font-size: 20px; }
.detail-head .spacer { flex: 1; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0 10px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before {
  content: ''; width: 8px; height: 8px; background: var(--accent); border-radius: 50%;
  position: absolute; left: -5px; top: 16px;
}
.timeline .when { color: var(--muted); font-size: 12px; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--sidebar-bg); }
.login-card { background: #fff; border-radius: 14px; padding: 34px; width: 380px; max-width: 92vw; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 18px; font-size: 13px; }

/* ---- Checklist ---- */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist input[type=checkbox] { width: 17px; height: 17px; margin-top: 2px; }
.checklist .opt { color: var(--muted); font-size: 11.5px; }
.checklist li.done .txt { text-decoration: line-through; color: var(--muted); }
.progressbar { height: 8px; border-radius: 99px; background: #e8ecf4; overflow: hidden; margin: 8px 0 14px; }
.progressbar > div { height: 100%; background: var(--ok); }

/* ---- Misc ---- */
.muted { color: var(--muted); }
.danger-text { color: var(--bad); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pagination { display: flex; gap: 6px; margin-top: 14px; }
.pagination a, .pagination span { padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.pagination .cur { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- Passport MRZ scan status ---- */
.mrz-status { margin-top: 10px; font-size: 13px; font-weight: 500; min-height: 18px; }
.mrz-status.working { color: var(--accent); }
.mrz-status.ok { color: var(--ok); }
.mrz-status.warn { color: var(--warn); }
.mrz-status.bad { color: var(--bad); }

/* ---- Print (visa checklist) ---- */
@media print {
  .sidebar, .topbar, .noprint { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { border: 0; }
}

/* ---- Mobile ---- */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -260px; transition: left .2s; z-index: 50; }
  .sidebar.open { left: 0; }
  .hamburger { display: block; }
  .globalsearch input { width: 150px; }
  .content { padding: 14px; }
  .kanban { grid-template-columns: 1fr; }
  .formgrid { grid-template-columns: 1fr; }
}
