/* FeiraLab UI. Light by default, dark via [data-theme="dark"]. One indigo accent. */
:root {
  --bg: #f6f5fc;
  --bg-grad: linear-gradient(180deg, #f1effc 0%, #f8f7fd 320px, #f8f7fd 100%);
  --surface: #ffffff;
  --surface-2: #faf9fe;
  --surface-hover: #f3f2fb;
  --border: #e4e2f0;
  --border-strong: #d2cfe4;
  --text: #1d1b31;
  --text-2: #4a4864;
  --muted: #6e6c86;
  --accent: #5b5bf0;
  --accent-hover: #4a4ae0;
  --accent-soft: #ebebff;
  --accent-text: #4545d6;
  --on-accent: #ffffff;
  --focus: rgba(91, 91, 240, 0.45);
  --green: #15803d; --green-bg: #dcf5e4;
  --amber: #a15c07; --amber-bg: #fdf0d2;
  --red: #b42318; --red-bg: #fde4e1;
  --grey: #5b5970; --grey-bg: #eceaf4;
  --purple: #6d3fd1; --purple-bg: #ece4fb;
  --blue: #1d5fc2; --blue-bg: #dfeafd;
  --indigo: #4545d6; --indigo-bg: #e8e8ff;
  --sleep: #55597f; --sleep-bg: #e9ebf6;
  --log-bg: #12111f; --log-text: #d9d7ee; --log-dim: #7c7a98; --log-ok: #6ee7a0; --log-err: #ff8f85; --log-warn: #f5c66b;
  --shadow-sm: 0 1px 2px rgba(35, 30, 90, 0.06);
  --shadow: 0 1px 3px rgba(35, 30, 90, 0.07), 0 8px 24px rgba(35, 30, 90, 0.06);
  --shadow-lg: 0 24px 60px rgba(25, 20, 70, 0.28);
  --radius: 10px;
  --radius-sm: 7px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f0e1a;
  --bg-grad: linear-gradient(180deg, #17152b 0%, #0f0e1a 320px, #0f0e1a 100%);
  --surface: #171627;
  --surface-2: #1c1b2f;
  --surface-hover: #212039;
  --border: #2b2a44;
  --border-strong: #3a3959;
  --text: #ecebf8;
  --text-2: #c4c2de;
  --muted: #9391b0;
  --accent: #7b7bff;
  --accent-hover: #9090ff;
  --accent-soft: #25244a;
  --accent-text: #a5a5ff;
  --on-accent: #10102a;
  --focus: rgba(123, 123, 255, 0.5);
  --green: #6ee7a0; --green-bg: #12301f;
  --amber: #f5c66b; --amber-bg: #3a2c0d;
  --red: #ff8f85; --red-bg: #3d1714;
  --grey: #b0aecb; --grey-bg: #26253d;
  --purple: #c4a6ff; --purple-bg: #2d2150;
  --blue: #8fb9ff; --blue-bg: #14284a;
  --indigo: #a5a5ff; --indigo-bg: #25244a;
  --sleep: #a9aed3; --sleep-bg: #232540;
  --log-bg: #0a0a14;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.65);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg) var(--bg-grad) no-repeat;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, pre, .mono { font-family: var(--mono); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 6px; z-index: 300; }
.skip-link:focus { left: 8px; }
.icon { flex: none; vertical-align: -3px; }
#main { outline: none; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; font-size: 16px; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-link { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.nav-link:hover { background: var(--surface-hover); text-decoration: none; color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-right { display: flex; align-items: center; gap: 6px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.user-btn { width: auto; height: auto; padding: 2px; border-radius: 50%; }
body.no-shell #shell { display: none; }

/* Page */
.page { --pad-y: 112px; max-width: 1180px; margin: 0 auto; padding: 32px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 64px 0; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background 0.12s, border-color 0.12s, transform 0.05s; }
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #2a0b08; }
.btn-danger:hover { background: var(--red); filter: brightness(1.08); }
.btn-danger-ghost { color: var(--red); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 15px; border-radius: 9px; }
.btn.copied { color: var(--green); border-color: var(--green); }
.split-btn { display: inline-flex; }
.split-main { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-caret { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 0 8px; border-left-color: rgba(255, 255, 255, 0.3); }

/* Forms */
.input, .select, .textarea { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); transition: border-color 0.12s, box-shadow 0.12s; }
.textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.input::placeholder { color: var(--muted); opacity: 0.8; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.input[aria-invalid="true"] { border-color: var(--red); }
.input.mono { font-size: 13px; }
.check { width: 16px; height: 16px; accent-color: var(--accent); }
.form { display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; align-items: center; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 600; font-size: 13px; }
.field-hint { font-size: 12px; color: var(--muted); }
.field-error { font-size: 12px; color: var(--red); min-height: 0; }
.field-error:empty { display: none; }
.inline-form { display: flex; gap: 8px; margin-bottom: 14px; }
.search-box { position: relative; display: flex; align-items: center; width: 260px; color: var(--muted); }
.search-box.wide { width: 100%; max-width: 420px; margin-bottom: 14px; }
.search-box .icon { position: absolute; left: 11px; pointer-events: none; }
.search-input { padding-left: 34px; padding-right: 28px; }
.kbd { position: absolute; right: 8px; font-size: 11px; border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; color: var(--muted); background: var(--surface-2); }
.search-input:focus ~ .kbd { display: none; }
input[type="search"]::-webkit-search-cancel-button { appearance: none; }

/* Switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; padding: 4px 0; position: relative; }
.switch-text { display: flex; flex-direction: column; gap: 2px; }
.switch-label { font-weight: 600; }
.switch-desc { font-size: 12.5px; color: var(--muted); max-width: 60ch; }
.switch-input { position: absolute; opacity: 0; right: 0; width: 38px; height: 22px; margin: 0; cursor: pointer; }
.switch-track { flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--border-strong); position: relative; transition: background 0.15s; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch-input:checked ~ .switch-track { background: var(--accent); }
.switch-input:checked ~ .switch-track .switch-thumb { transform: translateX(16px); }
.switch-input:focus-visible ~ .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Cards, pills, avatars */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.card h3 { font-size: 15px; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--grey-bg); color: var(--grey); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-purple { background: var(--purple-bg); color: var(--purple); font-weight: 550; }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-indigo { background: var(--indigo-bg); color: var(--indigo); }
.pill-grey { background: var(--grey-bg); color: var(--grey); }
.pill-sleep { background: var(--sleep-bg); color: var(--sleep); }
.pill .icon { flex: none; }
.pill.pulse .dot { animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 650; overflow: hidden; border: 2px solid var(--surface); flex: none; text-transform: uppercase; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-more { background: var(--grey-bg); color: var(--grey); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar + .avatar { margin-left: -8px; }

/* Home */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin: 12px 0 28px; }
.hero-title { display: flex; align-items: center; gap: 12px; font-size: 52px; font-weight: 700; letter-spacing: -0.035em; }
.hero-tagline { font-size: 22px; color: var(--text-2); margin-top: 10px; letter-spacing: -0.015em; }
.hero-actions { display: flex; gap: 10px; }
.strip-wrap { margin-bottom: 26px; }
.strip { list-style: none; margin: 0; padding: 2px 2px 10px; display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.strip-item { flex: none; scroll-snap-align: start; }
.strip-card { display: block; width: 196px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow-sm); transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s; }
.strip-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.strip-card .thumb { width: 100%; height: 106px; border-radius: 0; }
.strip-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; }
.strip-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); flex: none; }
.dot-sleeping { background: var(--sleep); } .dot-live { background: #22c55e; } .dot-building { background: #f59e0b; } .dot-failed { background: #ef4444; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 28px; }
.stat { background: var(--surface); padding: 14px 16px; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-line { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }

/* Thumbnails */
.thumb { position: relative; width: 44px; height: 32px; border-radius: 7px; overflow: hidden; flex: none; display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.95); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); }
.thumb-initials { font-weight: 700; font-size: 13px; letter-spacing: 0.02em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); z-index: 1; }
.thumb-chrome, .thumb-lines { display: none; }
.thumb-lg { width: 112px; height: 72px; border-radius: 9px; }
.thumb-lg .thumb-initials { font-size: 22px; }
.strip-card .thumb-initials { font-size: 30px; }
.strip-card .thumb-chrome, .thumb-lg .thumb-chrome { display: flex; gap: 3px; position: absolute; top: 6px; left: 7px; }
.thumb-chrome i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); }
.strip-card .thumb-lines { display: flex; flex-direction: column; gap: 4px; position: absolute; left: 12px; bottom: 12px; opacity: 0.5; }
.thumb-lines i { height: 4px; width: 46px; border-radius: 2px; background: #fff; }
.thumb-lines i:nth-child(2) { width: 30px; } .thumb-lines i:nth-child(3) { width: 38px; }

/* Toolbar, chips, table */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 13px; border-radius: 15px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 550; cursor: pointer; }
.chip:hover { background: var(--surface-hover); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
@media (max-width: 900px) { .table .col-created, .table .col-team { display: none; } }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: 8px 12px; }
.row-link { cursor: pointer; transition: background 0.1s; }
.row-link:hover { background: var(--surface-hover); }
.name-cell { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.name-text { min-width: 0; }
.name-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.app-link { font-weight: 650; color: var(--text); }
.app-link:hover { color: var(--accent-text); }
.name-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.name-desc { font-family: var(--font); }
.kind { font-size: 12.5px; color: var(--text-2); }
.col-status { width: 110px; }
.col-updated, .col-created { white-space: nowrap; }
.table-count { padding: 9px 14px; border-top: 1px solid var(--border); }

/* Empty state */
.empty { text-align: center; padding: 56px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty-art { width: 54px; height: 54px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; }
.empty h3 { font-size: 17px; }
.error-state .empty-art { background: var(--red-bg); color: var(--red); }

/* Login */
.login { min-height: calc(100vh - var(--pad-y, 112px)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand h1 { font-size: 38px; font-weight: 700; letter-spacing: -0.03em; }
.tagline { color: var(--muted); font-size: 16px; margin-bottom: 18px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.login-form { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
.login-note { text-align: center; }
.login-card .btn-lg { width: 100%; }

/* App detail */
.app-page { display: flex; flex-direction: column; gap: 14px; }
.app-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.app-title { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-right: 4px; }
.back { margin-left: -8px; }
.app-desc { color: var(--text-2); max-width: 70ch; margin-top: 4px; }
.app-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.branch-switch .icon-btn { width: auto; }
.callout { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.callout > div:not(.callout-icon):not(.callout-main) { flex: 1; }
.callout-amber { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 35%, transparent); color: var(--amber); }
.callout-amber strong { color: inherit; }
.callout-indigo { background: var(--indigo-bg); border-color: color-mix(in srgb, var(--indigo) 25%, transparent); align-items: flex-start; }
.callout-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--surface); color: var(--accent-text); display: flex; align-items: center; justify-content: center; flex: none; }
.callout-main { flex: 1; }
.banner { margin-top: 14px; }
.callout-sleep { background: var(--sleep-bg); border-color: color-mix(in srgb, var(--sleep) 30%, transparent); color: var(--sleep); }
.callout-sleep strong { color: inherit; }
.field-row { display: flex; align-items: center; gap: 8px; }
.field-row .input { max-width: 160px; }
.meta-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.meta-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.meta-value { font-size: 13px; min-height: 26px; display: flex; align-items: center; }
.url-cell { display: inline-flex; align-items: center; gap: 2px; }
.url-cell .icon-btn { width: 28px; height: 28px; }
.url { font-size: 12.5px; }
.traffic { display: inline-flex; align-items: center; gap: 8px; }
.sparkline { display: block; }
.spark-line { stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: var(--accent); opacity: 0.12; }
.tabs { scrollbar-width: none; overflow-y: hidden; display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-top: 6px; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab-panel { padding-top: 14px; outline: none; }

/* Logs */
.logs-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
.logs-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.logview { background: var(--log-bg); color: var(--log-text); border-radius: var(--radius); padding: 12px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.65; height: 420px; overflow: auto; border: 1px solid var(--border); }
.log-line { white-space: pre-wrap; word-break: break-word; }
.log-time { color: var(--log-dim); margin-right: 10px; user-select: none; }
.log-ok .log-msg { color: var(--log-ok); }
.log-error .log-msg { color: var(--log-err); }
.log-warn .log-msg { color: var(--log-warn); }
.log-empty { color: var(--log-dim); }
.side-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 8px; }
.deploy-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 456px; overflow: auto; }
.deploy-item { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.deploy-item:hover { background: var(--surface-hover); }
.deploy-item.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.deploy-top { display: flex; justify-content: space-between; align-items: center; }
.deploy-err { color: var(--red); }

/* Env table */
.env-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.env-table td { padding: 8px 10px; }
.env-table td:first-child { width: 32%; }
.env-table td:nth-child(3) { width: 70px; }
.env-table td:nth-child(4) { width: 50px; }
.env-table .field-error { margin-top: 4px; }

/* DB, setup, settings */
.db-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.backup-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.backup { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.backup-main { display: flex; flex-direction: column; }
.setup { display: flex; flex-direction: column; gap: 18px; max-width: 820px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.step { display: flex; gap: 12px; }
.step-num { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.step-label { font-weight: 600; }
.settings { display: flex; flex-direction: column; gap: 18px; max-width: 720px; }
.settings-card h3 { margin-bottom: -4px; }
.danger-zone { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.danger-zone h3 { color: var(--red); }

/* Code blocks */
.codeblock { position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.codeblock-text { margin: 0; padding: 10px 76px 10px 12px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; white-space: pre; }
.modal .codeblock-text { white-space: pre-wrap; word-break: break-all; }
.codeblock-text code { font-family: inherit; }
.codeblock-copy { position: absolute; top: 6px; right: 6px; }
.inline-code { font-size: 0.92em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(20, 18, 48, 0.38); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 0.14s ease-out; }
.modal-backdrop.closing { opacity: 0; transition: opacity 0.14s; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-height: calc(100vh - 48px); display: flex; flex-direction: column; animation: pop 0.16s ease-out; outline: none; }
.modal-sm { max-width: 420px; } .modal-md { max-width: 560px; } .modal-lg { max-width: 720px; }
.modal-header { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; }
.modal-heading { flex: 1; min-width: 0; }
.modal-title { font-size: 17px; font-weight: 650; word-break: break-word; }
.modal-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.modal-body { padding: 4px 20px 18px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.modal-text { color: var(--text-2); }
.modal-body-fixed { height: min(540px, calc(100vh - 220px)); }
.deploy-head { display: flex; align-items: center; gap: 8px; }
.deploy-badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 11px; background: var(--grey-bg); color: var(--grey); white-space: nowrap; }
.deploy-badge.ok { background: var(--green-bg); color: var(--green); }
.deploy-badge.bad { background: var(--red-bg); color: var(--red); }
.modal .logview { height: 240px; }
.whats-next { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; border-top: 1px solid var(--border); }
.next-title { display: flex; align-items: center; gap: 7px; font-size: 14px; }

/* New dialog */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tpl { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }
.tpl:hover { background: var(--surface-hover); }
.tpl.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--focus); background: var(--accent-soft); }
.tpl-name { font-weight: 650; }
.tpl-desc { font-size: 12px; color: var(--muted); }
.tpl-rt { font-size: 11px; color: var(--accent-text); }
.matches { display: flex; flex-direction: column; gap: 8px; }
.matches:empty { display: none; }
.matches-title { font-size: 12px; font-weight: 600; color: var(--muted); }
.match { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.match-text { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.match-actions { display: flex; gap: 6px; }

/* Tokens */
.token-list { display: flex; flex-direction: column; gap: 8px; }
.token-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.token-main { flex: 1; display: flex; flex-direction: column; }
.token-fresh { display: flex; flex-direction: column; gap: 6px; }

/* Menu & toast */
.menu { position: fixed; z-index: 120; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; outline: none; animation: pop 0.1s ease-out; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-hover); outline: none; }
.menu-item.danger { color: var(--red); }
.menu-item:disabled { opacity: 0.45; }
.menu-label { flex: 1; }
.menu-hint { font-size: 11.5px; color: var(--muted); }
.menu-icon-space { width: 15px; }
.menu-divider { height: 1px; background: var(--border); margin: 5px 0; }
.menu-heading { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 6px 10px 2px; }
.menu-user { display: flex; flex-direction: column; padding: 6px 10px; }
.toasts { position: fixed; right: 16px; top: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 9px; padding: 11px 14px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); cursor: pointer; animation: pop 0.18s ease-out; font-weight: 500; }
.toast .icon { margin-top: 2px; }
.toast-success .icon { color: #4ade80; } .toast-error .icon { color: #fb7185; }
:root[data-theme="dark"] .toast-success .icon { color: #16a34a; } :root[data-theme="dark"] .toast-error .icon { color: #dc2626; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: all 0.2s; }

/* Skill, roadmap, help */
.skill-page { max-width: 980px; margin: 0 auto; }
.skill-head { margin: 24px 0 28px; }
.skill-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.skill-title { font-size: 46px; font-weight: 700; letter-spacing: -0.035em; }
.skill-sub { font-size: 20px; color: var(--text-2); margin-top: 8px; }
.install-card { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; background: var(--surface-2); }
.install-head { display: flex; align-items: baseline; gap: 10px; }
.alt-install { margin-top: 4px; } .alt-install summary { cursor: pointer; color: var(--muted); margin-bottom: 8px; }
.skill-grid { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 40px; }
.skill-main { display: flex; flex-direction: column; gap: 30px; }
.skill-main h2 { font-size: 19px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; scroll-margin-top: 72px; }
.skill-aside { position: sticky; top: 76px; align-self: start; }
.toc { display: flex; flex-direction: column; gap: 6px; border-left: 1px solid var(--border); padding-left: 14px; }
.toc-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
.toc a { color: var(--text-2); }
.cheat td { padding: 8px 12px; }
.prose { display: flex; flex-direction: column; gap: 10px; color: var(--text-2); line-height: 1.65; }
.prose h2, .prose h3, .prose h4 { color: var(--text); margin-top: 10px; font-size: 16px; }
.prose ul, .prose ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.ideas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 820px; }
.idea { display: flex; gap: 16px; align-items: flex-start; padding: 14px 16px; }
.idea-body { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.idea-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vote { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 48px; padding: 6px 0; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text-2); cursor: pointer; font-weight: 650; flex: none; }
.vote:hover { background: var(--surface-hover); }
.vote.voted { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.faq { display: flex; flex-direction: column; gap: 8px; max-width: 820px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 16px; }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; cursor: pointer; font-weight: 600; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item[open] summary .icon { transform: rotate(180deg); }
.faq-item p { padding-bottom: 14px; color: var(--text-2); }
.help-contact { display: flex; gap: 12px; align-items: flex-start; max-width: 820px; margin-top: 20px; }

/* Responsive */
@media (max-width: 900px) {
  .page { --pad-y: 84px; padding: 20px 16px 64px; }
  .nav-inner { padding: 0 12px; gap: 8px; }
  .nav-link span { display: none; }
  .nav-link { padding: 8px; }
  .hero-title { font-size: 38px; }
  .hero-tagline { font-size: 18px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .col-team, .col-created, .col-kind { display: none; }
  .logs-layout { grid-template-columns: 1fr; }
  .deploy-list { max-height: 220px; }
  .db-grid { grid-template-columns: 1fr; }
  .skill-grid { grid-template-columns: 1fr; }
  .skill-aside { display: none; }
  .skill-title { font-size: 34px; }
  .search-box { width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .meta-row { gap: 16px 22px; }
  .meta-thumb { display: none; }
  .app-title { font-size: 24px; }
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 24px); }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .col-updated { display: none; }
  .brand-word { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
