:root {
  --bg: #f3f4f6; --surface: #fff; --surface-2: #f7f8fa; --line: #e7e9ee; --line-strong: #d9dce3;
  --text: #0b0c0f; --muted: #5b6270; --faint: #8a909c;
  --blue: #0071e3; --blue-strong: #0062c4; --blue-soft: #e3effc; --blue-line: #b9d6f7;
  --green: #12753a; --green-soft: #e6f5ea; --green-line: #b7e0c3;
  --amber: #b25e00; --amber-soft: #fdf1df; --amber-line: #f3d3a3;
  --red: #c8102e; --red-soft: #fde8ec; --red-line: #f5b8c3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 16px; --sidebar: 256px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0d12; --surface: #14171e; --surface-2: #1a1e27; --line: #252a35; --line-strong: #333a48;
  --text: #f2f4f8; --muted: #a3abba; --faint: #717a8b;
  --blue: #3b9bff; --blue-strong: #62afff; --blue-soft: #12283f; --blue-line: #1f4670;
  --green: #4cc47a; --green-soft: #11281b; --green-line: #1f4a31;
  --amber: #f0a445; --amber-soft: #2e2110; --amber-line: #57401d;
  --red: #ff6b81; --red-soft: #33141b; --red-line: #5c2430;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
code, .mono, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.icon { flex: none; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---- frame ---- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.app.collapsed { --sidebar: 68px; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface);
  border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 12px; min-height: 52px; }
.brand-text { display: grid; line-height: 1.25; min-width: 0; }
.brand-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.logo {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; color: #fff;
  background: var(--blue); box-shadow: 0 2px 6px rgba(0, 113, 227, .35);
}
.nav-group { display: grid; gap: 2px; margin-bottom: 14px; }
.nav-title { padding: 6px 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text);
  font-weight: 500; border: 1px solid transparent; white-space: nowrap; overflow: hidden;
}
.nav-link:hover { background: var(--surface-2); }
.nav-link[aria-current="page"] { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue-strong); font-weight: 600; }
.app.collapsed .brand-text, .app.collapsed .nav-title, .app.collapsed .nav-link span { display: none; }
.app.collapsed .nav-link { justify-content: center; padding: 10px 0; }
.app.collapsed .brand { justify-content: center; padding-inline: 0; }
.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.top-divider { width: 1px; height: 20px; background: var(--line-strong); }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); min-width: 0; white-space: nowrap; }
.breadcrumb b { color: var(--text); font-weight: 600; }
.icon-button {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
}
.icon-button:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.quick-search {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); min-width: 170px;
}
.quick-search span { flex: 1; text-align: left; }
kbd { padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 11px; }
.anchor { position: relative; }
.profile { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border: 0; background: transparent; border-radius: 10px; }
.profile:hover { background: var(--surface-2); }
.profile-text { display: grid; text-align: left; line-height: 1.2; }
.profile-text small { color: var(--muted); font-size: 11px; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-weight: 700; font-size: 13px;
  background: var(--blue-soft); color: var(--blue-strong); border: 1px solid var(--blue-line);
}
.popover {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 8px; display: grid; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); z-index: 40;
}
.popover p { padding: 6px 10px; font-size: 12.5px; }
.popover button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.popover button:hover { background: var(--surface-2); }
main { padding: 28px; display: grid; gap: 16px; align-content: start; max-width: 1560px; width: 100%; margin: 0 auto; }
.scrim { display: none; }

/* ---- page pieces ---- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.page-head h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
.page-head p { margin-top: 8px; color: var(--muted); font-size: 15px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 600; }
.card-head small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.grid { display: grid; gap: 16px; }
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stat { display: grid; gap: 14px; padding: 18px 20px; text-align: left; min-height: 124px; align-content: space-between; width: 100%; }
button.stat:hover { border-color: var(--blue-line); }
.stat.active { background: var(--blue-soft); border-color: var(--blue-line); box-shadow: 0 0 0 1px var(--blue-line); }
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.stat small { color: var(--muted); font-size: 12.5px; min-height: 1em; }
.stat-icon, .tile-icon {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.blue { color: var(--blue); } .green { color: var(--green); } .amber { color: var(--amber); } .red { color: var(--red); }
.stat-icon.blue, .tile-icon.blue { background: var(--blue-soft); border-color: var(--blue-line); }
.stat-icon.green, .tile-icon.green { background: var(--green-soft); border-color: var(--green-line); }
.stat-icon.amber, .tile-icon.amber { background: var(--amber-soft); border-color: var(--amber-line); }
.stat-icon.red, .tile-icon.red { background: var(--red-soft); border-color: var(--red-line); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { color: var(--green); background: var(--green-soft); border-color: var(--green-line); }
.badge.red { color: var(--red); background: var(--red-soft); border-color: var(--red-line); }
.badge.amber { color: var(--amber); background: var(--amber-soft); border-color: var(--amber-line); }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; white-space: nowrap; box-shadow: var(--shadow);
}
.button:hover:not(:disabled) { background: var(--surface-2); }
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--blue-strong); }
.button.danger { color: var(--red); border-color: var(--red-line); }
.button.ghost { box-shadow: none; }
.button.small { height: 30px; padding: 0 10px; font-size: 13px; }
.segmented { display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 500; }
.pill.active { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue-strong); font-weight: 600; }
.toggle { position: relative; width: 40px; height: 24px; border-radius: 999px; border: 0; background: var(--line-strong); flex: none; padding: 0; transition: background .15s; }
.toggle i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.toggle[aria-checked="true"] { background: var(--blue); }
.toggle[aria-checked="true"] i { transform: translateX(16px); }
.state { display: grid; justify-items: center; gap: 10px; padding: 48px 20px; text-align: center; }
.state-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.state small { color: var(--faint); }
.error-state .state-icon { color: var(--red); background: var(--red-soft); border-color: var(--red-line); }
.skeleton { display: grid; gap: 12px; padding: 20px; }
.skeleton i { height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--line) 25%, var(--surface-2) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton i:nth-child(2) { width: 70%; } .skeleton i:nth-child(3) { width: 45%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-block: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
th.right, td.right { text-align: right; }
td small { display: block; color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.modal .row-actions { justify-content: flex-start; flex-wrap: wrap; }
.diff pre { margin: 0; white-space: pre-wrap; font-size: 12px; }
.diff tr.changed { background: var(--amber-soft); }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); min-width: 240px; flex: 1; max-width: 420px; }
.search input, .search input:focus { border: 0; background: transparent; outline: 0; box-shadow: none; padding: 0; flex: 1; min-width: 0; color: var(--text); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 20px 16px; align-items: end; }
.filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 13px; }
.pager select { height: 32px; width: auto; border-radius: 999px; padding: 0 10px; }

/* ---- forms ---- */
input:not([type]), input[type="text"], input[type="number"], input[type="password"], input[type="datetime-local"], input[type="date"], input[type="search"], input[type="email"], input[type="url"], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface-2); outline: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent); background: var(--surface); }
textarea { resize: vertical; }
input[type="color"] { width: 56px; height: 38px; padding: 2px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 6px; align-content: start; }
.field > span:first-child { font-weight: 600; font-size: 13.5px; }
.field small { color: var(--muted); font-size: 12.5px; }
.wide { grid-column: 1 / -1; }
.form-error { color: var(--red); background: var(--red-soft); border: 1px solid var(--red-line); border-radius: 10px; padding: 10px 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toggle-row { display: flex; align-items: center; min-height: 38px; }
.image-field { display: flex; gap: 8px; align-items: center; }
.image-field img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
/* A setting row: text on the left, control on the right. */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-top: 1px solid var(--line); }
.setting:first-child { border-top: 0; }
.setting b { display: block; font-weight: 600; }
.setting small { color: var(--muted); }
.setting .control { width: 280px; max-width: 50%; flex: none; display: flex; justify-content: flex-end; }

/* ---- modal ---- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(10, 14, 22, .45); backdrop-filter: blur(2px); overflow-y: auto; }
.modal-backdrop.top { place-items: start center; padding-top: 12vh; }
.modal { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 64px rgba(16, 24, 40, .28); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { width: min(980px, 100%); }
.modal > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal h2 { font-size: 17px; }
.modal-body { padding: 20px; overflow-y: auto; display: grid; gap: 16px; }
.palette { width: min(600px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 64px rgba(16, 24, 40, .28); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-input input { border: 0; background: transparent; box-shadow: none; padding: 0; min-height: 28px; font-size: 15px; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 8px; display: grid; gap: 2px; }
.palette-list button { display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; color: var(--muted); }
.palette-list button span { flex: 1; color: var(--text); font-weight: 500; }
.palette-list button:hover, .palette-list button:focus-visible { background: var(--blue-soft); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--green-line); color: var(--green); box-shadow: 0 12px 32px rgba(16, 24, 40, .18); max-width: 420px; }
.toast span { color: var(--text); }
.toast.error { border-color: var(--red-line); color: var(--red); }
.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin: 0; }
.details dt { color: var(--muted); font-size: 12px; }
.details dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.json { margin: 0; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); overflow: auto; font-size: 12px; max-height: 320px; }

/* ---- dashboard ---- */
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.legend { display: flex; gap: 40px; flex-wrap: wrap; padding: 0 20px 16px; }
.legend span { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.legend span::before { content: ""; }
.legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; background: currentColor; }
.legend b { color: var(--text); font-size: 20px; }
.chart { width: 100%; height: 260px; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .gridline { stroke: var(--line); }
.bar-row { display: grid; gap: 8px; padding: 0 20px 16px; }
.bar-row > div { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.watch { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); color: inherit; }
.watch:hover { background: var(--surface-2); }
.watch span { flex: 1; }
.watch .tile-icon { flex: none; }
.watch small { display: block; color: var(--muted); }
.link { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 500; font-size: 13px; }
.link:hover { color: var(--blue); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--blue-strong); border-bottom-color: var(--blue); font-weight: 600; }

/* ---- login ---- */
.login-page {
  min-height: 100vh; display: grid; justify-items: center; align-content: center; gap: 28px; padding: 40px 16px;
  background: radial-gradient(900px 500px at 50% -10%, color-mix(in srgb, var(--blue) 12%, transparent), transparent 70%), var(--bg);
}
.login-language { position: fixed; top: 16px; right: 16px; }
.login-brand { display: grid; justify-items: center; gap: 12px; }
.login-brand .logo { width: 56px; height: 56px; border-radius: 16px; }
.eyebrow { color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.login-brand p { display: flex; gap: 8px; font-size: 16px; color: var(--muted); }
.login-brand p b { color: var(--text); } .login-brand p i { color: var(--faint); font-style: normal; }
.login-card { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 26px; overflow: hidden; box-shadow: 0 8px 28px rgba(16, 24, 40, .08); }
.login-form { padding: 36px 36px 32px; display: grid; gap: 12px; }
.login-form h1 { font-size: 28px; letter-spacing: -.02em; }
.login-form > p { color: var(--muted); font-size: 16px; margin-bottom: 16px; }
.login-form .form-grid { grid-template-columns: 1fr; gap: 20px; }
.login-form input { min-height: 50px; border-radius: 14px; font-size: 16px; }
.login-form .field > span:first-child { font-size: 15px; }
.login-form .button { width: 100%; height: 50px; border-radius: 14px; font-size: 16px; }
.login-form .form-actions { margin-top: 8px; }
.login-points { background: var(--surface-2); border-top: 1px solid var(--line); padding: 24px 36px 28px; display: grid; gap: 10px; }
.login-points b { margin-bottom: 4px; }
.login-points span { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.login-points .icon { color: var(--blue); }
.login-foot { color: var(--muted); text-align: center; line-height: 2; font-size: 13.5px; }

@media (max-width: 1100px) { .split, .cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); --sidebar: 256px; }
  .sidebar { position: fixed; left: 0; top: 0; width: 256px; transform: translateX(-100%); transition: transform .2s; }
  .app.mobile-open .sidebar { transform: none; }
  .app.mobile-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 14, 22, .45); z-index: 25; }
  .app.collapsed .brand-text, .app.collapsed .nav-title, .app.collapsed .nav-link span { display: revert; }
  .app.collapsed .nav-link { justify-content: flex-start; padding: 9px 10px; }
  main { padding: 16px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .quick-search span, .quick-search kbd, .profile-text, .breadcrumb span, .breadcrumb .icon { display: none; }
  .quick-search { min-width: 0; padding: 0 10px; }
  .cols-2, .form-grid, .details { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 24px; }
  .setting { flex-direction: column; align-items: stretch; }
  .setting .control { width: auto; max-width: none; justify-content: flex-start; }
}
.section { margin-top: 20px; }
.section h3 { margin: 0 0 10px; font-size: 14px; }
button.link { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 600; }
.note { margin: 0; padding: 12px 16px; border-radius: 14px; background: var(--amber-soft); color: var(--amber); font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.check input { width: auto; height: auto; }
.preview { align-self: start; display: grid; gap: 14px; }
.phone { border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: var(--surface-2); }
.phone header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.phone header img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.phone header small { display: block; color: var(--muted); }
.bubble { margin: 14px; padding: 12px 14px; border-radius: 16px 16px 16px 4px; background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; overflow-wrap: anywhere; }
.bubble img { width: 100%; max-height: 160px; object-fit: cover; border-radius: 10px; margin-bottom: 8px; }
.bubble small { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips code { padding: 3px 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; }
.list-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 0 0 10px; }
.list-row legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
.card-pad > .tile-head { margin-bottom: 14px; }
.card-pad > p { margin: 6px 0; }
.gauge .ring { position: relative; width: 140px; margin: 4px auto 10px; }
.gauge svg { transform: rotate(-90deg); display: block; }
.gauge circle { fill: none; stroke: var(--line); stroke-width: 10; }
.gauge circle.fill { stroke: var(--blue); stroke-linecap: round; transition: stroke-dashoffset .4s; }
.gauge strong { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; }
.gauge strong small { font-size: 13px; color: var(--muted); }
.gauge p { text-align: center; }
.service-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.service-row > span:first-child { flex: 1; display: grid; }
.qr-preview img { display: block; max-width: 100%; height: auto; background: #fff; border-radius: 12px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 14px 0; }
.check-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.check select { width: auto; }
td input, td select { min-width: 90px; }
.icon-button.danger:hover:not(:disabled) { color: var(--red); }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.grid.halves { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.bubble-button { margin-top: 10px; padding: 8px 12px; border-radius: 10px; text-align: center; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; color: var(--blue); }
progress { width: 90px; height: 6px; vertical-align: middle; accent-color: var(--blue); }

.code-block { margin: 8px 0 12px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; white-space: pre; overflow-x: auto; }
.doc-list { margin: 8px 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.55; }
tr.clickable { cursor: pointer; }
.method { display: inline-block; min-width: 46px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; text-align: center; color: #fff; background: #2563eb; }
.method.post { background: #16a34a; }

/* Layout children may shrink below their content, so wide tables scroll inside their card instead of widening the page. */
main > *, .card, .grid > *, .split > *, .stats > * { min-width: 0; }
.card { max-width: 100%; }
@media (max-width: 900px) {
  html, body { overflow-x: hidden; }
  .card:has(> table), .card:has(> .loaded > table) { overflow-x: auto; }
  .card > table, .table-wrap, .card { -webkit-overflow-scrolling: touch; }
  .card { overflow-x: auto; }
  th, td { padding: 10px 12px; }
  td { white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
  .modal td, td:has(pre), td:has(textarea) { white-space: normal; overflow-wrap: anywhere; }
  .page-head { align-items: stretch; flex-direction: column; gap: 12px; }
  .page-head p { font-size: 14px; }
  .page-actions .button { flex: 1 1 auto; justify-content: center; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-head, .filters { padding-inline: 14px; }
  .card-pad { padding: 14px; }
  .filters label, .filters .search, .toolbar .search { flex: 1 1 100%; max-width: none; min-width: 0; }
  .search { min-width: 0; }
  .segmented, .tabs { max-width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .segmented::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .segmented button, .tabs button { white-space: nowrap; flex: 0 0 auto; }
  .pager { flex-wrap: wrap; padding-inline: 14px; }
  .row-actions { flex-wrap: nowrap; }
  /* 16px keeps iOS from zooming the page when a field gets focus. */
  input:not([type]), input[type="text"], input[type="number"], input[type="password"], input[type="datetime-local"], input[type="date"], input[type="search"], input[type="email"], input[type="url"], select, textarea { font-size: 16px; min-height: 42px; }
  input, select, textarea { font-size: 16px; }
  .search { height: 42px; }
  .button { min-height: 40px; }
  .button.small { height: 36px; min-height: 36px; padding: 0 12px; }
  .pager select { height: 36px; min-height: 36px; }
  .modal-backdrop, .modal-backdrop.top { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 18px 18px 0 0; border-inline: 0; border-bottom: 0; }
  .modal-body { padding: 16px; }
  .modal .form-actions { position: sticky; bottom: -16px; background: var(--surface); padding: 12px 0; margin-bottom: -16px; }
  .modal .form-actions .button { flex: 1; justify-content: center; }
  .grid.halves { grid-template-columns: minmax(0, 1fr); }
  pre, .json, .code-block { max-width: 100%; overflow-x: auto; }
  .toast-stack, .toasts { left: 12px; right: 12px; }
}
@media (max-width: 420px) {
  main { padding: 12px; gap: 12px; }
  .page-head h1 { font-size: 22px; }
}
