/* NovaScribe — product UI */
:root {
  --bg: #080b12;
  --bg-soft: #0c101a;
  --panel: #111624;
  --panel-2: #161d2e;
  --panel-3: #1b2436;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --ink: #e9edf7;
  --ink-2: #b9c1d4;
  --muted: #7d879e;
  --accent: #5b82ff;
  --accent-2: #9d6bff;
  --accent-soft: rgba(91, 130, 255, 0.14);
  --green: #2fd6a4;
  --green-soft: rgba(47, 214, 164, 0.12);
  --amber: #f7b23b;
  --amber-soft: rgba(247, 178, 59, 0.13);
  --red: #fa5d78;
  --red-soft: rgba(250, 93, 120, 0.13);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 12% -10%, rgba(91, 130, 255, 0.16), transparent 62%),
    radial-gradient(900px 520px at 95% 0%, rgba(157, 107, 255, 0.12), transparent 58%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(91, 130, 255, 0.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* boot */
.boot { display: grid; place-content: center; gap: 6px; height: 100vh; text-align: center; }
.boot-mark { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; }
/* One real, announced page heading even before the SPA paints (Atlas Inspect and
   Nova Diagnostics both flagged a document with no <h1>). */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.boot-sub { color: var(--muted); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; }

/* ---------------------------------------------------------------- auth */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.95fr; }
.auth-side {
  padding: 54px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(160deg, rgba(91, 130, 255, 0.14), rgba(157, 107, 255, 0.05) 45%, transparent 75%);
  border-right: 1px solid var(--line);
}
.auth-brand { display: flex; align-items: center; gap: 11px; font-weight: 640; font-size: 17px; letter-spacing: -0.01em; }
.auth-pitch h1 { font-size: 44px; line-height: 1.08; letter-spacing: -0.035em; margin: 0 0 18px; font-weight: 620; max-width: 560px; }
.auth-pitch h1 em { font-style: normal; background: linear-gradient(92deg, #7fa2ff, #b98cff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-pitch h1.gradient { background: linear-gradient(92deg, #7fa2ff, #b98cff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-pitch p { color: var(--ink-2); font-size: 15px; max-width: 480px; margin: 0 0 26px; }
.auth-points { display: grid; gap: 14px; max-width: 480px; }
.auth-point { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); font-size: 13.5px; }
.auth-point b { color: var(--ink); font-weight: 600; }
.auth-foot { color: var(--muted); font-size: 11.5px; display: flex; gap: 14px; align-items: center; }
.auth-form-side { display: grid; place-content: center; padding: 40px; }
.auth-card { width: 384px; }
.auth-card h2 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.02em; }
.auth-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 13px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 11px 16px; }
/* Visible, announced error for the sign-in / create-workspace form. Without it a
   submit on an incomplete form produced no feedback at all. */
.auth-error {
  margin: 0 0 12px; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.45;
  color: #ffd7d7; background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.38);
}
.auth-error[hidden] { display: none; }
.auth-note { margin-top: 18px; font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.auth-recovery-link {
  display: block; width: 100%; margin: 12px 0 0; padding: 2px; border: 0; background: none;
  color: var(--muted); font: inherit; font-size: 12px; line-height: 1.5; text-align: center; cursor: pointer;
}
.auth-recovery-link:hover, .auth-recovery-link:focus-visible { color: var(--ink); text-decoration: underline; }
.modal-body form .field { margin-bottom: 14px; }
.modal-body form .btn { width: 100%; justify-content: center; }

/* --------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 246px 1fr; min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line); background: rgba(8, 11, 18, 0.72); backdrop-filter: blur(18px);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 8px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-content: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 22px rgba(91, 130, 255, 0.35);
}
.brand-name { font-weight: 650; letter-spacing: -0.015em; font-size: 15.5px; line-height: 1.1; }
.brand-sub { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2);
  font-size: 13.5px; cursor: pointer; border: 1px solid transparent; transition: background 0.14s, color 0.14s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.045); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); border-color: rgba(91, 130, 255, 0.28); color: #dce5ff; }
.nav-item .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 14px; }
.sidebar-card { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 11px 12px; font-size: 11.5px; color: var(--muted); }
.sidebar-card b { color: var(--ink); display: block; font-size: 12px; margin-bottom: 3px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.user-chip:hover { border-color: var(--line-strong); }
.avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-content: center; font-size: 12px; font-weight: 650; background: linear-gradient(145deg, #2a3550, #1a2233); color: #cfd8ff; }
.user-meta { line-height: 1.2; min-width: 0; }
.user-meta b { display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 10.5px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; display: flex; align-items: center; gap: 14px; padding: 0 26px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  background: rgba(8, 11, 18, 0.78); backdrop-filter: blur(18px);
}
.crumbs { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; }
.crumbs b { color: var(--ink); font-weight: 600; }
.searchbox { margin-left: auto; position: relative; width: 300px; }
.searchbox input {
  width: 100%; padding: 8px 12px 8px 34px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03); font-size: 13px; outline: none;
}
.searchbox input:focus { border-color: rgba(91, 130, 255, 0.5); box-shadow: 0 0 0 3px rgba(91, 130, 255, 0.12); }
.searchbox svg { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.view { padding: 26px 30px 60px; max-width: 1420px; width: 100%; margin: 0 auto; }

/* --------------------------------------------------------------- atoms */
h1.page-title { font-size: 24px; letter-spacing: -0.025em; margin: 0 0 4px; font-weight: 620; }
.page-sub { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04); color: var(--ink);
  font-size: 13px; font-weight: 520; cursor: pointer; transition: background 0.14s, border-color 0.14s, transform 0.06s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.075); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(150deg, #5b82ff, #7d63ff); border-color: transparent; color: #fff; box-shadow: 0 8px 22px rgba(91, 130, 255, 0.28); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { background: var(--red-soft); border-color: rgba(250, 93, 120, 0.3); color: #ffb3c0; }
.btn.sm { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 7px; border-radius: 9px; }
.btn.block { width: 100%; justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 550; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--ink-2);
}
.chip + .chip { margin-left: 4px; }
.chip.green { background: var(--green-soft); border-color: rgba(47, 214, 164, 0.28); color: #8ff0d2; }
.chip.amber { background: var(--amber-soft); border-color: rgba(247, 178, 59, 0.3); color: #ffd894; }
.chip.red { background: var(--red-soft); border-color: rgba(250, 93, 120, 0.3); color: #ffb3c0; }
.chip.blue { background: var(--accent-soft); border-color: rgba(91, 130, 255, 0.3); color: #c3d2ff; }
.chip.mono { font-family: var(--mono); font-size: 10.5px; }
.badge { font-size: 10px; font-weight: 650; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); color: var(--ink-2); }
.badge.accent { background: var(--accent); color: white; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(47, 214, 164, 0.15); }

.card { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em; }
.card-head .sub { color: var(--muted); font-size: 11.5px; }

.field { display: grid; gap: 6px; }
.field > label { font-size: 11.5px; color: var(--ink-2); font-weight: 550; }
.field .hint { font-size: 11px; color: var(--muted); }
.field-hint { font-size: 11px; color: var(--muted); margin: -4px 0 2px; line-height: 1.45; }

/* Sign in / Create account — first-class tabs, visible on a 320px phone before
   any scrolling. (Owner 2026-10-26: «δεν υπάρχει στο κινητό να κάνεις εγγραφή».) */
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 0 18px;
  padding: 4px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.035);
}
.auth-tab {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 9px 8px; border-radius: 9px;
  cursor: pointer; min-height: 40px; transition: background 0.14s, color 0.14s;
}
.auth-tab:hover { color: var(--ink); }
.auth-tab.active { background: linear-gradient(150deg, #5b82ff, #7d63ff); color: #fff; box-shadow: 0 6px 18px rgba(91, 130, 255, 0.28); }
.auth-tab:focus-visible { outline: 2px solid rgba(91, 130, 255, 0.6); outline-offset: 2px; }

/* Password + eye. The eye is a 46px touch target pinned inside the field so a
   thumb can reach it on a phone without a zoom. */
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { padding-right: 46px; }
.pw-eye {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  width: 40px; height: 38px; min-width: 40px; display: grid; place-items: center;
  appearance: none; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); cursor: pointer; padding: 0;
}
.pw-eye:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.pw-eye:focus-visible { outline: 2px solid rgba(91, 130, 255, 0.6); outline-offset: 1px; color: var(--ink); }
@media (max-width: 520px) {
  .pw-eye { width: 46px; height: 46px; right: 0; }
  .pw-wrap .input { padding-right: 52px; }
}
.input, .select, .textarea {
  width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.035); font-size: 13px; outline: none; transition: border-color 0.14s, box-shadow 0.14s;
}
.input:focus, .select:focus, .textarea:focus { border-color: rgba(91, 130, 255, 0.55); box-shadow: 0 0 0 3px rgba(91, 130, 255, 0.12); }
.textarea { resize: vertical; min-height: 84px; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.switch input { display: none; }
.switch span.track { width: 34px; height: 19px; border-radius: 20px; background: rgba(255, 255, 255, 0.14); position: relative; transition: background 0.15s; flex: none; }
.switch span.track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + span.track { background: var(--accent); }
.switch input:checked + span.track::after { transform: translateX(15px); }
.hint-line { font-size: 11.5px; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 11.5px; }

/* stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)); position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120px 80px at 100% 0%, rgba(91, 130, 255, 0.14), transparent 70%); pointer-events: none; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 27px; font-weight: 620; letter-spacing: -0.03em; margin-top: 8px; }
.stat .d { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* dashboard hero */
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; margin-bottom: 20px; }
.hero-main { padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(150deg, rgba(91, 130, 255, 0.16), rgba(157, 107, 255, 0.07) 55%, rgba(255, 255, 255, 0.02)); }
.hero-main h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -0.03em; font-weight: 620; }
.hero-main p { margin: 0 0 18px; color: var(--ink-2); font-size: 13.5px; max-width: 560px; }
.hero-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.hero-side { padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); display: grid; gap: 12px; align-content: start; }
.trust-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-2); }
.trust-row svg { color: var(--green); flex: none; }
.chain-box { font-family: var(--mono); font-size: 10.5px; color: var(--muted); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; word-break: break-all; }

/* lists */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: rgba(255, 255, 255, 0.02); }
.list-title { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ftile { width: 38px; height: 38px; border-radius: 10px; display: grid; place-content: center; flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; border: 1px solid rgba(255, 255, 255, 0.1); }
.ftile.doc { background: rgba(91, 130, 255, 0.18); color: #a8bfff; }
.ftile.sheet { background: rgba(47, 214, 164, 0.15); color: #8ff0d2; }
.ftile.slide { background: rgba(247, 178, 59, 0.15); color: #ffd894; }
.ftile.pdf { background: rgba(250, 93, 120, 0.15); color: #ffb3c0; }
.ftile.image { background: rgba(157, 107, 255, 0.16); color: #d3bbff; }
.ftile.text { background: rgba(255, 255, 255, 0.08); color: var(--ink-2); }

/* drive */
.drive-toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; flex-wrap: wrap; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); max-width: 100%; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 5px 10px; border-radius: 7px; font-size: 12px; cursor: pointer; }
.segmented button.active { background: rgba(255, 255, 255, 0.1); color: var(--ink); }
.folder-bar { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.folder-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); font-size: 12px; cursor: pointer; color: var(--ink-2); }
.folder-pill:hover { border-color: var(--line-strong); }
.folder-pill.active { background: var(--accent-soft); border-color: rgba(91, 130, 255, 0.35); color: #d5e0ff; }
.folder-pill .count { font-size: 10px; color: var(--muted); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 13px; }
.file-card { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 11px; cursor: pointer; transition: border-color 0.14s, transform 0.14s, background 0.14s; position: relative; }
.file-card:hover { border-color: rgba(91, 130, 255, 0.35); transform: translateY(-2px); background: var(--panel-2); }
.file-card .top { display: flex; align-items: flex-start; gap: 10px; }
.file-card .fname { font-size: 13px; font-weight: 550; word-break: break-word; line-height: 1.3; }
.file-card .fmeta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.file-card .actions { display: flex; gap: 5px; margin-top: auto; opacity: 0.65; transition: opacity 0.15s; }
.file-card:hover .actions { opacity: 1; }
.file-card .star { position: absolute; top: 10px; right: 10px; color: var(--muted); }
.file-card .star.on { color: var(--amber); }
.dropzone { border: 1px dashed rgba(255, 255, 255, 0.16); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; background: rgba(255, 255, 255, 0.012); }
.dropzone.hot { border-color: rgba(91, 130, 255, 0.6); background: rgba(91, 130, 255, 0.07); color: var(--ink); }

/* table */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); max-width: 100%; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th { text-align: left; padding: 10px 14px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(255, 255, 255, 0.022); }

/* empty */
.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty .icon-wrap { width: 54px; height: 54px; border-radius: 16px; display: grid; place-content: center; margin: 0 auto 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.empty h3 { margin: 0 0 5px; color: var(--ink); font-size: 15px; font-weight: 600; }
.empty p { margin: 0 0 16px; font-size: 12.5px; }

/* ---------------------------------------------------------------- editor */
.editor-shell { display: flex; flex-direction: column; height: calc(100vh - 62px); }
.editor-bar { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.editor-title { font-size: 13.5px; font-weight: 600; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-body { flex: 1; overflow: auto; background: var(--bg-soft); }
.editor-page { max-width: 840px; margin: 26px auto 80px; background: #fff; color: #17202e; border-radius: 10px; box-shadow: var(--shadow); padding: 54px 62px; min-height: 900px; }
.editor-page.landscape { max-width: 1080px; }
.doc-block { position: relative; margin: 0 0 2px; border-radius: 4px; }
.doc-block:hover { background: rgba(91, 130, 255, 0.06); }
.doc-block.locked { opacity: 0.75; }
.doc-block textarea { border: 0; background: transparent; width: 100%; resize: none; outline: none; padding: 2px 4px; color: #17202e; font: inherit; line-height: 1.5; overflow: hidden; }
.doc-block textarea:focus { background: rgba(91, 130, 255, 0.08); box-shadow: 0 0 0 2px rgba(91, 130, 255, 0.25); border-radius: 4px; }
.doc-block .h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; }
.doc-block .h2 { font-size: 21px; font-weight: 700; }
.doc-block .h3 { font-size: 17px; font-weight: 650; }
.doc-block .title { font-size: 32px; font-weight: 700; letter-spacing: -0.025em; }
.doc-block .normal { font-size: 15px; }
.doc-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.doc-table td, .doc-table th { border: 1px solid #d7dce6; padding: 5px 8px; }
.doc-lock-note { font-size: 10px; color: #8a94a8; font-style: italic; }
.sheet-wrap { overflow: auto; }
table.sheet { border-collapse: collapse; font-size: 12px; background: #fff; color: #17202e; }
table.sheet th { background: #eef1f7; color: #5b6478; font-weight: 600; font-size: 10.5px; padding: 4px 6px; border: 1px solid #d9dee8; position: sticky; top: 0; z-index: 2; }
table.sheet th.rowhead { position: sticky; left: 0; z-index: 3; width: 42px; text-align: center; }
table.sheet td { border: 1px solid #e3e7ef; padding: 0; min-width: 108px; height: 26px; }
table.sheet td input { width: 100%; height: 26px; border: 0; padding: 3px 6px; background: transparent; color: #17202e; outline: none; font-size: 12px; }
table.sheet td input:focus { background: #eef4ff; box-shadow: inset 0 0 0 2px #7d9cff; }
table.sheet td.formula input { color: #2b6b2b; font-family: var(--mono); font-size: 11px; }
.sheet-tabs { display: flex; gap: 4px; padding: 8px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.sheet-tab { padding: 6px 12px; border-radius: 8px 8px 0 0; font-size: 12px; cursor: pointer; color: var(--muted); border: 1px solid transparent; border-bottom: 0; }
.sheet-tab.active { background: var(--bg-soft); color: var(--ink); border-color: var(--line); }
.slide-canvas { position: relative; background: #fff; color: #17202e; border-radius: 8px; box-shadow: var(--shadow); margin: 20px auto; aspect-ratio: 16 / 9; max-width: 1000px; overflow: hidden; }
.slide-shape { position: absolute; }
.slide-shape textarea { border: 1px dashed transparent; background: transparent; width: 100%; height: 100%; resize: none; outline: none; font: inherit; color: inherit; padding: 2px; line-height: 1.25; }
.slide-shape textarea:hover { border-color: rgba(91, 130, 255, 0.35); }
.slide-shape textarea:focus { border-color: rgba(91, 130, 255, 0.8); background: rgba(91, 130, 255, 0.05); }
.pdf-stage { display: grid; place-items: center; padding: 22px; background: #0a0e16; min-height: 70vh; }
.pdf-page { position: relative; box-shadow: var(--shadow); border-radius: 4px; overflow: hidden; background: #fff; }
.pdf-page canvas { display: block; }
.editor-side { width: 300px; border-left: 1px solid var(--line); padding: 16px; overflow: auto; background: var(--panel); }
.version-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.version-row .vno { font-family: var(--mono); color: var(--accent); font-size: 11px; }

/* ---------------------------------------------------------------- sign */
.request-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 13px; }
.request-card { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: border-color 0.14s, transform 0.14s; }
.request-card:hover { border-color: rgba(91, 130, 255, 0.35); transform: translateY(-2px); }
.progress { height: 5px; border-radius: 20px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress > div { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.signer-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; }
.signer-row .st { margin-left: auto; }
.wizard-steps { display: flex; gap: 6px; align-items: center; margin-bottom: 18px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.wizard-steps .step { display: flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); }
.wizard-steps .step.active { color: var(--ink); border-color: rgba(91, 130, 255, 0.4); background: var(--accent-soft); }
.wizard-steps .step.done { color: var(--green); border-color: rgba(47, 214, 164, 0.3); }
.palette { display: flex; flex-direction: column; gap: 6px; }
.palette-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); cursor: pointer; font-size: 12.5px; }
.palette-item.active { border-color: rgba(91, 130, 255, 0.5); background: var(--accent-soft); }
.field-mark { position: absolute; border: 1.5px solid rgba(91, 130, 255, 0.9); background: rgba(91, 130, 255, 0.16); border-radius: 4px; cursor: move; display: flex; align-items: center; justify-content: center; font-size: 9px; color: #24406f; overflow: hidden; user-select: none; }
.field-mark.selected { border-color: #9d6bff; box-shadow: 0 0 0 3px rgba(157, 107, 255, 0.25); background: rgba(157, 107, 255, 0.2); }
.field-mark .del { position: absolute; top: -7px; right: -7px; width: 15px; height: 15px; border-radius: 50%; background: var(--red); color: #fff; font-size: 10px; display: grid; place-content: center; cursor: pointer; }
.field-mark .lbl { padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* signing page */
.sign-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg-soft); }
.sign-head { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: rgba(8, 11, 18, 0.85); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px); }
.sign-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 0; flex: 1; }
.sign-doc { padding: 22px; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 16px; max-height: calc(100vh - 66px); }
.sign-side { border-left: 1px solid var(--line); background: var(--panel); padding: 20px; overflow: auto; max-height: calc(100vh - 66px); }
.sign-field-box { position: absolute; border: 1.5px dashed rgba(91, 130, 255, 0.85); background: rgba(91, 130, 255, 0.1); border-radius: 3px; display: grid; place-items: center; font-size: 9px; color: #37507f; }
.sign-field-box.done { border-style: solid; border-color: rgba(47, 214, 164, 0.9); background: rgba(47, 214, 164, 0.14); color: #14664d; }
.sig-pad { width: 100%; height: 170px; border-radius: 10px; border: 1px dashed var(--line-strong); background: #fff; touch-action: none; cursor: crosshair; }
.sig-clear { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 11px; color: var(--muted); }
.sign-done { display: grid; place-content: center; text-align: center; min-height: 100vh; gap: 8px; padding: 40px; }
.sign-done .big { width: 66px; height: 66px; border-radius: 20px; background: var(--green-soft); border: 1px solid rgba(47, 214, 164, 0.35); display: grid; place-content: center; margin: 0 auto 12px; color: var(--green); }

/* forms */
.form-builder { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
.form-field-row { display: grid; grid-template-columns: 1.2fr 1fr 120px auto; gap: 9px; align-items: end; padding: 10px 0; border-bottom: 1px solid var(--line); }
.public-form { max-width: 620px; margin: 40px auto; padding: 0 20px 60px; }
.public-form h1 { font-size: 27px; letter-spacing: -0.03em; margin: 0 0 6px; }

/* audit */
.chain-banner { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 12px; border: 1px solid rgba(47, 214, 164, 0.28); background: var(--green-soft); margin-bottom: 16px; font-size: 12.5px; flex-wrap: wrap; }
/* The "sealed chain / Verify / Export JSON" row must wrap on a phone: it was
   pushing the audit page 49px wider than a 390px screen. */
.chain-banner .row { flex-wrap: wrap; min-width: 0; row-gap: 8px; }
.chain-banner > div { min-width: 0; }
.chain-banner.bad { border-color: rgba(250, 93, 120, 0.35); background: var(--red-soft); }
.ev-action { font-family: var(--mono); font-size: 11px; color: #c7d3ff; }
.ev-hash { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

/* toast + modal */
.toasts { position: fixed; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { min-width: 260px; max-width: 380px; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--panel-2); box-shadow: var(--shadow); font-size: 12.5px; display: flex; gap: 9px; align-items: flex-start; animation: toast-in 0.16s ease-out; }
.toast.err { border-color: rgba(250, 93, 120, 0.4); }
.toast.ok { border-color: rgba(47, 214, 164, 0.35); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.modal-backdrop { position: fixed; inset: 0; background: rgba(3, 5, 9, 0.7); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 150; padding: 20px; }
.modal { width: min(560px, 100%); max-height: 88vh; overflow: auto; border-radius: 16px; border: 1px solid var(--line-strong); background: var(--panel); box-shadow: var(--shadow); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px; display: grid; gap: 13px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 7px 12px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.copy-row { display: flex; gap: 6px; align-items: center; }
.copy-row input { flex: 1; font-family: var(--mono); font-size: 11px; }

/* settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.settings-grid .card { overflow: hidden; }
.form-grid { display: grid; gap: 13px; padding: 18px; }

/* preview modal */
.preview-body { background: #0a0e16; display: grid; place-items: center; padding: 12px; max-height: 70vh; overflow: auto; }
.preview-body canvas { max-width: 100%; box-shadow: var(--shadow); }

/* responsive */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .sign-body { grid-template-columns: 1fr; }
  .sign-side { max-height: none; border-left: 0; border-top: 1px solid var(--line); }
  .settings-grid, .form-builder { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .searchbox { width: 160px; }
  .view { padding: 18px 16px 60px; }
  .editor-page { padding: 28px 22px; }
}

/* ------------------------------------------------------- v1.0 additions */
.panel { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 16px; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-row .stat { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 13px 15px; }
.stat-row .stat .icon-wrap { grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; display: grid; place-content: center; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--ink-2); }
.stat-value { font-size: 20px; font-weight: 640; letter-spacing: -0.02em; line-height: 1.1; }
.stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(296px, 1fr)); gap: 13px; }
.file-card.selected { border-color: rgba(91, 130, 255, 0.6); background: rgba(91, 130, 255, 0.08); box-shadow: 0 0 0 1px rgba(91, 130, 255, 0.35) inset; }
.avatar-dot { width: 27px; height: 27px; border-radius: 50%; display: inline-grid; place-content: center; font-size: 9.5px; font-weight: 700; background: rgba(255, 255, 255, 0.09); color: var(--ink-2); flex: none; border: 1px solid rgba(255, 255, 255, 0.12); }
.avatar-dot.signed { background: var(--green-soft); color: #8ff0d2; border-color: rgba(47, 214, 164, 0.4); }
.avatar-dot.viewed { background: var(--amber-soft); color: #ffd894; border-color: rgba(247, 178, 59, 0.4); }
.avatar-dot.declined { background: var(--red-soft); color: #ffb3c0; border-color: rgba(250, 93, 120, 0.4); }
.signer-card { border: 1px solid var(--line); border-radius: 11px; padding: 10px 11px; background: rgba(255, 255, 255, 0.022); margin-bottom: 8px; }
.signer-card:last-child { margin-bottom: 0; }
.note-box { border: 1px solid var(--line); border-left: 3px solid rgba(91, 130, 255, 0.55); background: rgba(91, 130, 255, 0.06); border-radius: 9px; padding: 9px 11px; font-size: 12px; color: var(--ink-2); white-space: pre-wrap; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.pulse { animation: pulse-ring 0.85s ease-out; }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(91, 130, 255, 0.6); } 100% { box-shadow: 0 0 0 10px rgba(91, 130, 255, 0); } }

/* split view (request detail) */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 14px; align-items: start; }
.split-side { display: grid; gap: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.check-row input { accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
.kv-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.022); }

/* field placement */
.field-layout { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 14px; align-items: start; margin-top: 16px; }
.field-canvas-col { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #0a0e16; }
.field-canvas-col .pdf-stage { min-height: 420px; display: block; }
.field-side { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 14px; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.type-btn { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--ink-2); font-size: 11.5px; cursor: pointer; text-align: left; }
.type-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.type-btn.active { border-color: rgba(91, 130, 255, 0.55); background: var(--accent-soft); color: #d5e0ff; }
.signer-pick { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); cursor: pointer; font-size: 12px; color: var(--ink-2); }
.signer-pick.active { border-color: rgba(91, 130, 255, 0.5); background: var(--accent-soft); color: var(--ink); }
.field-row { display: flex; align-items: center; gap: 7px; padding: 5px 7px; border-radius: 7px; font-size: 11px; border: 1px solid var(--line); }
.field-layer { position: absolute; left: 0; top: 0; cursor: crosshair; }
.field-box { position: absolute; border: 1.5px dashed rgba(91, 130, 255, 0.9); background: rgba(91, 130, 255, 0.12); border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 8.5px; line-height: 1.1; color: #24406f; overflow: hidden; cursor: move; user-select: none; }
.field-box span { padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.field-box.sel { box-shadow: 0 0 0 2px rgba(157, 107, 255, 0.45); }
.field-box.filled { border-style: solid; border-color: rgba(47, 214, 164, 0.95); background: rgba(47, 214, 164, 0.12); color: #0f5c46; }
.field-del { position: absolute; top: -8px; right: -8px; width: 14px; height: 14px; border-radius: 50%; border: 0; background: var(--red); color: #fff; display: grid; place-content: center; cursor: pointer; opacity: 0; transition: opacity 0.12s; padding: 0; }
.field-box:hover .field-del, .field-box.sel .field-del { opacity: 1; }

/* wizard */
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 6px; }
.step { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 7px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); cursor: default; }
.step.done { cursor: pointer; }
.step.active { color: var(--ink); border-color: rgba(91, 130, 255, 0.42); background: var(--accent-soft); }
.step.done { color: var(--green); border-color: rgba(47, 214, 164, 0.3); }
.step-dot { width: 19px; height: 19px; border-radius: 50%; display: grid; place-content: center; font-size: 10px; font-weight: 700; background: rgba(255, 255, 255, 0.08); }
.step.active .step-dot { background: var(--accent); color: #fff; }
.step.done .step-dot { background: var(--green-soft); color: var(--green); }
.wizard-foot { display: flex; align-items: center; gap: 9px; margin-top: 20px; }
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.secret-box { font-family: var(--mono); font-size: 11.5px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: 9px; padding: 11px; word-break: break-all; }
.meta-pre { font-family: var(--mono); font-size: 11px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line); border-radius: 9px; padding: 11px; overflow: auto; max-height: 320px; margin: 0; white-space: pre-wrap; }
.detail-row td { background: rgba(0, 0, 0, 0.16); }
.chain-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-content: center; background: rgba(47, 214, 164, 0.14); color: var(--green); flex: none; }
.chain-banner.bad .chain-icon { background: var(--red-soft); color: var(--red); }

/* public pages */
.public-wrap { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg-soft); }
.public-head { display: flex; align-items: center; gap: 14px; padding: 13px 22px; border-bottom: 1px solid var(--line); background: rgba(8, 11, 18, 0.9); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 30; }
.public-head-meta { text-align: right; max-width: 320px; }
.public-head-meta .list-sub { max-width: 320px; }
.public-main { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 392px; min-height: 0; }
.public-doc { padding: 20px; overflow: auto; background: #0a0e16; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.public-side { border-left: 1px solid var(--line); background: var(--panel); padding: 18px; overflow: auto; }
.sig-slot { border: 1.5px dashed rgba(91, 130, 255, 0.5); background: rgba(91, 130, 255, 0.06); border-radius: 9px; min-height: 62px; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; color: var(--ink-2); font-size: 12px; padding: 8px; }
.sig-slot:hover { border-color: rgba(91, 130, 255, 0.85); background: rgba(91, 130, 255, 0.1); }
.public-error { margin: auto; max-width: 470px; text-align: center; padding: 40px 20px; }
.public-error .icon-wrap { width: 58px; height: 58px; border-radius: 17px; display: grid; place-content: center; margin: 0 auto 16px; background: var(--red-soft); border: 1px solid rgba(250, 93, 120, 0.3); color: var(--red); }
.public-error h2 { font-size: 20px; margin: 0 0 8px; letter-spacing: -0.02em; }
.public-error p { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.public-success { margin: auto; max-width: 560px; width: 100%; text-align: center; padding: 40px 20px; }
.success-mark { width: 66px; height: 66px; border-radius: 20px; display: grid; place-content: center; margin: 0 auto 16px; background: var(--green-soft); border: 1px solid rgba(47, 214, 164, 0.35); color: var(--green); }
.public-success h2 { font-size: 23px; margin: 0 0 8px; letter-spacing: -0.02em; }
.public-success p { color: var(--ink-2); font-size: 13.5px; margin: 0; }
/* Reopened / finished signing link: the document name and the moment it closed. */
.closed-meta { margin-top: 14px; font-size: 12px; color: var(--muted); display: flex; justify-content: center; gap: 2px; flex-wrap: wrap; overflow-wrap: anywhere; }
.form-card { margin: 34px auto 60px; width: min(660px, calc(100% - 32px)); border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 30px; }
.form-card h1 { font-size: 25px; letter-spacing: -0.025em; margin: 0 0 6px; }
.settings-card { margin-bottom: 14px; }

@media (max-width: 1180px) {
  .split, .field-layout, .review-grid, .grid-3 { grid-template-columns: 1fr; }
  .public-main { grid-template-columns: 1fr; }
  .public-side { border-left: 0; border-top: 1px solid var(--line); }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
}

/* language switcher (protocol §0n) */
.lang-slot { display: inline-flex; align-items: center; }
.lang-slot .nv-lang summary { padding: 8px 9px; }
@media (max-width: 980px) {
  .topbar { gap: 8px; padding: 0 14px; }
  .searchbox { width: 170px; }
}
@media (max-width: 720px) {
  .topbar { height: auto; min-height: 58px; flex-wrap: wrap; padding: 9px 12px; row-gap: 8px; }
  .topbar .searchbox { order: 5; width: 100%; }
  .topbar .crumbs { order: 1; }
  .topbar > .spacer { display: none; }
  .topbar .lang-slot { order: 3; margin-left: auto; }
  .topbar .btn { order: 4; }
  .lang-slot { order: 2; }
}

/* dashboard two-column body: collapses before it can overflow a phone */
.dash-cols { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }
@media (max-width: 980px) { .dash-cols { grid-template-columns: 1fr; } }
.ev-hash, .mono, .sha { overflow-wrap: anywhere; }
@media (max-width: 640px) { .list-row { flex-wrap: wrap; } .ev-hash { max-width: 100%; } }

/* ============================================================== APP SHELL
   Phone / tablet. The sidebar used to be `display: none` under 860px with no
   replacement, so a phone user could not reach Documents, Signatures, Forms,
   the ledger or Settings at all. It is now an off-canvas drawer + bottom tabs,
   the way an installed app behaves. */
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-content: center;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); cursor: pointer; padding: 0; flex: none;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn:active { transform: translateY(1px); }
.menu-btn { display: none; }
.sidebar-close { display: none; }
.scrim { display: none; }
.mobile-tabs { display: none; }

.install-btn { display: inline-flex; align-items: center; gap: 7px; }
.sidebar .install-slot { display: block; }
.auth-install { margin-top: 12px; }
.auth-install .install-btn { width: 100%; justify-content: center; }
.auth-mobile-brand { display: none; align-items: center; gap: 11px; margin-bottom: 20px; }
.auth-mobile-name { font-weight: 650; font-size: 17px; letter-spacing: -0.02em; line-height: 1.1; }
.auth-mobile-sub { font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); }

/* ---------------------------------------------------------- tablet ≤ 900 */
@media (max-width: 900px) {
  .menu-btn { display: inline-grid; }
  .sidebar-close { display: inline-grid; }
  .sidebar {
    display: flex; position: fixed; top: 0; left: 0; z-index: 60;
    height: 100vh; height: 100dvh; width: min(304px, 87vw);
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
    padding-top: calc(16px + env(safe-area-inset-top));
    transform: translateX(-105%); transition: transform 0.22s ease;
    background: #0a0e18; border-right: 1px solid var(--line-strong);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6); overflow-y: auto; overscroll-behavior: contain;
  }
  body.menu-open .sidebar { transform: none; }
  body.menu-open { overflow: hidden; }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 55; background: rgba(3, 5, 10, 0.62);
    backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  .view { padding: 18px 16px calc(80px + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 14px; }
}

/* ----------------------------------------------------------- phone ≤ 700 */
@media (max-width: 700px) {
  .mobile-tabs {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(9, 12, 20, 0.97); border-top: 1px solid var(--line);
    backdrop-filter: blur(18px); padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
  }
  .tab-item {
    display: grid; justify-items: center; gap: 3px; padding: 6px 2px 5px; border-radius: 10px;
    color: var(--muted); font-size: 9.5px; letter-spacing: 0.01em; line-height: 1;
  }
  .tab-item svg { width: 20px; height: 20px; }
  .tab-item.active { color: #d5ddff; background: var(--accent-soft); }
  .topbar { height: auto; min-height: 56px; flex-wrap: wrap; padding: 8px 12px; row-gap: 8px; }
  .topbar > .spacer { display: none; }
  .topbar .crumbs { order: 1; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .menu-btn { order: 0; }
  .topbar .searchbox { order: 6; width: 100%; margin-left: 0; }
  .topbar .lang-slot { order: 4; margin-left: auto; }
  .topbar .topbar-new { order: 5; }
  .view { padding: 14px 12px calc(92px + env(safe-area-inset-bottom)); }
  .page-title { font-size: 21px; }
  .hero-main { padding: 18px; }
  .hero-main h1 { font-size: 22px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-row { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .form-card { margin: 18px auto 40px; width: calc(100% - 24px); padding: 20px; border-radius: 18px; }
  .public-head { padding: 10px 14px; }
  .public-head-meta { display: none; }
  .public-doc { padding: 12px 10px; }
  .public-side { padding: 14px; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 18px 18px 14px 14px; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; justify-content: center; }
  .toasts { top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); left: 12px; right: 12px; }
  /* iOS zooms the page when a form control is focused under 16px. */
  .input, .select, .textarea, input, select, textarea { font-size: 16px; }
  .btn { min-height: 40px; }
  .new-label { display: none; }
  .topbar-new { padding: 8px 11px; }
}

/* small phone ≤ 400 */
@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1; justify-content: center; }
  .view { padding: 12px 10px calc(92px + env(safe-area-inset-bottom)); }
}

/* A phone must never scroll sideways. The UI is machine-translated into 109
   languages at runtime, and a long Greek/translated label inside a segmented
   filter could widen the whole page while the translation pass was running.
   Tables already scroll inside .table-wrap; here the filters get more room. */
@media (max-width: 720px) {
  .segmented button { padding: 6px 9px; font-size: 11.5px; }
  .drive-toolbar { flex-wrap: wrap; row-gap: 8px; }
  .page-sub { overflow-wrap: anywhere; }
}

/* ---------------------------------------------------------- login screen */
/* Rounded, floating card on a soft gradient — the phone gets the same brand
   surface as the desktop, not a bare form on black. */
.auth-wrap {
  min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 0.95fr;
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(91, 130, 255, 0.22), transparent 62%),
    radial-gradient(760px 460px at 96% 4%, rgba(157, 107, 255, 0.2), transparent 60%),
    radial-gradient(620px 420px at 50% 110%, rgba(47, 214, 164, 0.08), transparent 65%),
    #070a11;
}
.auth-form-side { display: grid; place-content: center; padding: 40px; }
.auth-card {
  width: 100%; max-width: 412px; padding: 30px; border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(170deg, rgba(23, 30, 48, 0.92), rgba(13, 17, 27, 0.94));
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
}
@media (max-width: 1180px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-form-side { padding: 28px; }
  .auth-mobile-brand { display: flex; }
}
@media (max-width: 520px) {
  .auth-wrap { padding: 18px 14px; place-items: center; align-content: center; }
  .auth-form-side { padding: 0; width: 100%; }
  .auth-card { max-width: 100%; padding: 22px 18px 20px; border-radius: 22px; }
  .auth-card h2 { font-size: 21px; }
  .auth-card .sub { margin-bottom: 18px; font-size: 12.5px; }
  .auth-card .field { margin-bottom: 12px; }
  .auth-card .btn[type=submit] { padding: 13px 16px; min-height: 46px; }
}

/* ---------------------------------------------------------- short screens */
/* A small phone (360x640, 320x568) must show the submit button without a
   scroll. These rules are LAST on purpose: the max-width:520px block above sets
   the default padding, and equal specificity means source order decides. */
@media (max-height: 700px) and (max-width: 520px) {
  .auth-note, .auth-install { display: none; }
  .auth-card { padding: 16px 16px 18px; }
  .auth-card h2 { font-size: 19px; margin-bottom: 2px; }
  .auth-card .sub { margin-bottom: 12px; }
  .auth-card .field { margin-bottom: 9px; }
  .auth-tabs { margin-bottom: 12px; }
}
/* 320x568: the brand block above the card is the first thing to go, so the form
   itself — including the submit button — is on screen without a scroll. */
@media (max-height: 640px) and (max-width: 520px) {
  .auth-mobile-brand { display: none; }
  .auth-card { padding: 14px 14px 16px; }
  .auth-card h2 { font-size: 18px; }
  .auth-card .sub { font-size: 12px; }
  .auth-card .field { margin-bottom: 8px; }
  .auth-card .btn[type=submit] { padding: 11px 14px; min-height: 44px; }
  .auth-card .input, .auth-card .pw-wrap .input { padding: 8px 10px; }
  .auth-card .pw-wrap .input { padding-right: 50px; }
}
