/* ==========================================================================
   Slate admin, brand: #F26B2D + black · Instrument Serif (display) + Inter (UI)
   ========================================================================== */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/inter.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/instrument-serif.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/instrument-serif-italic.woff2") format("woff2"); }

:root {
  /* Brand scale */
  --o-50: #FFF5EF; --o-100: #FFE7D9; --o-200: #FFCDB0; --o-300: #FFAA7E; --o-400: #F8874C;
  --o-500: #F26B2D; --o-600: #DB5419; --o-700: #B44113; --o-800: #8C3312; --o-900: #5C2008;
  --ink: #0D0D0E; --ink-2: #1A1A1C; --ink-3: #26262A;

  --bg: #F7F4F0;
  --surface: #FFFFFF;
  --surface-2: #FBF9F6;
  --surface-3: #F2EEE8;
  --border: #EAE4DC;
  --border-strong: #DCD4C9;
  --text: #121212;
  --text-2: #3A3835;
  --muted: #7A746C;
  --accent: var(--o-500);
  --accent-hover: var(--o-600);
  --accent-soft: var(--o-50);
  --accent-soft-2: var(--o-100);
  --accent-text: var(--o-700);
  --on-accent: #FFFFFF;
  --link: var(--o-700);
  --success: #1E8E5A; --success-soft: #E8F6EE;
  --warn: #C27C0E; --warn-soft: #FDF4E1;
  --danger: #D23B2F; --danger-soft: #FCEBE9;
  --info: #2F6FD6; --info-soft: #EAF1FC;

  --sidebar: var(--ink);
  --sidebar-hover: #19191B;
  --sidebar-text: #A19C95;
  --sidebar-line: #232326;

  --radius-sm: 8px; --radius: 12px; --radius-lg: 16px; --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(18, 18, 18, .04);
  --shadow: 0 1px 2px rgba(18, 18, 18, .04), 0 6px 20px -6px rgba(18, 18, 18, .08);
  --shadow-lg: 0 24px 60px -12px rgba(13, 13, 14, .28), 0 4px 12px rgba(13, 13, 14, .08);
  --ring: 0 0 0 3px rgba(242, 107, 45, .25);
  --font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sidebar-w: 256px;
  --topbar-h: 64px;
  color-scheme: light;
}
[data-mode="dark"] {
  --bg: #0B0B0C;
  --surface: #131315;
  --surface-2: #17171A;
  --surface-3: #1E1E22;
  --border: #26262B;
  --border-strong: #34343A;
  --text: #F3F0EC;
  --text-2: #CFC9C1;
  --muted: #8E8880;
  --accent: #F57A40;
  --accent-hover: #FF8C55;
  --accent-soft: #2A1710;
  --accent-soft-2: #3A1E12;
  --accent-text: #FFB48A;
  --link: #FF9A66;
  --success: #4ADE9B; --success-soft: #0F2219;
  --warn: #F5B544; --warn-soft: #2A2010;
  --danger: #FF6B5E; --danger-soft: #2C1513;
  --info: #7AA7FF; --info-soft: #121D33;
  --sidebar: #070708;
  --sidebar-hover: #141416;
  --sidebar-line: #1C1C1F;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.55 var(--font); font-feature-settings: "cv11", "ss01"; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 400; }
h1 { font: 400 40px/1.05 var(--serif); letter-spacing: -.01em; }
h1 em, h2 em { font-style: italic; color: var(--accent); }
h2 { font: 400 21px/1.2 var(--serif); letter-spacing: 0; }
h3 { font: 600 14.5px/1.3 var(--font); letter-spacing: -.01em; }
p { margin: 0 0 .75em; }
::selection { background: var(--o-200); color: var(--ink); }
code, kbd, pre { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; color: var(--text-2); }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; overflow: auto; }
pre code { background: none; padding: 0; }
pre { max-width: 100%; }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 11px; color: var(--muted); background: var(--surface); }
hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
img { max-width: 100%; }
.ic { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.small, small { font-size: 12.5px; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.text-success { color: var(--success); }
.req { color: var(--accent); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 999; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- Wordmark ---------- */
.wordmark { display: inline-flex; align-items: center; gap: 10px; }
.wordmark-text { font: 400 27px/1 var(--serif); letter-spacing: -.01em; color: #fff; }
.wordmark-text i { font-style: normal; color: var(--o-500); }
.logo-mark { flex-shrink: 0; display: block; border-radius: 25%; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; z-index: 50; transition: width .2s ease, transform .25s ease; overflow: hidden;
}
.sidebar::before { content: ""; position: absolute; width: 320px; height: 320px; left: -160px; top: -180px; background: radial-gradient(closest-side, rgba(242, 107, 45, .22), transparent); pointer-events: none; }
.brand { position: relative; height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 20px; }
.brand-link { display: flex; align-items: center; color: #fff; }
.brand-link:hover { color: #fff; }
.nav-collapse { color: #6A655F; }
.nav-collapse:hover { background: var(--sidebar-hover) !important; color: #fff !important; }
.nav { position: relative; flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: #2a2a2e transparent; }
.nav-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: #5E5953; padding: 18px 12px 8px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--sidebar-text);
  font-weight: 500; font-size: 13.5px; position: relative; transition: background .15s, color .15s;
}
.nav-link .ic { color: #6E6962; transition: color .15s; }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link:hover .ic { color: #D6D1CA; }
.nav-link.active { background: linear-gradient(100deg, rgba(242, 107, 45, .2), rgba(242, 107, 45, .06) 70%); color: #fff; }
.nav-link.active .ic { color: var(--o-500); }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--o-500); box-shadow: 0 0 12px var(--o-500); }
.nav-sub { display: flex; flex-direction: column; padding: 4px 0 8px 42px; position: relative; }
.nav-sub::before { content: ""; position: absolute; left: 21px; top: 4px; bottom: 10px; width: 1px; background: var(--sidebar-line); }
.nav-sub a { color: #8C877F; padding: 5px 10px; border-radius: 7px; font-size: 13px; }
.nav-sub a:hover { color: #fff; }
.nav-sub a.active { color: var(--o-300); font-weight: 600; }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--o-500); margin-left: auto; box-shadow: 0 0 0 3px rgba(242, 107, 45, .25); }
.sidebar-foot { position: relative; padding: 16px 20px; border-top: 1px solid var(--sidebar-line); font-size: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #5E5953; }
.sidebar-backdrop { display: none; }

.main-wrap { flex: 1; margin-left: var(--sidebar-w); min-width: 0; transition: margin .2s ease; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.search-trigger {
  display: flex; align-items: center; gap: 10px; flex: 0 1 440px; height: 40px; padding: 0 10px 0 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); color: var(--muted); font: inherit; cursor: pointer; text-align: left; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.search-trigger span { flex: 1; }
.search-trigger:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.main { padding: 36px 40px 72px; max-width: 1480px; margin-inline: auto; }

html.nav-collapsed { --sidebar-w: 76px; }
html.nav-collapsed .wordmark-text, html.nav-collapsed .nav-link span, html.nav-collapsed .nav-label, html.nav-collapsed .nav-sub, html.nav-collapsed .sidebar-foot { display: none; }
html.nav-collapsed .brand { padding: 16px 0 6px; justify-content: center; flex-direction: column; height: auto; gap: 8px; }
html.nav-collapsed .nav-collapse .ic { transform: rotate(180deg); }
html.nav-collapsed .nav-link { justify-content: center; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head p { margin: 8px 0 0; font-size: 14.5px; }
.page-head-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-head-sticky {
  position: sticky; top: var(--topbar-h); z-index: 30; margin: -36px -40px 26px; padding: 14px 40px; align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.page-head-sticky small { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.h-compact { font: 400 26px/1.1 var(--serif); }
.save-state { font-size: 12.5px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--accent-text); margin-bottom: 10px; }
[data-mode="dark"] .eyebrow { color: var(--accent); }
.eyebrow::before { content: ""; width: 18px; height: 1.5px; background: currentColor; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 550 13.5px/1 var(--font); cursor: pointer;
  white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, box-shadow .15s, transform .08s, color .15s; text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--o-500); border-color: var(--o-500); color: #fff; box-shadow: 0 1px 2px rgba(219, 84, 25, .35), 0 6px 16px -6px rgba(242, 107, 45, .6), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn-primary:hover { background: var(--o-600); border-color: var(--o-600); color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--ink-3); border-color: var(--ink-3); color: #fff; }
[data-mode="dark"] .btn-dark { background: #F3F0EC; border-color: #F3F0EC; color: var(--ink); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:not(.btn-ghost) { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid var(--muted); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-primary.is-loading::after { border-color: #fff; border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.link { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font: inherit; display: inline-flex; align-items: center; gap: 5px; }
.link-danger { color: var(--danger); }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 0; display: inline-flex; align-items: center; justify-content: center; font: 400 19px/1 var(--serif); color: #fff; background: var(--ink); cursor: pointer; flex-shrink: 0; box-shadow: inset 0 0 0 2px var(--o-500), 0 0 0 3px var(--bg); }
[data-mode="dark"] .avatar { background: var(--o-500); box-shadow: none; }
.avatar-sm { width: 32px; height: 32px; font-size: 16px; }
.show-dark { display: none; }
[data-mode="dark"] .show-dark { display: inline-flex; }
[data-mode="dark"] .show-light { display: none; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; display: none;
}
.dropdown.open .dropdown-menu { display: block; animation: pop .14s ease-out; }
.dropdown-right { left: auto; right: 0; }
.dropdown-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; color: var(--text); font-weight: 500; }
.dropdown-menu a .ic { color: var(--muted); }
.dropdown-menu button{display:flex;align-items:center;gap:10px;width:100%;padding:9px 11px;border:0;border-radius:9px;background:none;color:var(--text);font:inherit;font-weight:500;text-align:left;cursor:pointer;white-space:nowrap}.dropdown-menu button:hover{background:var(--accent-soft);color:var(--accent-text)}
.dropdown-menu a:hover { background: var(--accent-soft); color: var(--accent-text); }
.dropdown-menu a:hover .ic { color: var(--accent); }
.dropdown-head { padding: 10px 11px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; flex-direction: column; gap: 2px; }
.dropdown-head strong { font: 400 20px/1.1 var(--serif); }
.dropdown-head small { color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); min-height: 58px; }
.card-head h2 { display: flex; align-items: center; gap: 9px; }
.card-head h2 .ic { color: var(--accent); }
.card-pad { padding: 20px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-foot > .btn-primary:last-child { margin-left: auto; }
.sticky-foot { position: sticky; bottom: 0; z-index: 5; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 20px; }
.card-grid .card { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 .card { margin: 0; }
.split { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.split-wide { grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.stack > *, .stack-sm > * { min-width: 0; }

/* ---------- Dashboard ---------- */
.hero-panel {
  position: relative; overflow: hidden; border-radius: var(--radius-xl); background: var(--ink); color: #F3F0EC; padding: 34px 36px; margin-bottom: 22px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; isolation: isolate;
}
.hero-panel::before { content: ""; position: absolute; z-index: -1; width: 520px; height: 520px; right: -120px; top: -260px; background: radial-gradient(closest-side, rgba(242, 107, 45, .55), rgba(242, 107, 45, .12) 60%, transparent); }
.hero-panel::after { content: ""; position: absolute; z-index: -1; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(90deg, transparent, #000 60%); -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%); }
.hero-panel h1 { font-size: 46px; color: #fff; }
[data-mode="dark"] .hero-panel { background: #131315; border: 1px solid var(--border); }
.hero-panel h1 em { color: var(--o-400); }
.hero-panel p { color: #A19C95; margin: 10px 0 0; font-size: 15px; }
.hero-panel .eyebrow { color: var(--o-400); }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-actions .btn:not(.btn-primary) { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); color: #F3F0EC; box-shadow: none; }
.hero-actions .btn:not(.btn-primary):hover { background: rgba(255, 255, 255, .12); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 18px 20px 18px; background: var(--surface); overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .2s, transform .2s, box-shadow .2s;
}
.stat::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(closest-side, var(--accent-soft-2), transparent); opacity: 0; transition: opacity .25s; }
.stat:hover { border-color: var(--o-300); color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat:hover::after { opacity: 1; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat-value { font: 400 44px/1 var(--serif); letter-spacing: -.01em; margin-top: 14px; }
.stat-hint { color: var(--muted); font-size: 12px; }
.stat-arrow { color: var(--border-strong); transition: color .2s, transform .2s; }
.stat:hover .stat-arrow { color: var(--accent); transform: translate(2px, -2px); }

.banner { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 18px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 18px; }
.banner > div { flex: 1 1 220px; min-width: 0; }
.banner > .ic { color: var(--accent); }
.banner-accent { background: var(--accent-soft); border-color: var(--o-200); color: var(--text); }
[data-mode="dark"] .banner-accent { border-color: var(--o-800); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 8px; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 10px; transition: background .12s; }
.list li:hover { background: var(--surface-2); }
.list-main { display: flex; align-items: center; gap: 12px; color: var(--text); min-width: 0; flex: 1; }
.list-main:hover { color: var(--text); }
.list-main span { min-width: 0; }
.list-main strong { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main small { color: var(--muted); }
.list-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; }
.list li:hover .list-icon { background: var(--accent-soft); color: var(--accent); }
.list-compact li { padding: 7px 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); } .dot-warn { background: var(--o-500); box-shadow: 0 0 0 4px var(--accent-soft); } .dot-info { background: var(--info); box-shadow: 0 0 0 4px var(--info-soft); }

/* ---------- Pills & status ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; border-radius: 99px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill-soft { font-weight: 500; }
.pill-accent { background: var(--o-500); color: #fff; }
.pill-accent:hover { color: #fff; background: var(--o-600); }
.pill-success { background: var(--success-soft); color: var(--success); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; font-size: 11.5px; font-weight: 600; border-radius: 99px; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-publish { background: var(--success-soft); color: var(--success); }
.status-draft { background: var(--surface-3); color: var(--muted); }
.status-pending, .status-scheduled { background: var(--accent-soft); color: var(--accent-text); }
.status-private { background: var(--info-soft); color: var(--info); }
.status-trash { background: var(--danger-soft); color: var(--danger); }

/* ---------- Alerts / toasts ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); font-size: 13.5px; border: 1px solid transparent; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); }
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 44px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 13px 18px 13px 14px; border-radius: 14px; background: var(--ink); color: #F3F0EC;
  box-shadow: var(--shadow-lg); font-weight: 500; animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.2); max-width: 440px; border: 1px solid #2a2a2e;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--o-500); flex-shrink: 0; box-shadow: 0 0 10px var(--o-500); }
.toast .ic { display: none; }
.toast-success::before { background: #4ADE9B; box-shadow: 0 0 10px #4ADE9B; }
.toast-error::before { background: #FF6B5E; box-shadow: 0 0 10px #FF6B5E; }
.toast.out { animation: toastOut .2s ease-in forwards; }
[data-mode="dark"] .toast { background: #F3F0EC; color: var(--ink); border-color: transparent; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field > span { font-weight: 550; font-size: 13px; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field > label.switch-row { justify-content: flex-start; font-weight: 500; }
.help { color: var(--muted); font-size: 12px; line-height: 1.5; }
.input {
  width: 100%; height: 40px; padding: 0 13px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text);
  font: 14px var(--font); transition: border-color .15s, box-shadow .15s, background .15s; box-shadow: var(--shadow-sm);
}
textarea.input { height: auto; padding: 10px 13px; line-height: 1.55; resize: vertical; }
select.input { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A746C' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--o-500); box-shadow: var(--ring); }
.input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.input-sm { height: 34px; font-size: 13px; padding: 0 11px; }
.input-lg { height: 50px; font-size: 15px; border-radius: 12px; padding: 0 16px; }
.input-num { max-width: 160px; }
.input.code, textarea.code { font: 12.5px/1.65 var(--mono); tab-size: 2; background: var(--surface-2); }
.input-group { display: flex; gap: 6px; align-items: center; }
.input-group .input { flex: 1; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.span-2 { grid-column: span 2; }
.field-grid { display: flex; flex-wrap: wrap; gap: 18px; }
.field-grid > .field { flex: 0 0 calc(var(--w, 100%) - 18px); }
.field-grid > .field[style*="--w:100%"] { flex-basis: 100%; }
.choice { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 0; }
.choice-list { display: flex; flex-direction: column; gap: 4px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.choice-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 500; transition: border-color .15s, background .15s; }
.choice-card:hover { border-color: var(--border-strong); }
.choice-card:has(input:checked) { border-color: var(--o-500); background: var(--accent-soft); }
input[type=checkbox], input[type=radio] { accent-color: var(--o-500); width: 16px; height: 16px; margin: 0; }
.switch { appearance: none; width: 40px !important; height: 23px !important; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s cubic-bezier(.3, 1.4, .5, 1); }
.switch:checked { background: var(--o-500); }
.switch:checked::after { transform: translateX(17px); }
.switch-row { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.seg { display: inline-flex; padding: 4px; background: var(--surface-3); border-radius: 12px; gap: 3px; }
.seg label { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 550; color: var(--muted); }
.seg label:has(input:checked) { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.seg input { display: none; }
.inline-form { display: flex; gap: 8px; }
.color-input { width: 46px; height: 40px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.strength { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.strength i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.otp { letter-spacing: .35em; font: 600 22px var(--mono); text-align: center; }
.small-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-top: 8px; font-weight: 600; }
.section-title { margin: 26px 0 12px; font: 400 20px var(--serif); color: var(--text); }
.section-title:first-of-type { margin-top: 8px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 18px; margin: 0; }
legend { font: 400 19px var(--serif); padding: 0 8px; }

/* ---------- Tabs ---------- */
.tabs-pill { display: inline-flex; gap: 2px; padding: 4px; background: var(--surface-3); border-radius: 12px; flex-wrap: wrap; }
.tabs-pill a, .tabs-pill button { padding: 7px 13px; border-radius: 9px; color: var(--muted); font: 550 13px var(--font); border: 0; background: none; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; transition: color .15s; }
.tabs-pill a:hover, .tabs-pill button:hover { color: var(--text); }
.tabs-pill a span { font-size: 11px; color: var(--muted); background: var(--surface); padding: 0 7px; border-radius: 99px; line-height: 18px; }
.tabs-pill .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs-pill .active span { background: var(--o-500); color: #fff; }
.tabs-sm button { padding: 5px 11px; font-size: 12.5px; }
.tabs-line { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs-line a { display: flex; align-items: center; gap: 8px; padding: 11px 14px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs-line a:hover { color: var(--text); }
.tabs-line a.active { color: var(--text); border-bottom-color: var(--o-500); }
.tabs-line a.active .ic { color: var(--o-500); }

/* ---------- Toolbar & tables ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-inline { position: relative; display: flex; align-items: center; }
.search-inline .ic { position: absolute; left: 12px; color: var(--muted); }
.search-inline .input { padding-left: 36px; width: 290px; }
.ml-toolbar .search-inline .input { padding-left: 13px; }
.table-wrap { overflow-x: auto; }
.table-wrap > .table-form { min-width: 620px; }
.table-form code { white-space: nowrap; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table thead tr:first-child th:first-child { border-top-left-radius: var(--radius-lg); }
.table thead tr:first-child th:last-child { border-top-right-radius: var(--radius-lg); }
.table th.center, .table td.center { text-align: center; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-current { background: var(--accent-soft); }
.table-compact td, .table-compact th { padding: 9px 14px; }
.table-form td { padding: 9px 12px; }
.col-check { width: 44px; }
.row-title { font-weight: 600; color: var(--text); margin-right: 6px; font-size: 14px; }
.row-title:hover { color: var(--accent); }
.row-actions { display: flex; gap: 14px; font-size: 12.5px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
tr:hover .row-actions, tr:focus-within .row-actions { opacity: 1; }
.row-actions a, .row-actions .link { color: var(--muted); font-size: 12.5px; }
.row-actions a:hover, .row-actions .link:hover { color: var(--accent); }
.bulk-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--ink); color: #fff; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.bulk-bar .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #fff; box-shadow: none; }
.bulk-bar .btn:hover { background: rgba(255,255,255,.16); }
.bulk-bar .btn-danger { color: #FF9B91; }
.bulk-count { font-weight: 600; margin-right: 8px; color: var(--o-300); }
.pager { justify-content: space-between; }
.pager div { display: flex; align-items: center; gap: 10px; }
.seo-dots { display: inline-flex; gap: 4px; }
.seo-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.seo-dots i.on { background: var(--o-500); }
.user-cell { display: flex; align-items: center; gap: 12px; color: var(--text); }
.user-cell:hover { color: var(--text); }
.user-cell span { display: flex; flex-direction: column; }
.caps-table td:first-child { color: var(--text-2); }
.cap-yes { color: var(--o-500); }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 64px 20px; color: var(--muted); }
.empty-state > .ic { color: var(--o-400); margin-bottom: 4px; }
.empty-state h1, .empty-state h2 { color: var(--text); font: 400 26px var(--serif); }
.empty-state .btn { margin-top: 10px; }

/* ---------- Type / module cards ---------- */
.type-icon { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--o-400); flex-shrink: 0; }
[data-mode="dark"] .type-icon { background: var(--accent-soft-2); }
.type-body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.type-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.module-card h3 { margin: 16px 0 4px; font: 400 23px var(--serif); }
.module-card.is-active { border-color: var(--o-300); box-shadow: 0 0 0 3px var(--accent-soft); }
.module-card.is-active .type-icon { background: var(--o-500); color: #fff; }
.module-card.has-error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.module-card .card-pad { display: flex; flex-direction: column; height: 100%; }
.module-card .card-pad > p.muted { flex: 1; }
.module-deps { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 0 0 10px; }
.module-update { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; margin: 0 0 12px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 13px; font-weight: 550; }
.module-update span { display: inline-flex; gap: 6px; align-items: center; }
.module-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.module-links { display: inline-flex; gap: 12px; font-size: 13px; }
.module-meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 13.5px; }
.module-meta dt { color: var(--muted); }
.module-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.module-filter { margin-bottom: 16px; }
.module-filter .input { max-width: 340px; }
.module-add { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.module-file { padding: 0; }
.module-file > summary { cursor: pointer; list-style: none; }
.module-file > summary::-webkit-details-marker { display: none; }
.module-file pre { margin: 0; border: 0; border-radius: 0 0 var(--radius) var(--radius); max-height: 520px; }
.scan-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.scan-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.banner-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.banner-danger > .ic { color: var(--danger); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
label.check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
@media (max-width: 520px) { .module-add { grid-template-columns: 1fr; } .module-update { flex-wrap: wrap; } }

/* ---------- Settings ---------- */
.settings-tabs { display: flex; gap: 2px; overflow-x: auto; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 24px; box-shadow: var(--shadow-sm); scrollbar-width: none; }
.settings-tabs a { display: flex; align-items: center; gap: 8px; padding: 10px 15px; border-radius: 11px; color: var(--muted); font-weight: 550; white-space: nowrap; transition: color .15s, background .15s; }
.settings-tabs a:hover { color: var(--text); background: var(--surface-2); }
.settings-tabs a.active { background: var(--ink); color: #fff; box-shadow: 0 4px 12px -4px rgba(13,13,14,.5); }
.settings-tabs a.active .ic { color: var(--o-400); }
[data-mode="dark"] .settings-tabs a.active { background: var(--o-500); }
[data-mode="dark"] .settings-tabs a.active .ic { color: #fff; }
.settings-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-side { position: sticky; top: calc(var(--topbar-h) + 18px); display: flex; flex-direction: column; gap: 2px; }
.settings-side a { position: relative; padding: 9px 14px; border-radius: 10px; color: var(--text-2); font-weight: 500; transition: background .15s, color .15s; }
.settings-side a:hover { background: var(--surface); color: var(--text); }
.settings-side a.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); padding-left: 24px; }
.settings-side a.active::before { content: ""; position: absolute; left: 11px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--o-500); }
.settings-body { margin: 0; }
.settings-body > .card-head { padding: 20px 24px; }
.settings-body > .card-head h2 { font-size: 28px; }
.settings-fields { padding: 4px 0; }
.setting-row { display: grid; grid-template-columns: minmax(200px, 320px) minmax(0, 1fr); gap: 28px; padding: 18px 24px; border-bottom: 1px solid var(--border); align-items: start; }
.setting-row:last-child { border-bottom: 0; }
.setting-label { display: flex; flex-direction: column; gap: 4px; padding-top: 9px; }
.setting-label label, .setting-label strong { font-weight: 600; }
.setting-control { min-width: 0; padding-top: 1px; }
.setting-control .switch { margin-top: 8px; }
.setting-control > .input:not(.input-num):not(textarea) { max-width: 540px; }
.setting-row.is-danger .setting-label label { color: var(--danger); }
.setting-info { background: var(--surface-2); }

.update-box { display: flex; align-items: center; gap: 22px; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--radius-lg); flex-wrap: wrap; }
.update-box.has-update { border-color: var(--o-300); background: var(--accent-soft); }
.update-version { display: flex; flex-direction: column; }
.update-version strong { font: 400 34px/1.1 var(--serif); }
.update-actions { margin-left: auto; display: flex; gap: 8px; }
.release-notes pre { white-space: pre-wrap; font-family: var(--font); font-size: 13.5px; max-height: 300px; }

/* ---------- Editor screen ---------- */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 26px; align-items: start; }
.editor-side { padding-bottom: 20px; } /* scrolls with the page: one scrollbar */
.editor-side .card { margin-bottom: 14px; }
.editor-side .card-head { padding: 13px 18px; min-height: 50px; }
.editor-side .card-head h2 { font-size: 19px; }
.editor-side .card-pad { padding: 16px 18px; }
.title-input { width: 100%; border: 0; background: transparent; font: 400 48px/1.1 var(--serif); letter-spacing: -.01em; color: var(--text); padding: 4px 0; outline: none; }
.title-input:focus-visible { box-shadow: none; }
.title-input::placeholder { color: var(--border-strong); font-style: italic; }
.title-input-sm { font-size: 30px; }
.permalink { display: flex; align-items: center; gap: 4px; margin: 4px 0 20px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.permalink .ic { color: var(--o-500); }
.slug-input { border: 0; border-bottom: 1px dashed var(--border-strong); background: transparent; color: var(--accent-text); font: 550 13px var(--font); padding: 1px 2px; min-width: 60px; outline: none; }
[data-mode="dark"] .slug-input { color: var(--accent); }
.slug-input:focus { border-bottom-color: var(--o-500); }
.meta-list { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; padding-top: 10px; border-top: 1px solid var(--border); }
.meta-list div { display: flex; justify-content: space-between; color: var(--muted); }
.meta-list div span:last-child { color: var(--text-2); }
.side-links { display: flex; justify-content: space-between; font-size: 13px; }
.term-checklist { display: flex; flex-direction: column; max-height: 220px; overflow: auto; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:not(:empty) { margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 11px; background: var(--ink); color: #fff; border-radius: 99px; font-size: 12.5px; font-weight: 500; }
[data-mode="dark"] .chip { background: var(--accent-soft-2); color: var(--accent-text); }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; width: 19px; height: 19px; border-radius: 50%; line-height: 1; font-size: 14px; opacity: .7; }
.chip button:hover { background: var(--o-500); opacity: 1; }
.tag-input, .relation-field { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 20; max-height: 240px; overflow: auto; padding: 4px; }
.suggest button { display: flex; width: 100%; text-align: left; padding: 8px 11px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; justify-content: space-between; gap: 8px; }
.suggest button:hover, .suggest button.active { background: var(--accent-soft); }
.suggest small { color: var(--muted); }

/* Rich text editor */
.editor { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 20px; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.editor:focus-within { border-color: var(--border-strong); box-shadow: var(--shadow); }
.ed-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1px; padding: 7px 8px; border-bottom: 1px solid var(--border); position: sticky; top: calc(var(--topbar-h) + 73px); background: var(--surface); z-index: 10; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.editor-sm .ed-toolbar { position: static; }
.ed-toolbar button, .ed-toolbar select { height: 32px; min-width: 30px; padding: 0 6px; border: 0; background: none; border-radius: 8px; color: var(--text-2); cursor: pointer; font: 600 13px var(--font); display: inline-flex; align-items: center; justify-content: center; transition: background .12s, color .12s; }
.ed-toolbar select { padding-right: 24px; appearance: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%237A746C' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 7px center; font-weight: 550; }
.ed-toolbar button:hover, .ed-toolbar select:hover { background: var(--surface-3); color: var(--text); }
.ed-toolbar button.on { background: var(--ink); color: var(--o-400); }
[data-mode="dark"] .ed-toolbar button.on { background: var(--accent-soft-2); color: var(--accent-text); }
.ed-sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }
.ed-toolbar .ed-right { margin-left: auto; }
.ed-area { min-height: 400px; padding: 26px 30px; outline: none; font-size: 16.5px; line-height: 1.75; color: var(--text); }
.editor-sm .ed-area { min-height: 140px; padding: 14px 16px; font-size: 14.5px; }
.ed-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.ed-area > :first-child { margin-top: 0; }
.ed-area h2 { font: 400 32px/1.2 var(--serif); margin: 1.3em 0 .45em; }
.ed-area h3 { font: 400 25px/1.25 var(--serif); margin: 1.25em 0 .45em; }
.ed-area h4 { font: 600 17px var(--font); margin: 1.2em 0 .4em; }
.ed-area p { margin: 0 0 1em; }
.ed-area blockquote { margin: 1.2em 0; padding: 6px 22px; border-left: 3px solid var(--o-500); color: var(--text-2); font: italic 400 22px/1.45 var(--serif); }
.ed-area img { border-radius: 10px; height: auto; }
.ed-area a { text-decoration: underline; text-decoration-color: var(--o-300); text-underline-offset: 3px; }
.ed-area pre { white-space: pre-wrap; }
.ed-area table { border-collapse: collapse; width: 100%; }
.ed-area td, .ed-area th { border: 1px solid var(--border); padding: 7px 11px; }
.ed-source { display: block; width: 100%; min-height: 400px; border: 0; padding: 20px 24px; font: 13px/1.7 var(--mono); background: var(--surface-2); color: var(--text); outline: none; resize: vertical; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.ed-foot { display: flex; justify-content: space-between; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

/* SEO */
.serp { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; background: var(--surface-2); font-family: Arial, sans-serif; }
.serp-site { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); }
.serp-site > span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.serp-site small { color: var(--muted); font-size: 12px; word-break: break-all; }
.serp-fav { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); border: 3px solid var(--surface-3); }
.serp-title { color: #1a0dab; font-size: 19px; line-height: 1.3; margin: 8px 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-mode="dark"] .serp-title { color: #99c3ff; }
.serp-desc { color: var(--text-2); font-size: 13.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.counter { font-weight: 550; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.ok { color: var(--success); } .counter.over { color: var(--danger); } .counter.short { color: var(--o-600); }
.seo-checks { list-style: none; padding: 0; margin: 4px 0 16px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.seo-checks li { display: flex; gap: 9px; align-items: center; }
.seo-checks li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--o-400); flex-shrink: 0; }
.seo-checks li.good::before { background: var(--success); }
.seo-checks li.bad::before { background: var(--danger); }
.seo-panel .field { margin-bottom: 16px; }

/* Media field */
.media-field-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.media-field-preview:not(:empty) { margin-bottom: 10px; }
.media-field-preview figure { margin: 0; width: 96px; height: 96px; border-radius: 11px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-3) repeating-conic-gradient(var(--surface-2) 0 25%, transparent 0 50%) 50% / 16px 16px; display: flex; align-items: center; justify-content: center; }
.media-field-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-field-lg .media-field-preview figure { width: 100%; height: auto; aspect-ratio: 16/10; }
.media-field-lg .media-field-preview img { object-fit: contain; }
.media-field-actions { display: flex; gap: 6px; }
.file-chip { font-size: 11px; padding: 6px; word-break: break-all; text-align: center; }
.gallery-preview figure { cursor: pointer; }

/* Media library app */
.media-app { min-height: 300px; }
.ml-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.ml-toolbar .search-inline .input { width: 260px; }
[data-mode="library"] .ml-toolbar > label.btn { display: none; }
.ml-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.ml-layout.no-detail { grid-template-columns: minmax(0, 1fr); }
.ml-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ml-item { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; border: 2px solid transparent; background: var(--surface-3) repeating-conic-gradient(var(--surface-2) 0 25%, transparent 0 50%) 50% / 16px 16px; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; transition: border-color .15s, transform .15s; }
.ml-item img { width: 100%; height: 100%; object-fit: cover; }
.ml-item:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.ml-item.selected { border-color: var(--o-500); box-shadow: var(--ring); }
.ml-item .ml-check { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--o-500); color: #fff; display: none; align-items: center; justify-content: center; font-size: 13px; }
.ml-item.selected .ml-check { display: flex; }
.ml-item .ml-ext { font: 400 26px var(--serif); color: var(--muted); text-transform: uppercase; }
.ml-item .ml-badge { position: absolute; bottom: 8px; left: 8px; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--o-500); color: #fff; letter-spacing: .02em; }
.ml-drop { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 28px; text-align: center; color: var(--muted); margin-bottom: 16px; transition: border-color .15s, background .15s; background: var(--surface); }
.ml-drop.over { border-color: var(--o-500); background: var(--accent-soft); color: var(--accent-text); }
.ml-progress { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.ml-progress div { font-size: 12.5px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; display: flex; justify-content: space-between; }
.ml-detail { position: sticky; top: calc(var(--topbar-h) + 18px); }
.ml-detail .preview { border-radius: 12px; overflow: hidden; background: var(--surface-3) repeating-conic-gradient(var(--surface-2) 0 25%, transparent 0 50%) 50% / 16px 16px; display: flex; justify-content: center; margin-bottom: 12px; max-height: 240px; }
.ml-detail .preview img { object-fit: contain; max-height: 240px; }
.ml-meta { font-size: 12.5px; color: var(--muted); display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin-bottom: 14px; }
.ml-meta b { color: var(--text-2); font-weight: 550; }
.ml-saved { color: var(--success); font-weight: 650; }
.ml-more { display: flex; justify-content: center; padding: 16px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(13, 13, 14, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .15s; }
.modal-box { background: var(--bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: min(1180px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); animation: pop .2s; }
.modal-sm .modal-box { width: min(560px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); background: var(--surface); }
.modal-head h2 { font-size: 25px; }
.modal-body { padding: 20px 22px; overflow: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface); }
.ai-preview { max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; background: var(--surface); line-height: 1.7; }
@keyframes fade { from { opacity: 0; } }

/* Command palette */
.palette { position: fixed; inset: 0; z-index: 180; background: rgba(13, 13, 14, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: flex; justify-content: center; padding-top: 12vh; }
.palette-box { width: min(640px, calc(100% - 32px)); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; animation: pop .15s; align-self: flex-start; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--border); color: var(--o-500); }
.palette-input input { flex: 1; border: 0; background: none; height: 60px; font: 400 24px var(--serif); color: var(--text); outline: none; }
.palette-input input::placeholder { color: var(--muted); font-style: italic; }
.palette-results { overflow-y: auto; padding: 8px; }
.palette-group { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: 12px 12px 6px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 500; }
.palette-item:hover { color: var(--text); }
.palette-item small { margin-left: auto; color: var(--muted); font-weight: 400; }
.palette-item.active { background: var(--ink); color: #fff; }
.palette-item.active small { color: var(--o-300); }
[data-mode="dark"] .palette-item.active { background: var(--o-500); }
[data-mode="dark"] .palette-item.active small { color: #fff; }
.palette-foot { display: flex; gap: 16px; padding: 10px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--surface-2); }

/* Field builder */
.fb-list { display: flex; flex-direction: column; }

/* Repeater */
.repeater-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.repeater-row { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface-2); position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.repeater-row .rr-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; }

/* Menu builder */
.mb { display: flex; flex-direction: column; gap: 16px; min-width: 0; container-type: inline-size; }
.mb .card { padding: 16px; }
.mb-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.mb-head .field { flex: 1 1 180px; min-width: 0; margin: 0; }
.mb-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mb-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.mb-add { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mb-tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 10px; }
.mb-tabs button { flex: 1; border: 0; background: transparent; padding: 7px 6px; border-radius: 8px; font: 550 12.5px/1.2 var(--font); color: var(--muted); cursor: pointer; }
.mb-tabs button:hover { color: var(--text); }
.mb-tabs button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.mb-search { display: flex; flex-direction: column; gap: 8px; }
.mb-q { position: relative; display: block; }
.mb-q .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.mb-q .input { padding-left: 34px; width: 100%; }
.mb-results { margin-top: 8px; max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: var(--surface-2); }
.mb-results > p { margin: 4px 6px; }
.mb-result { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 8px; border-radius: 8px; cursor: pointer; }
.mb-result:hover { background: var(--surface-3); }
.mb-result > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mb-result strong { font-weight: 550; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-result small { color: var(--muted); font-size: 11.5px; }
.mb-result .icon-btn { width: 30px; height: 30px; flex-shrink: 0; }
.mb-results-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.mb-tree { min-width: 0; }
.mb-tree-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
.mb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mb-list .mb-list { margin: 6px 0 0 28px; position: relative; }
.mb-list .mb-list::before { content: ""; position: absolute; left: -15px; top: 0; bottom: 20px; width: 2px; border-radius: 2px; background: var(--border); }
.mb-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); position: relative; transition: border-color .15s, box-shadow .15s; }
.mb-row:hover { border-color: var(--border-strong); }
.mb-grip { cursor: grab; color: var(--muted); display: inline-flex; padding: 6px 2px; flex-shrink: 0; }
.mb-row:active .mb-grip { cursor: grabbing; }
.mb-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 0; background: transparent; padding: 4px 2px; text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.mb-title strong { font-weight: 600; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-title small { color: var(--muted); font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-warn { color: var(--warn); display: inline-flex; align-items: center; gap: 3px; vertical-align: -2px; }
.mb-tools { display: flex; gap: 0; flex-shrink: 0; opacity: .55; transition: opacity .15s; }
.mb-row:hover .mb-tools, .mb-row:focus-within .mb-tools { opacity: 1; }
.mb-tools .icon-btn { width: 30px; height: 30px; border-radius: 8px; }
.mb-tools .icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.mb-tools .mb-del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.mb-chev { color: var(--muted); display: inline-flex; transition: transform .15s; flex-shrink: 0; pointer-events: none; }
.mb-item.is-open > .mb-row { border-color: var(--accent); }
.mb-item.is-open > .mb-row .mb-chev { transform: rotate(90deg); }
.mb-details { margin: 6px 0 4px 28px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); display: grid; gap: 12px; }
.mb-details .field { margin: 0; }
.mb-details p { margin: 0; }
.mb-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.mb-item.is-dragging > .mb-row { opacity: .4; }
.mb-row.drop-before::before, .mb-row.drop-after::after { content: ""; position: absolute; left: 0; right: 0; height: 3px; border-radius: 3px; background: var(--accent); }
.mb-row.drop-before::before { top: -5px; }
.mb-row.drop-after::after { bottom: -5px; }
.mb-row.drop-inside { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.mb-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 16px; border: 2px dashed var(--border); border-radius: 12px; text-align: center; color: var(--muted); }
.mb-empty strong { color: var(--text); }
@container (max-width: 820px) {
  .mb-layout { grid-template-columns: minmax(0, 1fr); }
  .mb-add { position: static; }
}
@container (max-width: 480px) {
  .mb-tools { opacity: 1; }
  .mb-tools .icon-btn { width: 28px; }
  .mb-list .mb-list { margin-left: 16px; }
  .mb-list .mb-list::before { left: -10px; }
  .mb-details { margin-left: 0; }
  .mb-chev { display: none; }
}

/* 2FA */
.qr-box { display: flex; gap: 16px; align-items: center; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.qr-icon { width: 58px; height: 58px; border-radius: 16px; background: var(--ink); color: var(--o-400); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.secret { font-size: 15px; letter-spacing: .08em; padding: 7px 11px; display: inline-block; word-break: break-all; }

/* ---------- Auth pages (login / install) ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.auth-art {
  position: relative; overflow: hidden; background: var(--ink); color: #F3F0EC; padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between; isolation: isolate;
}
.auth-art::before { content: ""; position: absolute; z-index: -1; width: 780px; height: 780px; left: -220px; bottom: -420px; background: radial-gradient(closest-side, rgba(242, 107, 45, .75), rgba(242, 107, 45, .18) 55%, transparent); filter: blur(4px); }
.auth-art::after { content: ""; position: absolute; z-index: -1; inset: 0; background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 34px 34px; mask-image: radial-gradient(ellipse at 30% 100%, #000, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at 30% 100%, #000, transparent 75%); }
.auth-art .wordmark-text { font-size: 30px; }
.auth-quote { font: 400 clamp(40px, 4.6vw, 68px)/1.02 var(--serif); letter-spacing: -.015em; max-width: 560px; margin: 0; }
.auth-quote em { color: var(--o-400); }
.auth-points { display: flex; gap: 22px; flex-wrap: wrap; color: #A19C95; font-size: 13px; margin-top: 26px; }
.auth-points span { display: inline-flex; align-items: center; gap: 8px; }
.auth-points span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--o-500); box-shadow: 0 0 10px var(--o-500); }
.auth-art-foot { font-size: 12px; color: #6E6962; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card-wide { max-width: 600px; }
.auth-brand { margin-bottom: 28px; }
.auth-brand h1 { font-size: 44px; margin: 0 0 6px; }
.auth-brand p { font-size: 15px; }
.auth-brand .logo-mark { margin-bottom: 22px; display: none; }
.auth-card .alert { margin-bottom: 16px; }
.auth-foot { margin: 22px 0 0; font-size: 13px; }
.auth-foot a { color: var(--muted); }
.auth-foot a:hover { color: var(--accent); }
.req-list { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; font-size: 13px; background: var(--surface); }
.req-list summary { cursor: pointer; font-weight: 600; }
.req-list ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.req-list .ok { color: var(--success); } .req-list .bad { color: var(--danger); font-weight: 600; }
.prose pre { margin: 0 0 12px; }

/* ---------- Responsive ---------- */
.mobile-only { display: none; }
@media (max-width: 1280px) { .editor-layout { grid-template-columns: minmax(0, 1fr) 310px; } }
@media (max-width: 1100px) {
  .editor-layout, .split, .split-wide, .ml-layout { grid-template-columns: minmax(0, 1fr); }
  .editor-side { position: static; max-height: none; overflow: visible; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .hide-md { display: none; }
  .ml-detail { position: static; }
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth-brand .logo-mark { display: block; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); width: 270px !important; box-shadow: var(--shadow-lg); }
  html.nav-open .sidebar { transform: none; }
  html.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 45; }
  html.nav-collapsed .wordmark-text, html.nav-collapsed .nav-link span, html.nav-collapsed .nav-label { display: initial; }
  .nav-collapse { display: none; }
  .main-wrap { margin-left: 0 !important; }
  .mobile-only { display: inline-flex; }
  .main { padding: 24px 16px 56px; }
  .topbar { padding: 0 12px; }
  .search-trigger kbd { display: none; }
  h1 { font-size: 34px; }
  .hero-panel { padding: 26px 22px; }
  .hero-panel h1 { font-size: 36px; }
  .page-head-sticky { margin: -24px -16px 18px; padding: 12px 16px; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-side { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .settings-side a { white-space: nowrap; }
  .setting-row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 16px 18px; }
  .setting-label { padding-top: 0; }
  .grid-form { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .field-grid > .field { flex-basis: 100% !important; }
  .hide-sm { display: none; }
  .search-inline .input { width: 100%; }
  .search-inline { flex: 1; }
  .title-input { font-size: 36px; }
  .ed-area { padding: 18px; }
  .ed-toolbar { top: calc(var(--topbar-h) + 64px); }
  .req-list ul { grid-template-columns: 1fr; }
  .modal { padding: 0; }
  .modal-box { max-height: 100vh; height: 100%; border-radius: 0; }
  .row-actions { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.palette-input input:focus-visible { box-shadow: none; }

/* Field tabs, term pickers, forms */
.field-grid.has-tabs { display: block; }
.cf-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 16px; }
.cf-tabs button { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.cf-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.cf-pane[hidden] { display: none !important; }
.choice-scroll { max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px; gap: 2px; }
.choice-scroll .input { margin-bottom: 6px; }
.choice-inline { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-top: 4px; }
.sub-table td { vertical-align: top; }
.sub-detail dt { font-weight: 600; margin-top: 12px; }
.sub-detail dd { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filter-bar .input { width: auto; }
.ed-form-widget { display: block; margin: 12px 0; padding: 14px 16px; border: 1px dashed var(--accent); border-radius: 10px; background: var(--accent-soft, rgba(242,107,45,.08)); font-weight: 500; user-select: none; }
.nav-count { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; text-align: center; line-height: 18px; }
.rr-rich { display: flex; flex-direction: column; gap: 4px; }
.rr-rich-bar { display: flex; gap: 2px; }
.rr-rich-bar button { appearance: none; border: 1px solid var(--border); background: transparent; color: inherit; border-radius: 6px; min-width: 28px; height: 26px; cursor: pointer; font-size: 12px; }
.rr-rich-area { min-height: 90px; max-height: 320px; overflow: auto; white-space: normal; }
.rr-rich-area p { margin: 0 0 .6em; }
.repeater-row label.field[hidden] { display: none; }
.ed-form-widget::before { content: "Form widget · "; color: var(--accent); }

/* Revisions */
.revisions-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.revisions-list { } /* scrolls with the page: one scrollbar */
.revisions-list li.active { background: var(--accent-soft); }
.diff { font: 12.5px/1.6 var(--mono); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: auto; max-height: 520px; background: var(--surface-2); }
.diff > div { padding: 1px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff > div > span { display: inline-block; width: 16px; color: var(--muted); user-select: none; }
.diff-add, .diff-legend.diff-add { background: var(--success-soft); color: var(--success); }
.diff-del, .diff-legend.diff-del { background: var(--danger-soft); color: var(--danger); }
.diff-eq { color: var(--muted); }
.diff-gap { color: var(--muted); text-align: center; background: var(--surface-3); font-size: 11px; }
.diff-legend { padding: 1px 8px; border-radius: 6px; margin-right: 6px; }
@media (max-width: 860px) { .revisions-layout { grid-template-columns: 1fr; } .revisions-list { position: static; max-height: 260px; } }

/* Security check */
.sec-summary { display: flex; gap: 6px; flex-wrap: wrap; }
.sec-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sec-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; }
.sec-list li > div { flex: 1; min-width: 0; }
.sec-list li small { color: var(--muted); }
.sec-icon { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sec-ok .sec-icon { background: var(--success-soft); color: var(--success); }
.sec-warn .sec-icon { background: var(--warn-soft); color: var(--warn); }
.sec-bad .sec-icon { background: var(--danger-soft); color: var(--danger); }
.sec-info .sec-icon { background: var(--surface-3); color: var(--muted); }
.sec-tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-left: 6px; }
.sec-bad .sec-tag { color: var(--danger); } .sec-warn .sec-tag { color: var(--warn); }

.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.wh-events { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.wh-events legend { padding: 0; margin-bottom: 8px; }
.wh-mode { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.wh-mode-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; }
.wh-mode-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.wh-mode-opt input { margin-top: 3px; flex-shrink: 0; }
.wh-mode-opt span { display: flex; flex-direction: column; gap: 2px; }
.wh-mode-opt small { font-size: 12.5px; }
.wh-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.wh-groups[hidden] { display: none; }
.wh-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wh-group-title { font: 600 11px/1 var(--font); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.wh-ev { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.wh-ev:hover { background: var(--surface-3); }
.wh-ev input { margin-top: 3px; flex-shrink: 0; }
.wh-ev span { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13.5px; font-weight: 550; }
.wh-ev code { background: none; padding: 0; font-size: 11.5px; font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }

/* ==========================================================================
   0.13 refresh, calmer, cleaner: Inter for headings, quieter accents, denser
   tables, a single settings navigation, status tiles and the list-table kit.
   ========================================================================== */
h1 { font: 650 26px/1.2 var(--font); letter-spacing: -.02em; }
h2 { font: 600 16px/1.3 var(--font); letter-spacing: -.01em; }
h1 em, h2 em { font-style: normal; color: inherit; }
.main { padding: 28px 36px 72px; max-width: 1400px; margin-inline: auto; }
.page-head { margin-bottom: 20px; align-items: center; }
.page-head p { margin-top: 4px; font-size: 13.5px; }
.h-compact { font: 650 20px/1.2 var(--font); }
.section-title { font: 600 13px var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 12px; }
.section-title:first-of-type { margin-top: 4px; }
legend { font: 600 14px var(--font); }
.card { border-radius: var(--radius); box-shadow: none; }
.card-head { min-height: 52px; padding: 14px 18px; }
.card-head h2 .ic { color: var(--muted); }
.card-pad { padding: 18px; }
.card-foot { border-radius: 0 0 var(--radius) var(--radius); }
.empty-state h1, .empty-state h2 { font: 600 17px var(--font); }
.empty-state > .ic { color: var(--muted); }
.update-version strong { font: 650 26px/1.1 var(--font); }
.update-version strong.update-ok { display: inline-flex; align-items: center; gap: 6px; font-size: 18px; color: var(--success, #1f8a4c); }

/* Sidebar: quieter active state, collapsible groups */
.sidebar::before { opacity: .45; }
.nav-label { padding: 16px 12px 6px; }
.nav-link { padding: 8px 10px; gap: 10px; font-size: 13.5px; }
.nav-link.active { background: rgba(255, 255, 255, .06); }
.nav-link.active::before { box-shadow: none; }
.nav-group { position: relative; }
.nav-group > .nav-sub { display: none; padding: 2px 0 6px 38px; }
.nav-group.open > .nav-sub { display: flex; }
.nav-sub::before { left: 19px; }
.nav-sub a { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.nav-toggle { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 0; border-radius: 6px; background: none; color: #6E6962; cursor: pointer; padding: 0; transition: transform .15s, background .15s, color .15s; }
.nav-toggle:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-group.open .nav-toggle { transform: rotate(180deg); }
.nav-link .nav-count + .nav-toggle { margin-left: 4px; }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 650; line-height: 18px; padding: 0 6px; border-radius: 99px; background: var(--o-500); color: #fff; }
.nav-sub .nav-count { margin-left: 0; }
html.nav-collapsed .nav-toggle, html.nav-collapsed .nav-count { display: none; }

/* Dashboard */
.hero-panel { padding: 24px 28px; border-radius: var(--radius-lg); align-items: center; }
.hero-panel::after { display: none; }
.hero-panel::before { opacity: .55; }
.hero-panel h1 { font: 650 26px/1.2 var(--font); }
.hero-panel h1 em { color: var(--o-300); }
.hero-panel p { margin-top: 4px; font-size: 14px; }
.stat { padding: 16px 18px; border-radius: var(--radius); }
.stat:hover { transform: none; border-color: var(--border-strong); }
.stat::after { display: none; }
.stat-value { font: 650 28px/1 var(--font); letter-spacing: -.02em; margin-top: 12px; }
.stat-icon { width: 30px; height: 30px; border-radius: 8px; }
.dash-section { margin-bottom: 22px; }
.dash-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dash-section-head h2 { font-size: 15px; }

/* Status tiles (key settings) */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.status-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.status-icon { width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--muted); }
.status-ok .status-icon { background: var(--success-soft); color: var(--success); }
.status-warn .status-icon { background: var(--warn-soft); color: var(--warn); }
.status-danger .status-icon { background: var(--danger-soft); color: var(--danger); }
.status-info .status-icon { background: var(--info-soft); color: var(--info); }
.status-warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.status-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.status-text { display: flex; flex-direction: column; min-width: 0; flex: 1; color: var(--text); }
.status-text:hover { color: var(--text); }
.status-text:hover .status-label { text-decoration: underline; }
.status-label { font-weight: 600; font-size: 13px; }
.status-value { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-go { color: var(--muted); display: flex; }
.switch-sm { transform: scale(.85); transform-origin: right center; flex-shrink: 0; }

/* Settings: one navigation, search, calm rows */
.settings-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { position: static; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; scrollbar-width: thin; }
.settings-search { position: relative; margin-bottom: 8px; }
.settings-search > .ic { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.settings-search .input { padding-left: 32px; height: 38px; }
.settings-search-results { position: absolute; z-index: 30; left: 0; right: -120px; top: 42px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; max-height: 360px; overflow: auto; }
.settings-search-results a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.settings-search-results a:first-child, .settings-search-results a:hover { background: var(--surface-2); }
.settings-search-results small { color: var(--muted); font-size: 12px; }
.settings-search-results .muted { padding: 8px 10px; }
.settings-nav-home, .settings-nav-group summary { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 550; cursor: pointer; list-style: none; user-select: none; }
.settings-nav-group summary::-webkit-details-marker { display: none; }
.settings-nav-group summary > .ic:first-child, .settings-nav-home .ic { color: var(--muted); }
.settings-nav-group summary > .ic:last-child { margin-left: auto; color: var(--muted); transition: transform .15s; }
.settings-nav-group[open] summary > .ic:last-child { transform: rotate(180deg); }
.settings-nav-home:hover, .settings-nav-group summary:hover { background: var(--surface); color: var(--text); }
.settings-nav-home.active, .settings-nav-group summary.current { color: var(--text); }
.settings-nav-group summary.current > .ic:first-child { color: var(--accent); }
.settings-nav-items { display: flex; flex-direction: column; padding: 2px 0 6px 34px; }
.settings-nav-items a { padding: 6px 10px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.settings-nav-items a:hover { color: var(--text); background: var(--surface); }
.settings-nav-items a.active { color: var(--text); font-weight: 600; background: var(--surface); }
.settings-main { min-width: 0; }
.settings-head { margin-bottom: 18px; }
.settings-head h1 { margin-top: 4px; }
.settings-head p { margin: 6px 0 0; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.settings-card { margin-bottom: 18px; }
.settings-card .setting-row { grid-template-columns: minmax(180px, 300px) minmax(0, 1fr); gap: 24px; padding: 16px 20px; }
.setting-row.is-toggle, .settings-card .setting-row.is-toggle { grid-template-columns: minmax(0, 1fr) auto; align-items: center; } /* on/off rows: text uses the width, the switch sits beside it */
.setting-row.is-toggle .help { max-width: 720px; }
.setting-row.is-toggle .setting-label { padding-top: 0; }
.setting-row.is-toggle .setting-control { display: flex; justify-content: flex-end; }
.setting-row.is-toggle .setting-control .switch { margin-top: 0; }
.setting-row.flash { animation: flash 2s ease; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
.setting-heading { padding: 18px 20px 6px; border-bottom: 1px solid var(--border); }
.setting-heading p { margin: 2px 0 8px; }
.setting-note { display: flex; gap: 10px; padding: 12px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 13px; }
.setting-note > .ic { color: var(--info); margin-top: 2px; }
.settings-custom > .card, .settings-custom > section.card { margin-bottom: 18px; }
.save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 14px; padding: 12px 0; margin-top: 18px;
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--border); }
.save-bar [data-dirty] { display: inline-flex; gap: 6px; align-items: center; }
.settings-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.settings-cat { margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.settings-cat-head { display: flex; gap: 12px; color: var(--text); }
.settings-cat-head:hover { color: var(--text); }
.settings-cat-head:hover strong { color: var(--accent); }
.settings-cat-head > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.settings-cat-head small { font-size: 12.5px; line-height: 1.4; }
.settings-cat-icon { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.settings-cat-links { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.settings-cat-links a { font-size: 12.5px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.settings-cat-links a:hover { border-color: var(--border-strong); color: var(--text); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; align-items: baseline; }
.kv > span:nth-child(odd) { color: var(--muted); font-size: 13px; }
.kv code { word-break: break-all; }
ol.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
ol.steps li { padding-left: 4px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form .input { flex: 1 1 240px; max-width: 360px; }
.input-suffix-wrap { display: inline-flex; align-items: center; gap: 8px; }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* List tables */
.lt { margin-bottom: 20px; }
.lt-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.lt-toolbar .tabs-pill { flex-shrink: 0; }
.lt-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.lt-search { position: relative; display: flex; align-items: center; flex: 0 1 260px; min-width: 180px; }
.lt-search .ic { position: absolute; left: 10px; color: var(--muted); }
.lt-search .input { padding-left: 32px; height: 36px; width: 100%; }
.lt-filter { height: 36px; width: auto; max-width: 190px; padding-top: 0; padding-bottom: 0; }
.lt-filter.is-set { border-color: var(--accent); background-color: var(--accent-soft); }
.lt-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.lt-tools .icon-btn { border: 1px solid var(--border); background: var(--surface); width: 34px; height: 34px; }
.lt-colmenu { width: 260px; max-height: 420px; overflow-y: auto; padding: 6px; }
.lt-colitem { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: grab; font-size: 13px; }
.lt-colitem:hover { background: var(--surface-2); }
.lt-colitem.dragging { opacity: .5; }
.lt-colitem input:disabled + span { color: var(--muted); }
.lt-grip { color: var(--muted); display: flex; }
.lt-reset { width: 100%; justify-content: center; margin-top: 4px; }
.lt-card { overflow: hidden; }
.lt-table th { position: sticky; top: 0; z-index: 2; font-size: 11px; letter-spacing: .06em; padding: 10px 14px; }
.lt-table thead tr:first-child th:first-child, .lt-table thead tr:first-child th:last-child { border-radius: 0; }
.lt-table td { padding: 12px 14px; }
.lt-table.density-compact td { padding: 6px 14px; font-size: 13px; }
.lt-table.density-compact .row-actions { display: none; }
.lt-table.density-compact tr:hover .row-actions { display: flex; }
.lt-table.density-compact .row-thumb { width: 26px; height: 26px; }
.lt-sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.lt-sort .ic { opacity: .35; }
.lt-sort:hover, .lt-sort.on { color: var(--text); }
.lt-sort.on .ic, .lt-sort:hover .ic { opacity: 1; }
.lt-table td.col-primary { min-width: 220px; }
.row-main { display: flex; align-items: center; gap: 10px; }
.row-thumb { width: 36px; height: 36px; border-radius: 7px; flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--muted); }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-actions { gap: 12px; }
.row-actions .link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.cell-date { display: flex; flex-direction: column; white-space: nowrap; font-size: 13px; }
.cell-date small { font-size: 11.5px; }
.cell-img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.cell-code { font-size: 12px; }
.cell-link { font-size: 12.5px; word-break: break-all; }
.lt-foot { display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; font-size: 13px; }
.lt-per { display: inline-flex; align-items: center; gap: 8px; }
.lt-per .input { width: auto; height: 30px; padding-top: 0; padding-bottom: 0; }
.pager-nums { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.pager-nums .btn { min-width: 32px; justify-content: center; }
.pager-nums .is-current { background: var(--text); color: var(--surface); border-color: var(--text); }
.bulk-bar { border-radius: 0; flex-wrap: wrap; }
.bulk-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.bulk-select { display: inline-flex; gap: 4px; }
.bulk-select .input { height: 30px; width: auto; max-width: 200px; background-color: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.14); padding-top: 0; padding-bottom: 0; }
.bulk-select .input option { color: var(--text); background: var(--surface); }
.bulk-all { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #ddd; }
.quick-edit { min-width: min(520px, 80vw); }
.grid-2-tight { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Module pages: standard header with tabs */
.mod-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.mod-head-title { display: flex; align-items: center; gap: 12px; }
.mod-head-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.mod-head p { margin: 2px 0 0; }
.mod-tabs { margin-bottom: 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.kpi span { display: block; font-size: 12.5px; color: var(--muted); }
.kpi strong { display: block; font: 650 22px/1.2 var(--font); margin-top: 4px; letter-spacing: -.01em; }

@media (max-width: 1000px) {
  .settings-shell { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .settings-search { flex: 1 1 100%; }
  .settings-nav-group { position: relative; }
  .settings-nav-group[open] .settings-nav-items { position: absolute; z-index: 25; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; }
  .settings-card .setting-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .setting-row.is-toggle { grid-template-columns: minmax(0, 1fr) auto; }
}
@media (max-width: 860px) {
  .main { padding: 20px 16px 64px; }
  .lt-tools { margin-left: 0; }
  .lt-search { flex: 1 1 100%; }
  .pager-nums { margin-left: 0; }
}
.lt-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
.lt-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lt-table td { padding: 10px 14px; }
.row-actions { min-height: 18px; }
.status-value { white-space: normal; overflow: visible; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.nav-toggle { opacity: 0; }
.nav-group:hover .nav-toggle, .nav-group.open .nav-toggle, .nav-toggle:focus-visible { opacity: 1; }
@media (hover: none) { .nav-toggle { opacity: 1; } }
.pill-info { background: var(--info-soft); color: var(--info); }

/* Installed modules list */
.module-filter { margin-bottom: 12px; }
.module-list { overflow: hidden; }
.module-row { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.module-row:last-child { border-bottom: 0; }
.module-row.has-error { background: var(--danger-soft); }
.module-icon { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--muted); }
.module-row.is-active .module-icon { background: var(--accent-soft); color: var(--accent); }
.module-main { flex: 1; min-width: 0; }
.module-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.module-desc { margin: 4px 0 8px; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 820px; }
.module-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.module-meta .module-links { display: inline-flex; gap: 14px; margin-left: 8px; font-size: 13px; }
.module-actions { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 700px) { .module-row { flex-wrap: wrap; } .module-actions { width: 100%; } }

details.disclosure > summary { cursor: pointer; list-style: none; border-bottom: 0; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure[open] > summary { border-bottom: 1px solid var(--border); }

/* Phones: compact filters and settings jump menu */
.settings-jump, .lt-filter-toggle { display: none; }
@media (max-width: 1000px) {
  .settings-jump { display: block; width: 100%; }
  .settings-nav-home, .settings-nav-group { display: none; }
  .settings-nav { flex-direction: column; }
}
@media (max-width: 860px) {
  .lt-filter-toggle { display: inline-flex; }
  .lt-filters .lt-filter { display: none; }
  .lt-filters.show-filters .lt-filter { display: block; flex: 1 1 45%; max-width: none; }
  .lt-search { flex: 1 1 60%; }
  .row-actions { gap: 10px; flex-wrap: wrap; }
  .lt-top .tabs-pill { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; scrollbar-width: none; }
  .lt-top .tabs-pill a { white-space: nowrap; }
}
@media (max-width: 860px) {
  .lt-filters .lt-search { flex: 1 1 0; min-width: 0; }
  .lt-table td.col-primary { min-width: 170px; }
}
.lt, .lt-toolbar, .lt-toolbar > * { min-width: 0; max-width: 100%; }
.lt-top .tabs-pill { min-width: 0; }
.terms-list { min-width: 0; }
.split > form.card { position: sticky; top: calc(var(--topbar-h) + 16px); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .3s ease; }


/* Module pages: one header + tabs; wizard steps */
.module-page > .mod-head:first-child + .mod-tabs, .mod-head + .mod-tabs { margin-top: -4px; }
.settings-head .mod-tabs { margin: 14px 0 0; }
.tabs-line .pill { margin-left: 2px; }
.wizard-steps { display: flex; gap: 6px; list-style: none; margin: 0 0 18px; padding: 0; flex-wrap: wrap; counter-reset: none; }
.wizard-steps li { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 550; }
.wizard-steps li span { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); font-size: 12px; font-weight: 650; }
.wizard-steps li.is-current { color: var(--text); border-color: var(--accent); }
.wizard-steps li.is-current span { background: var(--accent); color: #fff; }
.wizard-steps li.is-done { color: var(--text-2); }
.wizard-steps li.is-done span { background: var(--success-soft); color: var(--success); }
nav.wizard-steps { align-self: flex-start; }
nav.wizard-steps > a, nav.wizard-steps > button { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 99px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text-2); font: 550 13px var(--font); cursor: pointer; }
nav.wizard-steps > button:disabled { color: var(--muted); cursor: default; opacity: .7; }
nav.wizard-steps > a > span, nav.wizard-steps > button > span { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-3); font-size: 12px; font-weight: 650; }
nav.wizard-steps > .active { color: var(--text); border-color: var(--accent); }
nav.wizard-steps > .active > span { background: var(--accent); color: #fff; }
.page-views { margin-bottom: 14px; }

/* Dashboard: greeting, stats first, status + settings in a side column */
.dash-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.dash-top h1 { font-size: 22px; }
.dash-top p { margin: 2px 0 0; font-size: 13px; }
.stat-grid-compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat-grid-compact .stat { padding: 12px 14px; flex-direction: row; align-items: center; gap: 12px; }
.stat-grid-compact .stat-top { order: 0; }
.stat-grid-compact .stat-arrow { display: none; }
.stat-grid-compact .stat-value { font-size: 20px; margin: 0; order: 1; }
.stat-grid-compact .stat-label { order: 2; margin-left: auto; text-align: right; font-size: 12px; line-height: 1.3; }
.stat-grid-compact .stat-hint { display: block; }
.dash-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.dash-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.dash-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.dash-side .card { margin: 0; }
.status-grid.is-compact { display: flex; flex-direction: column; gap: 0; }
.status-grid.is-compact .status-item { border: 0; border-radius: 0; border-bottom: 1px solid var(--border); padding: 10px 14px; background: none; }
.status-grid.is-compact .status-item:last-child { border-bottom: 0; }
.status-grid.is-compact .status-icon { width: 26px; height: 26px; border-radius: 7px; }
.status-grid.is-compact .status-value { -webkit-line-clamp: 1; }
.dash-links { display: flex; flex-direction: column; padding: 6px; }
.dash-links a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-size: 13.5px; }
.dash-links a span { flex: 1; }
.dash-links a .ic { color: var(--muted); }
.dash-links a:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 1200px) { .dash-layout { grid-template-columns: minmax(0, 1fr); } .dash-side { position: static; } .dash-main { grid-template-columns: minmax(0, 1fr); } }

/* Scrollbars: thin and theme-aware everywhere */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
.sidebar * { scrollbar-color: #2e2e33 transparent; }
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
  ::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
}

/* File fields: a calm drop area with a real button */
input[type=file] { width: 100%; max-width: 520px; padding: 14px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
  color: var(--muted); font: 13px var(--font); cursor: pointer; transition: border-color .15s, background .15s; }
input[type=file]:hover, input[type=file].is-over { border-color: var(--accent); background: var(--accent-soft); }
input[type=file], input[type=file].input { height: auto; min-height: 0; line-height: normal; display: block; } /* size to the button, also with the .input class (fixed height) */
input[type=file]::file-selector-button { margin-right: 14px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); font: 600 13px var(--font); cursor: pointer; }
input[type=file]::file-selector-button:hover { border-color: var(--border-strong); }
input[type=file][hidden] { display: none; }

/* Top bar settings button */
.settings-menu { width: 260px; }

.stat-grid-compact .stat { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; row-gap: 0; align-items: center; }
.stat-grid-compact .stat-top { grid-row: 1 / 3; }
.stat-grid-compact .stat-value { grid-column: 2; grid-row: 1; font-size: 19px; line-height: 1.1; }
.stat-grid-compact .stat-label { grid-column: 2; grid-row: 2; margin: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-grid-compact .stat-hint { display: inline; }
.stat-grid-compact .stat-hint { display: none; }

/* Import pages */
.import-drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 36px 20px; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.import-drop:hover, .import-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.import-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; max-width: none; }
.import-drop-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }

/* Goraiya: the AI drawer */
.goraiya-btn { gap: 7px; background: linear-gradient(135deg, var(--o-500), var(--o-700)); color: #fff; border-color: transparent; }
.goraiya-btn:hover { color: #fff; background: linear-gradient(135deg, var(--o-500), var(--o-700)); border-color: transparent; filter: brightness(1.08); }
.chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 99px; padding: 6px 12px; font: 13px var(--font); cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* Dashboard: start with AI */
.ai-start { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 20px 22px; margin-bottom: 18px;
  border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border: 1px solid var(--border); }
.ai-start h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.ai-start ol { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.ai-start .page-actions { flex-direction: column; align-items: stretch; }
@media (max-width: 760px) { .ai-start { grid-template-columns: 1fr; } }

/* Import report */
.import-page { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.import-page:last-child { border-bottom: 0; }
.import-page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.import-page-head > div { flex: 1; min-width: 200px; display: flex; flex-direction: column; }
.import-issues { list-style: none; margin: 10px 0 0 44px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.import-issues li { display: flex; gap: 8px; align-items: flex-start; }
.import-issues li > div { display: flex; flex-direction: column; }
.import-issues li.is-warn .ic { color: var(--warn); margin-top: 2px; }
.import-issues li.is-info .ic { color: var(--info); margin-top: 2px; }

/* SEO and Appearance: settings on their own page */
.settings-shell.is-solo { grid-template-columns: minmax(0, 1fr); }
.settings-shell.is-solo .settings-main { }
.settings-intro { margin: 0 0 16px; }

/* Styles editor (Appearance › Styles) */
.dse { display: flex; flex-direction: column; gap: 18px; min-width: 0; container-type: inline-size; }
.dse-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.dse-tabs button { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: transparent; padding: 9px 14px; border-radius: 9px; font: 550 13.5px/1 var(--font); color: var(--muted); cursor: pointer; white-space: nowrap; }
.dse-tabs button:hover { color: var(--text); }
.dse-tabs button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.dse-pane { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dse-intro { margin: 0; color: var(--muted); font-size: 13.5px; }
.dse-mono { font-family: var(--mono); font-size: 12.5px; }
.dse-plain { border: 0; background: transparent; padding: 2px 0; font: inherit; color: var(--text); width: 100%; min-width: 0; border-bottom: 1px dashed transparent; }
.dse-plain:hover, .dse-plain:focus { border-bottom-color: var(--border-strong); outline: 0; }
.dse-strong { font-weight: 600; font-size: 14px; }
.dse-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 7px; padding: 3px 7px; font: 500 11.5px/1.3 var(--mono); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dse-chip:hover { border-color: var(--border-strong); background: var(--surface-3); color: var(--text); }
.dse-del:hover { color: var(--danger); background: var(--danger-soft); }
.dse-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 32px 16px; border: 2px dashed var(--border); border-radius: 12px; text-align: center; color: var(--muted); }
.dse-empty strong { color: var(--text); }
.dse-warn { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
/* colours */
.dse-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.dse-color { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); min-width: 0; }
.dse-swatch { position: relative; flex-shrink: 0; width: 56px; height: 56px; border-radius: 12px; border: 1px solid rgba(0, 0, 0, .1); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.dse-swatch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.dse-color-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.dse-color-body .input { width: 100%; }
.dse-color .dse-del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; opacity: 0; }
.dse-color:hover .dse-del, .dse-color:focus-within .dse-del { opacity: 1; }
.dse-color .dse-strong { padding-right: 26px; }
.dse-add-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 82px; border: 2px dashed var(--border); border-radius: 14px; background: transparent; color: var(--muted); font: 550 13px var(--font); cursor: pointer; }
.dse-add-card:hover { border-color: var(--accent); color: var(--accent); }
/* variables */
.dse-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dse-vars { display: flex; flex-direction: column; gap: 6px; }
.dse-var { display: grid; grid-template-columns: 40px minmax(140px, 220px) minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.dse-var .icon-btn { width: 32px; height: 32px; }
.dse-var-name { display: flex; align-items: center; gap: 2px; font-family: var(--mono); color: var(--muted); min-width: 0; }
.dse-var-name .input { min-width: 0; }
.dse-vp { width: 40px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); display: flex; align-items: center; justify-content: center; font: 600 12px var(--font); color: var(--muted); }
.dse-vp.is-shadow { background: #fff; border: 0; }
.dse-vp.is-size { justify-content: flex-start; padding: 0 5px; }
.dse-vp.is-size i { display: block; height: 6px; border-radius: 3px; background: var(--accent); }
.dse-builtins { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; background: var(--surface-2); }
.dse-builtins summary { cursor: pointer; font-weight: 550; font-size: 13.5px; }
.dse-builtins > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
@container (max-width: 640px) {
  .dse-var { grid-template-columns: 40px minmax(0, 1fr) auto auto; }
  .dse-var-value { grid-column: 1 / -1; }
}
/* typography */
.dse-fonts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.dse-font { margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.dse-font-sample { font-size: 28px; line-height: 1.2; min-height: 68px; color: var(--text); overflow-wrap: anywhere; }
.dse-scale { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.dse-type { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dse-type:last-child { border-bottom: 0; }
.dse-type-sample { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dse-type-sample > div { color: var(--text); overflow-wrap: anywhere; }
.dse-type-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.dse-num { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 550; text-transform: uppercase; letter-spacing: .05em; }
.dse-num .input { width: 76px; text-transform: none; letter-spacing: 0; }
.dse-num select.input { width: 92px; }
/* classes */
.dse-classes { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.dse-cls-list { display: flex; flex-direction: column; gap: 8px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.dse-q { position: relative; display: block; }
.dse-q .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.dse-q .input { width: 100%; padding-left: 32px; }
.dse-cls-items { display: flex; flex-direction: column; gap: 2px; max-height: 380px; overflow-y: auto; }
.dse-cls-items button { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; color: var(--text-2); }
.dse-cls-items button:hover { background: var(--surface-3); color: var(--text); }
.dse-cls-items button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.dse-cls-items code { background: none; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dse-cls-items small { font-size: 10.5px; color: var(--muted); }
.dse-cls-edit { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.dse-cls-edit .field { margin: 0; }
.dse-cls-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dse-cls-name { flex: 1 1 200px; display: flex; align-items: center; gap: 2px; font: 600 18px var(--mono); color: var(--muted); min-width: 0; }
.dse-cls-name .input { font-size: 14px; min-width: 0; }
.dse-cls-preview { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.dse-seg { display: flex; gap: 2px; padding: 6px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.dse-seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font: 550 12.5px var(--font); color: var(--muted); cursor: pointer; }
.dse-seg button:hover { color: var(--text); }
.dse-seg button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.dse-stage { padding: 28px; background: #fff; background-image: radial-gradient(rgba(0, 0, 0, .06) 1px, transparent 1px); background-size: 14px 14px; min-height: 130px; display: flex; align-items: center; justify-content: center; overflow: auto; }
.dse-stage > * { margin: 0; max-width: 100%; }
.dse-insert { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dse-insert .dse-chip { font-family: var(--font); }
.dse-insert select { width: auto; max-width: 180px; }
@container (max-width: 700px) {
  .dse-classes { grid-template-columns: minmax(0, 1fr); }
  .dse-cls-list { position: static; }
  .dse-cls-items { flex-direction: row; flex-wrap: wrap; max-height: none; }
}
/* layout */
.dse-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.dse-slider { padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.dse-slider-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dse-slider-row { display: flex; align-items: center; gap: 12px; }
.dse-slider-row input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.dse-slider-row .input-num { width: 80px; }
.dse-shapes { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 20px; border: 1px dashed var(--border); border-radius: 14px; }
.dse-shape { width: 160px; height: 90px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.dse-shape-btn { padding: 11px 20px; background: var(--color-primary, var(--accent)); color: #fff; font-weight: 600; font-size: 14px; }
@container (max-width: 560px) {
  .dse-tabs { flex-wrap: wrap; overflow: visible; }
  .dse-tabs button { flex: 1 1 30%; padding: 9px 8px; }
}

/* Templates list */
.tpl-top { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kpis-inline { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.kpis-inline .kpi { flex: 1 1 96px; min-width: 96px; }
@media (max-width: 560px) { .kpis-inline { width: 100%; } .kpis-inline .kpi { padding: 10px 12px; } .kpis-inline .kpi strong { font-size: 20px; } }
.tpl-find { position: relative; flex: 0 1 300px; min-width: 200px; }
.tpl-find .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.tpl-find .input { width: 100%; padding-left: 34px; }
.tpl-group { margin-top: 18px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.tpl-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); min-width: 0; transition: border-color .15s, box-shadow .15s; }
.tpl-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.tpl-card-head { display: flex; gap: 12px; align-items: flex-start; }
.tpl-card-icon { flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-2); }
.tpl-card.is-active .tpl-card-icon { background: var(--accent-soft); color: var(--accent); }
.tpl-card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tpl-card-title small { overflow-wrap: anywhere; }
.tpl-versions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tpl-versions li { display: flex; align-items: center; gap: 4px; }
.tpl-versions .icon-btn { width: 32px; height: 32px; flex-shrink: 0; }
.tpl-version { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 9px; color: var(--text); }
.tpl-version:hover { background: var(--surface-3); color: var(--text); }
.tpl-version-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; font-size: 13.5px; }
.tpl-version small { flex-shrink: 0; font-size: 12px; }
.tpl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.tpl-dot.is-on { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.tpl-empty { margin: 0; }
.tpl-card-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

/* Template editor */
.tpe { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tpe-bar { position: sticky; top: var(--topbar-h); z-index: 15; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 0; background: var(--bg); }
.tpe-title { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tpe-name { border: 0; background: transparent; font: 650 20px/1.2 var(--font); color: var(--text); padding: 2px 0; border-bottom: 1px dashed transparent; min-width: 0; }
.tpe-name:hover, .tpe-name:focus { border-bottom-color: var(--border-strong); outline: 0; }
.tpe-where { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; padding: 0; color: var(--muted); font: 500 12.5px var(--font); cursor: pointer; max-width: 100%; }
.tpe-where span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpe-where:hover { color: var(--text); }
.tpe-where[aria-expanded="true"] .ic:last-child { transform: rotate(180deg); }
.tpe-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tpe-live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 550; padding: 0 6px; cursor: pointer; }
.tpe-settings { margin: 0; padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; align-items: end; }
.tpe-settings .field { margin: 0; }
.tpe-settings-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.tpe-work { display: grid; grid-template-columns: 250px minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; height: calc(100vh - var(--topbar-h) - 150px); min-height: 400px; }
.main:has(> .tpe), .main:has(.tpe-work) { padding-bottom: 16px; } /* the editor fills the window: one scrollbar */
.tpe.no-palette .tpe-work { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tpe.no-palette .tpe-palette { display: none; }
.tpe.no-preview .tpe-work { grid-template-columns: 250px minmax(0, 1fr); }
.tpe.no-preview.no-palette .tpe-work { grid-template-columns: minmax(0, 1fr); }
.tpe.no-preview .tpe-preview { display: none; }
.tpe-palette, .tpe-code, .tpe-preview { min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.tpe-find { position: relative; display: block; padding: 10px; border-bottom: 1px solid var(--border); }
.tpe-find .ic { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.tpe-find .input { width: 100%; padding-left: 30px; }
.tpe-pal-scroll { overflow-y: auto; padding: 6px 10px 12px; scrollbar-width: thin; }
.tpl-pal-group summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 8px 2px; font: 600 11px/1 var(--font); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.tpl-pal-group summary::-webkit-details-marker { display: none; }
.tpl-pal-group:not([open]) summary .ic { transform: rotate(-90deg); }
.tpl-pal-group > div { display: flex; flex-direction: column; gap: 4px; padding-bottom: 6px; }
.tpl-tag { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; padding: 6px 9px; border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; font: inherit; color: var(--text); }
.tpl-tag:hover { border-color: var(--border); background: var(--surface-2); }
.tpl-tag span { font-size: 13px; font-weight: 550; }
.tpl-tag code { background: none; padding: 0; font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpe-help { font-size: 12px; color: var(--muted); margin: 8px 2px 0; }
.tpe-tabs { display: flex; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tpe-tabs [data-code-tab] { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font: 600 12.5px var(--font); color: var(--muted); cursor: pointer; }
.tpe-tabs [data-code-tab]:hover { color: var(--text); }
.tpe-tabs [data-code-tab].is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tpe-tabs-space { flex: 1; }
.tpe-tabs .icon-btn { width: 32px; height: 32px; }
.tpe-editor { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.tpe-editor[hidden] { display: none; }
.tpe-gutter { margin: 0; padding: 14px 8px 14px 12px; border: 0; border-radius: 0; background: var(--surface-2); color: var(--muted); font: 12.5px/1.65 var(--mono); text-align: right; overflow: hidden; user-select: none; min-width: 44px; opacity: .8; }
.tpe-editor textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; padding: 14px; background: var(--surface); color: var(--text); font: 12.5px/1.65 var(--mono); tab-size: 2; white-space: pre; overflow: auto; }
.tpe-pv-bar { display: flex; align-items: center; gap: 6px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tpe-pv-bar select { flex: 1; min-width: 0; }
.tpe-pv-bar .icon-btn { width: 32px; height: 32px; flex-shrink: 0; }
.tpe-devices { display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-3); flex-shrink: 0; }
.tpe-devices button { border: 0; background: transparent; width: 30px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; }
.tpe-devices button:hover { color: var(--text); }
.tpe-devices button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tpe-frame-wrap { position: relative; flex: 1; min-height: 0; display: flex; justify-content: center; background: var(--surface-3); overflow: auto; }
.tpe-frame-wrap iframe { width: 100%; height: 100%; border: 0; background: #fff; transition: width .2s; }
.tpe-pv-msg { position: absolute; inset: auto 12px 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
@media (max-width: 1280px) {
  .tpe-work { grid-template-columns: 220px minmax(0, 1fr); height: auto; }
  .tpe-code { height: 62vh; }
  .tpe-preview { grid-column: 1 / -1; height: 70vh; }
  .tpe.no-palette .tpe-work, .tpe.no-preview .tpe-work { grid-template-columns: minmax(0, 1fr); }
  .tpe.no-preview .tpe-work { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .tpe-work, .tpe.no-preview .tpe-work { grid-template-columns: minmax(0, 1fr); }
  .tpe-palette { max-height: 260px; }
  .tpe-bar { position: static; }
}

/* Modules: one card design for installed and available modules */
.mod-toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.mod-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-3); }
.mod-seg button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: 550 13px var(--font); color: var(--muted); cursor: pointer; }
.mod-seg button:hover { color: var(--text); }
.mod-seg button span { min-width: 20px; padding: 1px 6px; border-radius: 99px; background: var(--surface); font-size: 11.5px; color: var(--muted); text-align: center; }
.mod-seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.mod-seg button.active span { background: var(--accent-soft); color: var(--accent); }
.mod-search { position: relative; flex: 0 1 320px; min-width: 200px; }
.mod-search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.mod-search .input { width: 100%; padding-left: 34px; }
.mod-section-head{margin:28px 0 12px}.mod-section-head h2{display:flex;align-items:center;gap:8px;font-size:1.05rem;margin:0}.mod-section-head p{margin:4px 0 0}
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.mod-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); min-width: 0; transition: border-color .15s, box-shadow .15s; }
.mod-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.mod-card[hidden] { display: none; }
.mod-card.has-error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.mod-card-head { display: flex; gap: 12px; align-items: center; }
.mod-icon { flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--muted); }
.mod-card.is-active .mod-icon { background: var(--accent-soft); color: var(--accent); }
.mod-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mod-title strong { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-title small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-desc { margin: 0; font-size: 13.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mod-switch { flex-shrink: 0; position: relative; width: 40px; height: 23px; border-radius: 99px; border: 0; padding: 0; background: var(--border-strong); cursor: pointer; transition: background .15s; }
.mod-switch span { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.mod-switch[aria-checked="true"] { background: var(--success); }
.mod-switch[aria-checked="true"] span { transform: translateX(17px); }
.mod-switch:hover { filter: brightness(.95); }
.mod-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mod-alert { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text); font-size: 13px; }
.mod-alert > div { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; }
.mod-alert code { display: block; width: 100%; font-size: 11.5px; overflow-wrap: anywhere; background: none; padding: 0; color: var(--text-2); }
.mod-alert .ic { color: var(--accent); flex-shrink: 0; }
.mod-alert.is-danger { background: var(--danger-soft); }
.mod-alert.is-danger .ic { color: var(--danger); }
.mod-alert.is-warn { background: var(--warn-soft); }
.mod-alert.is-warn .ic { color: var(--warn); }
.mod-alert .link-btn { border: 0; background: none; padding: 0; color: var(--link); font: inherit; cursor: pointer; }
.mod-deps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mod-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.mod-tags span { padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; }
.mod-card-foot { margin-top: auto; display: flex; align-items: center; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.mod-card-foot form { margin: 0; }
.mod-spacer { flex: 1; }
.mod-src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.mod-card-foot .icon-btn { width: 32px; height: 32px; }
.mod-none { margin-top: 12px; }

/* Goraiya in the editor */
.gor-guide-btn .ic { color: var(--accent); }
.gor-fab { position: fixed; z-index: 60; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 8px; border: 0; border-radius: 99px;
  background: linear-gradient(135deg, var(--o-500), var(--o-700)); color: #fff; font: 600 12.5px var(--font); box-shadow: 0 6px 18px -6px rgba(219, 84, 25, .6); cursor: pointer; }
.gor-fab:hover { filter: brightness(1.08); }
.gor-fab.is-block { width: 26px; height: 26px; padding: 0; justify-content: center; }
.gor-fab.is-block span { display: none; }
.gor-pop { position: fixed; z-index: 61; width: min(340px, calc(100vw - 16px)); padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg, 0 18px 40px -12px rgba(0, 0, 0, .25)); display: flex; flex-direction: column; gap: 10px; }
.gor-pop-head { display: flex; align-items: center; gap: 8px; }
.gor-pop-head .ic { color: var(--accent); }
.gor-pop-head strong { flex: 1; font-size: 13.5px; }
.gor-pop-head .icon-btn { width: 28px; height: 28px; }
.gor-pop-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.gor-pop-ask { display: flex; gap: 6px; }
.gor-pop-ask .input { flex: 1; min-width: 0; }
.gor-pop-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.ed-area .gor-block { outline: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 4px; border-radius: 4px; }
.gor-tips { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.gor-tips li { display: flex; gap: 10px; align-items: flex-start; }
.gor-tips li > .ic { color: var(--accent); margin-top: 3px; flex-shrink: 0; }
.gor-tips li div { display: flex; flex-direction: column; gap: 2px; }
.gor-tips li span { color: var(--muted); font-size: 13.5px; }
.gor-guide-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.gor-guide-ask { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.gor-guide-ask textarea { width: 100%; }
.gor-guide-connect { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.toast-action { margin-left: 12px; border: 0; background: rgba(255, 255, 255, .16); color: inherit; font: 600 12.5px var(--font); padding: 4px 10px; border-radius: 7px; cursor: pointer; }
.toast-action:hover { background: rgba(255, 255, 255, .26); }

/* Goraiya drawer */
.goraiya-backdrop { position: fixed; inset: 0; z-index: 79; background: rgba(12, 10, 8, .28); backdrop-filter: blur(2px); animation: goraiya-fade .2s ease; }
@keyframes goraiya-fade { from { opacity: 0; } to { opacity: 1; } }
.goraiya { position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -24px 0 60px -30px rgba(0, 0, 0, .35); animation: goraiya-in .22s ease; }
@keyframes goraiya-in { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 1600px) {
  html.goraiya-open .main-wrap { margin-right: 460px; }
  .goraiya-backdrop { display: none; }
  .goraiya { box-shadow: none; }
}
.goraiya-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); min-height: 64px; }
.goraiya-logo { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--o-500), var(--o-700)); color: #fff; flex-shrink: 0; }
.goraiya-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.goraiya-id strong { font-size: 15px; }
.goraiya-id small { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goraiya-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); flex-shrink: 0; }
.goraiya-head .icon-btn { width: 36px; height: 36px; }
.goraiya-body { flex: 1; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
/* welcome and setup */
.goraiya-setup, .goraiya-welcome { display: flex; flex-direction: column; gap: 18px; }
.goraiya-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 8px 8px 0; }
.goraiya-hero-mark { width: 60px; height: 60px; border-radius: 20px; display: flex; align-items: center; justify-content: center; color: var(--accent); background: var(--accent-soft); margin-bottom: 4px; }
.goraiya-hero h2 { font-size: 19px; margin: 0; }
.goraiya-hero p { margin: 0; font-size: 13.5px; max-width: 340px; }
.goraiya-starts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.goraiya-start { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-align: left; font: inherit; color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; }
.goraiya-start:hover { border-color: var(--accent); background: var(--accent-soft); }
.goraiya-start-ic { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--accent); margin-bottom: 4px; }
.goraiya-start strong { font-size: 13.5px; }
.goraiya-start small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.goraiya-try { display: flex; flex-direction: column; gap: 2px; }
.goraiya-try .small-label { margin-bottom: 4px; }
.goraiya-try-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; font: 13.5px var(--font); color: var(--text-2); cursor: pointer; }
.goraiya-try-item .ic { color: var(--muted); flex-shrink: 0; }
.goraiya-try-item:hover { background: var(--surface-3); color: var(--text); }
.goraiya-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 12.5px; }
.goraiya-note .ic { margin-top: 2px; flex-shrink: 0; }
.goraiya-setup-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.goraiya-setup-card .field { margin: 0; }
.goraiya-setup-card .field > span { display: flex; justify-content: space-between; align-items: center; }
.goraiya-keylink { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.goraiya-setup-card p { margin: 0; display: flex; gap: 6px; align-items: center; }
/* messages */
.goraiya-row { display: flex; gap: 10px; align-items: flex-start; }
.goraiya-user { justify-content: flex-end; }
.goraiya-avatar { width: 28px; height: 28px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.goraiya-msg { min-width: 0; max-width: 88%; font-size: 14px; line-height: 1.55; }
.goraiya-user .goraiya-msg { padding: 9px 13px; border-radius: 16px 16px 4px 16px; background: var(--surface-3); color: var(--text); white-space: normal; overflow-wrap: anywhere; }
.goraiya-assistant .goraiya-msg { flex: 1; max-width: none; padding-top: 4px; color: var(--text); }
.goraiya-msg p { margin: 0 0 8px; }
.goraiya-msg p:last-child { margin-bottom: 0; }
.goraiya-msg ul { margin: 0 0 8px; padding-left: 20px; }
.goraiya-assistant.is-error .goraiya-msg { color: var(--danger); }
.goraiya-tools { display: flex; gap: 4px; margin-top: 6px; }
.goraiya-tool { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--muted); font: 500 12px var(--font); padding: 4px 8px; border-radius: 7px; cursor: pointer; }
.goraiya-tool:hover { background: var(--surface-3); color: var(--text); }
.goraiya-result { display: flex; gap: 12px; align-items: flex-start; margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.goraiya-result-ic { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.goraiya-result-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.goraiya-result-main strong { font-size: 14px; overflow-wrap: anywhere; }
.goraiya-result-main small { color: var(--muted); font-size: 12.5px; }
.goraiya-result-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.goraiya-result.is-error { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.goraiya-typing { display: inline-flex; gap: 4px; margin-right: 8px; vertical-align: middle; }
.goraiya-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: goraiya-dot 1s infinite ease-in-out; }
.goraiya-typing i:nth-child(2) { animation-delay: .15s; } .goraiya-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes goraiya-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
/* composer */
.goraiya-composer { padding: 10px 14px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.goraiya-context { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; max-width: 100%; padding: 4px 10px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: 12px; }
.goraiya-context span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goraiya-box { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.goraiya-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.goraiya-box textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: 14px/1.5 var(--font); padding: 7px 0; max-height: 180px; }
.goraiya-send { width: 36px; height: 36px; flex-shrink: 0; border: 0; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; cursor: pointer; }
.goraiya-send:hover { filter: brightness(1.08); }
.goraiya-send:disabled { opacity: .5; cursor: default; }
.goraiya-hint { color: var(--muted); font-size: 11.5px; padding-left: 4px; }
@media (max-width: 480px) { .goraiya-starts { grid-template-columns: minmax(0, 1fr); } .goraiya-hint { display: none; } }
.goraiya-box textarea, .goraiya-box textarea:focus, .goraiya-box textarea:focus-visible { border: 0; outline: 0; box-shadow: none; background: transparent; }

/* ==========================================================================
   Import: files list, link import, design choice with previews, report (admin/views/import.php, admin/assets/import.js)
   ========================================================================== */
.import-tabs { margin-bottom: 14px; }
.import-pickers { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.import-files { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.import-files-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 13px; }
.import-group + .import-group { border-top: 1px solid var(--border); }
.import-group-head { display: flex; align-items: center; gap: 8px; padding: 9px 14px 4px; font: 600 12px var(--font); color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.import-group-head .ic { color: var(--muted); }
.import-group ul { list-style: none; margin: 0; padding: 0 6px 6px; }
.import-group li { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 8px; font-size: 13px; min-width: 0; }
.import-group li:hover { background: var(--surface-2); }
.import-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono, ui-monospace, monospace); font-size: 12.5px; }
.import-group .icon-btn { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; }
.import-designs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.import-design { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s; min-width: 0; }
.import-design:hover { border-color: var(--border-strong); }
.import-design:has(input:checked) { border-color: var(--o-500); background: var(--accent-soft); }
.import-design-head { display: flex; align-items: center; gap: 8px; }
.import-thumb { position: relative; display: block; height: 230px; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.import-thumb iframe { position: absolute; top: 0; left: 0; width: 400%; height: 400%; border: 0; transform: scale(.25); transform-origin: 0 0; pointer-events: none; }
.import-preview-pick { display: inline-flex; align-items: center; gap: 8px; }
.import-src { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.import-src-line { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--muted); }
.import-src-line a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-summary { padding: 14px 18px 0; }
.import-summary .kpis { margin-bottom: 4px; }
@media (min-width: 1100px) { .import-thumb { height: 260px; } }

/* ==========================================================================
   Module updates: automatic update states on module cards, error report, auto-update switch,
   dashboard banner, update log (admin/views/modules.php, admin/views/partials/module-update-*.php)
   ========================================================================== */
.mod-upd { align-items: flex-start; }
.mod-upd > .ic { margin-top: 2px; }
.mod-upd > div { display: block; }
.mod-report { margin-top: 6px; font-size: 12.5px; }
.mod-report summary { cursor: pointer; color: var(--link); width: max-content; }
.mod-report dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 10px; margin: 6px 0; }
.mod-report dt { color: var(--muted); }
.mod-report dd { margin: 0; overflow-wrap: anywhere; }
.mod-excerpt { max-height: 180px; overflow: auto; margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: 11.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.mod-upd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.mod-upd-actions form { margin: 0; }
.mod-updated { margin: 0; font-size: 12.5px; }
.mod-auto-form { margin: 0; }
.mod-auto { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 2px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
.mod-auto span { position: relative; width: 26px; height: 15px; border-radius: 99px; background: var(--border-strong); transition: background .15s; flex-shrink: 0; }
.mod-auto span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.mod-auto[aria-checked="true"] { color: var(--text-2); }
.mod-auto[aria-checked="true"] span { background: var(--success); }
.mod-auto[aria-checked="true"] span::after { transform: translateX(11px); }
.mod-auto:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.mod-local { font-size: 12px; }
.mod-auto-group { border: 0; padding: 0; margin: 4px 0 0; min-width: 0; }
.mod-auto-group legend { padding: 0; margin-bottom: 10px; }
.mod-auto-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.mod-auto-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; min-width: 0; }
.mod-auto-item:hover { border-color: var(--border-strong); }
.mod-auto-item input { flex-shrink: 0; margin: 0; }
.mod-auto-item span { flex: 1; min-width: 0; font-weight: 550; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-auto-item small { flex-shrink: 0; }
.mod-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mod-steps li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.mod-steps li span:not(.pill) { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; color: var(--text-2); }
.mod-steps .pill { min-width: 52px; justify-content: center; text-align: center; }
.mod-upd-banner { align-items: flex-start; }
.mod-upd-banner > .ic { margin-top: 2px; }
@media (max-width: 600px) { .mod-report dl { grid-template-columns: minmax(0, 1fr); } .mod-auto-list { grid-template-columns: minmax(0, 1fr); } }
/* Templates: tabs per group; the group title only shows on the All tab */
.tpl-toolbar { margin-top: 6px; }
.tpl-group .tpl-group-title { display: none; }
body.tpl-all .tpl-group .tpl-group-title { display: block; }
.tpl-group { margin-top: 0; }
body.tpl-all .tpl-group + .tpl-group { margin-top: 18px; }
.import-designs:has(.import-design:nth-child(3)) { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.import-parts { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.import-parts .choice { align-items: flex-start; padding: 3px 0; }
.import-parts .choice input { margin-top: 3px; }
.import-parts .choice > span { display: flex; flex-direction: column; font-size: 13px; font-weight: 550; line-height: 1.35; }
.import-parts .choice small { font-weight: 400; font-size: 11.5px; }
[data-page-design]:not(:has(input[value="partial"]:checked)) .page-design-parts { display: none; }
.page-design-parts { padding: 2px 0 6px 14px; gap: 2px; font-size: 13px; }

/* Balanced layouts: list filters in an even grid, dashboard cards at their own height, settings controls on the right */
@media (min-width: 1001px) {
  .lt-filters { display: grid; grid-template-columns: minmax(220px, 1.5fr) repeat(auto-fit, minmax(150px, 1fr)); align-items: center; }
  .lt-filters > [hidden], .lt-filters > input[type=hidden] { display: none; }
  .lt-filters .lt-search { flex: none; min-width: 0; }
  .lt-filters .lt-filter { width: 100%; max-width: none; }
}
.dash-main { align-items: start; }
.settings-card .setting-row:not(.is-toggle) { grid-template-columns: minmax(0, 1fr) minmax(240px, 440px); }
.settings-card .setting-row:not(.is-toggle) .help { max-width: 560px; }
/* Terms: New / Edit on their own page */
.term-form { display: flex; flex-direction: column; gap: 16px; }
.term-form .card { margin: 0; }
.term-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
.term-grid .field { margin: 0; }
.color-field { display: flex; align-items: center; gap: 8px; max-width: 260px; } .color-field .input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; }
/* Editor taxonomy card: find and add with a parent */
.term-find { position: relative; display: block; margin-bottom: 8px; }
.term-find .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.term-find .input { width: 100%; padding-left: 30px; }
.term-checklist .choice[hidden] { display: none; }
.term-none { margin: 6px 2px; }
.add-term { border-top: 1px solid var(--border); padding-top: 10px; }
.add-term summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--link); font-size: 13px; font-weight: 550; }
.add-term summary::-webkit-details-marker { display: none; }
.add-term-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }
.add-term-form .btn { justify-self: start; }

/* Term picker field: search above, options in columns */
.term-pick { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.term-pick-head { display: flex; align-items: center; gap: 12px; }
.term-pick-head .term-find { flex: 1 1 260px; max-width: 360px; margin: 0; }
.term-pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 12px; max-height: 260px; overflow-y: auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.term-pick-list .choice { padding: 6px 4px; min-width: 0; }
.term-pick-list .choice[hidden] { display: none; }
.term-pick-list .choice span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-pick-list > p { grid-column: 1 / -1; margin: 4px; }

/* Repeater rows with widths from the field builder */
.repeater-row.is-sized { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.repeater-row.is-sized > .field { grid-column: span 4; }
.repeater-row.is-sized > .rw-25 { grid-column: span 3; }
.repeater-row.is-sized > .rw-33 { grid-column: span 4; }
.repeater-row.is-sized > .rw-50 { grid-column: span 6; }
.repeater-row.is-sized > .rw-66 { grid-column: span 8; }
.repeater-row.is-sized > .rw-75 { grid-column: span 9; }
.repeater-row.is-sized > .rw-100 { grid-column: 1 / -1; }
@media (max-width: 760px) { .repeater-row.is-sized > .field { grid-column: 1 / -1; } }
/* Masonry: cards take only their own height (rows of 4px, spans set by admin.js) */
.dash-main[data-masonry].is-masonry { grid-auto-rows: 4px; row-gap: 0; align-items: start; }
.dash-main[data-masonry].is-masonry > * { margin: 0 0 20px; }

/* Backups */
.bk-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px}.bk-actions .input-sm{width:180px}
.bk-list li{display:block;padding:10px 12px}.bk-row{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px}.bk-row .list-main small{display:flex;flex-wrap:wrap;align-items:center;gap:4px}
.bk-link{display:flex;align-items:center;gap:8px;margin-top:8px;flex-wrap:wrap}.bk-link .input{flex:1;min-width:200px}
.bk-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px}.bk-box{display:flex;flex-direction:column;gap:8px;padding:14px;border:1px solid var(--border);border-radius:12px}.bk-box .small-label{display:flex;align-items:center;gap:6px}.bk-box p{margin:0}
