/* Pocip owner panel — plain CSS (no build step on shared hosting).
   Visual language: the "maydin.co workspace" design system (dark charcoal surfaces, pastel blue/lilac
   accents, light-weight numbers, pill controls, 16px cards), with a calmer type scale for a work tool
   that is used a lot on phones. Light theme keeps the same structure. */
:root, [data-theme=dark] {
  color-scheme: dark;
  /* surfaces */
  --canvas: #111114; --sidebar: #17191b; --card: #1c1f20; --control: #1c1e20; --control-alt: #1e2022;
  --raised: #292b2f; --row-hover: #232529; --tab-active: #343638; --hover: #202325;
  /* borders */
  --border-sidebar: #27292b; --border: #2a2d2f; --border-subtle: #202325; --border-control: #2c2e30;
  --border-interactive: #34373b; --border-strong: #41474e; --checkbox: #3c4144;
  /* text */
  --text: #f4f4f5; --name: #e4e6e8; --secondary: #c3c7ca; --data: #bcc0c3; --muted: #92989d;
  --nav: #96999b; --label: #737779; --summary: #929397; --faint: #6d7176; --crumb-parent: #797d81; --crumb-sep: #515558;
  --stat-label: #8c9093; --stat-sub: #777d80; --th: #777c80; --crumb-current: #d3d5d7; --tab-active-text: #f0f0f1;
  /* accent */
  --accent: #c0d0e7; --accent-hover: #d2def0; --accent-ink: #111b23; --accent-text: #c0d0e7; --focus: #c0d0e7;
  --hero-border: #c7d5e9; --hero-label: #5a6e7f; --hero-sub: #576d82;
  --light-btn: #f5f5f7; --light-btn-ink: #202124; --logo-bg: #f3f6f7; --logo-ink: #17191b;
  /* status */
  --ok: #c9d2e1; --warn: #d7b8d6; --bad: #f18e9a; --idle: #72777c;
  --badge: #2a2d30; --badge-text: #b9bdc0;
  --badge-ok: #c4d0e2; --badge-ok-text: #273342;
  --badge-warn: #3b2d3c; --badge-warn-text: #c5a6c2;
  --badge-bad: #3d272c; --badge-bad-text: #f18e9a;
  --alert: #3b2d3c;
  --avatar: #dfb9de; --avatar-ink: #644362;
  --bg: var(--canvas); /* inputs and inset boxes (older views use --bg) */
  --radius: 16px;
  --shadow: 0 25px 50px -12px rgb(0 0 0 / .6);
}
[data-theme=light] {
  color-scheme: light;
  --canvas: #f5f6f8; --sidebar: #ffffff; --card: #ffffff; --control: #ffffff; --control-alt: #eceef2;
  --raised: #e8ebf0; --row-hover: #f6f7f9; --tab-active: #ffffff; --hover: #f0f2f5;
  --border-sidebar: #e3e6eb; --border: #e3e6eb; --border-subtle: #e3e6eb; --border-control: #dde1e7;
  --border-interactive: #d3d8df; --border-strong: #c3cbd6; --checkbox: #b7c1cf;
  --text: #20242c; --name: #20242c; --secondary: #4b5563; --data: #4b5563; --muted: #657080;
  --nav: #5f6876; --label: #7b8493; --summary: #657080; --faint: #7b8493; --crumb-parent: #7b8493; --crumb-sep: #b7c1cf;
  --stat-label: #657080; --stat-sub: #7b8493; --th: #7b8493; --crumb-current: #20242c; --tab-active-text: #20242c;
  --accent: #c0d0e7; --accent-hover: #b3c5e0; --accent-ink: #111b23; --accent-text: #45628a; --focus: #647fa6;
  --hero-border: #b3c5e0; --hero-label: #4a5f72; --hero-sub: #4a6078;
  --light-btn: #20242c; --light-btn-ink: #ffffff; --logo-bg: #20242c; --logo-ink: #ffffff;
  --ok: #6f8fb8; --warn: #a76e9d; --bad: #c2475f; --idle: #9aa3b0;
  --badge: #eceef2; --badge-text: #4b5563;
  --badge-ok: #dbe5f3; --badge-ok-text: #273342;
  --badge-warn: #f4e8f3; --badge-warn-text: #7d4b78;
  --badge-bad: #fbe7eb; --badge-bad-text: #a8344d;
  --alert: #fbe7eb;
  --shadow: 0 25px 50px -12px rgb(15 23 42 / .25);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--text);
  font: 14px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); transition: color .2s; }
h1 { font-size: 34px; line-height: 42px; font-weight: 600; letter-spacing: -1.1px; margin: 0; }
h2 { font-size: 16px; line-height: 22px; font-weight: 500; margin: 0 0 12px; }
h3 { font-size: 15px; line-height: 22px; font-weight: 600; margin: 0; color: var(--name); }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }
.text-bad { color: var(--bad); }
.text-warn { color: var(--warn); }
.icon { flex-shrink: 0; display: block; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
.sm-only { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { *, *::backdrop { transition: none !important; } }

/* ── App shell ── */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  /* dvh = the height actually visible; plain vh on iPhone Safari runs under the browser bar and hid Akun/Keluar */
  width: 264px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  display: flex; flex-direction: column; padding: 0 16px 18px; background: var(--sidebar); border-right: 1px solid var(--border-sidebar);
  transition: width .3s ease-in-out, padding .3s ease-in-out; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
@media (min-width: 1280px) { .sidebar { width: 280px; padding: 0 20px 20px; } }
.sidebar-head { height: 72px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 4px; border-bottom: 1px solid var(--border); }
.logo { width: 40px; height: 40px; border-radius: 999px; background: var(--logo-bg); color: var(--logo-ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-text { min-width: 0; flex: 1; }
.brand-name { font-size: 17px; line-height: 23px; font-weight: 700; letter-spacing: -0.4px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; line-height: 17px; color: var(--crumb-parent); margin: 0; }
.ghost-icon { background: none; border: 0; color: var(--crumb-parent); width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background-color .2s, color .2s; }
.ghost-icon:hover { background: var(--raised); color: var(--text); }
.expand-btn { display: none; margin: 14px auto 0; }
.sidebar-nav { flex: 1; padding: 18px 0 20px; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-label { margin: 0 0 6px; padding: 0 12px; font-size: 11px; line-height: 18px; font-weight: 500; text-transform: uppercase; letter-spacing: .6px; color: var(--label); }
.nav-group nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 42px; width: 100%; padding: 0 12px; border-radius: 12px;
  color: var(--nav); text-decoration: none; font: inherit; font-size: 14px; line-height: 20px; font-weight: 500; text-align: left;
  background: none; border: 0; transition: background-color .2s, color .2s;
}
.nav-item .icon { width: 19px; height: 19px; }
.nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--raised); color: var(--text); }
.nav-item.danger:hover { background: var(--badge-bad); color: var(--bad); }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); display: grid; gap: 2px; }
.license-card { background: var(--raised); border-radius: 16px; padding: 14px 16px; margin-top: 14px; order: 2; }
.license-title { font-size: 13px; line-height: 20px; font-weight: 500; margin: 0; }
.license-card p.small { margin: 4px 0 0; line-height: 18px; }

/* Collapsed sidebar (Ctrl+B), icons only */
[data-sidebar=closed] .sidebar { width: 76px; padding: 0 12px 18px; }
[data-sidebar=closed] .sidebar-head { justify-content: center; padding: 0; }
[data-sidebar=closed] .brand-text, [data-sidebar=closed] .collapse-btn, [data-sidebar=closed] .nav-label,
[data-sidebar=closed] .nav-item span, [data-sidebar=closed] .license-card { display: none; }
[data-sidebar=closed] .expand-btn { display: flex; }
[data-sidebar=closed] .nav-group + .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
[data-sidebar=closed] .nav-item { justify-content: center; padding: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 18px 32px 40px; }
.topbar { height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumb { height: 36px; display: inline-flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 999px; min-width: 0;
  border: 1px solid var(--border-sidebar); background: var(--control); font-size: 13px; line-height: 20px; }
.crumb .muted { color: var(--crumb-parent); }
.crumb-sep { color: var(--crumb-sep); }
.crumb-current { font-weight: 500; color: var(--crumb-current); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--border-control); background: var(--control); color: var(--name);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background-color .2s, color .2s; text-decoration: none;
}
.icon-btn:hover { background: var(--raised); }
[data-theme=dark] .when-light, [data-theme=light] .when-dark { display: none; }
.avatar { width: 38px; height: 38px; border-radius: 999px; background: var(--avatar); color: var(--avatar-ink); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mobile-only { display: none; }
.banner { margin: 18px 0 0; padding: 10px 16px; border-radius: 12px; font-size: 13px; line-height: 20px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border-interactive); }
.banner.warn { background: var(--badge-warn); border-color: transparent; color: var(--badge-warn-text); }
.banner.warn strong { color: var(--text); }
.banner.bad { background: var(--badge-bad); border-color: transparent; color: var(--badge-bad-text); }
.page { width: 100%; max-width: 1360px; padding-top: 24px; }
.sidebar-backdrop { display: none; }

/* ── Page head: eyebrow, title, one short line of context, actions on the right ── */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.page-head p.muted { max-width: 680px; margin: 6px 0 0; font-size: 14px; line-height: 22px; color: var(--summary); }
.page-head p.muted.small { font-size: 14px; }
.page-head .meta { margin-top: 4px; font-size: 12px; line-height: 18px; color: var(--faint); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.eyebrow { font-size: 11px; line-height: 18px; letter-spacing: .6px; text-transform: uppercase; color: var(--label); font-weight: 500; margin: 0 0 4px; }
.eyebrow a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.eyebrow a::before { content: "‹"; font-size: 14px; line-height: 1; }
.eyebrow a:hover { color: var(--text); }

/* ── Grids ── */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
/* Overview row: one wide hero card + three stat cards, like the reference "Overview" grid. */
.grid-stats { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); }
@media (max-width: 1180px) { .grid-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-stats > .hero { grid-column: 1 / -1; } }
.stack { display: grid; gap: 14px; align-content: start; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card + .card { margin-top: 14px; }
.grid > .card + .card, .stack > .card + .card { margin-top: 0; }
.card > h2 + p.muted, .form-section > h2 + p.muted { margin-top: -8px; margin-bottom: 12px; }
.card > p + form, .card > p + .actions { margin-top: 12px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.card-head p { margin: 2px 0 0; }
.card.danger-zone { border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); }
.section { margin-top: 22px; }

/* Stat cards: label on top, a big light-weight number at the bottom */
.stat { container-type: inline-size; display: flex; flex-direction: column; gap: 4px; min-height: 124px; padding: 18px; border-radius: 15px; border-color: transparent; }
.stat .label { font-size: 13px; line-height: 20px; color: var(--stat-label); font-weight: 400; }
.stat .value { margin-top: auto; font-size: clamp(22px, 14cqi, 32px); line-height: 1.2; font-weight: 400; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .sub { font-size: 12px; line-height: 18px; color: var(--stat-sub); }
.stat.hero { position: relative; overflow: hidden; min-height: 176px; background: var(--accent); border-color: var(--hero-border); color: var(--accent-ink); }
.stat.hero .label { font-weight: 500; color: var(--hero-label); }
.stat.hero .value { font-size: clamp(32px, 13cqi, 52px); line-height: 1.12; letter-spacing: -0.055em; }
.stat.hero .sub { font-size: 13px; line-height: 20px; color: var(--hero-sub); }
.stat.hero .tag { position: absolute; top: 18px; right: 18px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px;
  background: #10171e; color: #f0f3f6; font-size: 11px; line-height: 14px; font-weight: 500; }
.stat.hero .tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #d7e1eb; }
.stat .pill { align-self: flex-start; }

.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.section-title h2 { margin: 0; }
.section-title p, .section-title .muted { margin: 0; font-size: 13px; color: var(--faint); }
.section-title > :last-child:not(:first-child) { margin-left: auto; }
.section-title a { font-size: 12px; color: var(--muted); }
.section-title a:hover { color: var(--text); }

.row { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 19px; padding: 4px 0; color: var(--data); }
.row .k { width: 110px; flex-shrink: 0; color: var(--muted); }
.row .v { min-width: 0; overflow-wrap: anywhere; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.alert-item > .dot { margin-top: 7px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.idle { background: var(--idle); }

/* Badges: neutral pill; ok = soft blue, warn = lilac, bad = pink */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; line-height: 16px; font-weight: 500; padding: 3px 9px; border-radius: 999px;
  background: var(--badge); color: var(--badge-text); white-space: nowrap; border: 0; vertical-align: middle; }
.pill.ok { background: var(--badge-ok); color: var(--badge-ok-text); }
.pill.ok .dot { background: var(--badge-ok-text); }
.pill.warn { background: var(--badge-warn); color: var(--badge-warn-text); }
.pill.warn .dot { background: var(--badge-warn-text); }
.pill.bad { background: var(--badge-bad); color: var(--badge-bad-text); }
.pill.idle { color: var(--muted); }

.alert-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); }
.alert-item:first-child { border-top: 0; padding-top: 0; }
.alert-item:last-child { padding-bottom: 0; }
.alert-item .title { font-weight: 500; font-size: 13px; line-height: 20px; color: var(--name); }
.alert-item > form { flex-shrink: 0; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }

/* Flash messages look like the reference toast */
.flash { border-radius: 12px; padding: 10px 16px; margin-bottom: 18px; border: 1px solid var(--border-interactive); background: var(--card); font-size: 13px; line-height: 20px; }
.flash.ok { background: var(--accent); color: var(--accent-ink); border-color: var(--border-strong); }
.flash.ok a { color: inherit; font-weight: 500; }
.flash.bad { background: var(--badge-bad); color: var(--badge-bad-text); border-color: transparent; }
.flash.warn { background: var(--badge-warn); color: var(--badge-warn-text); border-color: transparent; }
.flash.warn a, .flash.bad a { color: inherit; font-weight: 500; }
.flash ul { margin: 4px 0 0; padding-left: 18px; }

.secret { background: var(--canvas); border: 1px dashed var(--warn); border-radius: 12px; padding: 12px; margin: 10px 0; display: grid; gap: 4px; }
.secret code { display: block; overflow-wrap: anywhere; font-size: 12px; user-select: all; color: var(--text); }

.steps { padding-left: 18px; margin: 6px 0 12px; font-size: 13px; line-height: 21px; color: var(--muted); }
.steps li + li { margin-top: 2px; }
.steps strong { color: var(--text); font-weight: 500; }

/* ── Forms, like the reference dialog inputs ── */
label { display: block; font-size: 13px; line-height: 20px; color: var(--secondary); font-weight: 500; margin: 14px 0 4px; }
label:first-child { margin-top: 0; }
.hint { font-size: 12px; line-height: 18px; color: var(--muted); margin: 4px 0 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=date], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; height: 40px; background: var(--canvas); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 8px 12px; font: inherit; font-size: 14px; line-height: 22px; transition: border-color .2s;
}
textarea { height: auto; min-height: 84px; resize: vertical; }
input[type=file] { width: 100%; font: inherit; font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { margin-right: 10px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-control);
  background: var(--control-alt); color: var(--secondary); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--crumb-parent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); }
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; width: 17px; height: 17px; flex-shrink: 0; margin: 0; border-radius: 5px;
  border: 2px solid var(--checkbox); background: transparent; cursor: pointer; transition: background-color .2s, border-color .2s;
}
input[type=checkbox]:checked {
  border-color: #ecf0f1; background: #ecf0f1 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 8 3 3 7-7' fill='none' stroke='%2323292d' stroke-width='2'/%3E%3C/svg%3E") center/100% no-repeat;
}
[data-theme=light] input[type=checkbox]:checked { border-color: #20242c; background-color: #20242c; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 8 3 3 7-7' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E"); }
input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex-shrink: 0; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 400; color: var(--text); margin: 0; font-size: 13px; line-height: 20px; cursor: pointer; }
.check + .check, .form-gap { margin-top: 14px; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days .check { background: var(--control-alt); border: 1px solid var(--border-control); padding: 6px 12px; border-radius: 999px; margin: 0; }
.days .check:has(input:checked) { border-color: var(--accent); color: var(--text); }
.inline { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice .check { border: 1px solid var(--border-interactive); border-radius: 12px; padding: 11px 14px; background: var(--canvas); margin: 0; font-weight: 500; }
.choice .check:has(input:checked) { border-color: var(--accent); }
.choice-3 { grid-template-columns: repeat(3, 1fr); }
.choice .check { align-items: flex-start; }
.choice .check input { margin-top: 2px; }
.choice .check > span, .option-row > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choice .check strong, .option-row strong { font-weight: 500; color: var(--text); }
.choice .check .hint, .option-row .hint { margin: 0; font-weight: 400; }
/* Switch-like rows: checkbox + title + description, divided by hairlines */
.option-list { margin: 4px 0 0; }
.option-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; margin: 0; font-size: 13px; line-height: 20px; cursor: pointer; }
.option-row + .option-row { border-top: 1px solid var(--border); }
.option-row input { margin-top: 2px; }
/* Alur Softcopy: the gateway token only matters for automatic sending */
.card:has(input[name=method][value=manual]:checked) .token-section { display: none; }
/* Style (preset) cards in Tema & Alur */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 8px; }
.preset { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--border-interactive); border-radius: 14px;
  background: var(--canvas); cursor: pointer; margin: 0; font-weight: 400; transition: border-color .2s; }
.preset:hover { border-color: var(--border-strong); }
.preset:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.preset input[type=radio] { position: absolute; top: 14px; right: 14px; }
.preset-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text); padding-right: 22px; }
.preset-tag { font-size: 11px; line-height: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.preset .hint { margin: 0; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.card-foot .hint { margin: 0; }
@media (max-width: 640px) {
  .card-foot { flex-direction: column; align-items: stretch; }
  .preset-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .preset { padding: 12px; gap: 4px; }
  .preset input[type=radio] { top: 12px; right: 12px; }
  .preset .hint, .preset-tag { display: none; } /* phones: name and colours only */
  .preset-title { font-size: 13px; line-height: 18px; }
}
.swatches { display: flex; gap: 6px; }
.swatch { width: 20px; height: 20px; border-radius: 999px; border: 1px solid var(--border-strong); display: inline-block; }
.form-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-section > h2 { margin-bottom: 2px; }

/* Buttons: pills. Default = charcoal filter button; primary = soft blue action; in a page head primary = light "Invite" button. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; border-radius: 999px; padding: 0 16px;
  font: inherit; font-size: 13px; line-height: 20px; font-weight: 500; cursor: pointer; text-decoration: none; border: 1px solid var(--border-control);
  background: var(--control-alt); color: var(--badge-text); transition: background-color .2s, color .2s, border-color .2s; white-space: nowrap; flex-shrink: 0; }
.btn:hover { background: var(--raised); color: var(--text); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.page-head .btn.primary, .btn.light { background: var(--light-btn); color: var(--light-btn-ink); border-color: var(--light-btn); font-weight: 600; }
.page-head .btn.primary:hover, .btn.light:hover { opacity: .9; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--badge-bad); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--raised); color: var(--text); }
.btn.small { height: 32px; padding: 0 12px; font-size: 12px; }
.btn.block { width: 100%; }
.btn .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; line-height: 18px; font-weight: 600; }
.btn.is-active { border-color: var(--accent); color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.actions.end { justify-content: flex-end; }
/* Long forms: the save button stays in reach */
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 18px; padding: 12px 0 16px; background: linear-gradient(to bottom, transparent, var(--canvas) 14px); }
.save-bar p { margin: 0; font-size: 12px; color: var(--muted); max-width: 520px; }

/* Segmented control (period filter, tabs), like the reference status tabs */
.segmented { display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--control-alt); max-width: 100%;
  overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.segmented::-webkit-scrollbar { display: none; }
.segmented a, .segmented button { flex-shrink: 0; padding: 6px 14px; border: 0; background: none; border-radius: 999px; font: inherit; font-size: 13px; line-height: 18px; font-weight: 500;
  text-decoration: none; color: var(--muted); white-space: nowrap; transition: background-color .2s, color .2s; }
.segmented a:hover, .segmented button:hover { color: var(--text); }
.segmented .active { background: var(--tab-active); color: var(--tab-active-text); }
[data-theme=light] .segmented .active { box-shadow: 0 1px 2px rgb(0 0 0 / .08); }

/* Toolbar (like the reference users toolbar): segmented + search + filter + actions in one row */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.search { position: relative; flex: 0 1 280px; min-width: 180px; margin: 0; }
.search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--crumb-parent); pointer-events: none; }
.search input { height: 38px; padding-left: 38px; border-radius: 999px; background: var(--control); border-color: var(--border-control); font-size: 13px; }
.pill-select { width: auto; height: 38px; padding: 0 34px 0 14px; border-radius: 999px; background-color: var(--control); border-color: var(--border-control); font-size: 13px; font-weight: 500; color: var(--secondary); }
.filter-summary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; font-size: 12px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 6px 0 10px; border-radius: 999px; background: var(--badge); color: var(--secondary); font-size: 12px; text-decoration: none; }
.chip .icon { opacity: .7; }
.chip:hover { color: var(--text); }
.chip:hover .icon { opacity: 1; }
.chip.plain { padding: 0 10px; }
button.chip { border: 0; font: inherit; font-size: 12px; cursor: pointer; }
.filter-summary .reset { margin-left: 2px; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 11px; align-items: flex-end; }
.filters .field { display: grid; gap: 4px; min-width: 160px; }
.filters .field label { margin: 0; }

/* ── Dialog: centered on desktop, bottom sheet on phones ── */
.dialog { width: 440px; max-width: calc(100vw - 32px); max-height: 85vh; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--card); color: var(--text); box-shadow: var(--shadow); overflow: hidden;
  opacity: 0; scale: .96; transition: opacity .2s ease-out, scale .2s ease-out, translate .2s ease-out; }
.dialog[open] { display: flex; flex-direction: column; }
.dialog.is-open { opacity: 1; scale: 1; }
.dialog::backdrop { background: rgb(0 0 0 / .7); opacity: 0; transition: opacity .2s; }
.dialog.is-open::backdrop { opacity: 1; }
.dialog form { display: flex; flex-direction: column; min-height: 0; margin: 0; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.dialog-head h2 { margin: 0; font-size: 18px; line-height: 26px; font-weight: 600; }
.dialog-body { padding: 8px 20px 4px; overflow-y: auto; }
.dialog-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 20px 20px; }
.dialog-foot .btn { min-width: 96px; }
.dialog-foot .ghost { margin-right: auto; }

/* ── Tables: full-bleed inside a card, 44px header, roomy rows with dividers ── */
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 19px; color: var(--data); }
th { text-align: left; height: 42px; font-size: 12px; color: var(--th); font-weight: 400; padding: 0 12px; white-space: nowrap; border-bottom: 1px solid var(--border); }
td { padding: 13px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
td.right, th.right { text-align: right; }
td.nowrap { white-space: nowrap; }
tbody tr { transition: background-color .2s; }
tbody tr:hover td { background: var(--row-hover); }
td strong, td b, .cell-title { color: var(--name); font-weight: 500; }
td .sub { display: block; font-size: 12px; line-height: 18px; color: var(--muted); }
td input[type=number], td input[type=text], td select { height: 36px; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-subtle); background: var(--card); }
.card .table-wrap { margin: 0 -20px -20px; border: 0; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); background: none; }
.card > .table-wrap:first-child, .card.table-wrap { margin: 0; border-top: 0; }
.card.table-wrap { padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.card .table-wrap + * { margin-top: 20px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { margin: 0; }

.login { max-width: 400px; margin: 12vh auto 0; padding: 0 16px; }
.login .card { padding: 24px; border-color: var(--border-strong); }
.login h1 { font-size: 26px; line-height: 32px; letter-spacing: -0.8px; margin-bottom: 4px; }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; align-items: center; justify-content: center; }
.pagination a, .pagination span { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px;
  border: 1px solid var(--border-control); background: var(--control); border-radius: 999px; font-size: 12px; text-decoration: none; color: var(--muted); }
.pagination a:hover { color: var(--text); background: var(--raised); }
.pagination .current { background: none; border-color: transparent; color: var(--text); }
.card .pagination { padding-top: 16px; }

.linkbox { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.linkbox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--canvas); border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 12px; height: 38px; line-height: 36px; font-size: 12px; user-select: all; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); font-size: 13px; border: 1px dashed var(--border-interactive); border-radius: var(--radius); }
.empty strong, .empty > p:first-child { color: var(--text); font-size: 15px; font-weight: 500; }
.card .empty, .card.empty { border-style: dashed; }
.card .empty { border: 0; padding: 32px 12px; }
.logo-preview { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.logo-preview img { height: 48px; max-width: 160px; object-fit: contain; background: var(--canvas); border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
details.alert-item summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
details.alert-item summary::-webkit-details-marker { display: none; }
details.alert-item summary::before { content: "›"; color: var(--muted); transition: rotate .2s; display: inline-block; width: 10px; }
details.alert-item[open] summary::before { rotate: 90deg; }

/* ── Tablet ── */
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .3s ease-in-out; width: 280px !important;
    padding: 0 16px max(18px, env(safe-area-inset-bottom)) !important; }
  [data-mobile-nav=open] .sidebar { transform: none; }
  [data-mobile-nav=open] .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .7); }
  [data-sidebar=closed] .brand-text, [data-sidebar=closed] .nav-label, [data-sidebar=closed] .nav-item span, [data-sidebar=closed] .license-card { display: revert; }
  [data-sidebar=closed] .sidebar-head { justify-content: flex-start; padding: 0 4px; }
  [data-sidebar=closed] .nav-item { justify-content: flex-start; padding: 0 12px; }
  [data-sidebar=closed] .nav-group + .nav-group { border-top: 0; padding-top: 0; margin-top: 18px; }
  [data-sidebar=closed] .collapse-btn { display: inline-flex; }
  .expand-btn { display: none !important; }
  .mobile-only { display: inline-flex; }
  .desktop-only { display: none; }
  .main { padding: 14px 20px 40px; }
  h1 { font-size: 28px; line-height: 35px; letter-spacing: -0.8px; }
}

/* ── Phones ── */
@media (max-width: 640px) {
  .crumb { display: none; }
  .main { padding: 12px 16px 32px; }
  .page { padding-top: 16px; }
  h1 { font-size: 24px; line-height: 30px; letter-spacing: -0.6px; }
  .page-head { margin-bottom: 18px; align-items: flex-start; }
  .page-head p.muted, .page-head p.muted.small { font-size: 13px; line-height: 20px; }
  .card { padding: 16px; }
  .card .table-wrap { margin: 0 -16px -16px; }
  .inline, .choice, .choice-3 { grid-template-columns: 1fr; }
  .grid { gap: 10px; }

  /* Overview stats become compact rows (label left, value right); secondary stats a tight 2-column grid */
  .grid-stats { grid-template-columns: 1fr; gap: 8px; }
  .grid-stats > .stat { min-height: 0; padding: 12px 16px; flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 10px; row-gap: 0; }
  .grid-stats > .stat .label { flex: 1; min-width: 0; }
  .grid-stats > .stat .value { order: 2; margin: 0; font-size: 20px; letter-spacing: -0.03em; }
  .grid-stats > .stat .sub, .grid-stats > .stat .pill { order: 3; flex-basis: 100%; }
  .grid-stats > .stat .pill { flex-basis: auto; margin-top: 4px; }
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .grid-4 > .stat { min-height: 0; padding: 12px 14px; gap: 2px; }
  .grid-4 > .stat .value { margin-top: 6px; font-size: 22px; }
  .stat.hero { min-height: 0; padding: 16px; display: grid; grid-template-columns: 1fr auto; }
  .stat.hero .tag { position: static; grid-column: 2; grid-row: 1; }
  .stat.hero .value { grid-column: 1 / -1; font-size: 34px; margin-top: 18px; }
  .stat.hero .sub { grid-column: 1 / -1; }

  .toolbar { gap: 8px; }
  .toolbar > .segmented { order: -1; flex-basis: 100%; }
  .search { flex: 1 1 0; min-width: 0; }
  .btn .label-wide { display: none; }

  /* Tables marked .stack-sm turn into a list of cards */
  .stack-sm thead { display: none; }
  .stack-sm, .stack-sm tbody, .stack-sm tr, .stack-sm td { display: block; width: 100%; }
  .stack-sm tr { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .stack-sm tbody tr:last-child { border-bottom: 0; }
  .stack-sm td { padding: 0 !important; border: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; text-align: right; }
  .stack-sm td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex-shrink: 0; }
  .stack-sm td.cell-title { order: -1; display: block; text-align: left; font-size: 14px; margin-bottom: 2px; }
  .stack-sm td.cell-title .sub { font-weight: 400; text-align: left; }
  .stack-sm td.cell-actions { justify-content: flex-start; margin-top: 4px; }
  .stack-sm td.cell-actions .row-actions { justify-content: flex-start; }
  .stack-sm td > .sub, .stack-sm td.right { text-align: right; }
  .stack-sm td input, .stack-sm td select { max-width: 60%; }
  .stack-sm tbody tr:hover td { background: none; }

  /* Transactions: a compact 4-line card per sale (branch and add-ons ride along on the time and session lines) */
  .tx-table tr { display: grid; grid-template-columns: auto 1fr auto; gap: 3px 8px; grid-template-areas: "cust cust total" "time time time" "sess sess sess" "pay soft soft"; }
  .tx-table td { display: block; text-align: left; font-size: 12px; line-height: 18px; color: var(--muted); white-space: normal; }
  .tx-table td[data-label]::before { content: none; }
  .tx-table .c-branch, .tx-table .c-addon { display: none; }
  .tx-table .sm-only { display: inline; }
  .tx-table .c-sess .sub { display: inline; color: inherit; }
  .tx-table .c-sess .sub::before { content: " · "; }
  .tx-table .c-cust { grid-area: cust; font-size: 14px; margin: 0; color: var(--name); }
  .tx-table .c-cust .sub { text-align: left; }
  .tx-table .c-total { grid-area: total; text-align: right; font-size: 14px; }
  .tx-table .c-time { grid-area: time; }
  .tx-table .c-sess { grid-area: sess; }
  .tx-table .c-pay { grid-area: pay; margin-top: 6px; }
  .tx-table .c-soft { grid-area: soft; margin-top: 6px; align-self: center; }
  .tx-table .c-soft .sub { display: inline; margin-left: 4px; }

  .dialog { width: 100%; max-width: 100%; max-height: 88vh; margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0; scale: 1; translate: 0 24px; }
  .dialog.is-open { translate: 0 0; }
  .dialog-foot { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .dialog-foot .btn:not(.ghost) { flex: 1; }
  .save-bar .btn { flex: 1; }
  .alert-item { flex-wrap: wrap; }
  .alert-item > div:not(.item-actions) { flex: 1 1 200px; }
  .linkbox { flex-wrap: wrap; }
  .linkbox code { flex-basis: 100%; }
}
