/* MDView design system - SRS 4.2 design tokens, light / dark / auto, shared by every page */
:root {
  --primary: #2563EB; --primary-600: #1D4ED8; --primary-50: #EFF6FF; --primary-100: #DBEAFE;
  --accent: #7C3AED; --accent-50: #F5F3FF;
  --bg: #FFFFFF; --surface: #F8FAFC; --surface-2: #F1F5F9; --elev: #FFFFFF;
  --text: #0F172A; --text-2: #334155; --muted: #64748B; --line: #E2E8F0; --line-2: #CBD5E1;
  --code-bg: #F1F5F9;
  --success: #16A34A; --warning: #D97706; --danger: #DC2626;
  --success-bg: #DCFCE7; --warning-bg: #FEF3C7; --danger-bg: #FEE2E2;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px;
  --shadow-card: 0 1px 3px rgba(15,23,42,.08);
  --shadow-pop: 0 12px 32px -8px rgba(15,23,42,.18), 0 2px 6px rgba(15,23,42,.06);
  --shadow-glow: 0 10px 40px -12px rgba(37,99,235,.45);
  --font-ui: 'Inter', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-read: 'Source Serif 4', 'Sarabun', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --grad: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
  --grad-soft: linear-gradient(135deg, rgba(37,99,235,.10), rgba(124,58,237,.10));
  --glass: rgba(255,255,255,.72);
  --header-h: 60px;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #60A5FA; --primary-600: #3B82F6; --primary-50: rgba(96,165,250,.10); --primary-100: rgba(96,165,250,.18);
    --accent: #A78BFA; --accent-50: rgba(167,139,250,.12);
    --bg: #0F172A; --surface: #1E293B; --surface-2: #172033; --elev: #1E293B;
    --text: #E2E8F0; --text-2: #CBD5E1; --muted: #94A3B8; --line: #283548; --line-2: #334155;
    --code-bg: #0B1220;
    --success: #4ADE80; --warning: #FBBF24; --danger: #F87171;
    --success-bg: rgba(74,222,128,.12); --warning-bg: rgba(251,191,36,.12); --danger-bg: rgba(248,113,113,.12);
    --shadow-card: 0 1px 3px rgba(0,0,0,.4); --shadow-pop: 0 16px 40px -8px rgba(0,0,0,.6);
    --glass: rgba(15,23,42,.72);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary: #60A5FA; --primary-600: #3B82F6; --primary-50: rgba(96,165,250,.10); --primary-100: rgba(96,165,250,.18);
  --accent: #A78BFA; --accent-50: rgba(167,139,250,.12);
  --bg: #0F172A; --surface: #1E293B; --surface-2: #172033; --elev: #1E293B;
  --text: #E2E8F0; --text-2: #CBD5E1; --muted: #94A3B8; --line: #283548; --line-2: #334155;
  --code-bg: #0B1220;
  --success: #4ADE80; --warning: #FBBF24; --danger: #F87171;
  --success-bg: rgba(74,222,128,.12); --warning-bg: rgba(251,191,36,.12); --danger-bg: rgba(248,113,113,.12);
  --shadow-card: 0 1px 3px rgba(0,0,0,.4); --shadow-pop: 0 16px 40px -8px rgba(0,0,0,.6);
  --glass: rgba(15,23,42,.72);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-ui); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }
.gradient-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--elev); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s, box-shadow .15s, transform .15s; text-decoration: none !important; }
.btn:hover { background: var(--surface); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: transparent; color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.3); }
.btn-primary:hover { background: var(--primary-600); }
:root[data-theme="dark"] .btn-primary { color: #0B1220; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #0B1220; } }
.btn-grad { background: var(--grad); border: 0; color: #fff !important; box-shadow: var(--shadow-glow); }
.btn-grad:hover { filter: brightness(1.08); background: var(--grad); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); transition: border-color .15s, box-shadow .15s; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .85; }
.hint { font-size: 12px; color: var(--muted); }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.switch { position: relative; display: inline-flex; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 10px; gap: 2px; border: 1px solid var(--line); }
.seg button, .seg a { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted); min-height: 32px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.seg .on, .seg [aria-pressed="true"] { background: var(--elev); color: var(--text); box-shadow: var(--shadow-card); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; min-height: 32px; border-radius: 99px; border: 1px solid var(--line); background: var(--elev); font-size: 13px; cursor: pointer; color: var(--text-2); }
.chip:hover { border-color: var(--line-2); }
.chip.on { background: var(--primary-50); border-color: var(--primary); color: var(--primary); font-weight: 500; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--accent-50); color: var(--accent); font-weight: 500; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.badge.ok { background: var(--success-bg); color: var(--success); }
.badge.warn { background: var(--warning-bg); color: var(--warning); }
.badge.bad { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--primary-50); color: var(--primary); }
.badge-plan { background: var(--grad); color: #fff; }

/* ---------- cards / panels ---------- */
.card { background: var(--elev); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card-pad { padding: 20px; }
.card h2, .card h3 { margin: 0 0 4px; }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; }
.kpi .k { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--grad); transition: width .4s var(--ease); }
.meter.warn > i { background: var(--warning); }
.meter.bad > i { background: var(--danger); }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .art { width: 120px; height: 120px; margin: 0 auto 16px; border-radius: 28px; background: var(--grad-soft); display: grid; place-items: center; color: var(--primary); }
.empty .art .ico { width: 48px; height: 48px; stroke-width: 1.4; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 18px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.divider { height: 1px; background: var(--line); margin: 12px 0; border: 0; }

/* ---------- toasts / modal / menu ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-pop); animation: pop .2s var(--ease); font-size: 14px; }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok .ico { color: #4ADE80; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(4px); z-index: 900; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--elev); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); border: 1px solid var(--line); animation: pop .2s var(--ease); }
.modal header { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.modal header h3 { margin: 0; font-size: 18px; flex: 1; }
.modal .body { padding: 8px 20px 16px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.menu { position: absolute; z-index: 800; min-width: 220px; padding: 6px; background: var(--elev); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); animation: pop .15s var(--ease); }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--text); font-size: 14px; text-decoration: none; min-height: 40px; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu .head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }

/* ---------- header (glass) ---------- */
.hdr { position: sticky; top: 0; z-index: 500; height: var(--header-h); display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text) !important; text-decoration: none !important; letter-spacing: -.02em; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-glow); flex: none; }
.logo-mark svg { width: 20px; height: 20px; }
.logo b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hdr-nav { display: flex; gap: 2px; margin-left: 12px; }
.hdr-nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px; text-decoration: none; min-height: 40px; }
.hdr-nav a:hover { color: var(--text); background: var(--surface-2); }
.hdr-nav a.on { color: var(--primary); background: var(--primary-50); }
/* header dropdown ("Convert" tools menu) - shared by every page that uses the site header */
.nav-drop { position: relative; display: inline-flex; }
.nav-drop > button { display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; border: 0; border-radius: 9px; background: none;
  color: var(--muted); font: 500 14px/1 var(--font-ui); min-height: 40px; cursor: pointer; white-space: nowrap; }
.nav-drop > button .ico { width: 15px; height: 15px; transition: transform .15s var(--ease); }
.nav-drop:hover > button, .nav-drop:focus-within > button { color: var(--text); background: var(--surface-2); }
.nav-drop > button.on { color: var(--primary); background: var(--primary-50); }
.nav-drop:hover > button .ico, .nav-drop:focus-within > button .ico { transform: rotate(180deg); }
.nav-drop .nav-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 230px; padding: 6px; margin-top: 4px;
  background: var(--elev); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); z-index: 60; flex-direction: column; }
.nav-drop .nav-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.nav-drop:hover .nav-menu, .nav-drop:focus-within .nav-menu { display: flex; }
.hdr-nav .nav-menu a { width: 100%; justify-content: flex-start; padding: 9px 12px; min-height: 38px; color: var(--text-2); }
.hdr-nav .nav-menu a:hover { color: var(--text); background: var(--surface-2); }
.search-trigger { display: flex; align-items: center; gap: 10px; height: 40px; width: min(380px, 32vw); padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 14px; }
.search-trigger:hover { border-color: var(--line-2); }
.search-trigger kbd, kbd { margin-left: auto; font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--elev); color: var(--muted); }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; height: 34px; }
.lang-switch button { border: 0; background: transparent; padding: 0 10px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted); min-width: 40px; }
.lang-switch button.on { background: var(--primary); color: #fff; }
:root[data-theme="dark"] .lang-switch button.on { color: #0B1220; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 600; border: 2px solid var(--elev); box-shadow: 0 0 0 1px var(--line); cursor: pointer; flex: none; font-size: 14px; }
.plan-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid var(--line); background: var(--elev); font-size: 12px; color: var(--text-2); text-decoration: none !important; min-height: 34px; }
.plan-pill .badge { border-radius: 99px; }
.plan-pill .meter { width: 56px; height: 5px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 14px; background: var(--primary-50); color: var(--text); border-bottom: 1px solid var(--line); }
.banner.warning { background: var(--warning-bg); }
.banner.danger { background: var(--danger-bg); }

/* ---------- app shell: UI-01 / UI-07 three panes ---------- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr) 320px; min-height: calc(100vh - var(--header-h)); }
.shell.no-right { grid-template-columns: 264px minmax(0, 1fr); }
.side { border-right: 1px solid var(--line); background: var(--surface); padding: 14px 12px; position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; }
.main { min-width: 0; padding: 24px clamp(16px, 3vw, 40px) 64px; }
.right { border-left: 1px solid var(--line); background: var(--surface); position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a, .side-nav button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none; min-height: 40px; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; }
.side-nav a:hover, .side-nav button:hover { background: var(--surface-2); }
.side-nav a.on, .side-nav button.on { background: var(--primary-50); color: var(--primary); }
.side-nav .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.side h4 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 10px 8px; display: flex; align-items: center; }
.side h4 button { margin-left: auto; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; line-height: 1.2; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.drawer-btn { display: none; }
@media (max-width: 1279px) {
  .shell { grid-template-columns: 248px minmax(0, 1fr); }
  .shell > .right { display: none; }
  .shell.right-open > .right { display: block; position: fixed; right: 0; top: var(--header-h); width: min(360px, 92vw); z-index: 600; box-shadow: var(--shadow-pop); }
}
@media (max-width: 767px) {
  .shell, .shell.no-right { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: var(--header-h); z-index: 650; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s var(--ease); box-shadow: var(--shadow-pop); }
  .shell.drawer-open > .side { transform: none; }
  .drawer-btn { display: inline-flex; }
  .hdr-nav, .search-trigger .lbl, .search-trigger kbd, .hide-sm { display: none !important; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; }
  .main { padding: 16px 16px 72px; }
  .page-head h1 { font-size: 22px; }
}
.scrim { position: fixed; inset: var(--header-h) 0 0 0; background: rgba(15,23,42,.35); z-index: 640; }

/* ---------- command palette (Ctrl+K) ---------- */
.palette { position: fixed; inset: 0; z-index: 950; background: rgba(15,23,42,.4); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette .box { width: min(640px, 100%); background: var(--elev); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden; animation: pop .15s var(--ease); }
.palette .q { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette .q input { flex: 1; border: 0; background: none; font-size: 16px; outline: none; min-height: 28px; }
.palette .res { max-height: 52vh; overflow: auto; padding: 6px; }
.palette .item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; min-height: 44px; }
.palette .item .t { font-weight: 500; }
.palette .item .s { font-size: 12px; color: var(--muted); }
.palette .item.on { background: var(--primary-50); }
.palette .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 12px 4px; font-weight: 600; }
.palette .foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ---------- library ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.grid-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.doc-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-lg); background: var(--elev); border: 1px solid var(--line); box-shadow: var(--shadow-card);
  transition: transform .18s var(--ease), box-shadow .18s, border-color .18s; cursor: pointer; text-decoration: none !important; color: inherit; min-height: 170px; }
.doc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); border-color: var(--primary-100); }
.doc-card .fi { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--grad-soft); color: var(--primary); }
.doc-card .nm { font-weight: 600; font-size: 15px; line-height: 1.35; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.doc-card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.doc-card .foot { margin-top: auto; display: flex; align-items: center; gap: 8px; }
.doc-card .more { position: absolute; top: 10px; right: 10px; opacity: 0; transition: opacity .15s; }
.doc-card:hover .more, .doc-card:focus-within .more { opacity: 1; }
@media (hover: none) { .doc-card .more { opacity: 1; } }
.note-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-50); padding: 2px 8px; border-radius: 99px; }
.list-docs .doc-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 110px 120px 90px 40px; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-docs .doc-row:hover { background: var(--surface); }
@media (max-width: 767px) { .list-docs .doc-row { grid-template-columns: 32px minmax(0, 1fr) 40px; } .list-docs .doc-row .opt { display: none; } }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: 28px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; }
.dropzone.over, body.dragging .dropzone { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.drop-overlay { position: fixed; inset: 0; z-index: 980; background: rgba(37,99,235,.12); border: 3px dashed var(--primary); display: none; place-items: center; font-size: 22px; font-weight: 600; color: var(--primary); pointer-events: none; }
body.dragging .drop-overlay { display: grid; }
.folder-tree { list-style: none; margin: 0; padding: 0; }
.folder-tree ul { list-style: none; margin: 0; padding-left: 14px; }
.folder-tree .f { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text-2); min-height: 36px; }
.folder-tree .f:hover { background: var(--surface-2); }
.folder-tree .f.on { background: var(--primary-50); color: var(--primary); font-weight: 500; }
.folder-tree .f.drop { outline: 2px dashed var(--primary); }
.folder-tree .f .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-tree .f .c { font-size: 11px; color: var(--muted); }
.progress-ring { --p: 0; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; flex: none;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--surface-2) 0); position: relative; }
.progress-ring::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--elev); }
.progress-ring span { position: relative; }
.mini-progress { height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; flex: 1; }
.mini-progress i { display: block; height: 100%; background: var(--grad); }

/* ---------- history ---------- */
.timeline-group { margin-bottom: 26px; }
.timeline-group > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.hist-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--elev); border: 1px solid var(--line); margin-bottom: 8px; transition: border-color .15s, box-shadow .15s; }
.hist-item:hover { border-color: var(--primary-100); box-shadow: var(--shadow-card); }
.hist-item .src { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.hist-item .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-item .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.hist-item .acts { display: flex; gap: 2px; }
.pinned-mark { color: var(--accent); }

/* ---------- notes masonry ---------- */
.masonry { columns: 300px; column-gap: 16px; }
.note-card { break-inside: avoid; margin-bottom: 16px; padding: 16px; border-radius: 14px; background: var(--elev); border: 1px solid var(--line); border-top: 4px solid var(--nc, var(--accent)); box-shadow: var(--shadow-card); cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s; }
.note-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.note-card blockquote { margin: 0 0 10px; padding: 6px 10px; border-left: 3px solid var(--nc, var(--accent)); background: var(--surface); border-radius: 0 8px 8px 0; font-size: 13px; color: var(--text-2); font-family: var(--font-read); }
.note-card .body { font-size: 14px; }
.note-card .body p { margin: 0 0 6px; }
.note-card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.colors { display: flex; gap: 6px; }
.colors button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--elev); box-shadow: 0 0 0 1px var(--line); cursor: pointer; background: var(--c); }
.colors button.on { box-shadow: 0 0 0 2px var(--text); }

/* ---------- pricing / plans (shared by landing, pricing, billing) ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 26px 22px; border-radius: 20px; background: var(--elev); border: 1px solid var(--line); box-shadow: var(--shadow-card); transition: transform .2s var(--ease), box-shadow .2s; }
.plan:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.plan.hi { border: 2px solid transparent; background: linear-gradient(var(--elev), var(--elev)) padding-box, var(--grad) border-box; box-shadow: var(--shadow-glow); }
.plan .ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--grad); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 99px; white-space: nowrap; }
.plan .pn { font-size: 18px; font-weight: 700; }
.plan .pt { color: var(--muted); font-size: 14px; min-height: 42px; }
.plan .price { display: flex; align-items: baseline; gap: 6px; }
.plan .price .amt { font-size: 40px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.plan .price .per { color: var(--muted); font-size: 14px; }
.plan .save { font-size: 12px; color: var(--success); font-weight: 600; min-height: 18px; }
.plan ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.plan li { display: flex; gap: 9px; align-items: flex-start; }
.plan li .ico { color: var(--success); margin-top: 2px; }
.plan .cta { margin-top: auto; }
.plan.current { outline: 2px solid var(--success); }
.cycle-toggle { display: inline-flex; align-items: center; gap: 10px; }
.save-pill { font-size: 12px; font-weight: 600; color: var(--success); background: var(--success-bg); padding: 3px 9px; border-radius: 99px; }

/* ---------- misc ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.settings-sec { padding: 22px; margin-bottom: 16px; }
.settings-sec h2 { font-size: 17px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.settings-sec > p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.set-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row .l { flex: 1; min-width: 0; }
.set-row .l b { display: block; font-weight: 500; }
.set-row .l span { font-size: 13px; color: var(--muted); }
@media (max-width: 600px) { .set-row { flex-wrap: wrap; } }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status-dot.ok { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.footer-mini { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 40px 16px; }
.error-page .code { font-size: 88px; font-weight: 800; line-height: 1; }
@media print { .hdr, .side, .right, .no-print, .toasts, .banner { display: none !important; } .shell { display: block; } .main { padding: 0; } body { background: #fff; color: #000; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 900px) { .v-grid { grid-template-columns: minmax(0, 1fr) !important; } .pp-grid { grid-template-columns: 1fr !important; justify-items: center; } }
.usage-box .btn { margin-top: 10px; }
.side-nav a .ico, .hdr-nav a .ico { flex: none; }
.modal.wide { width: min(760px, 100%); }
body:not(.ready) [data-i18n-html], body:not(.ready) .hdr-nav { visibility: visible; }
@media (max-width: 767px) {
  .page-head > .grow { flex-basis: 100%; }
  .page-head .btn { flex: 1 1 auto; }
  .shell > .side { visibility: hidden; box-shadow: none; }
  .shell.drawer-open > .side { visibility: visible; box-shadow: var(--shadow-pop); }
  .toolbar .input-icon { flex-basis: 100%; max-width: none !important; }
  .panel-tabs button { padding: 10px 8px; }
}
.doc-card > .row:first-child { padding-right: 34px; }
.hdr-nav a, .plan-pill, .lang-switch button { white-space: nowrap; }
@media (max-width: 1360px) { .search-trigger { width: 240px; } .search-trigger .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }
@media (max-width: 1120px) { .app-hdr .hdr-nav a > span { display: none; } .app-hdr .hdr-nav a { padding: 8px 10px; } }
kbd { white-space: nowrap; }
