/* Everest HotelDesk Console. Colours come from the Everest Infotech mark: navy, ocean blue, glacier teal, summit gold. */
:root {
  --navy-900: #0f2a48;
  --navy-800: #153a63;
  --navy-700: #1c4b80;
  --blue-600: #23649f;
  --blue-500: #2f7cbf;
  --teal-500: #3aa6b0;
  --teal-300: #8fd3cf;
  --gold-500: #d4a43a;

  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #dde4ec;
  --text: #13243a;
  --text-2: #4c5d72;
  --text-3: #7a8a9d;
  --accent: var(--blue-600);
  --accent-ink: #ffffff;
  --accent-soft: #e6f0f9;
  --ok: #1f8a5b;      --ok-soft: #e3f4ec;
  --warn: #a86a00;    --warn-soft: #fdf1d9;
  --bad: #b3322f;     --bad-soft: #fbe6e5;
  --focus: #3aa6b0;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 42, 72, .06), 0 4px 16px rgba(15, 42, 72, .05);
  --sidebar: 248px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1622;
    --surface: #122030;
    --surface-2: #0f1b29;
    --border: #22344a;
    --text: #e4ecf5;
    --text-2: #a9b8c9;
    --text-3: #7d8da0;
    --accent: #4a97d6;
    --accent-soft: #16304a;
    --ok: #4cc28a;    --ok-soft: #12352a;
    --warn: #e7b04a;  --warn-soft: #3a2c10;
    --bad: #f07a76;   --bad-soft: #3d1a1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg);
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-800) 60%, #17466f);
  color: #d5e2ef; border-right: 1px solid rgba(255,255,255,.04);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; }
.brand b { display: block; font-size: 15px; letter-spacing: .2px; }
.brand small { display: block; font-size: 11px; color: var(--teal-300); letter-spacing: .6px; text-transform: uppercase; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.nav-label { margin: 16px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #7f9bb8; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: #d5e2ef; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(58,166,176,.18); color: #fff; box-shadow: inset 3px 0 0 var(--teal-500); }
.nav .count {
  margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; line-height: 18px; text-align: center;
  background: var(--gold-500); color: var(--navy-900); font-weight: 700;
}
.nav .count.live { background: var(--teal-500); color: #fff; }
.side-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.side-foot .who { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--teal-500); color: #fff; font-weight: 700; font-size: 13px;
}
.side-foot .who b { display: block; color: #fff; font-weight: 600; }
.side-foot .who small { color: #8fa9c4; }
.side-foot .links { display: flex; gap: 12px; margin-top: 10px; }
.side-foot .links a, .side-foot .links button { color: #a9c1da; font-size: 12.5px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.side-foot .links a:hover, .side-foot .links button:hover { color: #fff; text-decoration: underline; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 18px 28px 0;
}
.topbar .menu-btn { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 6px 28px 18px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 0 28px 40px; display: grid; gap: 20px; align-content: start; }
.crumbs { font-size: 12.5px; color: var(--text-3); }
.crumbs a { color: var(--text-2); }

/* ── Surfaces ──────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head .sub { color: var(--text-3); font-size: 12.5px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.stack { display: grid; gap: 20px; align-content: start; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi .label { color: var(--text-2); font-size: 12.5px; }
.kpi .value { font-size: 26px; font-weight: 650; letter-spacing: -.3px; }
.kpi .hint { font-size: 12px; color: var(--text-3); }
.kpi.alert .value { color: var(--warn); }
.kpi.bad .value { color: var(--bad); }
a.kpi:hover { text-decoration: none; border-color: var(--teal-500); }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th, .t td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.t th { font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.t tbody tr:hover { background: var(--surface-2); }
.t tbody tr:last-child td { border-bottom: 0; }
.t td.num, .t th.num { text-align: right; }
.t .title-cell b { display: block; font-weight: 600; }
.t .title-cell small { color: var(--text-3); }
.t .row-actions { white-space: nowrap; text-align: right; }
.empty { padding: 36px 18px; text-align: center; color: var(--text-3); }
.sms-body { white-space: pre-wrap; word-break: break-word; max-width: 680px; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label, .label-text { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--text-3); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 120px; resize: vertical; }
select[multiple] { min-height: 180px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(58,166,176,.2); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); }
.check input { width: 16px; height: 16px; accent-color: var(--blue-600); }
.checks { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.field-validation-error, .text-danger { color: var(--bad); font-size: 12.5px; }
.input-validation-error { border-color: var(--bad) !important; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }
.form-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.form-actions .spacer { flex: 1; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 600; font-size: 13px; margin-bottom: 10px; color: var(--text); }
.section + .section { margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--border); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.filters .field { min-width: 150px; }
.filters .grow { flex: 1; min-width: 220px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--text-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; }
.btn.link:hover { text-decoration: underline; }
form.inline { display: inline; }

/* ── Flash ─────────────────────────────────────────────────────────────── */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }

/* ── Pager ─────────────────────────────────────────────────────────────── */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 13px; }
.pager .btns { display: flex; gap: 8px; }
.btn[aria-disabled=true] { opacity: .45; pointer-events: none; }

/* ── Chart ─────────────────────────────────────────────────────────────── */
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 150px; padding: 8px 0 0; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; gap: 2px; position: relative; }
.bar { border-radius: 3px 3px 0 0; min-height: 2px; }
.bar.sms { background: var(--blue-500); }
.bar.bk { background: var(--teal-500); }
.bar-col:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--navy-900); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 4px; white-space: pre; z-index: 2;
}
.bar-days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; margin-top: 6px; font-size: 11px; color: var(--text-3); text-align: center; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--c); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-word; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow small { display: block; color: var(--text-3); }

.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.live-pill .dot { animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .live-pill .dot { animation: none; } }

dialog.viewer { width: min(900px, 92vw); max-height: 85vh; border: 1px solid var(--border); border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--text); }
dialog.viewer::backdrop { background: rgba(10, 22, 36, .55); }
dialog.viewer pre { margin: 0; padding: 16px 18px; overflow: auto; max-height: calc(85vh - 60px); white-space: pre-wrap; word-break: break-word; }

/* ── Auth pages ────────────────────────────────────────────────────────── */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: linear-gradient(160deg, var(--navy-900), var(--navy-800) 65%, #17466f);
}
.auth-card {
  width: min(420px, 100%); background: rgba(255,255,255,.96); color: #13243a; border-radius: 14px;
  box-shadow: 0 20px 60px rgba(15, 42, 72, .28); padding: 30px 30px 26px; border-top: 4px solid var(--teal-500);
}
.auth-card .logo { display: block; width: 110px; height: auto; margin: 0 auto 10px; }
.auth-card h1 { text-align: center; font-size: 20px; color: var(--navy-800); }
.auth-card .tag { text-align: center; color: #4c5d72; margin: 4px 0 22px; }
.auth-card form { display: grid; gap: 14px; }
.auth-card input { background: #fff; color: #13243a; border-color: #cfd9e4; }
.auth-card .btn.primary { width: 100%; padding: 10px; background: var(--blue-600); border-color: var(--blue-600); }
.auth-card details summary { cursor: pointer; color: #4c5d72; font-size: 13px; }
.auth-card details[open] summary { margin-bottom: 10px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 12px; color: #7a8a9d; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid-2, .grid-2.even { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(10,22,36,.45); }
  .topbar { padding: 14px 16px 0; }
  .topbar .menu-btn { display: inline-flex; }
  .page-head, .content { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .bars, .bar-days { gap: 3px; }
}

/* ── File inputs (App updates upload) ─────────────────────────────────── */
input[type=file] { font: inherit; color: var(--text-2); }
input[type=file]::file-selector-button {
  margin-right: 10px; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer;
}
input[type=file]::file-selector-button:hover { border-color: var(--text-3); }
