/* AJT Vault - design system */
:root {
  --brand: #2f6f9f;
  --brand-600: #255a82;
  --brand-50: #eaf2f8;
  --accent: #e8702a;
  --accent-50: #fdf0e7;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1b2430;
  --muted: #667385;
  --border: #e2e7ee;
  --ok: #15803d;
  --ok-50: #e8f6ee;
  --warn: #b45309;
  --warn-50: #fdf4e3;
  --bad: #c62828;
  --bad-50: #fdecec;
  --side: #ffffff;
  --side-text: #44505f;
  --side-hover: #eef2f7;
  --side-strong: #1b2430;
  --side-muted: #8a96a6;
  --side-line: #e2e7ee;
  --tap: rgba(15, 23, 42, .07);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151c; --surface: #17202a; --surface-2: #1c2733; --text: #e6ebf1; --muted: #93a1b2; --border: #2a3644;
    --brand-50: #1a2d3d; --accent-50: #3a2617; --ok-50: #12301f; --warn-50: #34280f; --bad-50: #3a1717;
    --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --side: #0b1117; --side-hover: #16212c; --side-text: #c4cfdc; --side-strong: #fff; --side-muted: #7d8b9b; --side-line: rgba(255,255,255,.06); --tap: rgba(255, 255, 255, .08);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f151c; --surface: #17202a; --surface-2: #1c2733; --text: #e6ebf1; --muted: #93a1b2; --border: #2a3644;
  --brand-50: #1a2d3d; --accent-50: #3a2617; --ok-50: #12301f; --warn-50: #34280f; --bad-50: #3a1717;
  --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --side: #0b1117; --side-hover: #16212c; --side-text: #c4cfdc; --side-strong: #fff; --side-muted: #7d8b9b; --side-line: rgba(255,255,255,.06); --tap: rgba(255, 255, 255, .08);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}

/* AJT Vault logo: a plain circle (no white tile), showing the variant matching the active theme */
img.brand-logo { background: none !important; padding: 0 !important; border-radius: 50% !important; box-shadow: none !important; object-fit: contain; }
:root[data-theme="light"] .brand-logo-dark,
:root[data-theme="dark"] .brand-logo-light { display: none !important; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .brand-logo-dark { display: none !important; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-logo-light { display: none !important; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.ic { width: 18px; height: 18px; flex: none; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------ app shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: none; background: var(--side); color: var(--side-text); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; border-right: 1px solid var(--side-line);
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: var(--side-strong); font-weight: 700; letter-spacing: .2px; }
.sidebar .brand img { width: 36px; height: 36px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.sidebar .brand small { display: block; color: var(--side-text); font-weight: 500; font-size: 11.5px; }
.nav { padding: 6px 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--side-text);
  font-weight: 500; position: relative;
}
.nav a:hover { background: var(--side-hover); color: var(--side-strong); text-decoration: none; }
.nav a.active { background: var(--side-hover); color: var(--side-strong); font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.sidebar .foot { margin-top: auto; padding: 14px 18px; font-size: 12px; color: var(--side-muted); border-top: 1px solid var(--side-line); }
/* "© AJT | ajtlb.com" credit: AJT is the parent company, shown with its own logo */
.ajt-credit { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; line-height: 1.35; text-align: left; }
.ajt-credit:hover { text-decoration: underline; }
.ajt-credit img { width: 26px; height: 26px; flex: none; object-fit: contain; background: #fff; border-radius: 50%; padding: 1px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.topbar .title { font-weight: 650; font-size: 1.05rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .menu-btn { display: none; }
.content { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }
.impersonate { background: var(--accent); color: #fff; padding: 8px 24px; display: flex; gap: 12px; align-items: center; justify-content: space-between; font-weight: 500; }
.impersonate form { margin: 0; }
.impersonate .btn { background: rgba(255,255,255,.18); color: #fff; border-color: transparent; }

.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text); font: inherit; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.user-chip .meta { line-height: 1.15; text-align: left; }
.user-chip .meta small { display: block; font-size: 11.5px; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 50;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }

.backdrop { display: none; }

/* ------------------------------------------------------------ page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.rest-switch { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.rest-switch a {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 550;
}
.rest-switch a:hover { text-decoration: none; border-color: var(--brand); }
.rest-switch a.active { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.rest-switch img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #fff; }

/* ------------------------------------------------------------ cards & grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .tiles > .card + .card, .stack > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 16px !important; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 1.5rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; 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; line-height: 1.2; min-height: 38px;
}
.btn:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(.95); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-50); border-color: var(--bad); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 5px 10px; min-height: 30px; font-size: 13px; }
.btn-icon { padding: 7px; min-height: 34px; min-width: 34px; }
.btn-block { width: 100%; }
form.inline { display: inline; margin: 0; }

/* ------------------------------------------------------------ forms */
label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=tel], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); font: inherit; min-height: 40px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: color-mix(in srgb, var(--text) 35%, var(--border)); box-shadow: 0 0 0 3px var(--tap); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.input-group { display: flex; }
.input-group input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .addon { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--border); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { margin: 0; min-width: 140px; }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
.table tbody tr:hover { background: color-mix(in srgb, var(--brand-50) 50%, transparent); }
.table tfoot td, .table tr.total td { font-weight: 700; background: var(--surface-2); }
.table.compact th, .table.compact td { padding: 6px 9px; font-size: 13px; }
.table td.actions { white-space: nowrap; text-align: right; }
/* Rows you type in: names and numbers stay readable on a phone, the table scrolls sideways if it has to */
.table.sheet-table th, .table.sheet-table td { padding-inline: 5px; }
.sheet-table select, .sheet-table input[type=text] { min-width: 112px; }
.sheet-table .input-group { min-width: 84px; }
.sheet-table .input-group input, .sheet-table input[data-amount], .sheet-table input[data-shares] { min-width: 52px; }
.sheet-table .btn-icon { width: 32px; padding: 0; }
.table .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.table thead .sticky-col { background: var(--surface-2); z-index: 3; }
/* A field in a table never gets squeezed: the table scrolls sideways instead */
.table td input[type=text] { min-width: 72px; }
.table:not(.perm-table) td select { min-width: 92px; }
.perm-table thead input[type=text] { min-width: 132px; }
/* Wide tables on small screens: the first column stays in view, so you always see whose row it is */
@media (max-width: 1100px) {
  .sticky-first tbody td:first-child, .sticky-first thead th:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
  .sticky-first thead th:first-child { z-index: 3; background: var(--surface-2); }
}
@media (max-width: 640px) { .sticky-first tbody td:first-child { max-width: 118px; white-space: normal; } }
/* Rows you type in, when their card is narrow (a phone, or a small column on a big screen): each row stacks so names, amounts and notes keep a usable width */
.table-wrap.cq { container-type: inline-size; }
@container (max-width: 480px) {
  .split-rows, .split-rows thead, .split-rows tbody, .split-rows tfoot, .day-rows, .day-rows thead, .day-rows tbody, .day-rows tfoot { display: block; }
  .split-rows tr, .day-rows tr { display: grid; align-items: center; column-gap: 6px; border-bottom: 1px solid var(--border); }
  .split-rows tr { grid-template-columns: var(--cols); }
  .day-rows tr { grid-template-columns: 58px minmax(0, 1fr) minmax(0, 1fr); }
  .table.split-rows th, .table.split-rows td, .table.day-rows th, .table.day-rows td { border-bottom: 0; width: auto !important; }
  .split-rows tr > :first-child { grid-column: 1 / -1; }
  .table.split-rows td input[type=text], .table.split-rows td select, .table.split-rows .input-group, .table.day-rows td input[type=text] { min-width: 0; width: 100%; }
  .split-rows.exp tr > :first-child { grid-column: auto; }
  .split-rows.exp tr[data-exp] > :first-child { grid-column: 1 / -1; }
  .split-rows.exp tr[data-exp] > :nth-child(2) { grid-column: 2; }
  .day-rows td:nth-child(4) { grid-column: 1 / -1; }
  .day-rows thead th:nth-child(4), .day-rows td:empty { display: none; }
  .day-rows td.nowrap { white-space: normal; }
  .day-rows td.nowrap small { display: block; }
  .split-rows thead tr, .split-rows tfoot tr, .day-rows thead tr, .day-rows tfoot tr { background: var(--surface-2); }
}
.float-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.float-row > :first-child { grid-column: 1 / -1; }
.table tr.muted-row td { color: var(--muted); }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.empty .ic { width: 36px; height: 36px; margin-bottom: 8px; opacity: .6; }

/* ------------------------------------------------------------ badges & alerts */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-ok { background: var(--ok-50); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-50); color: var(--warn); border-color: transparent; }
.badge-bad { background: var(--bad-50); color: var(--bad); border-color: transparent; }
.badge-brand { background: var(--brand-50); color: var(--brand); border-color: transparent; }
.badge-accent { background: var(--accent-50); color: var(--accent); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.alert-success { background: var(--ok-50); color: var(--ok); }
.alert-error { background: var(--bad-50); color: var(--bad); }
.alert-warning { background: var(--warn-50); color: var(--warn); }
.alert-info { background: var(--brand-50); color: var(--brand); }
.pos { color: var(--ok); } .neg { color: var(--bad); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
/* phones: tabs share one line (smaller, evenly spread); only if they still can't fit do they wrap instead of hiding off-screen */
@media (max-width: 600px) {
  .tabs { flex-wrap: wrap; overflow-x: visible; gap: 0; }
  .tabs a { flex: 1 1 auto; text-align: center; padding: 8px 6px; font-size: 13px; }
}
@media (max-width: 360px) { .tabs a { padding: 8px 4px; font-size: 12px; } }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg a, .seg button { padding: 7px 10px; color: var(--muted); border: 0; background: none; cursor: pointer; display: inline-flex; align-items: center; }
.seg a + a, .seg button + button { border-left: 1px solid var(--border); }
.seg a.active, .seg button.active { background: var(--brand-50); color: var(--brand); }

/* ------------------------------------------------------------ modal */
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text); }
dialog.modal::backdrop { background: rgba(10, 16, 24, .5); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 18px; max-height: 70vh; overflow-y: auto; }
/* Licence expiry bar (every page): green > 1 month, yellow < 1 month, orange < 2 weeks, red < 7 days */
.licence-bar { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13.5px; font-weight: 550; border: 1px solid; }
.licence-bar > span { flex: 1; }
.licence-bar .btn { background: #fff; color: inherit; border-color: currentColor; }
.licence-bar.l-green  { background: #e8f6ee; color: #15703a; border-color: #b6e2c6; }
.licence-bar.l-yellow { background: #fef9e1; color: #8a6a00; border-color: #f1df8a; }
.licence-bar.l-orange { background: #fff0e3; color: #b8510d; border-color: #f7c599; }
.licence-bar.l-red    { background: #fdecec; color: #b42121; border-color: #f2b6b6; }
:root[data-theme="dark"] .licence-bar .btn { background: transparent; }
:root[data-theme="dark"] .licence-bar.l-green  { background: #12301f; color: #4ade80; border-color: #1f5135; }
:root[data-theme="dark"] .licence-bar.l-yellow { background: #2f2a0e; color: #facc15; border-color: #574b12; }
:root[data-theme="dark"] .licence-bar.l-orange { background: #36210f; color: #fb923c; border-color: #5e3816; }
:root[data-theme="dark"] .licence-bar.l-red    { background: #3a1717; color: #f87171; border-color: #612626; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .licence-bar .btn { background: transparent; }
  :root:not([data-theme="light"]) .licence-bar.l-green  { background: #12301f; color: #4ade80; border-color: #1f5135; }
  :root:not([data-theme="light"]) .licence-bar.l-yellow { background: #2f2a0e; color: #facc15; border-color: #574b12; }
  :root:not([data-theme="light"]) .licence-bar.l-orange { background: #36210f; color: #fb923c; border-color: #5e3816; }
  :root:not([data-theme="light"]) .licence-bar.l-red    { background: #3a1717; color: #f87171; border-color: #612626; }
}
.licence-popup { width: min(460px, calc(100vw - 24px)); border-top: 4px solid var(--bad) !important; }
.licence-popup .modal-head h2 { display: flex; align-items: center; gap: 8px; color: var(--bad); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); }

/* ------------------------------------------------------------ closing sheet */
.closing-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.closing-side { position: sticky; top: 74px; }
.denoms { width: 100%; border-collapse: collapse; }
.denoms td { padding: 5px 4px; border-bottom: 1px dashed var(--border); }
.denoms td:first-child { font-weight: 650; white-space: nowrap; width: 38%; }
.denoms td.sub { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; width: 34%; }
.denoms input { text-align: center; min-height: 38px; padding: 6px; }
.denoms tr.total td { border-bottom: 0; font-weight: 700; padding-top: 10px; color: var(--text); }
.cur-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lines .line { display: grid; grid-template-columns: 1fr 140px 36px; gap: 8px; margin-bottom: 8px; }
.lines.cards .line { grid-template-columns: 1fr 1fr 36px; }
.lines.cards .line select { grid-column: 1 / -1; }
.lines.cards .line + .line { padding-top: 8px; border-top: 1px dashed var(--border); }
.results dl { margin: 0; }
.results .r { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.results .r dt { color: var(--muted); }
.results .r dd { margin: 0; font-weight: 650; text-align: right; }
.results .r.big { border: 0; padding-top: 12px; }
.results .r.big dt { color: var(--text); font-weight: 650; }
.results .r.big dd { font-size: 1.35rem; }
.diff-box { margin-top: 10px; border-radius: 10px; padding: 12px 14px; text-align: center; background: var(--surface-2); }
.diff-box .v { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.diff-box.ok { background: var(--ok-50); color: var(--ok); }
.diff-box.bad { background: var(--bad-50); color: var(--bad); }
.diff-box.warn { background: var(--warn-50); color: var(--warn); }
.save-state { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.save-state.saving::before, .save-state.saved::before, .save-state.error::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.save-state.saving::before { background: var(--warn); }
.save-state.saved::before { background: var(--ok); }
.save-state.error::before { background: var(--bad); }
.reading-input input { font-size: 1.3rem; font-weight: 700; min-height: 50px; }

/* Big dates so nobody fills the wrong day (closing sheet header, Start screen, close pop-up) */
.date-tile { width: 76px; flex: none; border-radius: 12px; overflow: hidden; text-align: center; background: var(--surface); border: 2px solid var(--accent); line-height: 1.1; }
.date-tile small { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 3px 0; }
.date-tile small:first-child { background: var(--accent); color: #fff; }
.date-tile b { display: block; font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.page-head p.date-line { font-size: 1.15rem; font-weight: 650; color: var(--text); }
.day-big { display: flex; flex-direction: column; align-items: center; line-height: 1.05; margin: 12px 0; }
.day-big .dow { font-size: 1.3rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.day-big .dd { font-size: 4.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.day-big .my { font-size: 1.3rem; font-weight: 650; }
.start-day { display: grid; place-items: center; min-height: calc(100vh - 220px); padding: 12px 0; }
.start-card { width: 100%; max-width: 520px; padding: 28px 24px; text-align: center; }
.start-card .logo-sq { width: 32px; height: 32px; }
.start-ic { width: 60px; height: 60px; margin: 10px auto 0; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.start-ic .ic { width: 28px; height: 28px; }
.start-ic.ok { background: var(--ok-50); color: var(--ok); }
.btn-xl { font-size: 1.15rem; padding: 14px 28px; min-height: 56px; border-radius: 12px; }
.mobile-bar { display: none; }
.instructions { white-space: pre-line; }

/* calendar strip for sales history */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .h { font-size: 11px; text-transform: uppercase; color: var(--muted); text-align: center; font-weight: 650; }
.cal a, .cal span.blank { min-height: 64px; border-radius: 10px; border: 1px solid var(--border); padding: 6px 8px; display: flex; flex-direction: column; color: var(--text); background: var(--surface); font-size: 12px; }
.cal span.blank { border: 0; background: none; }
.cal a:hover { text-decoration: none; border-color: var(--brand); }
.cal a .d { font-weight: 700; font-size: 13px; }
.cal a.approved { background: var(--ok-50); }
.cal a.submitted { background: var(--brand-50); }
.cal a.draft { background: var(--warn-50); }
.cal a.today { outline: 2px solid var(--accent); }
.cal a .amt { margin-top: auto; font-variant-numeric: tabular-nums; font-weight: 600; }

/* attendance pills */
.att { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.att input { display: none; }
.att label { margin: 0; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.att input:checked + label { color: #fff; border-color: transparent; }
.att input[value=present]:checked + label { background: var(--ok); }
.att input[value=absent]:checked + label { background: var(--bad); }
.att input[value=off]:checked + label { background: #64748b; }
.att input[value=leave]:checked + label { background: var(--brand); }
.att input[value=sick]:checked + label { background: var(--warn); }
.att-cell { width: 26px; height: 26px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; }
.att-present { background: var(--ok); } .att-absent { background: var(--bad); } .att-off { background: #94a3b8; } .att-leave { background: var(--brand); } .att-sick { background: var(--warn); } .att-closed { background: #334155; }

/* permissions matrix */
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table select { min-height: 32px; padding: 4px 6px; font-size: 13px; min-width: 88px; }
.perm-table select.l0 { color: var(--muted); }
.perm-table select.l1 { color: var(--brand); background: var(--brand-50); }
.perm-table select.l2 { color: var(--ok); background: var(--ok-50); }

/* company tiles (global admin) */
.tiles { display: grid; gap: 16px; }
.tiles.v-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tiles.v-medium { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tiles.v-small { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.tile { display: flex; flex-direction: column; gap: 10px; padding: 16px; color: var(--text); }
.tile:hover { text-decoration: none; border-color: var(--brand); }
.tile .logo { width: 56px; height: 56px; border-radius: 12px; object-fit: contain; background: #fff; border: 1px solid var(--border); }
.v-small .tile { align-items: center; text-align: center; padding: 12px; }
.v-small .tile .meta, .v-small .tile .stats { display: none; }
.v-medium .tile .stats { display: none; }
.tile .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; font-size: 12px; color: var(--muted); }
.tile .stats b { display: block; color: var(--text); font-size: 15px; }
.logo-sq { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--border); flex: none; }

/* bar chart */
.chart { width: 100%; height: 220px; }
.chart .bar { fill: var(--brand); }
.chart .bar:hover { fill: var(--accent); }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .grid-line { stroke: var(--border); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ------------------------------------------------------------ auth pages */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  background: radial-gradient(circle at 20% 20%, rgba(232,112,42,.35), transparent 45%), linear-gradient(150deg, #1d4f75, #17212c 70%);
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-art h1 { font-size: 2.1rem; max-width: 460px; }
.auth-art p { color: #c9d6e3; max-width: 440px; font-size: 1.02rem; }
.auth-art .brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.1rem; }
.auth-art .brand img { width: 46px; height: 46px; background: #fff; border-radius: 12px; padding: 4px; }
.auth-art ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; color: #dbe5ee; }
.auth-art li { display: flex; gap: 10px; align-items: center; }
.auth-art li .ic { color: var(--accent); }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-form .box { width: 100%; max-width: 400px; }
.auth-form h2 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-form .lead { color: var(--muted); margin-bottom: 22px; }
.auth-admin .auth-art { background: radial-gradient(circle at 80% 10%, rgba(47,111,159,.45), transparent 50%), linear-gradient(160deg, #0d141b, #1b2a38); }

/* ------------------------------------------------------------ public site */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.site-header .in, .site .in { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.site-header .in { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 12px; }
.site-header .logo { display: flex; align-items: center; gap: 10px; font-weight: 750; color: var(--text); font-size: 1.1rem; }
.site-header .logo img { width: 38px; height: 38px; }
.site-header nav { display: flex; gap: 8px; }
.hero { padding: 72px 0 48px; background: radial-gradient(circle at 85% 0%, var(--accent-50), transparent 40%), radial-gradient(circle at 0% 100%, var(--brand-50), transparent 45%); }
.hero .in { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3rem); letter-spacing: -.02em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: 1.1rem; color: var(--muted); max-width: 540px; }
.video { aspect-ratio: 16/9; border-radius: 16px; background: #0b1117; box-shadow: var(--shadow-lg); overflow: hidden; }
.video video { display: block; width: 100%; height: 100%; object-fit: contain; background: #0b1117; }
.section { padding: 56px 0; }
.section h2 { font-size: 1.6rem; text-align: center; margin-bottom: 8px; }
.section .sub { text-align: center; color: var(--muted); max-width: 620px; margin: 0 auto 32px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { padding: 22px; }
.feature .ic-wrap { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; margin-bottom: 12px; }
.feature:nth-child(3n+2) .ic-wrap { background: var(--accent-50); color: var(--accent); }
.feature .ic-wrap .ic { width: 22px; height: 22px; }
.feature p { color: var(--muted); margin: 0; }
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.shot { overflow: hidden; color: var(--text); transition: border-color .15s, transform .15s; }
.shot:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-2px); }
.shot-ic { height: 96px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: var(--brand-50); color: var(--brand); border-bottom: 1px solid var(--border); }
.shot-ic .ic { width: 34px; height: 34px; }
.shot:nth-child(3n+2) .shot-ic { background: var(--accent-50); color: var(--accent); }
.shot .body { padding: 14px 16px; }
.demo-banner { background: #17212c; color: #dbe5ee; padding: 8px 24px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 13.5px; }
.demo-banner .ic { width: 16px; height: 16px; vertical-align: -3px; color: var(--accent); }
.demo-banner .btn .ic { color: inherit; }
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 22px 0; margin-top: 40px; }
.site-footer .in { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.site-footer img { height: 40px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .closing-layout { grid-template-columns: 1fr; }
  .closing-side { position: static; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .cur-tabs { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .features, .shots { grid-template-columns: 1fr 1fr; }
  .hero .in { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(10,16,24,.45); z-index: 35; }
  .topbar { padding: 8px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .user-chip .meta { display: none; }
  .content { padding: 16px; }
  .impersonate { padding: 8px 16px; font-size: 13px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .closing-page { padding-bottom: 76px; }
  .mobile-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--border);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); align-items: center; gap: 10px; box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  }
  .mobile-bar .d { flex: 1; line-height: 1.2; }
  .mobile-bar .d b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
}
@media (max-width: 640px) {
  /* minmax(0, ...): a wide table scrolls inside its card instead of pushing the card off the screen */
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-4.kpis { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 1.2rem; }
  .features, .shots { grid-template-columns: 1fr; }
  .page-head { align-items: stretch; }
  .page-head .actions { width: 100%; }
  .lines .line { grid-template-columns: 1fr 110px 36px; }
  .page-head img.logo-sq { display: none; }
  .cal a { min-height: 52px; padding: 4px 5px; }
  .cal a .amt { font-size: 10.5px; }
  .site-header nav .btn:not(.btn-primary) { display: none; }
  .table th, .table td { padding: 8px 9px; }
  .hero { padding: 40px 0 28px; }
}

/* ------------------------------------------------------------ print */
@media print {
  .sidebar, .topbar, .impersonate, .no-print, .mobile-bar, .rest-switch, .btn { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  .closing-layout { grid-template-columns: 1fr 260px; }
  input, select, textarea { border: 0; padding: 0; min-height: 0; background: none !important; }
  /* Only the Global Super Admin may print or save as PDF (Ctx::canPrint); everyone else gets a blank notice */
  body.print-blocked > * { display: none !important; }
  body.print-blocked::before { content: "Printing is restricted to the owner."; display: block; padding: 40px; font-size: 16px; text-align: center; }
}

/* ------------------------------------------------------------ year › month › day history */
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; color: var(--muted); flex-wrap: wrap; }
.crumbs a { font-weight: 600; }
.months { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.month { padding: 14px 16px; color: var(--text); display: flex; flex-direction: column; gap: 6px; min-height: 128px; margin: 0 !important; }
.month:hover { text-decoration: none; border-color: var(--brand); }
.month.current { border-color: var(--accent); }
.month.future { opacity: .45; }
.month .mh { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; }
.month .mv { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.month .ms { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12.5px; }
.cal a.missing { background: var(--bad-50); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.cal span.blank.future { border: 1px dashed var(--border); border-radius: 10px; padding: 6px 8px; opacity: .5; min-height: 64px; }
@media (max-width: 960px) { .months { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .months { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cal span.blank.future { min-height: 52px; } }

/* Screenshot deterrent: viewer watermark + blur while a capture tool may be active (see app.js) */
.wm { position: fixed; inset: 0; z-index: 9998; pointer-events: none; opacity: .13; background-repeat: repeat; }
.guard-note { display: none; position: fixed; inset: 0; z-index: 9999; align-items: center; justify-content: center; padding: 16px; text-align: center; font-size: 1.2rem; font-weight: 700; color: var(--text); background: color-mix(in srgb, var(--bg) 55%, transparent); }
html.guard .shell, html.guard dialog { filter: blur(22px); }
html.guard .guard-note { display: flex; }
@media print { html.guard .shell, html.guard dialog { filter: none; } .wm { opacity: .18; -webkit-print-color-adjust: exact; print-color-adjust: exact; } .guard-note { display: none !important; } }

/* Honeypot field: hidden from people, filled in by spam bots */
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------------------ public site motion (home + demo) */
.site-header { transition: box-shadow .3s ease; }
.site-header.scrolled { box-shadow: 0 8px 24px -16px rgba(16, 24, 40, .35); }
.site .feature, .site .shot { transition: border-color .2s ease, box-shadow .25s ease, transform .25s cubic-bezier(.2, .8, .2, 1); }
.site .feature:hover, .site .shot:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); box-shadow: var(--shadow-lg); }
.site .feature .ic-wrap { transition: background .25s ease, color .25s ease; }
.site .feature:hover .ic-wrap { background: var(--brand); color: #fff; }
.site .feature:nth-child(3n+2):hover .ic-wrap { background: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  /* hero: staggered entrance, then a slow drifting glow */
  .site .hero { background-size: 140% 140%; animation: hero-drift 18s ease-in-out infinite alternate; }
  .site .hero .in > div:first-child > * { opacity: 0; animation: rise .7s cubic-bezier(.2, .8, .2, 1) forwards; }
  .site .hero .in > div:first-child > :nth-child(2) { animation-delay: .08s; }
  .site .hero .in > div:first-child > :nth-child(3) { animation-delay: .16s; }
  .site .hero .in > div:first-child > :nth-child(4) { animation-delay: .24s; }
  .site .hero .video { opacity: 0; animation: rise-in .9s .2s cubic-bezier(.2, .8, .2, 1) forwards; }
  /* video: pulsing play ring and a light sweep */
  .site .video .play { position: relative; transition: transform .25s cubic-bezier(.2, .8, .2, 1), background .25s ease; }
  .site .video .play::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); animation: ring 2.4s ease-out infinite; }
  .site .video:hover .play { transform: scale(1.08); background: rgba(255, 255, 255, .22); }
  .site .video::before { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .08), transparent); transform: skewX(-18deg); animation: sweep 6s 1.2s ease-in-out infinite; }
  /* cards lift on hover (transform only, no layout shift) */
  .site .feature:hover, .site .shot:hover { transform: translateY(-4px); }
  /* scroll reveal, set up by app.js */
  .site .will-reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.2, .8, .2, 1), transform .7s cubic-bezier(.2, .8, .2, 1), border-color .2s ease, box-shadow .25s ease; transition-delay: var(--rd, 0ms); }
  .site .will-reveal.revealed { opacity: 1; transform: none; transition-delay: var(--rd, 0ms), var(--rd, 0ms), 0ms, 0ms; }
  .site .will-reveal.revealed:hover { transition-delay: 0ms; }
  .site .feature.will-reveal.revealed:hover, .site .shot.will-reveal.revealed:hover { transform: translateY(-4px); }
  /* demo screenshots: placeholder lines draw in once visible */
  .site .shot .mock i { transform-origin: left center; transform: scaleX(0); transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
  .site .shot.revealed .mock i { transform: scaleX(1); }
  .site .shot.revealed .mock i:nth-child(2) { transition-delay: .08s; }
  .site .shot.revealed .mock i:nth-child(3) { transition-delay: .16s; }
  .site .shot.revealed .mock i:nth-child(4) { transition-delay: .24s; }
  .site .shot.revealed .mock i:nth-child(5) { transition-delay: .32s; }
  .site .shot.revealed .mock i:nth-child(6) { transition-delay: .40s; }
  .site .feature .ic-wrap .ic { transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
  .site .feature:hover .ic-wrap .ic { transform: rotate(-8deg) scale(1.1); }
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes ring { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes sweep { 0%, 60% { left: -60%; } 100% { left: 130%; } }
@keyframes hero-drift { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }

/* "Install app" buttons stay hidden until the browser can install directly (see app.js) */
[data-pwa-install][hidden] { display: none; }

/* Expired licence: greyed-out workspace with one message (no real data behind it) */
.nav a.locked { opacity: .45; cursor: not-allowed; }
.nav a.locked:hover { background: none; color: inherit; }
.nav a.locked svg:last-child { margin-left: auto; width: 14px; height: 14px; }
.license-lock { position: relative; min-height: calc(100vh - 130px); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px 0; }
.license-ghost { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 110px; gap: 16px; opacity: .55; filter: grayscale(1); pointer-events: none; overflow: hidden; }
.license-ghost i { display: block; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.license-ghost .wide { grid-column: span 2; grid-row: span 3; }
.license-card { position: relative; max-width: 480px; width: 100%; padding: 32px 28px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, .18); }
.license-card h1 { margin: 0; font-size: 1.4rem; }
.license-card p { margin: 0; }
.license-msg { font-size: 1.05rem; line-height: 1.5; }
.license-seal { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--bad-50); color: var(--bad); }
.license-seal svg { width: 26px; height: 26px; }
.btn-whatsapp { background: #0e7a53; border-color: #0e7a53; color: #fff; margin-top: 8px; padding: 12px 20px; font-weight: 600; }
.btn-whatsapp:hover { background: #0b6444; border-color: #0b6444; color: #fff; text-decoration: none; }
@media (max-width: 640px) { .license-ghost { grid-template-columns: repeat(2, 1fr); } }

/* Live support chat (company page + support agent inbox) */
.chat { display: flex; flex-direction: column; max-width: 860px; }
.chat .card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.chat-log { height: min(56vh, 520px); overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.chat-msg { max-width: 78%; align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 12px 12px 12px 4px; padding: 8px 12px; overflow-wrap: anywhere; }
.chat-msg small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
.chat-msg.mine { align-self: flex-end; background: var(--brand); border-color: var(--brand); color: #fff; border-radius: 12px 12px 4px 12px; }
.chat-msg.mine small { color: rgba(255, 255, 255, .75); }
.chat-msg.sys { align-self: center; background: none; border: 0; color: var(--muted); font-size: 12.5px; padding: 2px 8px; }
.chat-wait { padding: 12px 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.chat-form { display: flex; gap: 8px; padding: 12px; align-items: flex-end; }
.chat-form textarea { flex: 1; resize: vertical; min-height: 44px; }
.chat-inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.chat-inbox .chat { max-width: none; }
.chat-lists { max-height: calc(100vh - 160px); overflow-y: auto; }
.chat-item { display: block; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; }
.chat-item form { margin-top: 6px; }
.chat-item:hover, .chat-item.active { background: var(--brand-50); }
.chat-item.unread { border-left: 3px solid var(--accent); }
.chat-preview { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-empty { padding: 10px 14px; margin: 0; }
@media (max-width: 860px) { .chat-inbox { grid-template-columns: 1fr; } .chat-lists { max-height: none; } }

/* ---------- Always respect [hidden] (components with display:flex used to override it) */
[hidden] { display: none !important; }

/* ---------- Avatars with a photo */
.avatar-img { overflow: hidden; background: var(--surface-2); }
.avatar-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Settings (profile) */
.settings { max-width: 640px; margin: 0 auto; padding-bottom: 24px; }
.st-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 18px; text-align: center; }
.st-photo { position: relative; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.st-cam { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: #fff; border: 3px solid var(--bg); }
.st-cam svg { width: 15px; height: 15px; }
.st-name { font-size: 20px; font-weight: 700; margin-top: 4px; }
.st-sub { color: var(--muted); font-size: 13.5px; }
.st-section { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 20px 6px 8px; }
.st-group { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.st-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 14px; border: 0; background: none; color: var(--text);
  font: inherit; text-align: left; cursor: pointer; text-decoration: none; }
.st-row + .st-row, .st-group > * + * { border-top: 1px solid var(--border); }
.st-row:hover { background: var(--surface-2); text-decoration: none; }
.st-ico { width: 32px; height: 32px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.st-ico svg { width: 17px; height: 17px; }
.st-label { flex: 1; font-weight: 550; min-width: 0; }
.st-hint { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.st-value { color: var(--muted); font-size: 14px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-chev { color: var(--muted); display: grid; }
.st-chev svg { width: 16px; height: 16px; }
.st-switch-row { cursor: pointer; }
.st-signout { margin-top: 20px; }
.st-signout .st-row, .st-danger { color: var(--bad); }
.st-signout .st-ico { background: var(--bad-50); color: var(--bad); }
.st-version { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }
.st-photo-form { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.st-photo-preview { margin: 6px 0 4px; }

/* ---------- Switch */
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: .45; }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Sheets (dialogs): bottom sheet on phones, centred card on larger screens */
dialog.sheet { border: 0; padding: 0; width: min(440px, 100%); max-height: 88vh; border-radius: 18px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); }
dialog.sheet.sheet-wide { width: min(620px, 100%); }
dialog.sheet::backdrop { background: rgba(10, 15, 22, .55); }
dialog.sheet > form, dialog.sheet { display: flex; flex-direction: column; }
dialog.sheet:not([open]) { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px 18px; font-size: 16px; }
.sheet-body { padding: 6px 18px 4px; overflow: auto; }
.sheet-body .card { border: 0; box-shadow: none; padding: 0; background: none; }
.sheet-body .card h2 { display: none; }
.sheet-foot { padding: 10px 18px 18px; }
@media (max-width: 640px) {
  dialog.sheet { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
.st-hint-bad { color: var(--bad) !important; }

/* ---------- Menu badges (global admin) */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff;
  font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.nav-badge-warn { background: #f59e0b; color: #1b1300; }
.menu-btn { position: relative; }
.menu-dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; border: 2px solid var(--surface); }

/* taps and clicks: a soft grey flash instead of the blue highlight/outline (keyboard Tab still shows a grey ring) */
* { -webkit-tap-highlight-color: var(--tap); }
:focus:not(:focus-visible) { outline: none; }
a:focus-visible, button:focus-visible, .btn:focus-visible, [role="button"]:focus-visible, summary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--text) 30%, transparent); outline-offset: 2px; }
.btn:active, .nav a:active, .tabs a:active, .dropdown-menu a:active, .dropdown-menu button:active { box-shadow: inset 0 0 0 999px var(--tap); }
::selection { background: color-mix(in srgb, var(--text) 18%, transparent); }

/* ---------- after signing in: the vault door unlocks, swings open and fades into the page (about 2.5 s) */
.vault-intro { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; align-content: center; gap: 22px;
  background: radial-gradient(circle at 50% 45%, #1b2836 0%, #0b1117 70%); animation: vi-out .6s ease-in 2.05s forwards; cursor: pointer; }
.vi-stage { position: relative; width: 240px; height: 240px; perspective: 900px; animation: vi-pop .35s cubic-bezier(.2,.9,.3,1.2) both; }
.vi-inside { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, #fff3dc 0%, #f3c27a 35%, #e8702a 62%, rgba(232,112,42,0) 72%);
  opacity: 0; animation: vi-glow 1.4s ease-out .95s forwards; }
.vi-door { position: absolute; inset: 0; transform-origin: 6% 50%; transform-style: preserve-3d; filter: drop-shadow(0 14px 28px rgba(0,0,0,.55));
  animation: vi-open .85s cubic-bezier(.55,0,.25,1) 1s forwards; }
.vi-door svg { display: block; width: 100%; height: 100%; }
.vi-dial { transform-origin: 120px 120px; animation: vi-spin-back .8s cubic-bezier(.4,0,.2,1) .2s both; }
.vi-handle { transform-origin: 120px 120px; animation: vi-spin .8s cubic-bezier(.4,0,.2,1) .2s both; }
.vi-word { font: 800 1.35rem var(--font); letter-spacing: .04em; color: #e8702a; animation: vi-word .5s ease .3s both; }
@keyframes vi-pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes vi-spin { to { transform: rotate(240deg); } }
@keyframes vi-spin-back { to { transform: rotate(-120deg); } }
@keyframes vi-open { to { transform: rotateY(-108deg); } }
@keyframes vi-glow { 0% { opacity: 0; transform: scale(.6); } 60% { opacity: 1; } 100% { opacity: 1; transform: scale(3.2); } }
@keyframes vi-word { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes vi-out { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@media (prefers-reduced-motion: reduce) {
  /* phones with animations off: a short, calm fade instead of the moving door */
  .vi-stage, .vi-door, .vi-dial, .vi-handle, .vi-word, .vi-inside { animation: none; }
  .vault-intro { animation: vi-out .4s ease-in .8s forwards; }
}
