/* Ascent Select - UI
   Soft-grey canvas, white cards, Ascent blue accent, Inter. Compact + professional.
   Aesthetic aligned with the Ascent console design system. */

:root {
  --bg:         #fafafa;
  --surface:    #ffffff;
  --soft:       #fafafa;
  --text:       #1a1a1a;
  --head:       #111827;
  --muted:      #6b7280;
  --muted-2:    #9ca3af;
  --line:       #e5e7eb;
  --line-2:     #d1d5db;
  --brand:      #005bea;
  --brand-ink:  #0050cf;
  --brand-soft: #eaf1ff;
  --ok:         #0a7d33;
  --ok-bg:      #e7f6ec;
  --warn:       #8a6d00;
  --warn-bg:    #fbf3d8;
  --err:        #b42318;
  --err-bg:     #fdecea;
  --radius:     8px;
  --radius-sm:  6px;
  --sidebar-w:  224px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; color: var(--head); margin: 0; }
h1 { font-size: 18px; letter-spacing: -0.01em; }
h2 { font-size: 15px; }
h3 { font-size: 13px; }

/* ---------- layout shell (Ascent Kanban / Repo) ---------- */
body.has-sidebar .shell { margin-left: var(--sidebar-w); min-width: 0; }
.shell { display: flex; flex-direction: column; min-height: 100vh; }
.wrap { padding: 22px 26px; flex: 1; max-width: 1180px; width: 100%; }
.wrap-narrow { max-width: 560px; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--surface);
  border-right: .5px solid var(--line); display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
}
.sidebar .brand, .sidebar-brand { padding: 9px 18px 8px; border-bottom: .5px solid var(--line); display: block; }
.sidebar-brand img { height: 45px; width: auto; display: block; }
.sidenav { padding: 4px 10px; flex: 1; overflow-y: auto; }
.sidenav a {
  display: flex; align-items: center; gap: 9px; padding: 4px 10px; border-radius: 6px;
  color: #374151; font-size: 13px; margin-bottom: 1px;
}
.sidenav a:hover { background: var(--soft); text-decoration: none; }
.sidenav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.sidenav a svg { width: 16px; height: 16px; flex: 0 0 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.sidenav a .badge { margin-left: auto; }
.navgroup { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); padding: 6px 10px 2px; }
.navgroup:first-child { padding-top: 2px; }

.whoami { padding: 6px 16px 5px; border-top: .5px solid var(--line); }
.whoami-name { font-weight: 500; font-size: 13px; color: #111827; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whoami-mail { font-size: 11.5px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .signout { padding: 2px 10px 6px; }
.sidebar .signout a { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 6px; color: #374151; font-size: 13.5px; }
.sidebar .signout a:hover { background: var(--err-bg); color: var(--err); text-decoration: none; }
.sidebar .signout a svg { width: 16px; height: 16px; flex: 0 0 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.sidebar .powered { padding: 9px 18px; border-top: .5px solid var(--line); }
.sidebar .powered img { height: 28px; width: auto; display: block; }

/* ---------- mobile top bar (checkbox toggle) ---------- */
.navtoggle { display: none; }
.mobilebar { display: none; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: .5px solid var(--line); position: sticky; top: 0; z-index: 30; }
.mobilebar .brand img { height: 26px; display: block; }
.burger { display: inline-flex; flex-direction: column; gap: 4px; border: .5px solid var(--line-2); background: #fff; border-radius: 6px; padding: 8px 9px; cursor: pointer; }
.burger span { width: 16px; height: 1.7px; background: #374151; display: block; border-radius: 2px; }
.nav-scrim { display: none; position: fixed; inset: 0; background: rgba(17,24,39,.35); z-index: 35; }

/* ------------------------------------------------------------- Headings */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head h1 { margin-bottom: 3px; }
.lede { margin: 0; color: var(--muted); font-size: 13px; max-width: 60ch; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Cards */
.card {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-h {
  padding: 13px 16px; border-bottom: 0.5px solid var(--line);
  font-weight: 500; font-size: 13.5px; color: var(--head);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.card-b { padding: 16px; }
.table-card { padding: 0; overflow: hidden; }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty p { margin: 0 0 16px; }

/* --------------------------------------------------------------- Tables */
.grid { width: 100%; border-collapse: collapse; background: var(--surface); }
.grid thead th {
  text-align: left; font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted);
  padding: 11px 16px; border-bottom: 0.5px solid var(--line);
  background: var(--soft); white-space: nowrap;
}
.grid tbody td { padding: 11px 16px; border-bottom: 0.5px solid var(--line); vertical-align: middle; font-size: 13px; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr:hover { background: #fcfcfd; }

.col-price, .col-total, .col-qty { white-space: nowrap; }
.col-action { width: 1%; white-space: nowrap; }
.col-desc { color: var(--muted); max-width: 380px; }

.sku { font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.name { display: block; font-weight: 500; color: var(--head); }
.col-name .sku { display: block; margin-top: 2px; }
.price { font-variant-numeric: tabular-nums; }
.tag {
  display: inline-block; margin-top: 4px;
  font-size: 10.5px; color: var(--muted); background: var(--soft);
  border: 0.5px solid var(--line); border-radius: 999px; padding: 1px 8px;
}

/* --------------------------------------------------------------- Badges */
.badge {
  display: inline-flex; align-items: center; min-width: 18px; justify-content: center;
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
  color: #fff; background: var(--brand); line-height: 1.6;
}
.pill {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; border: 0.5px solid var(--line-2);
  color: var(--muted); background: var(--surface); line-height: 1.6;
}
.pill.green { color: var(--ok); background: var(--ok-bg); border-color: #bfe6cb; }
.pill.blue  { color: var(--brand); background: var(--brand-soft); border-color: #c9dcff; }
.pill.amber { color: var(--warn); background: var(--warn-bg); border-color: #ecdca0; }
.pill.red   { color: var(--err); background: var(--err-bg); border-color: #f0c4bf; }
.pill.grey  { color: var(--muted); background: var(--soft); }

.row-actions { display: flex; gap: 14px; }
.row-actions a { color: var(--brand); font-size: 13px; }
.link-remove {
  background: none; border: none; color: var(--muted-2);
  font: inherit; font-size: 12.5px; cursor: pointer; padding: 0;
}
.link-remove:hover { color: var(--err); }

/* ------------------------------------------------------------- Stepper */
.add-row { display: flex; align-items: center; gap: 10px; }
.stepper {
  display: inline-flex; align-items: center;
  border: 0.5px solid var(--line-2); border-radius: var(--radius-sm);
  overflow: hidden; height: 32px; background: var(--surface);
}
.step {
  width: 30px; height: 30px; border: none; background: var(--surface);
  color: var(--text); font-size: 15px; cursor: pointer; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.step:hover { background: var(--soft); }
.step-qty {
  width: 34px; height: 30px; border: none; text-align: center;
  font: inherit; font-size: 13px; color: var(--text);
  font-variant-numeric: tabular-nums; background: transparent;
  border-left: 0.5px solid var(--line-2); border-right: 0.5px solid var(--line-2);
}
.step-qty:focus { outline: none; }

/* --------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 8px 13px; border-radius: var(--radius-sm);
  border: 0.5px solid var(--line-2); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.btn:hover { background: var(--soft); text-decoration: none; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--soft); }
.btn-add { padding: 8px 18px; }
.btn-block { display: flex; width: 100%; margin-top: 14px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ------------------------------------------------------------- Summary */
.cart-layout, .checkout-layout, .confirm-layout {
  display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start;
}
.summary h2 { margin-bottom: 16px; }
.sum-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; font-size: 13.5px; color: var(--muted);
}
.sum-row span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }
.sum-total {
  margin-top: 6px; padding-top: 12px; border-top: 0.5px solid var(--line);
  font-size: 15px; font-weight: 600; color: var(--head);
}
.sum-total span:last-child { font-weight: 600; }
.sum-items { list-style: none; margin: 0 0 8px; padding: 0 0 8px; border-bottom: 0.5px solid var(--line); }
.sum-items li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13px; }
.sum-items .sum-name { color: var(--text); }
.sum-items em { color: var(--muted-2); font-style: normal; }
.fine { margin: 10px 0 0; font-size: 11.5px; color: var(--muted-2); text-align: center; }

/* --------------------------------------------------------------- Forms */
.form-card h2 { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field > span { font-size: 12.5px; color: #374151; font-weight: 500; }
.field em { color: var(--muted-2); font-style: normal; font-weight: 400; }
.field input, .field textarea, .field select {
  font: inherit; font-size: 13px; color: var(--text);
  padding: 8px 11px; border: 0.5px solid var(--line-2);
  border-radius: var(--radius-sm); background: var(--surface); width: 100%;
}
.field select { appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.field input[readonly] { background: var(--soft); color: var(--muted); }
.field textarea { resize: vertical; min-height: 70px; }
.check { display: flex; align-items: center; gap: 9px; margin: 16px 0 4px; font-size: 13px; color: var(--muted); }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }
.checkout-note {
  font-size: 13px; color: var(--muted); background: var(--soft);
  border: 0.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 14px; margin: 0 0 16px;
}
.checkout-note a { color: var(--brand); }
.pay-intro { font-size: 13.5px; color: var(--muted); margin: 0 0 18px; line-height: 1.5; }
.pay-note { font-size: 12px; color: var(--muted-2); margin: 14px 0 0; }

/* --------------------------------------------------------------- Auth */
.auth-wrap { max-width: 400px; margin: 6vh auto 0; }
.auth-card { padding: 30px 28px; border-radius: 12px; }
.auth-card h1 { font-size: 17px; margin-bottom: 6px; }
.auth-card .lede { margin-bottom: 20px; }
.auth-card .field { margin-bottom: 14px; }
.otp-input { letter-spacing: 8px; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; }
.resend { margin-top: 14px; text-align: center; }
.link-plain { background: none; border: none; color: var(--brand); font: inherit; font-size: 13px; cursor: pointer; }

/* --------------------------------------------------------------- Confirm */
.confirm-banner {
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
  border: 0.5px solid #bfe6cb; background: var(--ok-bg);
}
.confirm-banner .tick {
  width: 34px; height: 34px; border-radius: 50%; background: var(--ok);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; flex: none;
}
.confirm-ref { font-size: 15px; color: var(--head); font-weight: 600; }
.confirm-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* --------------------------------------------------------------- Flash */
.flash { border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; font-size: 13px; border: 0.5px solid; }
.flash-success { background: var(--ok-bg); border-color: #bfe6cb; color: var(--ok); }
.flash-error   { background: var(--err-bg); border-color: #f0c4bf; color: var(--err); }
.flash-info    { background: var(--brand-soft); border-color: #c9dcff; color: var(--brand); }

/* --------------------------------------------------------------- Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--head); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.show-cart { display: none; }

/* ---------------------------------------------------------- Policy pages */
.policy { max-width: 820px; line-height: 1.6; }
.policy h2 { font-size: 15px; margin: 26px 0 8px; color: var(--head); }
.policy h2:first-child { margin-top: 0; }
.policy h3 { font-size: 13.5px; margin: 18px 0 6px; color: var(--head); }
.policy p { margin: 0 0 12px; color: #374151; font-size: 14px; }
.policy ul, .policy ol { margin: 0 0 14px; padding-left: 20px; color: #374151; font-size: 14px; }
.policy li { margin: 4px 0; }
.policy a { color: var(--brand); }
.policy .policy-address { line-height: 1.7; }
.policy .policy-eff { color: var(--muted-2); font-size: 12.5px; margin-top: 14px; }
.policy .policy-legend { font-size: 12.5px; color: var(--muted-2); }
.policy-table-wrap { overflow-x: auto; margin: 0 0 16px; }
.policy-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 460px; }
.policy-table th, .policy-table td { border: 0.5px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.policy-table th { background: var(--soft); font-weight: 500; color: var(--head); }
.policy-table td { color: #374151; }

/* ------------------------------------------------- Site footer (policies) */
.site-footer { margin-top: 44px; padding-top: 20px; border-top: 0.5px solid var(--line); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; }
.footer-links a { font-size: 12.5px; color: var(--muted); }
.footer-links a:hover { color: var(--head); }
.footer-meta { font-size: 12px; color: var(--muted-2); }

/* ============================================================== Responsive */
.overlay { display: none; position: fixed; inset: 0; background: rgba(17,24,39,.35); z-index: 35; }
@media (max-width: 860px) {
  body.has-sidebar .shell { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 30px rgba(0,0,0,.12); }
  .navtoggle:checked ~ .sidebar { transform: translateX(0); }
  .navtoggle:checked ~ .nav-scrim { display: block; }
  .mobilebar { display: flex; }
  .wrap { padding: 16px 14px; }

  .page-head { flex-direction: column; gap: 12px; }
  .cart-layout, .checkout-layout, .confirm-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .show-cart { display: inline-flex; }

  /* Tables become stacked cards */
  table[data-cards] thead { display: none; }
  table[data-cards], table[data-cards] tbody { display: block; }
  table[data-cards] tr {
    display: block; background: var(--surface);
    border: 0.5px solid var(--line); border-radius: var(--radius);
    padding: 6px 4px; margin: 0 0 10px;
  }
  table[data-cards] tr:hover { background: var(--surface); }
  table[data-cards] td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; padding: 9px 14px; border-bottom: 0.5px solid var(--line) !important;
  }
  table[data-cards] td:last-child { border-bottom: 0 !important; }
  table[data-cards] td::before {
    content: attr(data-label); font-size: 11px; letter-spacing: 0.03em;
    text-transform: uppercase; color: var(--muted); font-weight: 500; flex: 0 0 auto;
  }
  table[data-cards] td[data-label=""]::before { display: none; }
  table[data-cards] .col-name { flex-direction: column; align-items: flex-start; gap: 2px; }
  table[data-cards] .col-name::before { order: -1; }
  table[data-cards] .col-desc { color: var(--muted); font-size: 13px; }
  table[data-cards] .col-action { display: block; }
  table[data-cards] .col-action::before { display: block; margin-bottom: 8px; }
  table[data-cards] .add-row { justify-content: space-between; }
  table[data-cards] .row-actions { justify-content: flex-end; }
  .col-desc { max-width: none; }
}
@media (max-width: 420px) {
  table[data-cards] .add-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .btn-add { width: 100%; }
}

/* Accessibility */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ------------------------------------------------------------------- Admin */
.admin-shell { min-height: 100vh; background: var(--bg); }
.admin-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--surface); border-bottom: 0.5px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.admin-brand { display: inline-flex; align-items: center; gap: 10px; }
.admin-brand:hover { text-decoration: none; }
.admin-brand img { width: 116px; height: auto; display: block; }
.admin-badge {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
  color: var(--brand); background: var(--brand-soft); border: 0.5px solid #c9dcff;
  padding: 2px 8px; border-radius: 999px;
}
.admin-user { display: inline-flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.admin-user .acct-email { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-main { max-width: 1080px; margin: 0 auto; padding: 24px; }
.admin-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.admin-cards .card { display: flex; flex-direction: column; }
.admin-cards .card .card-b { flex: 1; }
.admin-status { list-style: none; margin: 0; padding: 0; font-size: 13.5px; color: var(--muted); }
.admin-status li { padding: 5px 0; display: flex; gap: 8px; align-items: center; }
.admin-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.admin-auth .auth-card { width: 100%; max-width: 380px; }
.admin-auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.admin-auth-brand img { width: 120px; height: auto; }
@media (max-width: 720px) {
  .admin-cards { grid-template-columns: 1fr; }
  .admin-top { padding: 10px 14px; }
  .admin-main { padding: 16px 14px; }
}

/* ------------------------------------------------- Admin order builder */
.inline-search { display: flex; gap: 8px; }
.inline-search input[type=text] {
  flex: 1; font: inherit; font-size: 13px; padding: 8px 11px;
  border: 0.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface);
}
.inline-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.qty-input {
  width: 60px; font: inherit; font-size: 13px; text-align: center;
  padding: 6px 6px; border: 0.5px solid var(--line-2); border-radius: var(--radius-sm);
}
.admin-main .add-row { gap: 8px; }

/* Admin badge under the sidebar brand + live search results */
.brand-wrap .admin-badge { margin-top: 10px; }
.search-results { margin-top: 4px; }
.result-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 2px; border-bottom: 0.5px solid var(--line);
}
.result-row:last-child { border-bottom: none; }
.result-main { min-width: 0; }
.result-main .name { display: block; }
.result-main .sku { display: block; margin-top: 2px; }
.result-row form { margin: 0; display: flex; align-items: center; gap: 8px; }

/* Fix: second grid card was inheriting .card + .card top margin (misaligned tops) */
.admin-cards .card + .card { margin-top: 0; }

/* Clickable search-result rows (whole row is the button) */
.rowform { margin: 0; }
.result-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: none; border-bottom: 0.5px solid var(--line);
  padding: 11px 4px; font: inherit; color: var(--text);
  transition: background .12s;
}
.result-row:hover:not(:disabled) { background: var(--brand-soft); }
.result-row:disabled { cursor: not-allowed; opacity: .6; }
.rowform:last-child .result-row { border-bottom: none; }
.result-go { font-size: 12.5px; color: var(--brand); white-space: nowrap; flex: 0 0 auto; }
.result-row:disabled .result-go { color: var(--muted-2); }

/* Editable cart */
.cart-desc { width: 100%; min-width: 150px; font: inherit; font-size: 12.5px; padding: 6px 8px; border: 0.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
.cart-qty { width: 64px; font: inherit; font-size: 13px; text-align: center; padding: 6px; border: 0.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
.cart-desc:focus, .cart-qty:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cart-grid td { vertical-align: middle; }
.line-total { font-variant-numeric: tabular-nums; }

/* ADMIN badge in the sidebar foot (above email) */
.whoami .admin-badge { display: inline-block; margin-bottom: 3px; }

/* Payments report: stat row + filter bar */
.muted { color: var(--muted-2); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 0.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-n { font-size: 20px; font-weight: 600; color: var(--head); font-variant-numeric: tabular-nums; }
.stat-l { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); margin-top: 3px; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.fpill { font-size: 12.5px; padding: 6px 12px; border-radius: 999px; border: 0.5px solid var(--line-2); color: var(--muted); background: var(--surface); }
.fpill:hover { background: var(--soft); text-decoration: none; }
.fpill.on { background: var(--brand-soft); color: var(--brand); border-color: #c9dcff; font-weight: 500; }
.filter-search input { font: inherit; font-size: 13px; padding: 7px 11px; border: 0.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); min-width: 240px; }
.filter-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
@media (max-width: 700px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

/* Payments filter: FY dropdown next to status pills */
.filter-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fy-form { margin: 0; }
.fy-select { font: inherit; font-size: 13px; padding: 6px 10px; border: 0.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--head); cursor: pointer; }
.fy-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* Payments table: invoice as PDF link + date sub-row */
.inv-link { color: var(--text); font: inherit; text-decoration: none; }
.inv-link:hover { color: var(--brand); text-decoration: underline; }
.sub-date { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.stat-caption { font-size: 11.5px; color: var(--muted-2); margin: 16px 2px 10px; text-transform: uppercase; letter-spacing: .04em; }

/* Zoho entities settings form */
.cred-note { font-size: 12px; color: var(--muted-2); margin: 16px 0 8px; }
.check-row { display: flex; gap: 20px; margin-top: 12px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); }

/* Payments filter form (labelled controls, all on one line) */
.filter-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.fl { display: flex; flex-direction: column; gap: 4px; width: 160px; }
.fl > span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); }
.fl select, .fl input { width: 100%; height: 36px; font: inherit; font-size: 13px; padding: 6px 10px; border: 0.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--head); }
.fl select { cursor: pointer; }
.fl input:focus, .fl select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.fl-entity { width: 160px; }
.fl-client { width: 240px; }
.fl-fy { width: 150px; }
.fl-pay { width: 120px; }
.fl-search { flex: 1 1 auto; min-width: 180px; width: auto; }

/* Client portal */
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-brand img { height: 42px; width: auto; display: block; }
.portal { background: var(--bg); }
.portal-top { display: flex; align-items: center; gap: 16px; padding: 12px 26px; background: var(--surface); border-bottom: 0.5px solid var(--line); position: sticky; top: 0; z-index: 20; }
.portal-brand img { height: 40px; width: auto; display: block; }
.portal-acct { margin-left: auto; text-align: right; line-height: 1.35; }
.portal-acct .pa-co { font-size: 13px; font-weight: 600; color: var(--head); }
.portal-acct .pa-mail { font-size: 11.5px; color: var(--muted-2); }
.portal-main { max-width: 960px; margin: 0 auto; padding: 26px; }
.portal-foot { max-width: 960px; margin: 0 auto; padding: 20px 26px 40px; color: var(--muted-2); font-size: 12px; }

/* Client login - aligned to Ascent Kanban */
body.portal-auth { background: var(--bg); }
body.portal-auth .auth-wrap { min-height: 100vh; max-width: none; margin: 0; display: flex; align-items: center; justify-content: center; padding: 20px; }
body.portal-auth .auth-card { width: 100%; max-width: 380px; }
.auth-card .logo { margin-bottom: 20px; text-align: left; }
.auth-card .logo img { height: 45px; width: auto; display: block; }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.auth-powered { text-align: center; margin-top: 22px; }
.auth-powered img { height: 30px; width: auto; }

/* Contact type pill (Tech) + client-details group separator */
.pill.teal { background: #e6f7f4; color: #0f766e; }
.group-start:not(:first-child) td { border-top: 0.5px solid var(--line-2); }

/* Client invoices: filters + stat cards on one row (desktop) */
.inv-bar { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between; }
.inv-bar .filter-form { flex: 0 1 auto; margin: 0; }
.inv-stats { display: flex; gap: 12px; flex: 0 0 auto; }
.inv-stats .stat { min-width: 150px; }
@media (max-width: 640px) { .inv-stats { flex: 1 1 100%; } .inv-stats .stat { flex: 1; min-width: 0; } }

/* Outstanding balance shown under the amount */
.sub-bal { font-size: 11px; color: var(--err); margin-top: 2px; }

/* ---- Kanban tickets (thread) ---- */
.kb-back { margin: 0 0 6px; font-size: 12.5px; }
.kb-back a { color: var(--muted); }
.kb-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; font-size: 13px; }
.kb-facts span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); margin-bottom: 2px; }
.kb-facts em { color: var(--muted-2); font-style: normal; font-size: 12px; }
.kb-thread { display: flex; flex-direction: column; gap: 12px; }
.kb-msg { background: var(--surface); border: .5px solid var(--line); border-left: 3px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; }
.kb-msg.kb-out { border-left-color: var(--brand); background: #fbfcff; }
.kb-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 12.5px; margin-bottom: 8px; }
.kb-who { font-weight: 600; color: var(--head); }
.kb-mail { color: var(--muted-2); }
.kb-dir { font-size: 11px; color: var(--muted); background: var(--soft); border: .5px solid var(--line); border-radius: 999px; padding: 0 8px; }
.kb-out .kb-dir { color: var(--brand); background: var(--brand-soft); border-color: #c9dcff; }
.kb-date { margin-left: auto; color: var(--muted-2); white-space: nowrap; }
.kb-rcpt { font-size: 12px; color: var(--muted); margin: -4px 0 8px; overflow-wrap: anywhere; }
.kb-body { font-size: 13.5px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; overflow-x: auto; }
.kb-body p { margin: 0 0 8px; }
.kb-body blockquote { margin: 8px 0; padding-left: 10px; border-left: 2px solid var(--line-2); color: var(--muted); }
.kb-body table { border-collapse: collapse; max-width: 100%; }
.kb-body td, .kb-body th { border: .5px solid var(--line); padding: 4px 6px; }
.kb-body pre { white-space: pre-wrap; }
.kb-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: .5px dashed var(--line); }
.kb-att { font-size: 12.5px; border: .5px solid var(--line-2); border-radius: 6px; padding: 3px 9px; background: var(--soft); color: var(--text); }
.kb-att span { color: var(--muted-2); margin-left: 6px; }
.kb-att:hover { background: var(--brand-soft); text-decoration: none; }
@media (max-width: 860px) { .kb-date { margin-left: 0; } }

/* ---- Kanban tickets: spacing, clear filters, conversation list, client/Ascent colours ---- */
.inv-bar + .card, .inv-bar + .table-card { margin-top: 16px; }
.fl-clear { height: 36px; display: inline-flex; align-items: center; white-space: nowrap; }
.kb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
.kb-msg { scroll-margin-top: 16px; transition: box-shadow .3s; }
.kb-msg.kb-in { border-left-color: var(--ok); }
.kb-in .kb-dir { color: var(--ok); background: var(--ok-bg); border-color: #bfe6cb; }
.kb-msg.kb-flash { box-shadow: 0 0 0 3px var(--brand-soft); }
.kb-convo { position: sticky; top: 16px; background: var(--surface); border: .5px solid var(--line); border-radius: var(--radius); padding: 12px 8px; max-height: calc(100vh - 32px); overflow-y: auto; }
.kb-convo-h { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2); padding: 2px 10px 8px; }
.kb-ci { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.kb-ci:hover { background: var(--soft); text-decoration: none; }
.kb-ci.on { background: var(--brand-soft); }
.kb-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: 0 0 8px; background: var(--brand); }
.kb-ci-in .kb-dot { background: var(--ok); }
.kb-ci-t { display: flex; flex-direction: column; min-width: 0; }
.kb-ci-n { font-size: 13px; font-weight: 500; color: var(--head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-ci.on .kb-ci-n { color: var(--brand); }
.kb-ci-d { font-size: 11.5px; color: var(--muted-2); }
@media (max-width: 980px) { .kb-layout { grid-template-columns: 1fr; } .kb-convo { display: none; } }

/* ---- Stack services ---- */
.st-tabs { display: flex; gap: 6px; margin: 4px 0 12px; flex-wrap: wrap; }
.st-tabs a { padding: 6px 14px; border-radius: 999px; border: .5px solid var(--line-2); background: var(--surface); color: var(--text); font-size: 13px; }
.st-tabs a:hover { background: var(--soft); text-decoration: none; }
.st-tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.st-h { font-size: 15px; font-weight: 600; color: var(--head); margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; scroll-margin-top: 16px; }
.st-h:first-child { margin-top: 0; }
.st-h span { font-size: 11.5px; font-weight: 500; color: var(--muted); background: var(--soft); border: .5px solid var(--line); border-radius: 999px; padding: 0 8px; }
.st-card { overflow: hidden; scroll-margin-top: 16px; }
.st-card + .st-card { margin-top: 12px; }
.st-ch { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.st-title { font-weight: 600; color: var(--head); font-size: 14px; }
.st-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.st-desc { flex-basis: 100%; font-size: 12.5px; color: var(--muted); font-weight: 400; line-height: 1.45; }
.st-none { padding: 14px 16px; font-size: 13px; color: var(--muted-2); }
.st-svc tbody td { vertical-align: top; }
.st-inactive td { opacity: .55; }
.st-login { min-width: 200px; }
.st-login-box { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.st-login-box > * { display: block; max-width: 100%; }
@media (max-width: 860px) { .st-login-box { align-items: flex-end; text-align: right; } .st-pw { justify-content: flex-end; } }
.st-url { overflow-wrap: anywhere; }
.st-user, .st-lm { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.st-pw { display: flex !important; align-items: center; gap: 8px; margin-top: 4px; }
.st-pw-v { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--head); overflow-wrap: anywhere; user-select: all; }
.st-pw .btn { padding: 2px 9px; font-size: 11.5px; }
.st-soon { color: var(--warn); }
.st-exp { color: var(--err); }
.st-soon em, .st-exp em { font-style: normal; font-size: 11.5px; }
.lede-wide { max-width: none; }

/* ---- Payments report: action row under the filters ---- */
.filter-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: .5px solid var(--line); }
.fa-left, .fa-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fa-right { margin-left: auto; }
.btn-toggle-on { background: var(--brand-soft); color: var(--brand); border-color: #c9dcff; font-weight: 500; }
.btn-toggle-on:hover { background: #dce8ff; text-decoration: none; }

/* ---- Payments report: 6 cards in 3 columns + notes ---- */
.stat-row-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .stat-row-3 { grid-template-columns: repeat(2, 1fr); } }
.pay-notes { display: flex; flex-direction: column; gap: 4px; margin: -6px 2px 14px; font-size: 12px; color: var(--muted); }
.pay-warn { color: var(--warn); }
.stat-row-5 { grid-template-columns: repeat(5, 1fr); margin-bottom: 6px; }
.stat-row-5 .stat-n { font-size: 20px; }
@media (max-width: 1100px) { .stat-row-5 .stat-n { font-size: 17px; } }
@media (max-width: 860px) { .stat-row-5 { grid-template-columns: repeat(2, 1fr); } }
.stat-foot { font-size: 11.5px; color: var(--muted-2); margin: 0 2px 14px; }
.sub-note { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---- Kanban projects: hours ---- */
.hrs-cell { min-width: 150px; }
.hrs { display: block; font-variant-numeric: tabular-nums; }
.hbar { display: block; height: 5px; background: var(--soft); border: .5px solid var(--line); border-radius: 999px; overflow: hidden; margin: 5px 0 2px; max-width: 160px; }
.hbar i { display: block; height: 100%; background: var(--brand); }
.hbar.warn i { background: #d89b00; }
.hbar.over i { background: var(--err); width: 100% !important; }
.stat-of { font-size: 13px; font-weight: 500; color: var(--muted); }

/* ==========================================================================
   CLIENT PORTAL - MOBILE BASELINE (app.ascentcts.com, <= 860px)
   Scoped to body.portal so Ops / Management are unaffected.

   App shell  : .m-appbar (logo + account menu) on top, .m-tabbar at the bottom.
   Card roles : give any portal table class "mcard" and tag its cells:
     .m-title   primary line (top-left)            .m-aside   key figure / status (top-right)
     .m-meta    secondary lines (left, muted)      .m-aside2  second right-hand item (row 2)
     .m-full    full-width block (bars, logins)    .m-hide    hidden on mobile
     .m-label   prefix the cell with its data-label ("Ref 123")
     .m-link    on the row's main link - makes the whole card tappable
   .mcard-flat  rows as a divided list inside an existing card (no card-in-card).
   Rules: tap targets >= 44px, form controls 16px (prevents iOS zoom), money
   right-aligned with tabular figures, same tokens/colours as desktop.
   ========================================================================== */
.m-appbar, .m-tabbar { display: none; }

@media (max-width: 860px) {
  /* ---- shell ---- */
  body.portal .mobilebar, body.portal .sidebar, body.portal .nav-scrim { display: none !important; }
  body.portal { background: var(--bg); }
  body.portal .wrap { padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); }

  body.portal .m-appbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 40; height: 54px;
    padding: 0 12px 0 16px; padding-top: env(safe-area-inset-top);
    background: rgba(255,255,255,.92); -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: .5px solid var(--line);
  }
  body.portal .m-brand img { height: 26px; width: auto; display: block; }

  /* account menu (details/summary - works without JS) */
  body.portal .m-acct { position: relative; }
  body.portal .m-acct summary { list-style: none; cursor: pointer; padding: 5px; border-radius: 999px; }
  body.portal .m-acct summary::-webkit-details-marker { display: none; }
  body.portal .m-avatar {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 600; letter-spacing: .02em;
  }
  body.portal .m-acct[open] .m-avatar { background: var(--brand); color: #fff; }
  body.portal .m-acct-sheet {
    position: absolute; right: 0; top: calc(100% + 6px); width: min(290px, calc(100vw - 24px));
    background: var(--surface); border: .5px solid var(--line-2); border-radius: 14px;
    box-shadow: 0 12px 32px rgba(17,24,39,.14); padding: 14px 6px 6px;
  }
  body.portal .m-acct-co { font-weight: 600; color: var(--head); padding: 0 12px; font-size: 14px; }
  body.portal .m-acct-mail { color: var(--muted); font-size: 12.5px; padding: 2px 12px 12px; overflow-wrap: anywhere; border-bottom: .5px solid var(--line); }
  body.portal .m-acct-out { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; margin-top: 4px; border-radius: 10px; color: var(--err); font-size: 14px; }
  body.portal .m-acct-out svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }
  body.portal .m-acct-out:active { background: var(--err-bg); }

  /* bottom tab bar */
  body.portal .m-tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.95); -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
    border-top: .5px solid var(--line);
  }
  body.portal .m-tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 50px; border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 500;
    -webkit-tap-highlight-color: transparent;
  }
  body.portal .m-tabbar a:hover { text-decoration: none; }
  body.portal .m-tabbar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }
  body.portal .m-tabbar a.on { color: var(--brand); }
  body.portal .m-tabbar a.on svg { stroke-width: 2; }
  body.portal .m-tabbar a:active { background: var(--soft); }

  /* ---- page head: large title ---- */
  body.portal .page-head { margin-bottom: 14px; gap: 6px; }
  body.portal .page-head h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.01em; }
  body.portal .page-head .lede { font-size: 13.5px; line-height: 1.45; }
  body.portal .kb-back { margin-bottom: 8px; }
  body.portal .kb-back a { display: inline-flex; align-items: center; min-height: 36px; font-size: 14px; color: var(--brand); }

  /* ---- filters + summary ---- */
  body.portal .inv-bar { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 14px; }
  body.portal .filter-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  body.portal .filter-form .fl { width: auto; min-width: 0; }
  body.portal .filter-form > .fl:only-of-type { grid-column: 1 / -1; }
  /* search sits beside the select; its placeholder says the same as its label */
  body.portal .fl-search > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  body.portal .fl-search { align-self: end; }
  body.portal .fl > span { font-size: 11.5px; }
  body.portal .fl select, body.portal .fl input { height: 44px; font-size: 16px; border-radius: 10px; }
  body.portal .fl-clear { grid-column: 1 / -1; justify-self: end; height: 32px; border: 0; background: none; color: var(--brand); padding: 0 2px; font-size: 13.5px; }
  body.portal .inv-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  body.portal .inv-stats .stat { min-width: 0; padding: 12px 14px; border-radius: 12px; }
  body.portal .inv-stats .stat-n { font-size: 19px; }
  body.portal .stat-caption { margin: 2px 2px 8px; }
  body.portal .stat-foot { margin: 6px 2px 0; }

  /* ---- lists: rows become cards ---- */
  body.portal .table-card { background: none; border: 0; border-radius: 0; overflow: visible; }
  body.portal .table-card .empty { background: var(--surface); border: .5px solid var(--line); border-radius: 14px; }
  body.portal table.mcard, body.portal table.mcard tbody { display: block; }
  body.portal table.mcard thead { display: none; }
  body.portal table.mcard tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-flow: row dense;
    column-gap: 12px; row-gap: 4px; position: relative;
    background: var(--surface); border: .5px solid var(--line); border-radius: 14px;
    padding: 14px 16px; margin: 0 0 10px;
  }
  body.portal table.mcard tr:hover { background: var(--surface); }
  body.portal table.mcard tr:has(.m-link):active { background: var(--soft); }
  body.portal table.mcard td {
    display: block; padding: 0; border: 0 !important; min-width: 0; font-size: 13.5px;
  }
  body.portal table.mcard td::before { content: none; display: none; }
  body.portal table.mcard .m-title  { grid-column: 1; grid-row: 1; }
  body.portal table.mcard .m-title .name, body.portal table.mcard .m-title > a { font-size: 15px; font-weight: 600; color: var(--head); display: block; }
  body.portal table.mcard .m-title .sku, body.portal table.mcard .m-title .sub-date { display: block; font-size: 12.5px; margin-top: 2px; }
  body.portal table.mcard .m-aside  { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
  body.portal table.mcard .m-aside2 { grid-column: 2; grid-row: 2; text-align: right; align-self: start; }
  body.portal table.mcard .m-meta   { grid-column: 1; font-size: 13px; color: var(--muted); }
  body.portal table.mcard .m-meta .sku { display: inline !important; margin-left: 4px; }
  body.portal table.mcard .m-label::before { content: attr(data-label) " "; display: inline; color: var(--muted-2); font-size: 12.5px; text-transform: none; letter-spacing: 0; font-weight: 400; }
  body.portal table.mcard .m-full   { grid-column: 1 / -1; margin-top: 8px; }
  body.portal table.mcard .m-hide   { display: none; }
  body.portal table.mcard .m-link::after { content: ""; position: absolute; inset: 0; border-radius: 14px; }
  body.portal table.mcard .m-link { -webkit-tap-highlight-color: transparent; }
  body.portal table.mcard .m-aside .sub-bal, body.portal table.mcard .m-aside .sub-note { font-weight: 400; }
  body.portal table.mcard .pill { font-size: 11.5px; }

  /* flat variant: divided rows inside an existing card */
  body.portal table.mcard-flat tr { border: 0; border-top: .5px solid var(--line); border-radius: 0; margin: 0; padding: 14px 16px; background: none; }
  body.portal table.mcard-flat tr:first-child { border-top: 0; }

  /* ---- Systems and Infra ---- */
  body.portal .st-card { border-radius: 14px; }
  body.portal .st-ch { padding: 14px 16px 12px; }
  body.portal .st-title { font-size: 15px; }
  body.portal .st-h { font-size: 17px; margin: 22px 2px 10px; }
  body.portal .st-login-box { align-items: flex-start !important; text-align: left !important; background: var(--soft); border-radius: 10px; padding: 10px 12px; }
  body.portal .st-pw { justify-content: flex-start !important; }
  body.portal .st-pw .btn { min-height: 34px; padding: 4px 14px; font-size: 13px; }
  body.portal .hrs-cell { min-width: 0; }
  body.portal .hbar { max-width: none; height: 6px; }

  /* ---- ticket thread ---- */
  body.portal .kb-msg { border-radius: 14px; padding: 14px; }
  body.portal .kb-meta { gap: 2px 8px; }
  body.portal .kb-date { flex-basis: 100%; margin-left: 0; font-size: 12px; }
  body.portal .kb-body { font-size: 14.5px; line-height: 1.55; }
  body.portal .kb-att { min-height: 36px; display: inline-flex; align-items: center; }
  body.portal .fine { margin-top: 14px; }

  /* ---- sign-in ---- */
  body.portal-auth .auth-wrap { margin: 0 auto; min-height: 100vh; display: flex; align-items: center; padding: 20px 16px; }
  body.portal-auth .auth-card { width: 100%; padding: 26px 20px; border-radius: 16px; }
  body.portal-auth .field input { height: 48px; font-size: 16px; border-radius: 10px; }
  body.portal-auth .btn-block { min-height: 48px; font-size: 15px; border-radius: 10px; }
  body.portal-auth .actions .btn { min-height: 40px; }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  body.portal table.mcard tr:has(.m-link) { transition: background .12s ease; }
}
