/* Dashboard. White surfaces, hairline borders, Geist, one indigo accent. Motion only where it tells you something.
   Mobile-first: base rules are for phones (360px+); min-width queries at the end add tablet/desktop layouts. */

body.app { background: #fff; --ctl: 44px; --ctl-sm: 40px; --ctl-in: 44px; --fs-in: 16px; --safe-b: env(safe-area-inset-bottom, 0px); }
/* flex/grid children may shrink below their content (no horizontal page scroll); zero specificity so explicit min-widths still win */
:where(.main-col, .main, .page, .page-head, .page-titles, .section-body, .stack, .row, .card, .card-head, .card-titles, .card-body, .grid2, .cols, .cols3, .toolbar, .server-top, .server-name, .usage-main, .field, .switch-text, .sheet-body, .dialog-body) > * { min-width: 0; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { width: 48px; height: 48px; animation: breathe 1.6s var(--ease) infinite; }
@keyframes breathe { 50% { transform: scale(0.92); opacity: 0.7; } }

/* ---------- frame ---------- */
.sample-banner { position: sticky; top: 0; z-index: 40; height: 36px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; background: var(--accent-tint); color: var(--ink-2); border-bottom: 1px solid var(--accent-line); padding: 0 12px; white-space: nowrap; overflow: hidden; }
.sample-banner > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; }
.sample-banner .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-mid); box-shadow: 0 0 0 3px var(--accent-line); flex-shrink: 0; }
.sample-banner a, .sample-banner .linkish { font-weight: 560; color: var(--accent); flex-shrink: 0; min-height: 36px; display: inline-flex; align-items: center; }
.shell { --top: 0px; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.shell.has-banner { --top: 36px; min-height: calc(100vh - 36px); }

.sidebar { position: fixed; left: 0; top: var(--top); width: min(300px, 86vw); height: calc(100vh - var(--top)); height: calc(100dvh - var(--top)); display: flex; flex-direction: column; gap: 10px; padding: 14px 12px calc(12px + var(--safe-b)); border-right: 1px solid var(--line); background: #fff; z-index: 30; transform: translateX(-102%); visibility: hidden; transition: transform 0.34s var(--ease), visibility 0s 0.34s; box-shadow: 0 0 60px -10px rgba(10, 10, 12, 0.3); border-radius: 0 18px 18px 0; overscroll-behavior: contain; }
.shell.nav-open .sidebar { transform: none; visibility: visible; transition: transform 0.34s var(--ease); }
.scrim { position: fixed; inset: 0; z-index: 25; background: rgba(14, 14, 18, 0.3); opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease); }
.shell.nav-open .scrim { opacity: 1; pointer-events: auto; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 4px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; min-height: 36px; }
.brand b { font: 700 21px/1 var(--display); letter-spacing: -0.04em; }
.side-close { display: inline-grid; }
.search-trigger { display: flex; align-items: center; gap: 8px; width: 100%; height: var(--ctl); padding: 0 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--soft); color: var(--muted); font-size: 13.5px; transition: border-color 0.15s, background 0.15s; }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger:hover { border-color: #cfcfd4; background: #fff; }
kbd { font: 500 11px/1 var(--mono); padding: 3px 5px; border-radius: 5px; border: 1px solid var(--line-2); background: #fff; color: var(--muted); }
.side-nav { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 14px; padding: 4px 0; margin: 0 -4px; padding-inline: 4px; scrollbar-width: thin; }
.nav-head { display: flex; align-items: center; gap: 6px; padding: 0 8px 4px; font-size: 11.5px; font-weight: 560; color: var(--faint); letter-spacing: 0.02em; text-transform: uppercase; }
.nav-head span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 450; font-size: 14px; transition: color 0.18s, font-weight 0.18s; }
.nav-item .icon { flex-shrink: 0; stroke: currentColor; }
.nav-item:hover { color: var(--ink); font-weight: 520; }
.nav-item[aria-current='page'] { color: var(--ink); font-weight: 600; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub { margin-left: 6px; font-size: 11.5px; color: var(--faint); font-weight: 450; }
.count { font: 500 11.5px/1 var(--sans); color: var(--muted); background: var(--soft-2); padding: 3px 6px; border-radius: 99px; min-width: 20px; text-align: center; }
.nav-head .count { background: none; padding: 0; color: var(--faint); }
.side-foot { display: flex; align-items: center; gap: 10px; padding: 10px 6px 2px; border-top: 1px solid var(--line); }
.side-foot .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.side-foot .who b { font-size: 13.5px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who span { font-size: 12px; color: var(--faint); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: var(--top); z-index: 20; height: 56px; display: flex; align-items: center; gap: 4px; padding: 0 10px; background: rgba(255, 255, 255, 0.86); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.menu-btn, .top-search { display: inline-grid; flex-shrink: 0; }
.top-invite { flex-shrink: 0; }
.top-invite span { display: none; }
.crumbs { min-width: 0; overflow: hidden; }
.grow { flex: 1; min-width: 0; }
.crumbs ol { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; font-size: 14px; color: var(--muted); min-width: 0; }
.crumbs li { display: flex; align-items: center; gap: 4px; min-width: 0; }
.crumbs li .icon { color: var(--faint); stroke: currentColor; }
.crumbs a { text-decoration: none; border-radius: 6px; padding: 2px 4px; transition: color 0.15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs li:not(:last-child) { flex-shrink: 1; }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current='page'] { color: var(--ink); font-weight: 560; padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { flex: 1; padding: 18px 16px calc(140px + var(--safe-b)); max-width: 1120px; width: 100%; }
.main:focus { outline: none; }

.icon { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 10px; border: 0; background: transparent; color: var(--muted); transition: background 0.15s, color 0.15s; }
.icon-btn:hover { background: var(--soft-2); color: var(--ink); }

/* ---------- fluid hover / active pills ---------- */
.fluid { position: relative; isolation: isolate; }
.fluid > .fluid-hover, .fluid > .fluid-active { position: absolute; left: 0; top: 0; width: 0; height: 0; border-radius: 8px; pointer-events: none; opacity: 0; z-index: -1; transition: transform 0.32s var(--spring), width 0.32s var(--spring), height 0.32s var(--spring), opacity 0.2s var(--ease); }
.fluid > .fluid-hover { background: var(--soft-2); }
.fluid > .fluid-active { background: #fff; box-shadow: 0 0 0 1px var(--line-2), 0 1px 2px rgba(10, 10, 12, 0.06); }
.side-nav > .fluid-active { background: var(--soft-2); box-shadow: none; }
.side-nav > .fluid-hover { background: var(--soft); }
.fluid > .instant { transition: opacity 0.2s var(--ease) !important; }

/* ---------- page ---------- */
.page { display: flex; flex-direction: column; gap: 20px; animation: page-in 0.32s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-titles { display: flex; flex-direction: column; gap: 6px; max-width: 620px; }
.page-head h1 { font: 650 24px/1.15 var(--sans); letter-spacing: -0.025em; overflow-wrap: anywhere; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.page-actions > * { flex: 1 1 auto; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.45; }
.hint.center, .center { text-align: center; }
.hint.is-warn, .warn { color: var(--warn); }
.warn.small { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 0; }
.bad-text { color: var(--bad); }
.lock { display: flex; align-items: center; gap: 6px; }
.lock.center { justify-content: center; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; flex-wrap: wrap; }
.row.end { justify-content: flex-end; flex-wrap: wrap; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.cols3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.section-body { display: flex; flex-direction: column; gap: 16px; }
.section-body > * { animation: rise 0.36s var(--ease) both; }
.section-body > *:nth-child(2) { animation-delay: 30ms; }
.section-body > *:nth-child(3) { animation-delay: 60ms; }
.section-body > *:nth-child(4) { animation-delay: 90ms; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.linkish { background: none; border: 0; padding: 0; color: inherit; overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); cursor: pointer; }
.linkish:hover { text-decoration-color: currentColor; }

.section-tabs { display: block; position: sticky; top: calc(var(--top) + 56px); z-index: 10; margin: 0 -16px; padding: 8px 16px; background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.tabs-scroll { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 3px; background: var(--soft-2); border-radius: 12px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tab { flex-shrink: 0; scroll-snap-align: start; padding: 8px 14px; min-height: 44px; display: flex; align-items: center; border-radius: 9px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 470; white-space: nowrap; transition: color 0.18s, font-weight 0.18s; }
.tab:hover { color: var(--ink); }
.tab[aria-current='page'] { color: var(--accent); font-weight: 600; }

/* ---------- cards & stats ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 16px 0; }
.card-titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card-title .icon { color: var(--faint); }
.card-desc { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.card-aside { flex-shrink: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; max-width: 100%; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head + .card-body { padding-top: 14px; }
.danger-zone { border-color: #f6d4d0; }
.danger-zone .card-title .icon { color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 20px; font-weight: 640; letter-spacing: -0.025em; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-sub { font-size: 12.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat.tone-warn { border-color: #f5dcb5; background: linear-gradient(#fff, var(--warn-tint)); }
.stat.tone-warn .stat-value { color: var(--warn); }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 550; white-space: nowrap; }
.badge-neutral { background: var(--soft-2); color: var(--ink-2); }
.badge-ok { background: var(--ok-tint); color: var(--ok); }
.badge-bad { background: var(--bad-tint); color: var(--bad); }
.badge-warn { background: var(--warn-tint); color: var(--warn); }
.badge-accent { background: var(--accent-tint); color: var(--accent-mid); }

.notice { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r); background: var(--soft); border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.notice a { font-weight: 560; color: var(--accent); }
.summary-line { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px dashed var(--line-2); border-radius: var(--r); font-size: 14px; color: var(--ink-2); }
.summary-line .icon { margin-top: 3px; color: var(--muted); flex-shrink: 0; }
.big-number { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.big-number b { font-size: 30px; font-weight: 650; letter-spacing: -0.03em; }
.big-number span { color: var(--muted); font-size: 14px; }

/* ---------- buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: var(--ctl); padding: 0 14px; max-width: 100%; text-align: center; line-height: 1.25; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); font-size: 14px; font-weight: 520; text-decoration: none; white-space: normal; transition: background 0.15s, border-color 0.15s, transform 0.12s var(--ease), box-shadow 0.15s; box-shadow: 0 1px 1px rgba(10, 10, 12, 0.03); }
.btn:hover { background: var(--soft); border-color: #d2d2d7; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn .icon { flex-shrink: 0; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 2px rgba(30, 22, 56, 0.25); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #b42318; border-color: #b42318; }
.btn-danger-ghost { color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-tint); border-color: #f6c8c2; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--soft-2); border-color: transparent; }
.btn-accent { background: var(--accent-tint); border-color: var(--accent-line); color: var(--accent); }
.btn-accent:hover { background: #e7e3f7; border-color: #d2cbef; }
.btn-discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn-discord:hover { background: #4752c4; border-color: #4752c4; }
.btn-sm { min-height: var(--ctl-sm); padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { min-height: 48px; padding: 0 20px; font-size: 15.5px; border-radius: 12px; width: 100%; }
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ''; position: absolute; width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; animation: spin 0.7s linear infinite; }
.btn-primary.is-busy::after, .btn-danger.is-busy::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 550; color: var(--ink-2); }
.input { width: 100%; height: var(--ctl-in); padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; font-size: var(--fs-in); transition: border-color 0.15s, box-shadow 0.15s; }
.input::placeholder { color: var(--faint); }
.input:hover:not(:disabled) { border-color: #cfcfd4; }
.input:focus { border-color: var(--accent-mid); box-shadow: 0 0 0 3px rgba(91, 75, 183, 0.16); outline: none; }
.input:disabled { background: var(--soft); color: var(--muted); cursor: not-allowed; }
.has-error .input, .has-error .picker, .has-error .textarea { border-color: var(--bad); }
.field-error { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--bad); animation: shake 0.3s var(--ease); }
.field-warn { font-size: 12.5px; color: var(--warn); }
.field-warn:empty { display: none; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.textarea-wrap { position: relative; }
.textarea { height: auto; min-height: 96px; padding: 10px 12px 26px; line-height: 1.5; resize: vertical; }
.textarea.mono { font-size: 16px; }
.counter { position: absolute; right: 10px; bottom: 8px; font-size: 11.5px; color: var(--faint); pointer-events: none; transition: color 0.2s; }
.counter.near { color: var(--warn); }
.select-wrap { position: relative; }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer; }
.select-wrap .icon { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); }
.affix { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; background: #fff; }
.affix:focus-within { border-color: var(--accent-mid); box-shadow: 0 0 0 3px rgba(91, 75, 183, 0.16); }
.affix .input { min-width: 0; }
.affix .input { border: 0; box-shadow: none !important; border-radius: 0; }
.affix-text { display: grid; place-items: center; padding: 0 10px; background: var(--soft); color: var(--muted); font-size: 13.5px; border-right: 1px solid var(--line-2); }
.affix .affix-text:last-child { border-right: 0; border-left: 1px solid var(--line-2); }
input[type='number'].input { -moz-appearance: textfield; }
.checkbox { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; padding: 12px; min-height: 44px; background: var(--soft); border-radius: 10px; cursor: pointer; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0; min-height: 44px; }
.switch-row.is-disabled .switch-text { opacity: 0.55; }
.switch-text { display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0; }
.switch-label { font-size: 14px; font-weight: 520; }
.switch { position: relative; flex-shrink: 0; width: 44px; height: 26px; padding: 0; border: 0; border-radius: 99px; background: #dcdce1; transition: background 0.22s var(--ease); }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 0.5px rgba(0, 0, 0, 0.04); transition: transform 0.32s var(--spring), width 0.2s var(--ease); }
.switch::before { content: ''; position: absolute; inset: -9px -4px; } /* 44px tap area */
.switch:active .switch-thumb { width: 24px; }
.switch[aria-checked='true'] { background: var(--accent); }
.switch[aria-checked='true'] .switch-thumb { transform: translateX(18px); }
.switch[aria-checked='true']:active .switch-thumb { transform: translateX(14px); }
.switch:disabled { opacity: 0.45; cursor: not-allowed; }
.power .switch-row { padding: 6px 8px 6px 14px; border: 1px solid var(--line); border-radius: 99px; }

.segmented { display: flex; width: 100%; padding: 3px; background: var(--soft-2); border-radius: 11px; max-width: 100%; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.segmented::-webkit-scrollbar { display: none; }
.segmented > .fluid-active { border-radius: 8px; }
.segmented > .fluid-hover { background: rgba(255, 255, 255, 0.55); border-radius: 8px; }
.segmented button { flex: 1 0 auto; min-height: 40px; padding: 5px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 470; white-space: nowrap; transition: color 0.18s, font-weight 0.18s; }
.segmented button:hover { color: var(--ink); }
.segmented button[aria-checked='true'] { color: var(--accent); font-weight: 600; }
.segmented button:disabled { cursor: not-allowed; }
.seg-sm button { min-height: 38px; padding: 3px 11px; font-size: 13px; }

.slider-row { display: flex; align-items: center; gap: 12px; }
.slider { --p: 50%; flex: 1; min-width: 0; width: 100%; -webkit-appearance: none; appearance: none; height: 44px; background: transparent; cursor: pointer; }
.slider::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(to right, var(--accent-mid) var(--p), #e2e2e6 var(--p)); }
.slider::-moz-range-track { height: 4px; border-radius: 99px; background: linear-gradient(to right, var(--accent-mid) var(--p), #e2e2e6 var(--p)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -10px; border-radius: 50%; background: #fff; border: 1px solid #d4d4d9; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16); transition: transform 0.2s var(--spring); }
.slider::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 1px solid #d4d4d9; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16); }
.slider:active::-webkit-slider-thumb { transform: scale(1.12); }
.slider:disabled { opacity: 0.5; cursor: not-allowed; }

/* chips + picker */
.picker { position: relative; display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; align-items: center; }
.chips-empty { font-size: 13px; color: var(--faint); }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; max-width: 100%; padding: 0 4px 0 10px; overflow-wrap: anywhere; border-radius: 99px; background: var(--soft-2); font-size: 13px; font-weight: 500; animation: pop 0.24s var(--spring); }
.chip-sm { min-height: 22px; padding: 0 8px; font-size: 12px; animation: none; }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.chip-x { position: relative; display: grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.chip-x:hover { background: #e2e2e6; color: var(--ink); }
.picker-field { display: flex; align-items: center; gap: 8px; height: var(--ctl-in); padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; color: var(--faint); transition: border-color 0.15s, box-shadow 0.15s; }
.picker-field:focus-within { border-color: var(--accent-mid); box-shadow: 0 0 0 3px rgba(91, 75, 183, 0.16); }
.picker-input { flex: 1; border: 0; background: transparent; outline: none; font-size: var(--fs-in); color: var(--ink); min-width: 0; height: 100%; }
.picker-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 15; max-height: 260px; overflow-y: auto; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px -8px rgba(10, 10, 12, 0.18); animation: drop 0.16s var(--ease); }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }
.picker-group-name { padding: 8px 8px 4px; font-size: 11.5px; font-weight: 560; color: var(--faint); text-transform: uppercase; letter-spacing: 0.02em; }
.picker-opt { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 7px 8px; overflow-wrap: anywhere; border-radius: 8px; font-size: 14px; cursor: pointer; }
.picker-opt:hover, .picker-opt.is-active { background: var(--soft-2); }
.picker-opt .check { width: 16px; display: grid; place-items: center; color: var(--accent); flex-shrink: 0; }
.picker-opt[aria-selected='true'] { font-weight: 560; }
.picker-none { padding: 10px; color: var(--faint); font-size: 13px; }

/* ---------- data display ---------- */
.meter { position: relative; height: 6px; border-radius: 99px; background: var(--soft-2); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: inherit; animation: fill 0.8s var(--ease); transition: width 0.6s var(--ease); }
@keyframes fill { from { width: 0; } }
.meter.is-high .meter-fill, .meter.tone-warn .meter-fill { background: var(--warn); }
.mini-meter { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.mini-meter .meter { flex: 1; }
.usage-line { display: flex; flex-direction: column; gap: 8px; }
.usage { display: flex; flex-direction: column; }
.usage-row { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.usage-row:first-child { border-top: 0; padding-top: 2px; }
.usage-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--soft); color: var(--muted); flex-shrink: 0; }
.usage-main { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.usage-main b { font-weight: 560; font-size: 14px; }
.runs-on { font-size: 14px; color: var(--muted); }
.runs-on b { color: var(--ink); font-weight: 560; }
.free-note { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--r); background: var(--soft); }

.chart-wrap { position: relative; }
.chart { display: flex; flex-direction: column; gap: 8px; }
.chart-bars { display: flex; align-items: flex-end; gap: 2px; height: 150px; }
.chart-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 5px; }
.chart-bar { display: block; width: 100%; height: max(3px, var(--h)); background: #e4e4e8; border-radius: 5px 5px 3px 3px; transform-origin: bottom; animation: grow 0.6s var(--spring) both; animation-delay: calc(var(--i) * 22ms); transition: background 0.15s; }
.chart-col.is-last .chart-bar { background: var(--accent); }
.chart-col:hover .chart-bar { background: var(--accent-mid); }
@keyframes grow { from { transform: scaleY(0); } }
.chart-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translate(-50%, 4px); display: flex; flex-direction: column; align-items: center; padding: 6px 9px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.2s var(--ease); z-index: 3; }
.chart-tip span { color: #b9b9c0; font-size: 11px; }
.chart-col:hover .chart-tip { opacity: 1; transform: translate(-50%, 0); }
.chart-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); }
.sk-chart { height: 170px; }

.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 550; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: var(--soft); }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table td.actions { width: 1%; white-space: nowrap; }
.table td.limit .input { max-width: 140px; height: 34px; }
.ok-ic { color: var(--ok); display: inline-flex; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.rows li:first-child { border-top: 0; }
.matrix { display: grid; grid-template-columns: minmax(80px, 0.8fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; align-items: center; }
.matrix-3 { grid-template-columns: minmax(150px, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); }
.matrix .field { gap: 0; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.checklist a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 9px 6px; margin: 0 -6px; border-radius: 9px; text-decoration: none; font-size: 14px; transition: background 0.15s; }
.checklist a:hover { background: var(--soft); }
.checklist a > span:nth-child(2) { flex: 1; }
.checklist a > .icon { color: var(--faint); }
.tick { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); color: #fff; flex-shrink: 0; transition: background 0.2s, border-color 0.2s; }
.checklist .is-done .tick { background: var(--accent); border-color: var(--accent); }
.checklist .is-done a > span:nth-child(2) { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 4px 12px; padding: 10px 0; font-size: 14px; }
.timeline li time { grid-column: 2; }
.timeline li::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.timeline li:first-child::before { top: 16px; }
.timeline li:last-child::before { bottom: calc(100% - 16px); }
.tl-dot { position: relative; width: 13px; height: 13px; margin-top: 4px; border-radius: 50%; background: #fff; border: 2px solid var(--line-2); }
.timeline li:first-child .tl-dot { border-color: var(--accent-mid); }
.tl-fields { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 6px; }

/* server pieces */
.server-head .server-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.server-meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.avatar { --s: 32px; display: inline-grid; place-items: center; width: var(--s); height: var(--s); border-radius: calc(var(--s) * 0.3); background: linear-gradient(135deg, #f4f4f6, #e7e7ea); color: var(--ink-2); font-size: calc(var(--s) * 0.36); font-weight: 650; letter-spacing: -0.02em; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.vibes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 4px; background: var(--soft-2); border-radius: 13px; }
.vibes > .fluid-active { border-radius: 10px; }
.vibes > .fluid-hover { background: rgba(255, 255, 255, 0.6); border-radius: 10px; }
.vibe { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; color: var(--muted); transition: color 0.18s; }
.vibe b { font-size: 14px; font-weight: 500; color: var(--ink-2); transition: font-weight 0.18s; }
.vibe span { font-size: 12.5px; line-height: 1.35; }
.vibe[aria-checked='true'] b { font-weight: 650; color: var(--accent); }
.sample-says { display: flex; flex-direction: column; gap: 8px; }
.says { display: flex; gap: 10px; align-items: flex-start; }
.says img { flex-shrink: 0; }
.bubble { min-width: 0; overflow-wrap: anywhere; padding: 9px 13px; border-radius: 4px 16px 16px 16px; background: var(--accent-tint); font-size: 14px; line-height: 1.5; white-space: pre-line; animation: bubble 0.3s var(--spring); }
@keyframes bubble { from { transform: scale(0.96); opacity: 0.4; } }
.key-form { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--soft); }
.key-form .hint { display: flex; align-items: center; gap: 4px; }
.footer-preview { padding: 10px 12px; background: var(--soft); border-radius: 10px; }

/* servers list */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 8px; height: var(--ctl-in); padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; color: var(--faint); flex: 1 1 100%; transition: border-color 0.15s, box-shadow 0.15s; }
.search-box:focus-within { border-color: var(--accent-mid); box-shadow: 0 0 0 3px rgba(91, 75, 183, 0.16); }
.search-box .input { border: 0; height: 100%; padding: 0; box-shadow: none !important; }
.server-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.server-card { display: flex; flex-direction: column; justify-content: space-between; gap: 18px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; text-decoration: none; color: inherit; min-height: 132px; transition: border-color 0.18s, box-shadow 0.25s var(--ease), transform 0.25s var(--ease); }
.server-card.is-link:hover { border-color: #d4d4da; box-shadow: 0 10px 28px -14px rgba(10, 10, 12, 0.22); transform: translateY(-2px); }
.server-card.is-link:hover .server-go { gap: 9px; color: var(--accent); }
.server-card.is-absent { background: var(--soft); }
.server-card.is-banned { background: linear-gradient(#fff, #fff8f7); }
.server-card.is-add { align-items: center; justify-content: center; gap: 6px; text-align: center; border-style: dashed; color: var(--muted); transition: border-color 0.18s, color 0.18s; }
.server-card.is-add:hover { border-color: var(--accent-mid); color: var(--accent); }
.server-top { display: flex; gap: 12px; align-items: center; min-width: 0; }
.server-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.server-name b { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.status.ok { color: var(--ink-2); }
.status.bad { color: var(--bad); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-tint); flex-shrink: 0; }
.server-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.server-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.server-go { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 560; color: var(--muted); transition: gap 0.25s var(--spring), color 0.15s; }

/* owner bits */
.switch-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.status-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; font-size: 13px; font-weight: 520; text-decoration: none; transition: border-color 0.15s, background 0.15s; }
.status-chip:hover { border-color: #d0d0d6; background: var(--soft); }
.status-chip.tone-bad .live-dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-tint); }
.status-chip.tone-warn .live-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-tint); }
.toggle-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; max-width: 100%; overflow-wrap: anywhere; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 99px; background: #fff; font: 500 12.5px var(--mono); color: var(--ink-2); transition: background 0.15s, color 0.15s, border-color 0.15s; }
.tchip .icon { color: var(--ok); }
.tchip.is-off { background: var(--bad-tint); border-color: #f6c8c2; color: var(--bad); text-decoration: line-through; }
.tchip.is-off .icon { color: var(--bad); }
.gate-wrap { display: grid; place-items: center; padding: 24px 0; }
.gate { max-width: 440px; width: 100%; }
.gate .card-body { align-items: center; text-align: center; gap: 14px; padding: 28px 18px; }
.gate h2 { font-size: 20px; letter-spacing: -0.02em; }
.gate-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--soft-2); }
.code-form { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.code-input { height: 48px; font: 600 22px var(--mono); letter-spacing: 0.4em; text-align: center; }
.secret { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; background: var(--soft); border-radius: 10px; max-width: 100%; }
.secret code { background: none; padding: 0; overflow-wrap: anywhere; font-size: 13px; }
.versions { display: flex; flex-direction: column; gap: 8px; }
.prompt-pre { margin: 0; max-height: 280px; overflow: auto; padding: 12px; border-radius: 10px; background: var(--soft); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* accordion */
.acc { border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.acc-sum { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 12px 14px; cursor: pointer; list-style: none; border-radius: var(--r); transition: background 0.15s; }
.acc-sum::-webkit-details-marker { display: none; }
.acc-sum:hover { background: var(--soft); }
.acc-sum > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acc-sum b { font-size: 14px; font-weight: 560; }
.acc-sum .icon { transition: transform 0.25s var(--spring); color: var(--muted); }
.acc[open]:not(.closing) .acc-sum .icon { transform: rotate(180deg); }
.acc-content { overflow: hidden; transition: height 0.22s var(--ease); }
.acc-inner { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 12px; }

/* empty / error / skeleton */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 20px; border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.empty b { font-size: 16px; }
.empty p { color: var(--muted); max-width: 420px; }
.empty .row { justify-content: center; margin-top: 8px; }
.error-box { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid #f6d4d0; background: var(--bad-tint); border-radius: var(--r); color: var(--ink-2); }
.error-box > .icon { color: var(--bad); margin-top: 2px; flex-shrink: 0; }
.error-box > div { flex: 1; }
.error-box p { font-size: 14px; color: var(--muted); }
.sk { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #f2f2f4 0%, #e9e9ec 40%, #f2f2f4 80%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.sk-title { width: 36%; height: 16px; margin-bottom: 6px; }
.sk-big { height: 26px; width: 55%; }
.skeleton-lines { display: flex; flex-direction: column; gap: 10px; }
.card.is-loading .card-body { gap: 12px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* ---------- overlays ---------- */
.toasts { position: fixed; left: 12px; right: 12px; bottom: calc(84px + var(--safe-b)); z-index: 90; display: flex; flex-direction: column; align-items: stretch; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: none; padding: 10px 10px 10px 14px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 12px 32px -10px rgba(10, 10, 12, 0.4); animation: toast-in 0.32s var(--spring); }
.toast .icon { color: #8ee0a8; flex-shrink: 0; }
.toast.is-error .icon { color: #ffb4a8; }
.toast-x { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; margin-left: auto; border: 0; border-radius: 7px; background: transparent; color: #a1a1aa; }
.toast-x:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.toast.leaving { animation: toast-out 0.2s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* phones: dialogs are bottom sheets */
.dialog { width: 100vw; max-width: 100vw; max-height: 92vh; max-height: 92dvh; margin: auto 0 0; padding: 0 0 var(--safe-b); border: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; background: #fff; color: var(--ink); box-shadow: 0 -12px 48px -16px rgba(10, 10, 12, 0.35); overflow-y: auto; overscroll-behavior: contain; animation: sheet-up 0.3s var(--ease); }
.dialog:not(.sheet)::before { content: ''; display: block; width: 36px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: var(--line-2); }
.dialog.leaving:not(.sheet) { animation: sheet-down 0.18s var(--ease) forwards; }
.dialog::backdrop, .cmd::backdrop { background: rgba(14, 14, 18, 0.32); backdrop-filter: blur(2px); animation: fade 0.2s var(--ease); }
.dialog.leaving, .cmd.leaving { animation: dlg-out 0.16s var(--ease) forwards; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
@keyframes dlg-out { to { opacity: 0; transform: translateY(4px) scale(0.98); } }
@keyframes fade { from { opacity: 0; } }
.dialog-form { display: flex; flex-direction: column; }
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 0; }
.dialog-head h2 { font-size: 17px; font-weight: 620; letter-spacing: -0.015em; }
.dialog-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--soft-2); flex-shrink: 0; }
.dialog-icon.danger { background: var(--bad-tint); color: var(--bad); }
.dialog-body { display: flex; flex-direction: column; gap: 12px; padding: 14px 18px 4px; overflow-wrap: anywhere; font-size: 14px; color: var(--ink-2); }
.dialog-body .muted { font-size: 13px; }
.dialog-foot { display: flex; flex-direction: column-reverse; gap: 8px; padding: 18px 18px 16px; }
.dialog-foot .btn { width: 100%; min-height: 48px; }

.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; height: 92vh; height: 92dvh; max-height: 92dvh; border-radius: 20px 20px 0 0; border: 0; border-top: 1px solid var(--line); overflow: hidden; padding: 0; animation: sheet-up 0.32s var(--ease); }
.sheet[open] { display: flex; flex-direction: column; }
.sheet.leaving { animation: sheet-down 0.18s var(--ease) forwards; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes sheet-down { to { transform: translateY(40px); opacity: 0; } }
@keyframes sheet-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes sheet-out { to { transform: translateX(40px); opacity: 0; } }
.sheet-head { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 24px 16px 12px; border-bottom: 1px solid var(--line); }
.sheet-head::before { content: ''; position: absolute; left: 50%; top: 8px; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--line-2); }
.sheet-head > div { min-width: 0; overflow-wrap: anywhere; }
.sheet-head h2 { font-size: 18px; font-weight: 640; letter-spacing: -0.02em; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px calc(32px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; }
.sheet-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sheet-actions .label { display: block; margin-bottom: 6px; }
.stats-panel { display: flex; flex-direction: column; gap: 14px; }

/* phones: the command menu is a full-screen sheet */
.cmd { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: env(safe-area-inset-top) 0 var(--safe-b); border: 0; border-radius: 0; background: #fff; box-shadow: none; overflow: hidden; animation: sheet-up 0.22s var(--ease); }
.cmd[open] { display: flex; flex-direction: column; }
.cmd-head kbd { display: none; }
.cmd-head { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.cmd-input { flex: 1; min-width: 0; height: 56px; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.cmd-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px; }
.cmd-list > .fluid-active { background: var(--soft-2); box-shadow: none; }
.cmd-list > .fluid-hover { display: none; }
.cmd-group-name { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 560; color: var(--faint); text-transform: uppercase; letter-spacing: 0.02em; }
.cmd-item { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 10px; border-radius: 9px; font-size: 14px; cursor: pointer; color: var(--ink-2); transition: font-weight 0.15s; }
.cmd-item .icon { color: var(--muted); flex-shrink: 0; }
.cmd-item[aria-selected='true'] { color: var(--ink); font-weight: 560; }
.cmd-hint { font-size: 12px; color: var(--faint); }
.cmd-empty { padding: 28px; text-align: center; color: var(--faint); }
.cmd-foot { display: none; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); }
.cmd-foot kbd { margin-right: 2px; }

/* phones: a full-width bar pinned to the bottom, above the home indicator */
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; display: flex; align-items: center; gap: 12px; width: auto; max-width: none; padding: 10px 12px calc(10px + var(--safe-b)) 16px; border-radius: 16px 16px 0 0; background: var(--accent); color: #fff; box-shadow: 0 -10px 30px -12px rgba(30, 22, 56, 0.45); transform: translateY(calc(100% + 20px)); opacity: 0; transition: transform 0.42s var(--spring), opacity 0.2s var(--ease); }
.savebar.is-open { transform: none; opacity: 1; }
.savebar-text { display: flex; align-items: center; gap: 10px; font-size: 13.5px; min-width: 0; flex: 1; flex-wrap: wrap; }
.savebar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 3px rgba(255, 196, 61, 0.25); animation: pulse 1.8s var(--ease) infinite; flex-shrink: 0; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 196, 61, 0.06); } }
.savebar-issues { display: none; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.savebar-issues .linkish { color: #d9d3ff; text-decoration-color: rgba(217, 211, 255, 0.5); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.savebar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.savebar .btn-ghost { color: #d4d4d8; }
.savebar .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.savebar .btn-primary { background: #fff; color: var(--accent); border-color: #fff; }
.savebar .btn { min-height: 44px; }
.savebar kbd { display: none; }
.savebar .btn-primary:hover { background: #ededef; }
.savebar .btn-primary kbd { margin-left: 4px; border-color: var(--line-2); }
.savebar .btn-primary.is-busy::after { border-color: var(--accent) transparent var(--accent) transparent; }

/* ---------- sign in ---------- */
.signin { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, var(--safe-b)); background: radial-gradient(900px 420px at 50% -10%, var(--accent-tint) 0%, rgba(241, 239, 250, 0) 70%), #fff; }
.signin-brand { align-self: flex-start; display: flex; align-items: center; gap: 9px; text-decoration: none; min-height: 44px; }
.signin-brand b { font: 700 22px/1 var(--display); letter-spacing: -0.04em; }
.signin-card { margin: auto; width: min(420px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 32px 20px 24px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 24px 60px -30px rgba(10, 10, 12, 0.25); animation: page-in 0.4s var(--ease); }
.signin-mascot { animation: bob 3.2s var(--ease) infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-3deg); } }
.signin-card h1 { font: 650 26px/1.15 var(--display); letter-spacing: -0.03em; }
.signin-card .muted { margin-bottom: 8px; }
.or { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--faint); font-size: 12.5px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.signin-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 18px; padding: 16px; font-size: 13.5px; }
.signin-links a { color: var(--muted); text-decoration: none; min-height: 44px; display: flex; align-items: center; }
.signin-links a:hover { color: var(--ink); }

/* ---------- phones (base): matrix and tables as stacked cards ---------- */
.matrix, .matrix-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.matrix > span:first-child { display: none; }
.matrix > .label:nth-child(n + 4) { grid-column: 1 / -1; margin-top: 6px; }
.table-wrap { overflow-x: visible; margin: 0; padding: 0; }
.table thead { display: none; }
.table, .table tbody, .table tr, .table td { display: block; width: 100%; }
.table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
.table tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: none; }
.table td { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 5px 0; border: 0; text-align: right; overflow-wrap: anywhere; }
.table td > * { min-width: 0; max-width: 100%; }
.table td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex-shrink: 0; }
.table td:not([data-label])::before { content: none; }
.table td:first-child { font-size: 15px; text-align: left; justify-content: flex-start; }
.table td.actions { width: 100%; justify-content: flex-end; padding-top: 8px; }
.table td.num { text-align: right; }
.table td.limit .input { max-width: 140px; }

/* ---------- 641px+: tablet ---------- */
@media (min-width: 641px) {
  body.app { --ctl: 36px; --ctl-sm: 32px; --ctl-in: 38px; --fs-in: 14px; }
  .btn { white-space: nowrap; }
  .textarea.mono { font-size: 13px; }
  .big-number b { font-size: 34px; }
  .stats { gap: 12px; }
  .stat { padding: 16px 18px; }
  .stat-value { font-size: 24px; }
  .cols, .cols3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vibes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-head { padding: 18px 20px 0; flex-wrap: nowrap; }
  .card-body { padding: 16px 20px 20px; }
  .page-actions { width: auto; }
  .page-actions > * { flex: 0 0 auto; }
  .server-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .search-box { flex: 1 1 220px; min-width: 220px; }
  .segmented { display: inline-flex; width: auto; }
  .segmented button { min-height: 32px; padding: 5px 14px; }
  .seg-sm button { min-height: 28px; }
  .slider { height: 28px; }
  .chip { min-height: 28px; }
  .picker-opt, .checklist a, .acc-sum, .vibe { min-height: 0; }
  .status-chip, .tchip { min-height: 30px; }
  .timeline li { grid-template-columns: 14px minmax(0, 1fr) auto; }
  .timeline li time { grid-column: auto; }
  .code-form { flex-direction: row; }
  .gate .card-body { padding: 32px 28px; }
  .signin { padding: 20px; }
  .signin-card { padding: 36px 28px 28px; }

  .matrix { grid-template-columns: minmax(80px, 0.8fr) minmax(0, 1fr) minmax(0, 1fr); }
  .matrix-3 { grid-template-columns: minmax(150px, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); }
  .matrix > span:first-child { display: revert; }
  .matrix > .label:nth-child(n + 4) { grid-column: auto; margin-top: 0; }

  .table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
  .table thead, .table, .table tbody, .table tr, .table td { display: revert; }
  .table { width: 100%; }
  .table tr { width: auto; padding: 0; border-bottom: 0; }
  .table tbody tr:hover { background: var(--soft); }
  .table td { width: auto; padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: normal; }
  .table tr:last-child td { border-bottom: 0; }
  .table td::before { content: none; }
  .table td:first-child { font-size: inherit; }
  .table td.num { text-align: right; }
  .table td.actions { width: 1%; padding-top: 11px; }

  .savebar { left: 50%; right: auto; bottom: 20px; width: max-content; max-width: calc(100vw - 24px); gap: 16px; padding: 8px 8px 8px 16px; border-radius: 14px; box-shadow: 0 18px 40px -12px rgba(30, 22, 56, 0.5); transform: translate(-50%, calc(100% + 40px)); }
  .savebar.is-open { transform: translate(-50%, 0); }
  .savebar-text { flex: 0 1 auto; font-size: 14px; }
  .savebar-issues { display: flex; }
  .savebar kbd { display: inline-block; }
  .savebar .btn { min-height: var(--ctl-sm); }

  .toasts { left: auto; right: 20px; bottom: 20px; align-items: flex-end; }
  .toast { max-width: min(420px, calc(100vw - 32px)); }
  .toast-x { width: 26px; height: 26px; }

  .dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 64px -16px rgba(10, 10, 12, 0.35); animation: dlg-in 0.24s var(--spring); }
  .dialog-sm { width: min(400px, calc(100vw - 32px)); }
  .dialog:not(.sheet)::before { content: none; }
  .dialog.leaving:not(.sheet) { animation: dlg-out 0.16s var(--ease) forwards; }
  .dialog-head { padding: 20px 22px 0; }
  .dialog-body { padding: 14px 22px 4px; }
  .dialog-foot { flex-direction: row; justify-content: flex-end; padding: 18px 22px 20px; }
  .dialog-foot .btn { width: auto; min-height: var(--ctl); }

  .sheet { margin: 0 0 0 auto; width: min(760px, 100vw); height: 100vh; max-height: 100vh; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: 18px 0 0 18px; animation: sheet-in 0.34s var(--ease); }
  .sheet.leaving { animation: sheet-out 0.18s var(--ease) forwards; }
  .sheet-head { padding: 20px 22px 14px; }
  .sheet-head::before { content: none; }
  .sheet-body { padding: 18px 22px 40px; }

  .cmd { width: min(620px, calc(100vw - 24px)); height: auto; max-height: calc(100vh - 24vh); margin: 12vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 32px 80px -20px rgba(10, 10, 12, 0.4); animation: dlg-in 0.2s var(--spring); }
  .cmd-head kbd { display: inline-block; }
  .cmd-input { height: 54px; }
  .cmd-list { flex: 0 1 auto; max-height: min(56vh, 440px); }
  .cmd-item { min-height: 40px; }
  .cmd-foot { display: flex; }
}

/* ---------- 901px+: desktop frame with a fixed sidebar ---------- */
@media (min-width: 901px) {
  .shell { grid-template-columns: 264px minmax(0, 1fr); }
  .sidebar { position: sticky; width: auto; height: calc(100vh - var(--top)); padding: 14px 12px 12px; transform: none; visibility: visible; transition: none; box-shadow: none; border-radius: 0; }
  .scrim, .side-close, .menu-btn, .top-search, .section-tabs { display: none; }
  .topbar { padding: 0 28px; gap: 8px; }
  .top-invite span { display: inline; }
  .main { padding: 28px 40px 140px; }
  .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2.wide-first { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .page-head h1 { font-size: 28px; }
  .nav-item { min-height: 34px; }
  .tab { min-height: 36px; }
  .icon-btn { width: 36px; height: 36px; }
}

/* ---------- 1081px+: wide ---------- */
@media (min-width: 1081px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
