/* ---------- base ---------- */
* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --accent: #2563eb;
  --accent-dark: #1e40af;
  --bg: #f3f4f6;
  --paper: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #dc2626;
  --ok: #059669;
  --hover: #f9fafb;
  --active-bg: #dbeafe;
  --active-border: #bfdbfe;
  --row-hover: #fafbff;
  --code-bg: #eef0f3;
  --mark-bg: #fef08a;
  --badge-family-bg: #dcfce7;
  --badge-family-fg: #166534;
  --badge-private-bg: #fee2e2;
  --badge-private-fg: #991b1b;
  --warn-bg: #fef3c7;
  --warn-border: #fcd34d;
  --warn-fg: #92400e;
}
/* dark palette — used when the user picked Dark, or picked Auto and the OS is dark */
:root[data-theme='dark'] {
  color-scheme: dark;
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --bg: #0f172a;
  --paper: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --danger: #f87171;
  --ok: #34d399;
  --hover: #263449;
  --active-bg: #1e40af;
  --active-border: #1e3a8a;
  --row-hover: #223047;
  --code-bg: #334155;
  --mark-bg: #a16207;
  --badge-family-bg: #14532d;
  --badge-family-fg: #86efac;
  --badge-private-bg: #7f1d1d;
  --badge-private-fg: #fca5a5;
  --warn-bg: #451a03;
  --warn-border: #92400e;
  --warn-fg: #fbbf24;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --accent: #3b82f6;
    --accent-dark: #2563eb;
    --bg: #0f172a;
    --paper: #1e293b;
    --border: #334155;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --danger: #f87171;
    --ok: #34d399;
    --hover: #263449;
    --active-bg: #1e40af;
    --active-border: #1e3a8a;
    --row-hover: #223047;
    --code-bg: #334155;
    --mark-bg: #a16207;
    --badge-family-bg: #14532d;
    --badge-family-fg: #86efac;
    --badge-private-bg: #7f1d1d;
    --badge-private-fg: #fca5a5;
    --warn-bg: #451a03;
    --warn-border: #92400e;
    --warn-fg: #fbbf24;
  }
}
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Hebrew', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
button {
  font: inherit;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover { background: var(--hover); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-dark); }
button.danger { color: var(--danger); }
button.ghost { background: transparent; border: none; }
button.active { background: var(--active-bg); border-color: var(--active-border); }
input, select, textarea { font: inherit; color: inherit; }
input, select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--paper);
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; }
.fatal { background: #fee2e2; color: #991b1b; padding: 12px 16px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.logo { font-weight: 700; font-size: 18px; white-space: nowrap; }
.spacer { flex: 1; }
.home-link { font-size: 22px; text-decoration: none; color: var(--text); padding: 2px 8px; border-radius: 6px; }
.home-link:hover { background: var(--bg); }
.title-input {
  font-size: 17px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  min-width: 0;
  flex: 1;
  max-width: 480px;
}
.title-input:hover, .title-input:focus { border-color: var(--border); background: var(--paper); }
.search { flex: 1; max-width: 420px; }
.status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.status.connected { color: var(--ok); }
.status.failed { color: var(--danger); }
.share-select { font-size: 13px; }

.presence { display: flex; gap: 4px; }
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* dropdown menus */
details.menu { position: relative; }
details.menu summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper);
  white-space: nowrap;
  user-select: none;
}
details.menu summary::-webkit-details-marker { display: none; }
details.menu[open] summary { background: var(--bg); }
.menu-items {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 4px);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  display: flex;
  flex-direction: column;
  min-width: 170px;
  z-index: 30;
  overflow: hidden;
}
.menu-items button { border: none; border-radius: 0; text-align: start; padding: 9px 14px; background: var(--paper); }
.menu-items button:hover { background: var(--bg); }

/* ---------- menu bar (OpenOffice-style) ---------- */
.menubar {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 2px 8px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 49px;
  z-index: 16;
  font-size: 14px;
}
.menu-root { position: relative; }
.menu-root > span {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
}
.menu-root:hover > span, .menu-root.open > span { background: var(--bg); }
.menu-pop {
  display: none;
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  min-width: 210px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
  padding: 4px;
  z-index: 40;
}
.menu-root.open > .menu-pop { display: block; }
.menu-pop button, .submenu > span {
  display: block;
  width: 100%;
  text-align: start;
  border: none;
  background: none;
  padding: 7px 12px;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.menu-pop button:hover, .submenu:hover > span { background: var(--active-bg); }
.menu-pop hr { border: none; border-top: 1px solid var(--border); margin: 4px 2px; }
.submenu { position: relative; }
.submenu > span { display: flex; justify-content: space-between; align-items: center; }
.menu-pop.sub { top: -4px; inset-inline-start: 100%; display: none; }
.submenu:hover > .menu-pop.sub { display: block; }
.menubar + .toolbar { top: 84px; }
.toolbar.hidden { display: none; }

/* ---------- app launcher (right drawer) ---------- */
/* hamburger fixed to the physical LEFT, above the drawer so it toggles closed */
.topbar.has-ham { padding-left: 52px; }
.app-ham {
  position: fixed;
  left: 10px;
  top: 9px;
  border: 1px solid var(--border);
  background: var(--paper);
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  z-index: 95;
}
.app-ham:hover { background: var(--bg); }
.app-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.3);
  opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 90;
}
.app-overlay.show { opacity: 1; pointer-events: auto; }
/* drawer slides in from the physical LEFT in both LTR and RTL */
.app-drawer {
  position: fixed; top: 0; left: 0; height: 100vh; width: 270px;
  background: var(--paper); border-right: 1px solid var(--border);
  box-shadow: 8px 0 30px rgba(0,0,0,.18);
  transform: translateX(-100%); transition: transform .2s; z-index: 91;
  display: flex; flex-direction: column; padding: 10px;
}
.app-drawer.open { transform: translateX(0); }
.app-drawer-head {
  font-weight: 700; font-size: 17px; padding: 8px 10px 12px 52px;
  display: flex; align-items: center; justify-content: space-between;
}
.app-close {
  border: none; background: none; cursor: pointer; font-size: 18px;
  color: var(--muted); padding: 4px 8px; border-radius: 6px; line-height: 1;
}
.app-close:hover { background: var(--bg); color: var(--text); }
.app-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: none; background: none; border-radius: 8px;
  font-size: 15px; text-align: start; text-decoration: none; color: var(--text); cursor: pointer;
}
.app-item:hover { background: var(--bg); }
.app-drawer-sep { border-top: 1px solid var(--border); margin: 6px 4px; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px;
  padding: 6px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 49px;
  z-index: 15;
}
.toolbar > * { flex: 0 0 auto; }
/* the "More" overflow dropdown */
#more-menu .menu-items { z-index: 45; }
#more-menu .menu-items.wide { min-width: 230px; padding: 4px; }
#more-menu .menu-items button {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-radius: 6px;
}
#more-menu .menu-items button.active { background: var(--active-bg); }
.mi-ic { width: 22px; text-align: center; flex: 0 0 auto; }
.ls-row { display: flex; align-items: center; gap: 4px; padding: 6px 10px; font-size: 13px; }
.ls-row > span:first-child { flex: 1; color: var(--muted); }
.ls-row button {
  min-width: 34px; padding: 3px 6px; border: 1px solid var(--border);
  border-radius: 5px; background: var(--paper); font-size: 12px;
}
.ls-row button:hover { background: var(--bg); }
.toolbar button {
  min-width: 32px;
  padding: 5px 8px;
  border-color: transparent;
  background: transparent;
  font-size: 14px;
}
.toolbar button:hover { background: var(--bg); }
.toolbar button.active { background: var(--active-bg); }
.toolbar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 5px; }
.toolbar select { padding: 4px 6px; font-size: 13px; }
.toolbar details.menu summary { border: none; padding: 5px 8px; }
.word-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.font-select { max-width: 130px; }
.size-select { max-width: 70px; }
.color-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}
.color-btn:hover { background: var(--bg); }
.color-btn input[type=color] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}
.color-btn::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 6px;
  right: 6px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: .5;
}

/* find & replace */
.find-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.find-panel input { font-size: 13px; padding: 4px 8px; width: 170px; }
.find-panel button { padding: 4px 10px; font-size: 13px; }
.ProseMirror .find-hit { background: rgba(250, 204, 21, .45); border-radius: 2px; }
.ProseMirror .find-hit.active { background: rgba(249, 115, 22, .65); }

/* page break */
.ProseMirror .page-break, .note-preview .page-break {
  border: none;
  border-top: 2px dashed var(--border);
  margin: 1.4em -20px;
  position: relative;
  height: 0;
}
.ProseMirror .page-break::after {
  content: 'page break';
  position: absolute;
  top: -0.7em;
  inset-inline-end: 24px;
  font-size: 10px;
  color: var(--muted);
  background: var(--paper);
  padding: 0 6px;
}
.ProseMirror .page-break.ProseMirror-selectednode { outline: 2px solid var(--accent); }

/* version history */
.versions-list { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.version-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.version-row > span:first-child { flex: 1; }

/* ---------- editor page ---------- */
.editor-body { display: flex; flex-direction: column; height: 100vh; }
.editor-main { flex: 1; overflow-y: auto; padding: 28px 12px 80px; }
.doc-page {
  max-width: 850px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 60px 70px;
  min-height: 900px;
}
@media (max-width: 700px) { .doc-page { padding: 24px 18px; } }

.ProseMirror { outline: none; line-height: 1.15; }
.ProseMirror p { margin: 0 0 .6em; }
.ProseMirror h1 { font-size: 1.9em; margin: .8em 0 .4em; }
.ProseMirror h2 { font-size: 1.5em; margin: .8em 0 .4em; }
.ProseMirror h3 { font-size: 1.2em; margin: .8em 0 .4em; }
.ProseMirror h4 { font-size: 1.05em; margin: .8em 0 .4em; }
.ProseMirror h5 { font-size: .95em; font-weight: 700; margin: .8em 0 .4em; }
.ProseMirror h6 { font-size: .85em; font-weight: 700; color: var(--muted); margin: .8em 0 .4em; }
.ProseMirror blockquote { border-inline-start: 3px solid var(--border); margin-inline-start: 0; padding-inline-start: 14px; color: var(--muted); }
.ProseMirror pre { background: #111827; color: #e5e7eb; border-radius: 8px; padding: 12px 16px; overflow-x: auto; direction: ltr; text-align: left; }
.ProseMirror code { background: var(--code-bg); border-radius: 4px; padding: 1px 5px; font-size: .92em; }
.ProseMirror pre code { background: none; padding: 0; }
.ProseMirror img { max-width: 100%; height: auto; border-radius: 4px; }
.ProseMirror img.ProseMirror-selectednode { outline: 2px solid var(--accent); }
.ProseMirror hr { border: none; border-top: 2px solid var(--border); margin: 1.4em 0; }
.ProseMirror a { color: var(--accent); }
.ProseMirror mark { background: var(--mark-bg); border-radius: 2px; padding: 0 1px; }

.ProseMirror table { border-collapse: collapse; width: 100%; margin: .8em 0; table-layout: fixed; }
.ProseMirror th, .ProseMirror td { border: 1px solid var(--border); padding: 6px 10px; vertical-align: top; position: relative; }
.ProseMirror th { background: var(--bg); font-weight: 600; }
.ProseMirror .selectedCell::after {
  content: ''; position: absolute; inset: 0; background: rgba(37, 99, 235, .12); pointer-events: none;
}
.ProseMirror .column-resize-handle {
  position: absolute; top: 0; bottom: -2px; width: 4px;
  inset-inline-end: -2px; background: var(--accent); pointer-events: none;
}

.ProseMirror ul[data-type='taskList'] { list-style: none; padding: 0; }
.ProseMirror ul[data-type='taskList'] li { display: flex; gap: 8px; }
.ProseMirror ul[data-type='taskList'] li > label { flex: 0 0 auto; user-select: none; }
.ProseMirror ul[data-type='taskList'] li > div { flex: 1; }
.ProseMirror ul[data-type='taskList'] li[data-checked='true'] > div { text-decoration: line-through; color: var(--muted); }

.ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  color: var(--muted);
  float: inline-start;
  height: 0;
  pointer-events: none;
}

/* collaboration cursors */
.collaboration-cursor__caret {
  border-left: 1px solid currentColor;
  border-right: 1px solid currentColor;
  margin-left: -1px;
  margin-right: -1px;
  pointer-events: none;
  position: relative;
  word-break: normal;
}
.collaboration-cursor__label {
  border-radius: 3px 3px 3px 0;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  left: -1px;
  line-height: normal;
  padding: 1px 5px;
  position: absolute;
  top: -1.35em;
  user-select: none;
  white-space: nowrap;
}

/* focus mode: hide chrome, center the page */
body.focus-mode .topbar,
body.focus-mode .menubar,
body.focus-mode .toolbar { display: none; }
body.focus-mode .editor-main { padding-top: 40px; }
.focus-exit {
  position: fixed; top: 12px; inset-inline-end: 12px; z-index: 95;
  background: var(--paper); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; cursor: pointer; opacity: .5; transition: opacity .2s;
}
.focus-exit:hover { opacity: 1; }

/* special-character picker */
.char-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
  max-width: 340px; max-height: 300px; overflow-y: auto;
}
.char-cell {
  font-size: 18px; padding: 6px 0; border: 1px solid var(--border);
  border-radius: 6px; background: var(--paper); cursor: pointer; line-height: 1.2;
}
.char-cell:hover { background: var(--active-bg); }

/* ---------- notes ---------- */
.note-wrap { flex: 1; display: flex; gap: 16px; padding: 20px; overflow: hidden; }
#note-text {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  background: var(--paper);
}
.note-preview { flex: 1; overflow-y: auto; min-height: 0; }
.note-wrap.view-edit .note-preview { display: none; }
.note-wrap.view-preview #note-text { display: none; }
.view-toggle { display: flex; gap: 0; }
.view-toggle button { border-radius: 0; }
.view-toggle button:first-child { border-start-start-radius: 6px; border-end-start-radius: 6px; }
.view-toggle button:last-child { border-start-end-radius: 6px; border-end-end-radius: 6px; }
.note-preview h1, .note-preview h2, .note-preview h3 { margin: .8em 0 .4em; }
.note-preview pre { background: #111827; color: #e5e7eb; border-radius: 8px; padding: 12px 16px; overflow-x: auto; direction: ltr; text-align: left; }
.note-preview code { background: var(--code-bg); border-radius: 4px; padding: 1px 5px; }
.note-preview pre code { background: none; }
.note-preview blockquote { border-inline-start: 3px solid var(--border); margin-inline-start: 0; padding-inline-start: 14px; color: var(--muted); }
.note-preview table { border-collapse: collapse; }
.note-preview th, .note-preview td { border: 1px solid var(--border); padding: 6px 10px; }

/* ---------- home page ---------- */
.home-main { max-width: 1000px; margin: 0 auto; padding: 24px 16px 60px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.tabs button { border: none; background: transparent; border-radius: 6px 6px 0 0; padding: 8px 16px; color: var(--muted); }
.tabs button.active { color: var(--accent); box-shadow: inset 0 -2px var(--accent); font-weight: 600; }

.folder-bar { display: flex; align-items: center; gap: 10px; margin: 8px 0 6px; }
.folder-bar .crumbs { padding: 0; flex: 1; }
.chip-btn { padding: 4px 12px; font-size: 13px; border-radius: 999px; }
.folder-row .doc-title { font-weight: 600; }
.tag-filter { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.tag-label { font-size: 13px; color: var(--muted); }
.tag-chip {
  padding: 3px 10px; font-size: 12px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border); cursor: pointer;
}
.tag-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tag-chip.clear { color: var(--danger); }
.tag-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.tag-pill {
  font-size: 11px; padding: 1px 8px; border-radius: 999px;
  background: var(--active-bg); color: var(--accent); cursor: pointer; white-space: nowrap;
}

.doc-list { display: flex; flex-direction: column; }
.doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-top: none;
}
.doc-row:first-child { border-top: 1px solid var(--border); border-radius: 8px 8px 0 0; }
.doc-row:last-child { border-radius: 0 0 8px 8px; }
.doc-row:only-child { border-radius: 8px; }
.doc-row:hover { background: var(--row-hover); }
.doc-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: var(--text); }
.doc-icon { font-size: 18px; }
.doc-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.family { background: var(--badge-family-bg); color: var(--badge-family-fg); }
.badge.private { background: var(--badge-private-bg); color: var(--badge-private-fg); }
.doc-owner { font-size: 13px; color: var(--muted); white-space: nowrap; }
.doc-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.doc-actions { display: flex; gap: 4px; }
.doc-actions button { padding: 4px 8px; font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

@media (max-width: 640px) {
  .doc-owner, .doc-date { display: none; }
  .search { max-width: 160px; }
}

/* ---------- dialogs ---------- */
dialog {
  border: none;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 22px 26px;
  min-width: 340px;
  max-width: 92vw;
}
dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-form { display: flex; flex-direction: column; gap: 10px; }
.dialog-form h3 { margin: 0 0 6px; }
.dialog-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.dialog-form label input, .dialog-form label select { font-size: 15px; color: var(--text); }
.dialog-form hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; width: 100%; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.dialog-error { color: var(--danger); font-size: 13px; margin: 0; }
.users-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.users-table th, .users-table td { border-bottom: 1px solid var(--border); padding: 7px 8px; text-align: start; }
.add-user { display: flex; gap: 6px; flex-wrap: wrap; }
.add-user input { flex: 1; min-width: 120px; }

/* ---------- auth pages ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.08);
  padding: 36px 40px;
  width: 360px;
  position: relative;
}
.auth-card h1 { margin: 0 0 14px; font-size: 24px; text-align: center; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.auth-card label input { font-size: 15px; }
button.wide { width: 100%; padding: 10px; font-size: 15px; }
.lang-corner { position: absolute; top: 10px; inset-inline-end: 10px; color: var(--muted); }

/* ---------- spreadsheet ---------- */
.sheet-main { flex: 1; min-height: 0; position: relative; }
#univer-container { position: absolute; inset: 0; }

/* ---------- files ---------- */
.nav-link {
  text-decoration: none;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
}
.nav-link:hover { background: var(--bg); }
.crumbs { padding: 4px 2px 10px; font-size: 14px; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumb-sep { color: var(--muted); margin: 0 2px; }
#drop-zone { border-radius: 8px; }
#drop-zone.dragging { outline: 2px dashed var(--accent); outline-offset: 4px; }

/* ---------- system / cert status ---------- */
.warn-banner {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-fg);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 14px;
}
.cert-ok { color: var(--ok); font-weight: 600; }
.cert-warn { color: var(--danger); font-weight: 700; }
.renew-note { font-size: 13px; color: var(--muted); }
.renew-note pre {
  background: #111827;
  color: #e5e7eb;
  border-radius: 6px;
  padding: 8px 12px;
  direction: ltr;
  text-align: left;
  user-select: all;
}

/* ---------- sign-in approval ---------- */
#approval-panel { text-align: center; }
.pulse { font-size: 48px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.req-details p { margin: 6px 0; }
.req-meta { font-size: 12px; color: var(--muted); }
.req-result { text-align: center; font-weight: 600; }
.req-result.ok { color: var(--ok); }
.req-result.bad { color: var(--danger); }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.device-list { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-direction: column; gap: 6px; }
.device-list li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.device-list li button { margin-inline-start: auto; padding: 3px 8px; font-size: 12px; }
h4 { margin: 4px 0; }
