/* HotelOps AI - design tokens (light + dark), layout, components */
:root {
  color-scheme: light;
  --page: #f6f6f3;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --line: #e1e0d9;
  --line-strong: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --brand: #1c5cab;
  --brand-ink: #ffffff;
  --brand-soft: #e3eefc;
  --nav-bg: #0f1d33;
  --nav-ink: #c9d3e3;
  --nav-active: #ffffff;
  --nav-hover: rgba(255, 255, 255, 0.07);
  --series-1: #2a78d6; /* actual */
  --series-2: #eb6834; /* budget */
  --series-3: #1baf7a; /* last year */
  --good: #006300;
  --good-bg: #e4f4e4;
  --bad: #b3261e;
  --bad-bg: #fbe7e6;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 29, 51, 0.06), 0 1px 1px rgba(15, 29, 51, 0.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --ink: #ffffff; --ink-2: #c3c2b7; --ink-3: #898781;
    --line: #2c2c2a; --line-strong: #383835; --ring: rgba(255,255,255,0.10); --brand: #3987e5; --brand-soft: #16253a;
    --nav-bg: #111418; --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --good: #0ca30c; --good-bg: #13261a; --bad: #e66767; --bad-bg: #2d1717; --warn: #fab219; --warn-bg: #2b2310;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --ink: #ffffff; --ink-2: #c3c2b7; --ink-3: #898781;
  --line: #2c2c2a; --line-strong: #383835; --ring: rgba(255,255,255,0.10); --brand: #3987e5; --brand-soft: #16253a;
  --nav-bg: #111418; --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  --good: #0ca30c; --good-bg: #13261a; --bad: #e66767; --bad-bg: #2d1717; --warn: #fab219; --warn-bg: #2b2310;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); background: var(--page); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); font-size: 12px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.nav { background: var(--nav-bg); color: var(--nav-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #3987e5, #1baf7a); display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; }
.brand-name { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
.brand-name span { color: #7fb4f0; }
.nav a.item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--nav-ink); text-decoration: none; font-weight: 500; }
.nav a.item:hover { background: var(--nav-hover); color: #fff; }
.nav a.item.active { background: rgba(57, 135, 229, 0.18); color: var(--nav-active); }
.nav a.item svg { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.nav .section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #6f7c91; padding: 14px 10px 4px; }
.nav .spacer { flex: 1; }
.nav .hotel-chip { font-size: 12px; padding: 10px; border-radius: 8px; background: rgba(255,255,255,0.05); line-height: 1.35; }
.nav .hotel-chip b { color: #fff; font-weight: 600; display: block; }

.shell { height: 100vh; overflow: hidden; }
.main { min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow-y: auto; position: relative; }
.shell-page { overflow: hidden; } /* only .main scrolls; one scrollbar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar .title { flex: 1 1 220px; min-width: 0; }
.topbar .title .subtle { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 20px; max-width: 1440px; width: 100%; }
.btn.menu-btn { display: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { width: 36px; padding: 0; justify-content: center; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 0 14px; height: 34px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], textarea {
  height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); min-width: 0;
}
textarea { height: auto; padding: 10px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; }

/* ---------- cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 1560px) { .kpis { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .kpis { grid-template-columns: 1fr; } }
.two { grid-template-columns: 2fr 1fr; }
.halves { grid-template-columns: 1fr 1fr; }

button.kpi { font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; transition: border-color .15s, box-shadow .15s, transform .15s; }
button.kpi:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(15, 29, 51, 0.10); transform: translateY(-1px); }
.kpi .label { color: var(--ink-2); font-size: 13px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.kpi .label svg { width: 16px; height: 16px; color: var(--ink-3); transition: color .15s, transform .15s; }
button.kpi:hover .label svg { color: var(--brand); transform: translateX(2px); }

/* ---------- modal ---------- */
dialog.modal { width: min(760px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28); overflow: auto; }
dialog.modal::backdrop { background: rgba(10, 16, 28, 0.55); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: pop .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-body { padding: 16px 20px 22px; display: flex; flex-direction: column; gap: 22px; }
.modal-body h3 { margin-bottom: 6px; }
tr.current td { background: var(--brand-soft); font-weight: 600; }
.share { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--surface-2); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.share i { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }
.kpi .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin: 6px 0 10px; }
.kpi .deltas { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--ink-3); }
.delta-row { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-3); }

.chart { width: 100%; height: 320px; }
.chart.sm { height: 260px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 2px; border-radius: 1px; vertical-align: 3px; width: 14px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-weight: 600; color: var(--ink-2); font-size: 12px; background: var(--surface); position: sticky; top: 0; }
thead tr.group th { text-align: center; border-bottom: 1px solid var(--line-strong); color: var(--ink); }
th.num { text-align: right; }
tr.section td { background: var(--surface-2); font-weight: 650; color: var(--ink); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
tr.total td { font-weight: 650; border-top: 1px solid var(--line-strong); }
tbody tr:hover td:not(.sect) { background: var(--brand-soft); }
table.report td:first-child, table.report th:first-child { white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.report tr.section td:first-child { background: var(--surface-2); }
td.divider, th.divider { border-left: 1px solid var(--line-strong); }

/* ---------- chips / status ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.info { background: var(--brand-soft); color: var(--brand); }
.chip svg { width: 13px; height: 13px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; background: var(--brand-soft); color: var(--ink); font-size: 13px; }
.banner.warn { background: var(--warn-bg); }
.banner svg { width: 18px; height: 18px; flex: none; color: var(--brand); margin-top: 1px; }
.banner.warn svg { color: var(--warn); }

/* ---------- upload ---------- */
.drops { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: border-color .15s, background .15s; background: var(--surface); }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop.ready { border-style: solid; border-color: var(--good); }
.drop .fname { font-size: 12px; color: var(--ink-2); word-break: break-all; }
.drop input { display: none; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checks li { display: flex; gap: 10px; align-items: center; }
.steps { display: flex; gap: 0; counter-reset: s; }
.steps li { list-style: none; flex: 1; padding: 10px 12px; border-top: 3px solid var(--line); font-size: 12px; color: var(--ink-3); }
.steps li.done { border-color: var(--good); color: var(--ink); }
.steps li.active { border-color: var(--brand); color: var(--ink); animation: pulse 1.2s ease-in-out infinite; }
.steps li.fail { border-color: var(--bad); color: var(--bad); }
@keyframes pulse { 50% { opacity: .55; } }
.banner.good { background: var(--good-bg); }
.banner.good svg { color: var(--good); }
ul.notes { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
ul.notes li { padding: 8px 10px; border-radius: 6px; }
ul.notes li.bad { background: var(--bad-bg); color: var(--ink); border-left: 3px solid var(--bad); }
ul.notes li.warn { background: var(--warn-bg); color: var(--ink); border-left: 3px solid var(--warn); }
details summary { cursor: pointer; color: var(--brand); margin-top: 4px; }
input[type="date"] { height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); }
.steps li b { display: block; font-size: 13px; }

/* ---------- assistant ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 420px; }
.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 2px 16px; }
.msg { max-width: 760px; padding: 12px 14px; border-radius: 12px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.ai .who { font-size: 11px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.composer { display: flex; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.composer textarea { flex: 1; min-height: 76px; max-height: 160px; }
[hidden] { display: none !important; }
code.path { background: var(--surface-2); padding: 8px 10px; border-radius: 6px; font-size: 12px; word-break: break-all; flex: 1; min-width: 0; }
.msg.error { background: var(--bad-bg); }
.msg.typing { color: var(--ink-2); }
.dots { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: middle; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.suggest button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 12px; color: var(--ink-2); }
.suggest button:hover { border-color: var(--brand); color: var(--brand); }
.proposal { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.diff { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--surface-2); border-radius: 6px; padding: 8px 10px; }
.diff .del { color: var(--bad); }
.diff .add { color: var(--good); }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: radial-gradient(circle at 20% 20%, #1c3d6e 0, #0f1d33 55%); color: #dbe5f3; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero h1 { font-size: 34px; color: #fff; line-height: 1.15; max-width: 460px; }
.login-hero p { max-width: 440px; color: #aebbd0; font-size: 15px; }
.login-hero ul { padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; color: #c9d3e3; }
.login-hero li::before { content: "✓"; color: #1baf7a; font-weight: 700; margin-right: 10px; }
.login-form { display: grid; place-items: center; padding: 32px 16px; background: var(--page); }
.login-form form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.login-form input { height: 42px; }
.login-form .btn { height: 42px; justify-content: center; }
.error { color: var(--bad); font-size: 13px; min-height: 18px; }

.empty { text-align: center; padding: 40px 16px; color: var(--ink-3); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .two, .halves { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .nav { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; row-gap: 10px; }
  .topbar .title { flex: 1 1 0; }
  #top-controls { order: 3; width: 100%; flex-wrap: nowrap; }
  #top-controls:empty { display: none; }
  #date-sel { flex: 1; }
  .content { padding: 16px 16px 40px; }
  .drops { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .topbar .hide-sm { display: none; }
}

/* ---------- sign-up and account pages ---------- */
.two-fields { display: grid; grid-template-columns: 1fr 140px; gap: 12px; }
.hint { font-size: 12px; color: var(--ink-3); margin: -8px 0 0; }
.login-form h2 { font-size: 15px; }
.done { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.devbox { background: var(--warn-bg); border-left: 3px solid var(--warn); border-radius: 6px; padding: 10px 12px; font-size: 13px; line-height: 1.5; word-break: break-all; }
.login-page.single { grid-template-columns: 1fr; }
.account-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.account-card h1 { font-size: 22px; margin-bottom: 4px; }
.account-card .btn { justify-content: center; height: 42px; }
.account-card input { height: 42px; }
.brand.dark { color: var(--ink); padding: 0 0 6px; }
.brand.dark .brand-name span { color: var(--brand); }
.login-form form { padding-block: 24px; }
.member-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.member-actions .btn { height: 30px; padding: 0 10px; font-size: 12px; }
.invite-row { display: grid; grid-template-columns: 1.2fr 1.6fr 140px auto; gap: 10px; align-items: end; }
@media (max-width: 860px) { .invite-row { grid-template-columns: 1fr; } .two-fields { grid-template-columns: 1fr; } }

.pipe-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; color: var(--ink-2); }
.pipe-steps b { color: var(--ink); }

/* Terms and Privacy pages */
.legal-body { background: var(--page); }
.legal-wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.legal-top { background: #0f1d33; }
.legal-top .legal-wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.legal { padding-top: 40px; padding-bottom: 64px; color: var(--ink); line-height: 1.65; }
.legal h1 { font-size: 32px; letter-spacing: -0.015em; margin: 0 0 4px; }
.legal h2 { font-size: 19px; margin: 32px 0 8px; }
.legal p, .legal li { color: var(--ink-2); }
.legal ul { padding-left: 20px; display: grid; gap: 6px; }
.legal b { color: var(--ink); }
.legal .ph { background: var(--warn-bg); color: var(--warn); padding: 0 4px; border-radius: 4px; }
.legal-links { display: flex; gap: 16px; }
.legal-links a { color: inherit; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.consent input { margin-top: 3px; width: 16px; height: 16px; flex: none; }

/* Show/hide password button (pw-toggle.js) */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 42px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 34px;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); cursor: pointer; }
.pw-toggle:hover { color: var(--ink); background: var(--surface-2); }
.pw-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

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