/* Connetix app — minimal design system (customer portal + admin) */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --subtle: #f4f4f5;
  --ink: #0a0a0a;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --line: #e9e9ec;
  --line-2: #d9d9de;
  --blue: #1a6fb5;
  --blue-ink: #155a93;
  --blue-soft: #edf4fb;
  --ok: #16794a; --ok-soft: #e9f6ef;
  --warn: #9a5b05; --warn-soft: #fdf3e2;
  --bad: #b42318; --bad-soft: #fdecea;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(10, 10, 10, 0.04), 0 1px 1px rgba(10, 10, 10, 0.02);
  --shadow-lg: 0 24px 60px -20px rgba(10, 10, 10, 0.28);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 400 14.5px/1.55 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; letter-spacing: -0.005em; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; }
h1 { font-size: 26px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
code { font: 500 0.88em var(--mono); background: var(--subtle); padding: 1px 6px; border-radius: 6px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; font: 500 13.5px var(--font); color: #fff; background: var(--ink); border: 1px solid var(--ink); border-radius: var(--radius-sm); cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: transform 140ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, opacity 150ms ease; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn--full { width: 100%; height: 40px; }
.btn--danger { background: var(--surface); color: var(--bad); border-color: #f1c7c2; }
.btn--blue { background: var(--blue); border-color: var(--blue); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: #27272a; border-color: #27272a; }
  .btn--blue:hover { background: var(--blue-ink); border-color: var(--blue-ink); }
  .btn--ghost:hover { background: var(--subtle); border-color: var(--line-2); color: var(--ink); }
  .btn--danger:hover { background: var(--bad-soft); border-color: #f1c7c2; color: var(--bad); }
}
.linkbtn { text-align: left; background: none; border: 0; padding: 0; font: 500 13.5px var(--font); color: var(--blue); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Forms */
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .opt { font-weight: 400; color: var(--muted); font-size: 12px; }
input, select, textarea { font: 400 14px var(--font); color: var(--ink); padding: 8px 11px; min-height: 38px; width: 100%; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); transition: border-color 150ms ease, box-shadow 150ms ease; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26, 111, 181, 0.14); }
input:disabled, select:disabled { background: var(--subtle); color: var(--muted); }
input[type="checkbox"] { width: 16px; min-height: 16px; height: 16px; accent-color: var(--blue); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--ink-2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 14px; }
.msg { font-size: 13px; padding: 9px 12px; border-radius: var(--radius-sm); }
.msg--err { color: var(--bad); background: var(--bad-soft); }
.msg--ok { color: var(--ok); background: var(--ok-soft); }
.msg--info { color: var(--blue-ink); background: var(--blue-soft); }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth__side { background: var(--ink); color: #a1a1aa; padding: 44px; display: flex; flex-direction: column; justify-content: space-between; }
.auth__side h2 { color: #fff; font-size: clamp(26px, 3vw, 36px); font-weight: 600; max-width: 12em; letter-spacing: -0.03em; }
.auth__side ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.auth__side li { padding-left: 26px; position: relative; color: #d4d4d8; }
.auth__side li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 10px; height: 5px; border-left: 1.5px solid #7cb6ea; border-bottom: 1.5px solid #7cb6ea; transform: rotate(-45deg); }
.auth__side small { color: #71717a; }
.auth__side a { color: #a5cdf2; }
.auth__side small a { color: #a1a1aa; }
.auth__logo { background: #fff; border-radius: 10px; padding: 8px 12px; display: inline-block; }
.auth__logo img { height: 30px; width: auto; }
.auth__main { display: grid; place-items: center; padding: 48px 24px; }
.auth__box { width: 100%; max-width: 380px; display: grid; gap: 20px; }
.auth__box h1 { font-size: 24px; }
.tabs { display: inline-flex; padding: 3px; background: var(--subtle); border-radius: 10px; gap: 2px; justify-self: start; }
.tabs button { background: none; border: 0; padding: 6px 12px; font: 500 13px var(--font); color: var(--muted); cursor: pointer; border-radius: 8px; transition: background-color 150ms ease, color 150ms ease; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* App shell */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--bg); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side__logo img { height: 28px; width: auto; margin: 4px 8px; }
.side nav { display: grid; gap: 1px; }
.side nav button { display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: 0; border-radius: 8px; padding: 7px 10px; font: 500 13.5px var(--font); color: var(--ink-2); cursor: pointer; transition: background-color 120ms ease, color 120ms ease; }
.side nav button svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.side nav button[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.side nav button[aria-current="page"] svg { color: var(--blue); }
@media (hover: hover) { .side nav button:not([aria-current="page"]):hover { background: var(--subtle); } }
.side__label { font: 500 11px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 10px 4px; }
.side__count { margin-left: auto; font: 500 11px var(--mono); background: var(--blue); color: #fff; border-radius: 99px; padding: 0 6px; line-height: 18px; min-width: 18px; text-align: center; }
.side__foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 10px 0; font-size: 13px; display: grid; gap: 3px; }
.side__foot b { font-weight: 600; overflow-wrap: anywhere; }
.side__foot span { color: var(--muted); overflow-wrap: anywhere; font-size: 12.5px; }
.side__foot .linkbtn, .side__foot a { justify-self: start; margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }
.main { padding: 32px 40px 72px; min-width: 0; max-width: 1240px; }
.head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head p { color: var(--muted); margin-top: 4px; }
.mobilebar { display: none; }

/* Cards & stats */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat small { display: block; color: var(--muted); font-size: 12.5px; }
.stat b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.cols { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; align-items: start; }

.planbox { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; }
.planbox h2 { font-size: 22px; letter-spacing: -0.03em; }
.planbox p { color: var(--ink-2); margin-top: 4px; }
.meter { height: 6px; background: var(--subtle); border-radius: 99px; overflow: hidden; margin-top: 16px; }
.meter i { display: block; height: 100%; background: var(--blue); border-radius: 99px; transition: width 600ms var(--ease-out); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font: 500 11.5px var(--font); text-transform: capitalize; padding: 2px 8px; border-radius: 99px; background: var(--subtle); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.badge--active, .badge--live, .badge--answered, .badge--acknowledged, .badge--sent, .badge--received, .badge--paid, .badge--won { background: var(--ok-soft); color: var(--ok); }
.badge--pending, .badge--requested, .badge--open, .badge--mapping, .badge--testing, .badge--new, .badge--contacted { background: var(--warn-soft); color: var(--warn); }
.badge--expired, .badge--canceled, .badge--error, .badge--paused, .badge--urgent, .badge--suspended, .badge--lost { background: var(--bad-soft); color: var(--bad); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font: 500 12px var(--font); color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color 120ms ease; }
@media (hover: hover) { .tbl tbody tr:hover { background: #fcfcfd; } }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .acts { text-align: right; white-space: nowrap; }
.tbl .acts .btn + .btn { margin-left: 6px; }
.scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.empty { padding: 32px 8px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty b { display: block; color: var(--ink); font-weight: 600; font-size: 14.5px; margin-bottom: 4px; }

/* Plans */
.buyplans { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.buyplan { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 6px; background: var(--surface); }
.buyplan b { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; }
.buyplan ul { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; display: grid; gap: 3px; }
.seg { display: inline-flex; padding: 3px; background: var(--subtle); border-radius: 10px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; width: 1px; min-height: 0; }
.seg span { display: block; padding: 6px 12px; border-radius: 8px; font-weight: 500; font-size: 13px; color: var(--muted); transition: background-color 150ms ease, color 150ms ease; }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--blue); }

/* Checkout */
.buyplan { cursor: pointer; position: relative; transition: border-color 150ms ease, box-shadow 150ms ease; }
.buyplan input { position: absolute; opacity: 0; pointer-events: none; width: 1px; min-height: 0; }
.buyplan:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.buyplan:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.buyplan .radio { position: absolute; top: 18px; right: 18px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); }
.buyplan:has(input:checked) .radio { border: 5px solid var(--ink); }
.co-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); margin-top: 6px; flex-wrap: wrap; }
.co-row small { display: block; color: var(--muted); font-size: 12.5px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
.stepper button { width: 36px; height: 36px; background: none; border: 0; font-size: 16px; cursor: pointer; color: var(--ink); border-radius: var(--radius-sm); }
.stepper button:hover { background: var(--subtle); }
.stepper output { min-width: 30px; text-align: center; font: 500 14px var(--mono); }
.co-sum { display: grid; gap: 8px; padding: 14px 0 0; font-size: 14px; }
.co-sum div { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); }
.co-sum .total { color: var(--ink); font-weight: 600; font-size: 16px; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 2px; }
.co-sum small { color: var(--muted); font-size: 12.5px; }
.checkout { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 32px; }
.co-order { padding-right: 32px; border-right: 1px solid var(--line); }
.co-trust { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
.co-trust li { padding-left: 22px; position: relative; }
.co-trust li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 9px; height: 5px; border-left: 1.5px solid var(--ok); border-bottom: 1.5px solid var(--ok); transform: rotate(-45deg); }
.co-form { display: grid; gap: 14px; align-content: start; }
.pay-el { min-height: 160px; }
.co-test { font-size: 12.5px; color: var(--warn); background: var(--warn-soft); padding: 8px 10px; border-radius: var(--radius-sm); }
.co-done { text-align: center; padding: 28px 12px; display: grid; gap: 10px; justify-items: center; }
.co-done p { color: var(--ink-2); max-width: 30em; }
.co-check { width: 52px; height: 52px; border-radius: 50%; background: var(--ok-soft); position: relative; }
.co-check::after { content: ""; position: absolute; left: 18px; top: 16px; width: 16px; height: 9px; border-left: 2.5px solid var(--ok); border-bottom: 2.5px solid var(--ok); transform: rotate(-45deg); }
@media (max-width: 860px) { .checkout { grid-template-columns: 1fr; } .co-order { padding-right: 0; border-right: 0; padding-bottom: 20px; border-bottom: 1px solid var(--line); } }

/* Upgrade timing */
.co-when { margin-top: 14px; display: grid; gap: 8px; }
.when { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; transition: border-color 150ms ease; }
.when:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.when input { width: 16px; min-height: 16px; height: 16px; margin-top: 2px; accent-color: var(--ink); }
.when b { font-weight: 500; display: block; }
.when small { color: var(--muted); font-size: 12.5px; }
.seg input:disabled + span { opacity: .5; cursor: not-allowed; }

/* Partner usage */
.usage { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.usage b { font-weight: 600; }
.usage small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 8px; }

/* Checklist */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 4px; border-radius: 8px; }
.checklist .tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); flex: none; margin-top: 1px; position: relative; }
.checklist .done .tick { background: var(--ok); border-color: var(--ok); }
.checklist .done .tick::after { content: ""; position: absolute; left: 6px; top: 4px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checklist .done .txt { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.checklist small { display: block; color: var(--muted); font-size: 12.5px; }

/* Attention list */
.alist { display: grid; gap: 2px; }
.aitem { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px; cursor: pointer; transition: background-color 120ms ease; border: 0; background: none; text-align: left; font: inherit; color: inherit; width: 100%; }
@media (hover: hover) { .aitem:hover { background: var(--subtle); } }
.aitem i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--warn); }
.aitem i.high { background: var(--bad); }
.aitem b { font-weight: 500; display: block; }
.aitem small { color: var(--muted); font-size: 12px; }
.aitem span:last-child { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Files */
.files { display: grid; gap: 6px; }
.file { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; }
.file svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.file a { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file small { color: var(--muted); margin-left: auto; white-space: nowrap; }
.drop { display: block; border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 16px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease; }
.drop.is-over, .drop:hover { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-ink); }
.drop input { display: none; }

/* Detail rows & timeline */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; gap: 14px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.timeline li { padding-left: 24px; position: relative; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--blue); }
.timeline small { display: block; color: var(--muted); font-size: 12px; }
.thread { display: grid; gap: 10px; margin-top: 10px; }
.bubble { padding: 10px 12px; border-radius: 12px; background: var(--subtle); white-space: pre-wrap; font-size: 13.5px; max-width: 92%; }
.bubble--admin { background: var(--blue-soft); justify-self: end; }
.bubble small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 3px; white-space: normal; }

/* Dialog */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); color: var(--ink); background: var(--surface); }
dialog.wide { width: min(880px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 10, 10, 0.32); backdrop-filter: blur(2px); }
dialog[open] { animation: pop 180ms var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: scale(0.97) translateY(4px); } }
.dlg { padding: 22px; display: grid; gap: 16px; }
.dlg__head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.dlg__head h2 { font-size: 17px; }
.dlg__x { background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.dlg__x:hover { background: var(--subtle); }
.dlg__foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.tabsbar { display: flex; gap: 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabsbar button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 10px; margin-bottom: -1px; font: 500 13px var(--font); color: var(--muted); cursor: pointer; }
.tabsbar button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; z-index: 100; box-shadow: var(--shadow-lg); transition: opacity 200ms ease, transform 200ms var(--ease-out); max-width: calc(100vw - 32px); }
.toast[data-hide] { opacity: 0; transform: translate(-50%, 8px); pointer-events: none; }
.loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); font-size: 13.5px; }
.spin { width: 20px; height: 20px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin 650ms linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius); background: var(--bad-soft); color: var(--bad); font-size: 13.5px; margin-bottom: 14px; }
.banner .btn { margin-left: auto; }

@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; }
  .auth__side { padding: 24px; }
  .auth__side ul, .auth__side small, .auth__side h2 { display: none; }
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform 220ms var(--ease-out); box-shadow: var(--shadow-lg); background: var(--surface); }
  .side.is-open { transform: none; }
  .mobilebar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: rgba(250, 250, 250, 0.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .mobilebar img { height: 26px; width: auto; }
  .main { padding: 22px 16px 56px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .grid2, .buyplans { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .tbl--stack thead { display: none; }
  .tbl--stack tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .tbl--stack td { display: block; border: 0; padding: 3px 0; }
  .tbl--stack .acts, .tbl--stack .num { text-align: left; }
  h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .side, dialog[open], .toast, .meter i { transition: none; animation: none; }
  .btn:active { transform: none; }
}

/* ---------- Plans & billing: current plan + options ---------- */
.plan-now { margin-bottom: 14px; }
.plan-now__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.plan-now__badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.plan-now h2 { font-size: 26px; letter-spacing: -0.035em; }
.plan-now__top p { color: var(--ink-2); margin-top: 4px; }
.plan-now__days { text-align: right; }
.plan-now__days b { display: block; font-size: 34px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.plan-now__days small { color: var(--muted); font-size: 12.5px; }
.plan-now__days.is-warn b { color: var(--warn); }
.plan-now__dates { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.plan-now__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-top: 18px; }
.plan-now__grid > div { background: var(--surface); padding: 14px 16px; min-width: 0; }
.plan-now__grid small { display: block; color: var(--muted); font-size: 12px; }
.plan-now__grid b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.plan-now__grid b span { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.plan-now__grid > div > span { font-size: 12.5px; color: var(--muted); }
.plan-now--pending { border-color: #f3dcb4; }

.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.pl-opt { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: border-color 160ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .pl-opt:hover { border-color: var(--line-2); } }
.pl-opt h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin-top: 12px; }
.pl-opt p { color: var(--ink-2); font-size: 13px; margin-top: 4px; flex: 1; }
.pl-opt__foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.pl-opt__foot b { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pl-opt__ico { width: 32px; height: 32px; border-radius: 9px; background: var(--blue-soft); display: grid; place-items: center; position: relative; }
.pl-opt__ico::before { content: ""; width: 16px; height: 16px; background: var(--blue); -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.pl-opt__ico--refresh { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-3-6.7L21 8'/%3E%3Cpath d='M21 3v5h-5'/%3E%3C/svg%3E"); }
.pl-opt__ico--up { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5'/%3E%3Cpath d='m5 12 7-7 7 7'/%3E%3C/svg%3E"); }
.pl-opt__ico--plus { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }

/* Overview: partner list + locked setup steps */
.plist { list-style: none; margin: 0; padding: 0; }
.plist li + li { border-top: 1px solid var(--line); }
.plist button { all: unset; box-sizing: border-box; display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 4px; cursor: pointer; border-radius: 8px; }
.plist button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .plist button:hover { background: var(--subtle); } }
.plist b { font-weight: 500; display: block; }
.plist small { color: var(--muted); font-size: 12.5px; }
.checklist .locked { opacity: 0.55; }
.checklist .locked .tick { border-style: dashed; }

@media (max-width: 900px) {
  .opts { grid-template-columns: 1fr; }
  .plan-now__grid { grid-template-columns: 1fr 1fr; }
}

/* Auto-renew */
.ar-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--subtle); }
.ar-row__txt b { font-weight: 600; font-size: 14px; }
.ar-row__txt small { display: block; color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
.ar-row__acts { display: flex; align-items: center; gap: 14px; }
.switch { all: unset; box-sizing: border-box; width: 40px; height: 24px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; flex: none; transition: background-color 180ms var(--ease-out); }
.switch span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform 180ms var(--ease-out); }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"] span { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch:disabled { opacity: .5; cursor: progress; }
.ar-opt { margin-top: 14px; }
.ar-opt input { accent-color: var(--ok); }

/* Navigation polish */
[data-panel]:not([hidden]) { animation: panelIn 260ms var(--ease-out); }
@keyframes panelIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.head h1:focus { outline: none; }
.head h1:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 4px; }
.side nav button:focus-visible, .linkbtn:focus-visible, .btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (max-width: 980px) {
  body.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(10,10,10,.28); z-index: 35; animation: panelIn 200ms var(--ease-out); }
  body.menu-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  [data-panel]:not([hidden]), body.menu-open::after { animation: none; }
  .switch, .switch span { transition: none; }
}

/* Documents by trading partner */
.docsum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.docgroups { display: grid; gap: 14px; }
.docgroup { transition: border-color 150ms ease, background-color 150ms ease, box-shadow 200ms ease; }
.docgroup.is-over { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 3px rgba(26,111,181,.12); }
.docgroup__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.docgroup__head > div { flex: 1; min-width: 0; }
.docgroup__head h2 { font-size: 16px; }
.docgroup__head small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.file__main { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.file__note { flex-basis: 100%; color: var(--muted); font-size: 12.5px; margin: 0; }
.tag { display: inline-flex; align-items: center; font: 500 11px var(--font); padding: 2px 8px; border-radius: 99px; background: var(--subtle); color: var(--ink-2); white-space: nowrap; }
.tag--guide { background: var(--blue-soft); color: var(--blue-ink); }
.tag--mapping, .tag--test { background: #f1edfd; color: #5b3fc4; }
.tag--agreement { background: var(--ok-soft); color: var(--ok); }
.tag--cx { background: #0a0a0a; color: #fff; }
.tag--need { background: var(--warn-soft); color: var(--warn); }
.drop--sm { padding: 12px; margin-top: 6px; }
@media (max-width: 600px) { .docsum { grid-template-columns: 1fr; } .file { flex-wrap: wrap; } .file small { margin-left: 0; } }

/* ===== Depth (3D) for the portal ===== */
.main { perspective: 1600px; }
.card, .stat, .pl-opt { box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 1px 2px rgba(10,10,10,.04), 0 14px 30px -26px rgba(10,30,60,.35); }
[data-depth] { --tx: 0deg; --ty: 0deg; --gx: 50%; --gy: 0%; position: relative; transform: rotateX(var(--tx)) rotateY(var(--ty)); transition: transform 500ms var(--ease-out), box-shadow 300ms ease; }
[data-depth]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 300ms ease; background: radial-gradient(360px circle at var(--gx) var(--gy), rgba(26,111,181,.09), transparent 45%); }
[data-depth].is-hover { transition: transform 120ms linear, box-shadow 300ms ease; box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 28px 50px -30px rgba(10,30,60,.4); }
[data-depth].is-hover::after { opacity: 1; }
/* The current plan card floats slightly, with a soft glow behind it */
.plan-now { position: relative; overflow: hidden; }
.plan-now::before { content: ""; position: absolute; width: 380px; height: 380px; right: -120px; top: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(26,111,181,.16), transparent 65%); pointer-events: none; }
.planbox, #planCard { position: relative; }
#planCard { overflow: hidden; }
#planCard::before { content: ""; position: absolute; width: 320px; height: 320px; right: -100px; top: -150px; border-radius: 50%; background: radial-gradient(circle, rgba(26,111,181,.14), transparent 65%); pointer-events: none; }
.pl-opt__ico { box-shadow: 0 6px 14px -8px rgba(26,111,181,.6); transform: translateZ(0); }
@media (prefers-reduced-motion: reduce) { [data-depth] { transition: none; transform: none; } }
.upctl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; align-items: end; }
.upctl .field:nth-last-child(2) { grid-column: 1 / -1; }
.upctl__chk { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); grid-column: 1 / -1; }
.upctl__chk input { width: auto; min-height: 0; }

/* ===== Login: 3D scene + raised card ===== */
.auth__side { position: relative; overflow: hidden; isolation: isolate; background: radial-gradient(120% 80% at 0% 0%, #12233a 0%, #0a0a0a 55%); }
.auth__side > * { position: relative; }
.auth__fx { position: absolute !important; inset: 0; z-index: -1; pointer-events: none; }
.auth__floor { position: absolute; left: -50%; right: -50%; bottom: -35%; height: 85%; transform: perspective(700px) rotateX(70deg); transform-origin: 50% 100%;
  background-image: linear-gradient(rgba(124,182,234,.22) 1px, transparent 1px), linear-gradient(90deg, rgba(124,182,234,.22) 1px, transparent 1px); background-size: 54px 54px;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 100%, #000 25%, transparent 75%); mask-image: radial-gradient(ellipse 60% 70% at 50% 100%, #000 25%, transparent 75%); animation: authFloor 18s linear infinite; }
@keyframes authFloor { to { background-position: 0 54px, 0 0; } }
.auth__orb { position: absolute; width: 460px; height: 460px; right: -140px; top: 18%; border-radius: 50%; background: radial-gradient(circle, rgba(26,111,181,.45), transparent 65%); filter: blur(30px); }

.auth__scene { --rx: 10deg; --ry: -18deg; position: relative; height: 290px; margin: 8px 0 28px 40px; perspective: 1100px; transform-style: preserve-3d; }
.auth__scene > * { position: absolute; transform-style: preserve-3d; }
.auth__scene .as-card, .auth__scene .as-chip { transition: transform 700ms var(--ease-out); }
.auth__scene.is-live .as-card, .auth__scene.is-live .as-chip { transition: transform 120ms linear; }
.as-card { background: rgba(255,255,255,.96); color: var(--ink); border-radius: 14px; padding: 16px 18px; box-shadow: 0 40px 60px -30px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.08); }
.as-card b { display: block; font-size: 18px; letter-spacing: -.02em; margin-top: 8px; }
.as-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.as-badge { font: 500 11px var(--font); color: var(--ok); background: var(--ok-soft); padding: 2px 8px; border-radius: 99px; }
.as-meter { display: block; height: 5px; border-radius: 99px; background: var(--subtle); margin-top: 12px; overflow: hidden; }
.as-meter i { display: block; width: 62%; height: 100%; background: var(--blue); border-radius: 99px; }
.as-card--plan { width: 270px; left: 0; top: 10px; transform: rotateX(var(--rx)) rotateY(var(--ry)) translateZ(40px); }
.as-card--list { width: 230px; left: 210px; top: 140px; padding: 10px 14px; transform: rotateX(var(--rx)) rotateY(var(--ry)) translateZ(90px); }
.as-card--list div { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 7px 0; }
.as-card--list div + div { border-top: 1px solid var(--line); }
.as-card--list em { font: normal 500 11px var(--font); padding: 2px 8px; border-radius: 99px; background: var(--subtle); color: var(--ink-2); }
.as-card--list em.ok { background: var(--ok-soft); color: var(--ok); }
.as-card--list em.warn { background: var(--warn-soft); color: var(--warn); }
.as-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 99px; font: 500 12.5px var(--font); color: var(--ink); background: rgba(255,255,255,.92); box-shadow: 0 18px 30px -16px rgba(0,0,0,.7); white-space: nowrap; }
.as-chip span { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--ok); }
.as-chip--b span { background: var(--blue); }
.as-chip--a { left: 250px; top: 0; transform: rotateX(var(--rx)) rotateY(var(--ry)) translateZ(140px); animation: asFloat 6s ease-in-out infinite; }
.as-chip--b { left: 20px; top: 210px; transform: rotateX(var(--rx)) rotateY(var(--ry)) translateZ(120px); animation: asFloat 7s ease-in-out -2s infinite; }
@keyframes asFloat { 50% { margin-top: -8px; } }

.auth__main { position: relative; background: radial-gradient(60% 50% at 70% 20%, rgba(26,111,181,.08), transparent 70%), var(--bg); }
.auth__box { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; max-width: 420px;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 40px 80px -50px rgba(10,30,60,.45), 0 12px 24px -20px rgba(10,30,60,.2); }
.auth__box .tabs { background: var(--subtle); border-radius: 10px; padding: 3px; }
.pw { position: relative; display: block; }
.pw input { padding-right: 64px; width: 100%; }
.pw__toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; font: 500 12.5px var(--font); color: var(--blue); padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.pw__toggle:focus-visible { outline: 2px solid var(--blue); }
.auth__trust { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 12px; color: var(--muted); margin: 4px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.auth__trust span::before { content: "✓ "; color: var(--ok); }
@media (max-width: 1180px) { .auth__scene { display: none; } }
@media (max-width: 980px) { .auth { grid-template-rows: auto 1fr; } .auth__main { place-items: start center; padding-top: 28px; } .auth__box { box-shadow: none; border: 0; padding: 8px 0; background: transparent; } .auth__main { background: var(--bg); } }
@media (prefers-reduced-motion: reduce) { .auth__floor, .as-chip { animation: none; } }

/* Login preview cards: flat (no 3D tilt) */
.auth__scene { perspective: none; transform-style: flat; }
.auth__scene > * { transform-style: flat; }
.as-card--plan, .as-card--list, .as-chip--a, .as-chip--b { transform: none; }
.auth__scene .as-card, .auth__scene .as-chip { transition: none; }

/* Trading partners: plan slots */
.head__acts { display: flex; gap: 8px; flex-wrap: wrap; }
.pusage { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.pusage__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pusage__top b { font-weight: 600; }
.pusage small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 10px; }
.pslots { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 6px; margin-top: 12px; max-width: 520px; }
.pslots i { height: 10px; border-radius: 99px; background: var(--subtle); box-shadow: inset 0 0 0 1px var(--line); }
.pslots i.is-used { background: var(--blue); box-shadow: 0 4px 10px -6px rgba(26,111,181,.8); }
.pusage__side { display: flex; gap: 22px; align-items: center; padding-left: 24px; border-left: 1px solid var(--line); }
.pusage__side small { margin-top: 0; }
.pusage__side b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
@media (max-width: 760px) { .pusage { grid-template-columns: 1fr; } .pusage__side { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 14px; } }

/* Locked portal (no paid plan yet) */
body.is-locked .side nav button:not([data-view="plans"]):not([data-view="account"]) { opacity: .4; pointer-events: none; }
body.is-locked .side nav button:not([data-view="plans"]):not([data-view="account"])::after { content: ""; margin-left: auto; width: 12px; height: 12px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat; }
.lockcard { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; border-color: #cfe0f1; background: linear-gradient(180deg, #f5f9fd, var(--surface)); }
.lockcard h2 { font-size: 18px; }
.lockcard p { color: var(--ink-2); margin-top: 4px; max-width: 60ch; }
.lockcard__ico { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--blue); box-shadow: 0 10px 20px -10px rgba(26,111,181,.8); position: relative; }
.lockcard__ico::after { content: ""; position: absolute; inset: 10px; background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat; }

/* Admin multi-select */
.tbl .selc, .tbl th:first-child:has(input[data-selall]) { width: 34px; }
.tbl input[data-sel], .tbl input[data-selall] { width: 16px; height: 16px; margin: 0; cursor: pointer; }
.tbl tr.is-sel td { background: rgba(0, 0, 0, .035); }
.bulkbar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg, #fafafa); position: sticky; top: 0; z-index: 2; }
.bulkbar[hidden] { display: none; }
.bulkbar b { margin-right: auto; font-weight: 500; }

/* PayPal checkout */
.ar-row[hidden] { display: none; }
#ppButtons { min-height: 150px; }
.pay-el.is-busy { opacity: .5; pointer-events: none; }
#pStateSel[hidden], .field input[hidden] { display: none; }
