/* ==========================================================================
   Design system — neutral, dense, monochrome (light / dark)
   ========================================================================== */
@font-face { font-family: "Geist"; src: url("./fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("./fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #fafafa;
  --bg-2: #f4f4f5;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --hover: rgba(10, 10, 11, .04);
  --active: rgba(10, 10, 11, .065);
  --border: #e8e8eb;
  --border-2: #d9d9de;
  --text: #0a0a0b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --primary: #0a0a0b;
  --primary-fg: #fafafa;
  --primary-hover: #2a2a2e;
  --ring: rgba(10, 10, 11, .1);
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, .06);
  --overlay: rgba(10, 10, 11, .28);
  --grid-dot: rgba(10, 10, 11, .08);
  --shadow-sm: 0 1px 2px rgba(10, 10, 11, .04);
  --shadow-md: 0 1px 2px rgba(10, 10, 11, .04), 0 8px 24px -8px rgba(10, 10, 11, .08);
  --shadow-lg: 0 2px 6px rgba(10, 10, 11, .04), 0 24px 64px -16px rgba(10, 10, 11, .22);
  --sidebar-w: 232px;
  --radius: 10px;
  --radius-sm: 7px;
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --bg-2: #141415;
  --panel: #111112;
  --panel-2: #0e0e0f;
  --hover: rgba(255, 255, 255, .045);
  --active: rgba(255, 255, 255, .075);
  --border: #222225;
  --border-2: #313136;
  --text: #ededee;
  --text-2: #c4c4ca;
  --muted: #8b8b94;
  --faint: #5d5d65;
  --primary: #ededee;
  --primary-fg: #0a0a0a;
  --primary-hover: #ffffff;
  --ring: rgba(255, 255, 255, .12);
  --ok: #3fb950;
  --warn: #e3a008;
  --danger: #f2555a;
  --danger-bg: rgba(242, 85, 90, .09);
  --overlay: rgba(0, 0, 0, .6);
  --grid-dot: rgba(255, 255, 255, .07);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, .02), 0 24px 64px -12px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}
a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
[v-cloak] { display: none !important; }
::selection { background: color-mix(in srgb, var(--text) 16%, transparent); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.i { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.i > svg { width: 16px; height: 16px; }

/* ==========================================================================
   Shell
   ========================================================================== */
.shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); flex: none; display: flex; flex-direction: column;
  background: var(--bg); border-right: 1px solid var(--border); padding: 12px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.logo { width: 28px; height: 28px; border-radius: 8px; flex: none; display: block; box-shadow: 0 0 0 .5px rgba(255, 255, 255, .12), 0 4px 10px -4px rgba(10, 10, 11, .45); }
.brand-name { font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: var(--muted); line-height: 1.3; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-title { font-size: 11.5px; color: var(--faint); padding: 14px 10px 6px; font-weight: 500; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; width: 100%;
  border: 0; border-radius: 7px; background: none; color: var(--text-2); cursor: pointer;
  font-size: 13.5px; text-align: left; transition: background .12s, color .12s;
}
.nav-item .i { color: var(--muted); }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--text); font-weight: 500; }
.nav-item.active .i { color: var(--text); }
.nav-count { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.meter { padding: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); }
.meter-row { display: flex; font-size: 12px; color: var(--muted); }
.meter-row b { color: var(--text-2); font-weight: 500; }
.foot-row { display: flex; align-items: center; gap: 6px; padding: 0 2px; }
.me { display: flex; align-items: center; gap: 9px; padding: 4px 4px 2px 6px; }
.me .avatar { cursor: pointer; padding: 0; font-family: inherit; }
.me .avatar:hover { border-color: var(--border-2); color: var(--text); }
.me-text { min-width: 0; flex: 1; }
.me-name { font-size: 13px; font-weight: 500; line-height: 1.25; }
.me-sub { font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.nav-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; margin-left: auto; background: var(--faint); flex: none; }
.nav-dot.ok { background: var(--ok); }
.nav-dot.warn { background: var(--warn); }
.nav-dot.danger { background: var(--danger); }
a.nav-item { text-decoration: none; }
.brand-text { min-width: 0; }

/* Collapsed icon rail (Cursor-style activity bar) */
.sidebar { position: relative; z-index: 30; transition: width .18s ease, padding .18s ease; }
.nav-item { position: relative; }
.sidebar.rail { width: 56px; padding: 12px 8px; }
.sidebar.rail .brand { justify-content: center; padding: 6px 0 12px; }
.sidebar.rail .brand-text,
.sidebar.rail .nav-label,
.sidebar.rail .nav-count,
.sidebar.rail .meter,
.sidebar.rail .me-text { display: none; }
.sidebar.rail .nav-title { font-size: 0; padding: 0; height: 1px; background: var(--border); margin: 8px 6px; }
.sidebar.rail .nav-item { justify-content: center; padding: 0; height: 38px; gap: 0; }
.sidebar.rail .nav-item .i > svg { width: 17px; height: 17px; }
.sidebar.rail .nav-dot { position: absolute; top: 8px; right: 8px; margin: 0; box-shadow: 0 0 0 2px var(--bg); }
.sidebar.rail .sidebar-foot { align-items: stretch; }
.sidebar.rail .foot-row { flex-direction: column; padding: 0; gap: 2px; }
.sidebar.rail .foot-row .spacer { display: none; }
.sidebar.rail .foot-row .theme-btn, .sidebar.rail .foot-row .nav-item { width: 100%; }
.sidebar.rail .collapse-btn { width: 100%; height: 38px; }
.sidebar.rail .me { flex-direction: column; padding: 4px 0 0; gap: 6px; }
.sidebar.rail .me .btn { width: 100%; height: 34px; }
.sidebar.rail .nav-item::after, .sidebar.rail .collapse-btn::after, .sidebar.rail .me .btn::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translate(-4px, -50%);
  padding: 5px 9px; border-radius: 6px; background: var(--primary); color: var(--primary-fg); font-size: 12px; font-weight: 500;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; box-shadow: var(--shadow-md);
}
.sidebar.rail .collapse-btn::after { content: "展开侧栏"; }
.sidebar.rail .me .btn::after { content: "退出登录"; }
.sidebar.rail .collapse-btn, .sidebar.rail .me .btn { position: relative; }
.sidebar.rail .nav-item:hover::after, .sidebar.rail .collapse-btn:hover::after, .sidebar.rail .me .btn:hover::after { opacity: 1; transform: translate(0, -50%); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.topbar {
  height: 48px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 20px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.crumbs-top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.crumbs-top b { color: var(--text); font-weight: 500; }
.crumbs-top .sep { color: var(--faint); }
.content { flex: 1; overflow: auto; }
.content.flush { overflow: hidden; display: flex; }
.page { max-width: 1120px; margin: 0 auto; padding: 32px 32px 64px; }
.page.wide { max-width: 1320px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.025em; line-height: 1.25; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; max-width: 640px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* ==========================================================================
   Primitives
   ========================================================================== */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.xsmall { font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); min-height: 52px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--panel); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background .12s, border-color .12s, color .12s, opacity .12s; text-decoration: none;
}
.btn .i > svg { width: 15px; height: 15px; }
.btn:hover { background: var(--bg-2); border-color: var(--border-2); }
.btn:focus-visible, .nav-item:focus-visible, .menu-item:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn.block { width: 100%; height: 36px; }

/* Inputs */
.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--panel); outline: none; font-size: 13.5px; transition: border-color .12s, box-shadow .12s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-2); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--muted); box-shadow: 0 0 0 3px var(--ring); }
.textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 84px; line-height: 1.55; }
.select { appearance: none; padding-right: 30px; 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='%2371717a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 32px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* Badges / status */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-2); font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge.solid { background: var(--bg-2); border-color: transparent; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.status.ok::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 16%, transparent); }
.status.warn::before { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 16%, transparent); }
.status.danger::before { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent); }
.status.idle::before { background: var(--faint); }
.kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--panel); }
.code { font-family: var(--mono); font-size: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; color: var(--text-2); }

/* Avatar / tile */
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-2); font-size: 11.5px; font-weight: 600;
}
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.tile {
  width: 34px; height: 34px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text); font-size: 13.5px; font-weight: 600;
}
.tile.lg { width: 40px; height: 40px; font-size: 15px; border-radius: 9px; }
.tile .i > svg { width: 17px; height: 17px; }

/* Tables */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 9px 16px; height: 38px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--panel-2);
}
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover td { background: var(--hover); }
.table .actions-cell { text-align: right; width: 1%; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/* Progress */
.progress { height: 4px; background: var(--active); border-radius: 99px; overflow: hidden; min-width: 80px; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--text-2); transition: width .3s; }
.progress.warn > i { background: var(--warn); }
.progress.danger > i { background: var(--danger); }

/* Stats strip */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats > div { padding: 16px 20px; border-left: 1px solid var(--border); min-width: 0; }
.stats > div:first-child { border-left: 0; }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.03em; margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-sub { font-size: 12px; color: var(--faint); margin-top: 4px; }

/* Segmented control */
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; }
.seg button { height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.seg.icons button { width: 28px; padding: 0; justify-content: center; }
.seg.icons .i > svg { width: 14px; height: 14px; }

/* Underline tabs */
.utabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); padding: 0 24px; }
.utab { position: relative; height: 42px; border: 0; background: none; color: var(--muted); font-size: 13.5px; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 6px; }
.utab:hover { color: var(--text); }
.utab.active { color: var(--text); font-weight: 500; }
.utab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); border-radius: 2px; }
.utab .count { font-size: 11.5px; color: var(--faint); }

/* Switch & checkbox */
.switch { position: relative; width: 32px; height: 18px; flex: none; cursor: pointer; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: var(--border-2); border-radius: 99px; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked + i { background: var(--primary); }
[data-theme="dark"] .switch input:checked + i::after { background: var(--primary-fg); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { outline: 2px solid var(--text); outline-offset: 2px; }
.switch input:disabled + i { opacity: .4; cursor: not-allowed; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--primary); margin: 0; }

/* Notes */
.note { display: flex; gap: 10px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); color: var(--text-2); font-size: 13px; }
.note .i { color: var(--muted); margin-top: 1px; }
.note.warn { border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); background: color-mix(in srgb, var(--warn) 6%, var(--panel)); }
.note.warn .i { color: var(--warn); }

/* Empty */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); font-size: 13.5px; }
.empty .tile { margin: 0 auto 14px; width: 40px; height: 40px; color: var(--muted); background: var(--panel); }
.empty .empty-title { color: var(--text); font-weight: 500; font-size: 14px; margin-bottom: 4px; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-2); border-top-color: var(--text); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; flex: none; }
.spinner.lg { width: 22px; height: 22px; }
.btn.primary .spinner { border-color: color-mix(in srgb, var(--primary-fg) 30%, transparent); border-top-color: var(--primary-fg); }

/* Section (settings style) */
.section { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.section + .section { margin-top: 16px; }
.section-body { padding: 20px 24px; }
.section-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.section-desc { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; }
.section-foot {
  display: flex; align-items: center; gap: 12px; padding: 11px 24px; border-top: 1px solid var(--border);
  background: var(--panel-2); border-radius: 0 0 var(--radius) var(--radius); font-size: 12.5px; color: var(--muted); min-height: 54px;
}
.section-foot .btn { margin-left: auto; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 12px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }

/* ==========================================================================
   Overlays
   ========================================================================== */
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.985); } }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } }
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--overlay); backdrop-filter: blur(3px); animation: fade .15s ease-out; padding: 16px; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .16s ease-out; }
.modal.sm { width: min(420px, 100%); }
.modal.wide { width: min(760px, 100%); }
.modal-head { padding: 18px 22px 0; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.015em; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; }
.modal-body { padding: 18px 22px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; border-top: 1px solid var(--border); background: var(--panel-2); border-radius: 0 0 14px 14px; }
.drawer-overlay { place-items: stretch end; padding: 0; }
.drawer { width: min(820px, 100vw); height: 100vh; background: var(--panel); border-left: 1px solid var(--border); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .18s ease-out; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 24px; }
.drawer-body { flex: 1; overflow: auto; padding: 22px 24px; }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 12px 24px; border-top: 1px solid var(--border); background: var(--panel-2); }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 9px; min-width: 260px; max-width: 420px; padding: 11px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop .16s ease-out; }
.toast .i { color: var(--ok); }
.toast.error .i { color: var(--danger); }

.menu { position: fixed; z-index: 80; min-width: 184px; padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); animation: pop .12s ease-out; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; height: 32px; padding: 0 10px; border: 0; background: none; border-radius: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; text-align: left; }
.menu-item .i { color: var(--muted); }
.menu-item:hover { background: var(--hover); color: var(--text); }
.menu-item.danger, .menu-item.danger .i { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-bg); }
.menu-sep { height: 1px; background: var(--border); margin: 4px -4px; }
.menu-label { font-size: 11.5px; color: var(--faint); padding: 6px 10px 4px; }

/* ==========================================================================
   Feature blocks
   ========================================================================== */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

/* Skills */
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.skill { padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: border-color .12s, box-shadow .12s; }
.skill:hover { border-color: var(--border-2); box-shadow: var(--shadow-md); }
.skill-head { display: flex; gap: 12px; align-items: flex-start; }
.skill-title { font-size: 14px; font-weight: 600; letter-spacing: -.01em; line-height: 1.35; }
.skill-id { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.skill-desc { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.6; min-height: 42px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.skill-foot { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); margin-top: auto; }

/* Files */
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 13.5px; min-width: 0; }
.crumbs button { border: 0; background: none; cursor: pointer; padding: 3px 6px; border-radius: 5px; color: var(--muted); display: inline-flex; align-items: center; }
.crumbs button:hover { background: var(--hover); color: var(--text); }
.crumbs button.cur { color: var(--text); font-weight: 500; }
.crumbs .sep { color: var(--faint); padding: 0 1px; }
.file-card { position: relative; }
.drop-mask {
  position: absolute; inset: -1px; z-index: 5; border-radius: var(--radius); border: 1.5px dashed var(--text-2);
  background: color-mix(in srgb, var(--panel) 88%, transparent); display: grid; place-items: center; text-align: center; pointer-events: none;
}
.file-name { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; }
.file-name:hover .fname { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-2); }
.fico { width: 28px; height: 28px; border-radius: 7px; flex: none; display: grid; place-items: center; border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); }
.fico .i > svg { width: 15px; height: 15px; }
.fico.dir { color: var(--text); }
.row-actions { opacity: 0; transition: opacity .12s; }
tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }
/* Skill icon (admin + workspace) */
.sk-icon {
  --s: 36px; --c: #6366f1;
  position: relative; width: var(--s); height: var(--s); flex: none; display: grid; place-items: center; overflow: hidden;
  border-radius: calc(var(--s) * .3);
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 24%, #fff) 0%, color-mix(in srgb, var(--c) 9%, #fff) 100%);
  box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--c) 32%, transparent), 0 1px 2px rgba(0, 0, 0, .06);
}
[data-theme="dark"] .sk-icon {
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 36%, #19191b) 0%, color-mix(in srgb, var(--c) 15%, #19191b) 100%);
  box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--c) 45%, transparent);
}
.sk-icon .sk-emoji { font-size: calc(var(--s) * .52); line-height: 1; transform: translateY(.02em); }
.sk-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sk-icon.img { background: var(--panel); }
.sk-icon::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255, 255, 255, .28), transparent 48%); pointer-events: none; }

/* Icon editor (admin skill drawer) */
.ic { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; padding: 18px; }
.ic-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 112px; }
.ic-preview .sk-icon { transition: transform .35s cubic-bezier(.34, 1.4, .64, 1); }
.ic-preview:hover .sk-icon { transform: rotate(-6deg) scale(1.05); }
.ic-preview-name { font-size: 12px; color: var(--muted); text-align: center; max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ic-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ic-label { font-size: 12px; font-weight: 500; color: var(--muted); width: 36px; flex: none; }
.ic-emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; max-height: 118px; overflow: auto; padding: 2px; flex: 1; }
.ic-emoji { height: 34px; border: 0; border-radius: 9px; background: transparent; font-size: 19px; cursor: pointer; transition: background .12s, transform .15s cubic-bezier(.34, 1.4, .64, 1); }
.ic-emoji:hover { background: var(--hover); transform: scale(1.12); }
.ic-emoji.on { background: var(--active); box-shadow: inset 0 0 0 1.5px var(--text-2); }
.ic-custom { width: 120px; height: 30px; font-size: 14px; text-align: center; }
.ic-swatch { width: 22px; height: 22px; border-radius: 50%; border: 0; cursor: pointer; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); transition: transform .15s cubic-bezier(.34, 1.4, .64, 1), box-shadow .15s; }
.ic-swatch:hover { transform: scale(1.15); }
.ic-swatch.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); }
.ic-color { width: 30px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 7px; background: none; cursor: pointer; }
.ic-drop { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px dashed var(--border-2); border-radius: 10px; transition: background .12s, border-color .12s; }
.ic-drop.over { background: var(--hover); border-color: var(--text-2); }
.ic-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ic-mode label { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.ic-mode label:has(input:checked) { border-color: var(--text-2); background: var(--panel-2); }
.ic-mode input { margin: 3px 0 0; accent-color: var(--primary); }
.ic-mode b { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13.5px; }
.ic-mode b .i > svg { width: 14px; height: 14px; }
.ic-mode span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.55; }

/* Skill parameters (admin) */
.pr { display: flex; flex-direction: column; gap: 14px; }
.pr-presets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pr-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; border: 1px dashed var(--border-2); background: var(--panel); color: var(--text-2); font-size: 12.5px; cursor: pointer; transition: background .12s, border-color .12s, transform .12s; }
.pr-chip:hover:not(:disabled) { background: var(--hover); border-style: solid; transform: translateY(-1px); }
.pr-chip:disabled { opacity: .4; cursor: default; }
.pr-chip .i > svg { width: 13px; height: 13px; }
.pr-empty { text-align: center; padding: 36px 20px; border: 1px dashed var(--border); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pr-empty .tile { margin-bottom: 10px; color: var(--muted); }
.pr-list { display: flex; flex-direction: column; gap: 10px; }
.pr-item { padding: 12px 14px 14px; }
.pr-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-width: 0; }
.pr-item-head b { font-weight: 500; font-size: 13.5px; }
.pr-item-head .badge .i > svg { width: 11px; height: 11px; }
.pr-index { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; color: var(--muted); background: var(--bg-2); flex: none; }
.pr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.pr-grid .full { grid-column: 1 / -1; }
.pr-grid .field > label { font-size: 12px; font-weight: 500; color: var(--muted); }
.pr-grid .input, .pr-grid .select { height: 32px; font-size: 13px; }
.pr-list-enter-active, .pr-list-leave-active { transition: opacity .18s, transform .18s; }
.pr-list-enter-from, .pr-list-leave-to { opacity: 0; transform: translateY(-6px); }
.pr-list-move { transition: transform .2s; }

/* Skill attachments (tree) */
.fx { display: flex; flex-direction: column; gap: 12px; }
.fx-lead { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.fx-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fx-crumbs { gap: 1px; min-height: 28px; }
.fx-crumb-label { font-size: 12px; color: var(--faint); margin-right: 4px; }
.fx-crumbs button { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.fx-crumbs button .i > svg { width: 14px; height: 14px; }
.crumbs button.drop { background: var(--active); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--text-2); }
.fx-search { width: 180px; }
.fx-search .input { height: 28px; font-size: 12.5px; }
.fx-upload { position: relative; }
.fx-upload .btn .i:last-child > svg { width: 13px; height: 13px; opacity: .7; }
.menu.fx-menu { position: absolute; top: calc(100% + 4px); right: 0; min-width: 210px; }
.fx-selbar {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-radius: 9px;
  background: var(--bg-2); border: 1px solid var(--border); font-size: 13px; animation: pop .12s ease-out;
}
.fx-progress { padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); }
.fx-progress .progress { min-width: 0; }
.fx-progress.done .progress > i { background: var(--ok); }
.fx-ok { color: var(--ok); }
.fx-bad { color: var(--danger); }
.fx-fail { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; color: var(--danger); }
.fx-card { position: relative; overflow: hidden; transition: box-shadow .12s, border-color .12s; }
.fx-card.over { border-color: var(--text-2); box-shadow: 0 0 0 3px var(--ring); }
.fx-head, .fx-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 90px 132px; align-items: center; gap: 10px; padding: 0 12px 0 14px; }
.fx-head { height: 36px; border-bottom: 1px solid var(--border); background: var(--panel-2); font-size: 12px; color: var(--muted); font-weight: 500; }
.fx-col-size { text-align: right; font-size: 12.5px; }
.fx-col-act { display: flex; justify-content: flex-end; gap: 0; }
.fx-body { max-height: min(56vh, 620px); overflow: auto; }
.fx-row { height: 40px; border-bottom: 1px solid var(--border); cursor: default; user-select: none; transition: background .1s; }
.fx-row:last-child { border-bottom: 0; }
.fx-row:hover { background: var(--hover); }
.fx-row:hover .row-actions, .fx-row .row-actions:focus-within { opacity: 1; }
.fx-row.dir { cursor: pointer; }
.fx-row.sel { background: color-mix(in srgb, var(--text) 5%, transparent); }
.fx-row.cur .fx-name { font-weight: 600; }
.fx-row.cur .fico { border-color: var(--text-2); }
.fx-row.drop { background: var(--active); box-shadow: inset 0 0 0 1.5px var(--text-2); }
.fx-row[draggable="true"] { cursor: grab; }
.fx-row.dir[draggable="true"] { cursor: pointer; }
.fx-col-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fx-caret { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border: 0; padding: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer; transition: transform .12s; }
.fx-caret:hover { background: var(--active); color: var(--text); }
.fx-caret .i > svg { width: 14px; height: 14px; }
.fx-caret.open { transform: rotate(90deg); }
.fx-caret-pad { width: 18px; flex: none; }
.fx-row .fico { width: 24px; height: 24px; border-radius: 6px; }
.fx-row .fico .i > svg { width: 13px; height: 13px; }
.fx-name { font-size: 13px; min-width: 0; }
.fx-count { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.fx-del { color: var(--danger) !important; }
.fx-empty { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 34px 20px; color: var(--muted); font-size: 13px; line-height: 1.6; border-top: 1px dashed var(--border); }
.fx-empty b { color: var(--text); font-weight: 500; }
.fx-empty > .i > svg { width: 22px; height: 22px; }
.fx-droptip {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 3; pointer-events: none;
  padding: 6px 12px; border-radius: 99px; background: var(--primary); color: var(--primary-fg); font-size: 12.5px; font-weight: 500; box-shadow: var(--shadow-md); white-space: nowrap;
}
.fx-dest { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 9px; padding: 4px; }
.fx-dest-item { display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; border: 0; border-radius: 6px; background: none; font-size: 13px; color: var(--text-2); cursor: pointer; text-align: left; padding-right: 10px; }
.fx-dest-item .i { color: var(--muted); }
.fx-dest-item:hover { background: var(--hover); color: var(--text); }
.fx-dest-item.active { background: var(--active); color: var(--text); font-weight: 500; }
.fx-dest-item:disabled { opacity: .4; cursor: not-allowed; background: none; }
.fx-zipfile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); }
.fx-radio { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 400; }
.fx-radio:has(input:checked) { border-color: var(--text-2); background: var(--panel-2); }
.fx-radio input { margin: 3px 0 0; accent-color: var(--primary); }
.fx-radio b { display: block; font-weight: 500; }
.fx-radio span { color: var(--muted); font-size: 12.5px; }
@media (max-width: 720px) {
  .fx-head, .fx-row { grid-template-columns: 22px minmax(0, 1fr) 70px 64px; }
  .fx-row .row-actions { opacity: 1; }
  .fx-row .row-actions .btn:nth-child(-n+2) { display: none; }
}

.upload-panel { position: fixed; right: 20px; bottom: 20px; z-index: 60; width: 360px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .16s ease-out; }
.upload-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 500; }
.upload-list { max-height: 240px; overflow: auto; padding: 6px 0; }
.upload-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 7px 14px; font-size: 12.5px; }
.upload-item .progress { grid-column: 1 / -1; min-width: 0; height: 3px; }
.upload-item .err { grid-column: 1 / -1; color: var(--danger); font-size: 12px; }

/* Chat viewer (admin) */
.page.fill { padding-bottom: 24px; }
.cv { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 12px; height: calc(100vh - 186px); min-height: 480px; }
.cv > .card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.cv-side-head { padding: 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.cv-user { display: flex; align-items: center; gap: 8px; }
.cv-user .select { height: 32px; font-size: 13px; font-weight: 500; }
.cv-search .input { height: 30px; font-size: 12.5px; background: var(--panel-2); }
.cv-list { flex: 1; overflow: auto; padding: 4px 6px 10px; }
.cv-group { font-size: 11.5px; color: var(--faint); font-weight: 500; padding: 12px 8px 4px; }
.cv-item { display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; text-align: left; cursor: pointer; color: var(--text); }
.cv-item:hover { background: var(--hover); }
.cv-item.active { background: var(--active); }
.cv-item:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.cv-item-title { font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.cv-item.active .cv-item-title { font-weight: 500; }
.cv-item-meta { display: flex; gap: 5px; font-size: 11.5px; color: var(--faint); }

.cv-head { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); min-height: 60px; }
.cv-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.cv-head-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.cv-head-meta span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--faint); vertical-align: middle; margin: -2px 12px 0 -6px; }
.cv-scroll { flex: 1; overflow: auto; }
.cv-placeholder { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 13px; }
.cv-placeholder .tile { margin-bottom: 10px; color: var(--muted); }
.cv-thread { max-width: 780px; margin: 0 auto; padding: 20px 28px 56px; display: flex; flex-direction: column; gap: 18px; }
.cv-day { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--faint); margin: 6px 0 -4px; }
.cv-day::before, .cv-day::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.cv-meta { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.cv-meta span { font-weight: 500; color: var(--text-2); }
.cv-meta time { color: var(--faint); font-size: 11.5px; }
.cv-msg.user { align-self: flex-end; max-width: 78%; display: flex; flex-direction: column; align-items: flex-end; }
.cv-bubble { background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px 14px 4px 14px; padding: 9px 14px; font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.cv-msg.ai { display: flex; gap: 12px; align-items: flex-start; }
.cv-ai-mark { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--primary); color: var(--primary-fg); margin-top: 1px; }
.cv-ai-mark .i > svg { width: 14px; height: 14px; }
.cv-ai-body { min-width: 0; flex: 1; }
.cv-system { align-self: center; font-size: 12px; color: var(--faint); padding: 3px 10px; border-radius: 99px; background: var(--bg-2); }
.cv-tools { margin-left: 38px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); overflow: hidden; }
.cv-tools-head { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 12px; border: 0; background: var(--panel-2); color: var(--muted); font-size: 12.5px; cursor: pointer; text-align: left; }
.cv-tools-head:hover { color: var(--text); }
.cv-tools-head .i > svg { width: 14px; height: 14px; }
.cv-tools-head > span:first-of-type { color: var(--text-2); font-weight: 500; white-space: nowrap; }
.cv-tools-names { flex: 1; min-width: 0; font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.cv-tools .cv-caret { transition: transform .12s; }
.cv-tools.open .cv-caret { transform: rotate(90deg); }
.cv-tools-body { border-top: 1px solid var(--border); }
.cv-tool + .cv-tool { border-top: 1px solid var(--border); }
.cv-tool-name { display: flex; align-items: center; gap: 7px; padding: 7px 12px 0; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.cv-tool-name .i > svg { width: 13px; height: 13px; }
.cv-tool-name time { margin-left: auto; color: var(--faint); font-family: var(--font); font-size: 11px; }
.cv-tool pre { margin: 0; padding: 6px 12px 10px; font-family: var(--mono); font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; color: var(--text-2); max-height: 300px; overflow: auto; }
@media (max-width: 1100px) {
  .cv { grid-template-columns: 1fr; height: auto; }
  .cv-side { max-height: 320px; }
  .cv-main { min-height: 560px; }
}

/* Markdown (rendered by md.js) */
.md { font-size: 14px; line-height: 1.75; color: var(--text); word-break: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h2, .md h3, .md h4, .md h5, .md h6 { margin: 18px 0 8px; line-height: 1.4; letter-spacing: -.01em; font-weight: 600; }
.md h2 { font-size: 17px; } .md h3 { font-size: 15.5px; } .md h4, .md h5, .md h6 { font-size: 14px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md li > ul, .md li > ol { margin: 2px 0 4px; }
.md li::marker { color: var(--muted); }
.md .md-task-item { list-style: none; margin-left: -20px; }
.md .md-task { display: inline-block; width: 13px; height: 13px; border: 1.5px solid var(--border-2); border-radius: 4px; vertical-align: -1px; margin-right: 7px; }
.md .md-task.done { background: var(--text-2) center / 9px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); border-color: var(--text-2); }
.md strong { font-weight: 600; }
.md a { color: var(--text); text-decoration-color: var(--border-2); }
.md .md-ref { border-bottom: 1px dashed var(--border-2); cursor: help; }
.md hr { border: 0; height: 1px; background: var(--border); margin: 16px 0; }
.md blockquote { margin: 0 0 10px; padding: 2px 0 2px 14px; border-left: 3px solid var(--border-2); color: var(--text-2); }
.md code { font-family: var(--mono); font-size: 12.5px; padding: 1px 5px; border-radius: 5px; background: var(--bg-2); border: 1px solid var(--border); }
.md .md-code { margin: 4px 0 12px; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--panel-2); }
.md .md-code-head { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 8px 0 12px; border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.md .md-copy { border: 0; background: none; color: var(--muted); font-size: 11.5px; padding: 3px 8px; border-radius: 5px; cursor: pointer; font-family: var(--font); }
.md .md-copy:hover { background: var(--hover); color: var(--text); }
.md pre { margin: 0; padding: 12px 14px; overflow: auto; max-height: 460px; }
.md pre code { padding: 0; border: 0; background: none; font-size: 12.5px; line-height: 1.65; white-space: pre; }
.md .md-table { overflow-x: auto; margin: 4px 0 12px; border: 1px solid var(--border); border-radius: 9px; }
.md table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md th, .md td { padding: 7px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.md th { background: var(--panel-2); font-weight: 500; color: var(--text-2); white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
.md td + td, .md th + th { border-left: 1px solid var(--border); }

/* Workspace (iframe) */
.frame-wrap { position: relative; flex: 1; min-width: 0; }
.frame-wrap iframe { border: 0; width: 100%; height: 100%; display: block; background: var(--bg); }
.boot { position: absolute; inset: 0; display: grid; place-items: center; background: var(--bg); }
.boot-card { width: min(380px, calc(100% - 32px)); }
.boot-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin-top: 16px; }
.boot-steps { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); padding-top: 16px; }
.boot-steps li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--faint); }
.boot-steps li.done { color: var(--text-2); }
.boot-steps li.done .i { color: var(--ok); }
.boot-steps li.active { color: var(--text); }
.boot-steps .dotph { width: 16px; height: 16px; display: grid; place-items: center; }
.boot-steps .dotph::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--border-2); }

/* Steps list */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { position: relative; padding-left: 34px; font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.steps li::before {
  counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center; font-family: var(--mono); font-size: 11.5px; color: var(--text); background: var(--bg-2); border: 1px solid var(--border);
}

/* Code editor */
.code-editor { font-family: var(--mono); font-size: 12.5px; line-height: 1.7; tab-size: 2; background: var(--panel-2); min-height: 62vh; }

/* ==========================================================================
   Responsive
   ========================================================================== */
.menu-btn { display: none !important; }
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 860px) {
  .sidebar:not(.rail) { position: fixed; z-index: 40; height: 100vh; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar.rail .nav-item::after, .sidebar.rail .collapse-btn::after, .sidebar.rail .me .btn::after { display: none; }
  .menu-btn { display: inline-flex !important; }
  .grid-2, .grid-3, .form-grid, .stats.three { grid-template-columns: 1fr; }
  .page { padding: 20px 16px 48px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head .actions { margin-left: 0; }
  .row-actions { opacity: 1; }
}
/* ==========================================================================
   Motion & finish
   ========================================================================== */
:root { --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.4, .64, 1); }

/* views & panels enter softly */
.content > .page { animation: m-view .38s var(--ease) both; }
.drawer-body > * { animation: m-fade .28s var(--ease) both; }
.modal { animation: m-pop .32s var(--spring) both; }
.overlay { animation: fade .18s ease-out; }
.drawer { animation: m-slide .34s var(--ease) both; }
.menu { animation: m-pop .2s var(--spring) both; transform-origin: top right; }
.toast { animation: m-toast .42s var(--spring) both; }

/* buttons feel pressable */
.btn { transition: background .12s, border-color .12s, color .12s, opacity .12s, transform .15s var(--ease), box-shadow .15s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn .i > svg { transition: transform .25s var(--spring); }
.btn:hover .i > svg { transform: scale(1.08); }
.nav-item .i > svg { transition: transform .25s var(--spring); }
.nav-item:hover .i > svg { transform: scale(1.1); }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--text);
  animation: m-grow .3s var(--spring) both;
}
.sidebar.rail .nav-item.active::before { left: -8px; }

/* underline tabs: the indicator grows in */
.utab.active::after { animation: m-ink .3s var(--ease) both; transform-origin: center; }

/* inputs */
.input, .select, .textarea { transition: border-color .15s, box-shadow .2s var(--ease), background .15s; }
.switch i::after { transition: transform .25s var(--spring); }

/* cards */
.card { transition: border-color .15s, box-shadow .25s var(--ease), transform .25s var(--ease); }
.skill { cursor: pointer; animation: m-rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.skill:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.skill .sk-icon { transition: transform .35s var(--spring); }
.skill:hover .sk-icon { transform: rotate(-6deg) scale(1.06); }
.skill-head .badge .i > svg { width: 11px; height: 11px; }
.stats > div { animation: m-rise .4s var(--ease) both; }
.stats > div:nth-child(2) { animation-delay: .04s; } .stats > div:nth-child(3) { animation-delay: .08s; } .stats > div:nth-child(4) { animation-delay: .12s; }
.table tbody tr { animation: m-fade .3s var(--ease) both; }
.empty .tile { animation: m-float 3.2s ease-in-out infinite; }

@keyframes m-view { from { opacity: 0; transform: translateY(8px); } }
@keyframes m-fade { from { opacity: 0; } }
@keyframes m-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes m-pop { from { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes m-slide { from { opacity: .4; transform: translateX(36px); } }
@keyframes m-toast { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes m-grow { from { transform: scaleY(0); } }
@keyframes m-ink { from { transform: scaleX(.2); opacity: 0; } }
@keyframes m-float { 50% { transform: translateY(-4px); } }
@keyframes m-logo { from { opacity: 0; transform: scale(.6) rotate(-20deg); } }
@keyframes m-aurora { 0% { transform: translate(-54%, -50%) rotate(0deg) scale(1); } 100% { transform: translate(-46%, -52%) rotate(14deg) scale(1.12); } }
@keyframes m-shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
