/* ============================================================
   Nova Office — foundation, shell & workspace
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --font-ui: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;

  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --ease: cubic-bezier(.22, .8, .28, 1);
  --dur: 180ms;

  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(124, 92, 255, .16);
  --ok: #35d39a;
  --warn: #f6c453;
  --danger: #fb7185;

  --topbar-h: 58px;
  --rail-w: 76px;
}

html[data-theme="dark"] {
  --bg: #07080b;
  --bg-2: #0b0d12;
  --surface: #101319;
  --surface-2: #151922;
  --surface-3: #1b202b;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --line-3: rgba(255, 255, 255, .2);
  --text: #eef0f6;
  --text-2: #c3c8d4;
  --muted: #8b93a7;
  --faint: #5e6577;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, .75);
  --glass: rgba(10, 12, 17, .72);
  --paper: #ffffff;
  --paper-ink: #1a1c22;
  --hover: rgba(255, 255, 255, .055);
  --active: rgba(255, 255, 255, .09);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f1f2f6;
  --bg-2: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --surface-3: #eceef4;
  --line: rgba(16, 20, 32, .08);
  --line-2: rgba(16, 20, 32, .14);
  --line-3: rgba(16, 20, 32, .24);
  --text: #10131b;
  --text-2: #333a4a;
  --muted: #697184;
  --faint: #98a0b1;
  --shadow: 0 24px 55px -24px rgba(20, 26, 46, .32);
  --glass: rgba(255, 255, 255, .78);
  --paper: #ffffff;
  --paper-ink: #1a1c22;
  --hover: rgba(16, 20, 32, .05);
  --active: rgba(16, 20, 32, .08);
  --accent-soft: rgba(124, 92, 255, .12);
  color-scheme: light;
}

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
kbd {
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--muted);
}
::selection { background: rgba(124, 92, 255, .32); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i {
  width: 18px; height: 18px; flex: none;
  stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  display: block;
}

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 20px;
}
::-webkit-scrollbar-thumb:hover { background: var(--line-3); background-clip: content-box; }

/* ============================================================ boot splash */
/* Real text served in the HTML (§0v.2 item 10). Replaced by the workspace as
   soon as it is ready, so humans see a tidy splash and crawlers read content. */
.boot-splash {
  position: fixed; inset: 0; z-index: 400;
  display: grid; place-items: center;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(124, 92, 255, .2), transparent 60%),
    radial-gradient(760px 460px at 92% 0%, rgba(34, 211, 238, .1), transparent 62%),
    var(--bg);
}
.boot-splash.is-out { opacity: 0; transition: opacity 220ms var(--ease); }
.boot-card { width: min(520px, 100%); }
.boot-mark {
  width: 46px; height: 46px; border-radius: 15px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 22px; color: #fff;
  background: linear-gradient(135deg, #9a7bff 0%, #6d4bf0 48%, #2fb8d8 100%);
  box-shadow: 0 12px 30px -12px rgba(124, 92, 255, .9), inset 0 0 0 1px rgba(255, 255, 255, .16);
  margin-bottom: 20px;
}
.boot-card h1 { font-size: 27px; font-weight: 680; letter-spacing: -.035em; }
.boot-lede { margin-top: 8px; font-size: 15px; color: var(--text-2); }
.boot-list { margin: 20px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.boot-list li {
  position: relative; padding-left: 22px;
  font-size: 13.5px; line-height: 1.5; color: var(--muted);
}
.boot-list li::before {
  content: ""; position: absolute; left: 4px; top: 8px;
  width: 6px; height: 6px; border-radius: 50%;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
}
.boot-note { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.55; color: var(--faint); }
/* Second block of served text (§0v.2 item 10): same content, quieter type, so the
   splash stays one tidy card on a phone. Nothing here is hidden from crawlers. */
.boot-list-secondary { margin-top: 16px; gap: 8px; }
.boot-list-secondary li { font-size: 12.5px; line-height: 1.45; color: var(--faint); }
.boot-list-secondary li::before { top: 7px; width: 5px; height: 5px; opacity: .75; }
.boot-warn { color: var(--warn); border-top: 0; padding-top: 10px; margin-top: 10px; }

/* ============================================================ shell */

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(124, 92, 255, .18), transparent 60%),
    radial-gradient(760px 460px at 92% 0%, rgba(34, 211, 238, .10), transparent 62%),
    radial-gradient(900px 700px at 60% 110%, rgba(124, 92, 255, .07), transparent 65%),
    var(--bg);
}

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #9a7bff 0%, #6d4bf0 48%, #2fb8d8 100%);
  box-shadow: 0 8px 22px -8px rgba(124, 92, 255, .85), inset 0 0 0 1px rgba(255, 255, 255, .14), inset 0 1px 0 rgba(255, 255, 255, .35);
  position: relative;
  overflow: hidden;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(255, 255, 255, .38), transparent 58%),
    radial-gradient(90% 70% at 85% 100%, rgba(34, 211, 238, .28), transparent 60%);
}
.brand-mark span {
  font-family: var(--font-display);
  font-weight: 800; font-size: 17px; color: #fff;
  letter-spacing: -.04em; position: relative; z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}
.brand-name {
  font-family: var(--font-display);
  font-size: 15.5px; font-weight: 600; letter-spacing: -.025em;
  color: var(--text); white-space: nowrap;
}
.brand-name b { font-weight: 750; color: var(--text); }
.brand-badge {
  font-size: 9px; font-weight: 700; letter-spacing: .16em;
  color: var(--muted);
  border: 1px solid var(--line-2);
  padding: 3px 6px; border-radius: 5px;
  margin-left: 2px;
}

.topbar-center { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.icon-btn {
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(.95); }
.icon-btn.is-active { color: var(--text); background: var(--active); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }
.topbar-palette {
  width: auto; height: 32px; padding: 0 8px 0 10px; gap: 10px;
  display: inline-flex; align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
}
.topbar-palette:hover { border-color: var(--line-2); }
.topbar-palette kbd { font-size: 10px; padding: 1px 5px; }

#themeToggle .icon-sun { display: none; }
html[data-theme="light"] #themeToggle .icon-moon { display: none; }
html[data-theme="light"] #themeToggle .icon-sun { display: block; }

.install-btn { gap: 6px; height: 32px; padding: 0 11px; border-radius: 9px; }
.install-btn .i { width: 15px; height: 15px; }
.install-btn[hidden] { display: none !important; }
.install-steps { display: flex; flex-direction: column; gap: 12px; }
.install-step { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.install-num {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(150deg, #8b6bff, #6344ea);
}

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(150deg, #22d3ee, #7c5cff 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  margin-left: 4px;
  user-select: none;
}

.app-body { flex: 1; display: flex; min-height: 0; }

.rail {
  width: var(--rail-w); flex: none;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 12px 10px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .014), transparent 38%);
  z-index: 20;
}
.rail-new {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center; margin-bottom: 10px;
  color: #fff;
  background: linear-gradient(150deg, #8b6bff, #6244e8);
  box-shadow: 0 10px 24px -10px rgba(124, 92, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .28);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.rail-new:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -10px rgba(124, 92, 255, .95); }
.rail-new .i { width: 20px; height: 20px; stroke-width: 2; }
.rail-nav { display: flex; flex-direction: column; gap: 4px; width: 100%; align-items: center; }
.rail-btn {
  width: 52px; height: 50px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); position: relative;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.rail-btn .i { width: 19px; height: 19px; }
.rail-btn span { font-size: 9px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.rail-btn:hover { color: var(--text-2); background: var(--hover); }
.rail-btn.is-active { color: var(--text); background: var(--active); }
.rail-btn.is-active .i { color: var(--accent); filter: drop-shadow(0 0 10px rgba(124, 92, 255, .5)); }
.rail-btn.is-active::before {
  content: ""; position: absolute; left: -10px; top: 15px;
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.rail-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 3px rgba(53, 211, 154, .14);
}
.rail-dot.is-dirty { background: var(--warn); box-shadow: 0 0 0 3px rgba(246, 196, 83, .14); }
.rail-note { font-size: 8.5px; letter-spacing: .18em; color: var(--faint); font-weight: 700; }

.view { flex: 1; min-width: 0; min-height: 0; overflow: hidden; position: relative; }
.view.is-home { overflow-y: auto; overflow-x: hidden; }

/* ============================================================ primitives */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn .i { width: 16px; height: 16px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; gap: 6px; }
.btn-sm .i { width: 15px; height: 15px; }
.btn-primary {
  color: #fff;
  background: linear-gradient(150deg, #8b6bff, #6344ea);
  border-color: transparent;
  box-shadow: 0 8px 22px -10px rgba(124, 92, 255, .85), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover { background: linear-gradient(150deg, #9375ff, #6b4cf0); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { color: #fff; background: linear-gradient(150deg, #fb7185, #e11d48); border-color: transparent; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.chip .i { width: 13px; height: 13px; }
.chip-accent { color: #c7b8ff; background: var(--accent-soft); border-color: rgba(124, 92, 255, .28); }
html[data-theme="light"] .chip-accent { color: #5b3ed6; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.field {
  width: 100%; height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--text);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field::placeholder { color: var(--faint); }
.field:focus { border-color: rgba(124, 92, 255, .7); box-shadow: 0 0 0 3px rgba(124, 92, 255, .16); }

.seg {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.seg button {
  height: 26px; padding: 0 9px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
}
.seg button:hover { color: var(--text); background: var(--hover); }
.seg button.is-active { color: var(--text); background: var(--surface-3); box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }

.hr { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ============================================================ home */

.home {
  max-width: 1220px;
  margin: 0 auto;
  padding: 38px 40px 64px;
}
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.home-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .18em;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 14px;
}
.home-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 3px rgba(53, 211, 154, .12);
}
.home h1 {
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.06; font-weight: 680;
  letter-spacing: -.035em;
  max-width: 620px;
}
.home h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #a78bfa 0%, #7c5cff 42%, #22d3ee 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.home-sub { color: var(--muted); font-size: 14.5px; max-width: 520px; margin-top: 14px; line-height: 1.55; }
.home-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; flex: none; }
.home-stats { display: flex; flex-wrap: wrap; gap: 8px; }

.home-grid { display: grid; grid-template-columns: 1.45fr .9fr; gap: 18px; margin-bottom: 40px; }
.quick {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 18px;
  background: linear-gradient(160deg, rgba(124, 92, 255, .12), rgba(34, 211, 238, .05) 60%, transparent);
  border: 1px solid rgba(124, 92, 255, .22);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.quick::after {
  content: ""; position: absolute; width: 320px; height: 320px; right: -140px; top: -180px;
  background: radial-gradient(circle, rgba(124, 92, 255, .35), transparent 66%);
  pointer-events: none;
}
.quick-card {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 18px;
  min-height: 128px;
  text-align: left;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .08);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
html[data-theme="light"] .quick-card { background: rgba(255, 255, 255, .72); border-color: rgba(16, 20, 32, .07); }
.quick-card:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .16); }
html[data-theme="light"] .quick-card:hover { background: #fff; border-color: rgba(124, 92, 255, .3); }
.quick-card .q-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .06);
}
html[data-theme="light"] .quick-card .q-icon { background: var(--surface-2); }
.quick-card .q-icon .i { width: 20px; height: 20px; }
.quick-card[data-type="doc"] .q-icon { color: #8b7cff; background: rgba(124, 92, 255, .16); }
.quick-card[data-type="sheet"] .q-icon { color: #35d39a; background: rgba(53, 211, 154, .13); }
.quick-card[data-type="slides"] .q-icon { color: #f6c453; background: rgba(246, 196, 83, .13); }
.quick-card[data-type="import"] .q-icon { color: #22d3ee; background: rgba(34, 211, 238, .12); }
.quick-card b { font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.quick-card small { color: var(--muted); font-size: 12px; line-height: 1.35; }

.spotlight {
  padding: 20px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 14px;
}
.spotlight h3 { font-size: 13px; font-weight: 650; letter-spacing: 0; }
.spotlight p { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.spotlight-list { display: flex; flex-direction: column; gap: 9px; margin-top: auto; }
.spotlight-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.spotlight-row .i { width: 15px; height: 15px; color: var(--ok); }
.spotlight-orbit {
  position: relative; height: 104px; border-radius: var(--r-md);
  overflow: hidden; margin: 2px 0 4px;
  background:
    radial-gradient(60% 90% at 30% 20%, rgba(124, 92, 255, .28), transparent 70%),
    radial-gradient(50% 80% at 80% 80%, rgba(34, 211, 238, .18), transparent 70%),
    var(--bg-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
}
.spotlight-orbit .glyph {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, rgba(139, 107, 255, .9), rgba(34, 211, 238, .75));
  color: #fff; box-shadow: 0 12px 30px -10px rgba(124, 92, 255, .9);
}
.spotlight-orbit .glyph .i { width: 24px; height: 24px; stroke-width: 1.6; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 16px; }
.section-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; }
.section-head h2 .count { font-size: 11px; color: var(--muted); font-weight: 600; background: var(--surface-2); padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); }
.section-head .right { display: flex; align-items: center; gap: 8px; }

.home-search { position: relative; width: 230px; }
.home-search .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); }
.home-search input {
  width: 100%; height: 34px; padding: 0 12px 0 32px;
  border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); outline: none; font-size: 12.5px;
}
.home-search input:focus { border-color: rgba(124, 92, 255, .55); box-shadow: 0 0 0 3px rgba(124, 92, 255, .12); }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(226px, 1fr)); gap: 12px; }
.file-card {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 136px;
  padding: 15px 16px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: left;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  overflow: hidden;
}
.file-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-2);
  background: var(--surface-2);
  box-shadow: 0 16px 34px -22px rgba(0, 0, 0, .6);
}
.file-card .fc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.file-card .fc-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface-3);
}
.file-card[data-type="doc"] .fc-icon { color: #a596ff; background: rgba(124, 92, 255, .14); }
.file-card[data-type="sheet"] .fc-icon { color: #5be0ae; background: rgba(53, 211, 154, .12); }
.file-card[data-type="slides"] .fc-icon { color: #ffd479; background: rgba(246, 196, 83, .12); }
.file-card .fc-name {
  font-size: 13.5px; font-weight: 600; letter-spacing: -.01em;
  line-height: 1.3; margin-bottom: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-card .fc-meta { font-size: 11.5px; color: var(--muted); margin-top: auto; display: flex; align-items: center; gap: 7px; }
.file-card .fc-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.file-card .fc-star { color: var(--warn); }
.file-card .fc-actions {
  position: absolute; right: 10px; bottom: 10px;
  display: flex; gap: 2px; opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px; padding: 2px;
}
.file-card:hover .fc-actions { opacity: 1; transform: none; }
.file-card .fc-actions .icon-btn { width: 26px; height: 26px; border-radius: 6px; }
.file-card .fc-actions .i { width: 14px; height: 14px; }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tpl-card {
  position: relative; text-align: left;
  border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tpl-card:hover { transform: translateY(-2px); border-color: var(--line-2); }
.tpl-art { height: 96px; position: relative; overflow: hidden; display: grid; place-items: center; }
.tpl-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, .22)); }
.tpl-art .mini { width: 66px; height: 74px; border-radius: 5px; background: rgba(255, 255, 255, .92); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .5); position: relative; z-index: 1; padding: 10px 9px; display: flex; flex-direction: column; gap: 4px; }
.tpl-art .mini i { display: block; height: 3px; border-radius: 2px; background: rgba(20, 24, 36, .18); }
.tpl-art .mini i:first-child { width: 55%; height: 5px; background: rgba(20, 24, 36, .55); margin-bottom: 3px; }
.tpl-art .mini i:nth-child(3) { width: 80%; }
.tpl-art .mini i:nth-child(4) { width: 66%; }
.tpl-art .mini.sheet { padding: 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.tpl-art .mini.sheet i { height: auto; border-radius: 2px; background: rgba(20, 24, 36, .1); }
.tpl-art .mini.sheet i:nth-child(1) { background: rgba(20, 24, 36, .34); }
.tpl-art .mini.slides { width: 92px; height: 58px; padding: 9px; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.tpl-art .mini.slides i:first-child { width: 60%; height: 6px; }
.tpl-art .mini.slides i:nth-child(2) { width: 84%; height: 3px; }
.tpl-art .mini.slides i:nth-child(3) { width: 45%; height: 3px; }
.tpl-body { padding: 12px 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tpl-body b { display: block; font-size: 12.5px; font-weight: 620; }
.tpl-body small { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; }

.empty-files {
  grid-column: 1 / -1;
  padding: 34px;
  border-radius: var(--r-md);
  border: 1px dashed var(--line-2);
  background: rgba(255, 255, 255, .015);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.home-foot {
  margin-top: 44px; padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  color: var(--faint); font-size: 11.5px;
}
.home-foot .left { display: flex; align-items: center; gap: 8px; }
.home-foot .i { width: 14px; height: 14px; }

/* ============================================================ menus */

.menu {
  position: fixed;
  z-index: 200;
  min-width: 208px;
  padding: 5px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  animation: menuIn 140ms var(--ease);
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px) scale(.985); } }
.menu-item {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px;
  border-radius: 7px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-2); text-align: left;
}
.menu-item .i { width: 15px; height: 15px; color: var(--muted); }
.menu-item:hover { background: var(--hover); color: var(--text); }
.menu-item .kbd { margin-left: auto; }
.menu-item .swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line-2); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-label { font-size: 9.5px; font-weight: 700; letter-spacing: .13em; color: var(--faint); padding: 7px 9px 5px; text-transform: uppercase; }

/* ============================================================ modal / palette / toast */

.overlay {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(4, 5, 9, .62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 140ms var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: min(520px, 100%);
  max-height: 84vh;
  display: flex; flex-direction: column;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  animation: modalIn 180ms var(--ease);
  overflow: hidden;
}
.modal.wide { width: min(720px, 100%); }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { padding: 18px 20px 12px; display: flex; align-items: flex-start; gap: 12px; }
.modal-head h3 { font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.modal-head p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.modal-close { margin-left: auto; }
.modal-body { padding: 6px 20px 18px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--bg-2); }

.palette {
  position: fixed; inset: 0; z-index: 160;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 20px 20px;
  background: rgba(4, 5, 9, .5);
  backdrop-filter: blur(8px);
  animation: fadeIn 120ms var(--ease);
}
.palette-box {
  width: min(620px, 100%);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: modalIn 160ms var(--ease);
  display: flex; flex-direction: column;
  max-height: 66vh;
}
.palette-input { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.palette-input .i { width: 18px; height: 18px; color: var(--faint); }
.palette-input input { flex: 1; background: none; border: none; outline: none; font-size: 15px; letter-spacing: -.01em; }
.palette-input input::placeholder { color: var(--faint); }
.palette-list { overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 11px;
  border-radius: 8px; text-align: left;
  color: var(--text-2);
}
.palette-item .pi-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.palette-item .pi-icon .i { width: 15px; height: 15px; }
.palette-item .pi-text { min-width: 0; flex: 1; }
.palette-item b { display: block; font-size: 13px; font-weight: 580; color: var(--text); }
.palette-item small { color: var(--muted); font-size: 11px; }
.palette-item .pi-hint { font-size: 10px; color: var(--faint); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
.palette-item.is-active { background: var(--accent-soft); }
.palette-item.is-active .pi-icon { background: rgba(124, 92, 255, .2); color: #c9bcff; }
.palette-foot { padding: 9px 14px; border-top: 1px solid var(--line); display: flex; gap: 14px; color: var(--faint); font-size: 10.5px; }
.palette-empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }

.toast-root { position: fixed; z-index: 300; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 15px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  font-size: 12.5px; font-weight: 500;
  color: var(--text);
  animation: toastIn 200ms var(--ease);
  pointer-events: auto;
}
.toast .i { width: 15px; height: 15px; color: var(--ok); }
.toast[data-kind="warn"] .i { color: var(--warn); }
.toast[data-kind="error"] .i { color: var(--danger); }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: all 200ms var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ============================================================ generic editor chrome */

.editor { height: 100%; display: flex; flex-direction: column; min-height: 0; }

.editor-bar {
  flex: none;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  min-height: 46px;
  overflow-x: auto;
  scrollbar-width: none;
  position: relative;
  z-index: 12;
}
.editor-bar::-webkit-scrollbar { display: none; }
.tb-group { display: flex; align-items: center; gap: 2px; flex: none; }
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 5px; flex: none; }
.tb-btn {
  width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center;
  color: var(--muted);
  flex: none;
}
.tb-btn:hover { background: var(--hover); color: var(--text); }
.tb-btn.is-active { background: var(--accent-soft); color: #b9a6ff; }
.tb-btn .i { width: 16px; height: 16px; }
.tb-btn[disabled] { opacity: .35; pointer-events: none; }
.tb-text {
  height: 30px; padding: 0 9px; border-radius: 7px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 5px;
}
.tb-text:hover { background: var(--hover); color: var(--text); }
.tb-select {
  height: 30px; padding: 0 24px 0 9px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 12px; font-weight: 550;
  outline: none; cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 12px) 13px, calc(100% - 8px) 13px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  max-width: 150px;
}
.tb-select:hover { background-color: var(--hover); }
.tb-select option { background: var(--surface); color: var(--text); }
.tb-swatch {
  width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center; position: relative;
}
.tb-swatch:hover { background: var(--hover); }
.tb-swatch .bar { width: 15px; height: 3px; border-radius: 2px; background: currentColor; margin-top: -5px; }
.tb-swatch .i { width: 15px; height: 15px; margin-bottom: 2px; }
.tb-swatch input[type="color"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.spacer { flex: 1; }

.statusbar {
  flex: none;
  height: 32px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  z-index: 10;
}
.statusbar .sb-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.statusbar .sb-btn { height: 22px; padding: 0 7px; border-radius: 5px; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.statusbar .sb-btn:hover { background: var(--hover); color: var(--text); }
.statusbar .i { width: 13px; height: 13px; }
.statusbar .saved-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.statusbar .saved-dot.dirty { background: var(--warn); }

/* topbar document title */
.doc-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.doc-title-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.doc-title-icon .i { width: 16px; height: 16px; }
.doc-title-input {
  min-width: 0; width: 100%; max-width: 440px;
  background: transparent; border: 1px solid transparent;
  border-radius: 7px;
  font-family: var(--font-display);
  font-size: 14.5px; font-weight: 600; letter-spacing: -.015em;
  padding: 5px 8px; margin-left: -8px;
  outline: none;
  text-overflow: ellipsis;
}
.doc-title-input:hover { background: var(--hover); }
.doc-title-input:focus { background: var(--bg-2); border-color: var(--line-2); }
.save-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--faint); white-space: nowrap; flex: none; padding-right: 6px; }
.save-chip .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
.save-chip.dirty .dot { background: var(--warn); }

/* dropdown popovers generic */
.popover {
  position: fixed; z-index: 200;
  padding: 10px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  animation: menuIn 130ms var(--ease);
}

/* ============================================================ responsive */

@media (max-width: 960px) {
  .home { padding: 26px 20px 50px; }
  .home-head { flex-direction: column; align-items: flex-start; }
  .home-head-right { align-items: flex-start; }
  .home-grid { grid-template-columns: 1fr; }
  .brand-badge { display: none; }
  .topbar-palette kbd { display: none; }
}
@media (max-width: 720px) {
  :root { --rail-w: 60px; }
  .rail-btn { width: 42px; }
  .brand-name { display: none; }
  .home h1 { font-size: 28px; }
  .home-search { width: 100%; }
  .section-head { flex-wrap: wrap; }

  /* phone shell: bottom navigation, compact top bar, wrapping status */
  .app-body { flex-direction: column; }
  .rail {
    order: 2; flex-direction: row; align-items: center; justify-content: space-between;
    width: 100%; height: 58px; padding: 6px 10px; gap: 6px;
    border-right: 0; border-top: 1px solid var(--line);
    background: var(--glass);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
  }
  .rail-new { width: 40px; height: 40px; margin-bottom: 0; border-radius: 12px; }
  .rail-nav { flex-direction: row; width: auto; flex: 1; justify-content: space-around; gap: 2px; }
  .rail-btn { width: 58px; height: 44px; }
  .rail-btn.is-active::before {
    left: 50%; top: auto; bottom: -5px; transform: translateX(-50%);
    width: 18px; height: 2.5px; border-radius: 2px;
  }
  .rail-foot { margin-top: 0; margin-left: 2px; }
  .rail-note { display: none; }
  .view { order: 1; }

  .topbar { gap: 8px; padding: 0 10px; }
  .topbar-center { min-width: 0; }
  .brand { display: none; }
  .save-chip { display: none; }
  .avatar { display: none; }
  .install-btn .install-label { display: none; }
  .install-btn { padding: 0 8px; }
  .doc-title-input { font-size: 13.5px; max-width: none; }
  .file-actions .icon-btn:nth-child(2),
  .file-actions .icon-btn:last-child { display: none; }

  .statusbar {
    height: auto; min-height: 32px;
    flex-wrap: wrap; gap: 4px 12px;
    padding: 5px 10px; line-height: 1.5;
  }
  .statusbar .sb-item { font-size: 10.5px; }
  .home-foot { flex-wrap: wrap; gap: 8px 14px; }
  .home-foot .left { flex-wrap: wrap; row-gap: 5px; }

  /* Finger-sized targets on phones (WCAG 2.5.8 wants >= 24px; we ship 34px). */
  .file-card { min-height: 150px; padding-bottom: 48px; }
  .file-card .fc-actions { opacity: 1; transform: none; gap: 4px; bottom: 8px; right: 8px; }
  .file-card .fc-actions .icon-btn { width: 34px; height: 34px; border-radius: 8px; }
  .file-card .fc-actions .i { width: 16px; height: 16px; }
  .install-btn { height: 34px; }
  .topbar-actions .icon-btn { width: 36px; height: 36px; }
  .nv-lang summary { padding: 8px 11px; }
}

/* Touch devices have no hover — keep file-card actions visible and tappable.
   The 26px hover buttons are too small for a finger, so on touch they grow and
   the card keeps room for them underneath the metadata line. */
@media (hover: none) {
  .fc-actions { opacity: 1; transform: none; }
  .file-card { min-height: 150px; padding-bottom: 48px; }
  .file-card .fc-actions { gap: 4px; bottom: 8px; right: 8px; }
  .file-card .fc-actions .icon-btn { width: 34px; height: 34px; border-radius: 8px; }
  .file-card .fc-actions .i { width: 16px; height: 16px; }
}
