/* iOS-flavoured grouped-list UI, matching the Cabinet Scan app. */
:root {
  --tint: #2E61D9;              /* AccentColor.colorset — srgb(0.18,0.38,0.85) */
  --tint-ink: #ffffff;
  --bg: #f2f2f7;               /* systemGroupedBackground */
  --group: #ffffff;            /* secondarySystemGroupedBackground */
  --group-2: #f2f2f7;
  --fill-quaternary: rgba(116,116,128,.08);
  --separator: rgba(60,60,67,.16);
  --label: #1c1c1e;
  --label-2: rgba(60,60,67,.6);   /* secondaryLabel */
  --label-3: rgba(60,60,67,.3);   /* tertiaryLabel */
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --radius: 12px;
  --maxw: 780px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tint: #6E9BFF;
    --tint-ink: #0b0b0f;
    --bg: #000000;
    --group: #1c1c1e;
    --group-2: #2c2c2e;
    --fill-quaternary: rgba(118,118,128,.24);
    --separator: rgba(84,84,88,.6);
    --label: #ffffff;
    --label-2: rgba(235,235,245,.6);
    --label-3: rgba(235,235,245,.3);
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
a { color: var(--tint); text-decoration: none; }
button { font: inherit; }
h1, h2, h3 { line-height: 1.2; }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; border-radius: 4px; }

.icon { width: 1em; height: 1em; flex: none; vertical-align: -0.15em; }

/* ---- nav bar ---- */
#topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  height: 48px;
  background: color-mix(in srgb, var(--group) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--label);
  font-size: 15px;
}
.brand img { border-radius: 6px; }
#nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
#nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--label-2);
  font-weight: 500;
  font-size: 14px;
}
#nav a .icon { font-size: 15px; }
#nav a:hover { background: var(--fill-quaternary); }
#nav a.active { color: var(--tint); }

/* ---- layout ---- */
#view {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 16px 60px;
}
#footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px 30px;
  color: var(--label-3);
  font-size: 12px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
#footer a { color: var(--label-2); }
.loading { color: var(--label-2); padding: 48px 0; text-align: center; }

/* ---- large title + inline nav title ---- */
.large-title { font-size: 30px; font-weight: 700; margin: 4px 0 16px; letter-spacing: -0.02em; }
.nav-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  min-height: 32px;
}
.nav-title-row h1 { font-size: 20px; font-weight: 700; margin: 0; }
.nav-title-row .spacer { flex: 1; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--tint);
  font-size: 15px;
  font-weight: 400;
  margin-bottom: 8px;
}
.back-link .icon { font-size: 17px; }
.bar-btn {
  border: 0;
  background: transparent;
  color: var(--tint);
  font-size: 15px;
  padding: 5px 6px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.bar-btn:hover { background: var(--fill-quaternary); }
.bar-btn .icon { font-size: 18px; }
.bar-btn:disabled { color: var(--label-3); cursor: default; background: none; }

/* ---- grouped list ---- */
.group {
  background: var(--group);
  border-radius: var(--radius);
  margin: 0 0 22px;
  overflow: hidden;
}
.group-header {
  font-size: 13px;
  color: var(--label-2);
  padding: 2px 16px 7px;
  margin-top: 2px;
}
.group-header.upper { text-transform: uppercase; letter-spacing: 0.03em; font-size: 12px; }
.group-footer {
  font-size: 12.5px;
  color: var(--label-2);
  padding: 7px 16px 0;
  margin: -14px 0 22px;
  line-height: 1.4;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  min-height: 44px;
  border-top: 0.5px solid var(--separator);
  color: var(--label);
  width: 100%;
  text-align: left;
  background: none;
  border-left: 0; border-right: 0; border-bottom: 0;
}
.row:first-child { border-top: 0; }
button.row { cursor: pointer; }
button.row:hover, a.row:hover { background: var(--fill-quaternary); }
.row .icon.leading { font-size: 20px; color: var(--tint); }
.row .grow { flex: 1; min-width: 0; }
.row .title { display: block; }
.row .subtitle { display: block; font-size: 13px; color: var(--label-2); margin-top: 2px; }
.row .value { color: var(--label-2); text-align: right; white-space: nowrap; }
.row .chevron { font-size: 15px; color: var(--label-3); flex: none; }
.row.wrap { align-items: flex-start; }
.row .muted { color: var(--label-2); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- home ---- */
.home {
  text-align: center;
  padding: 30px 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.home .hero-icon {
  width: 78px; height: 78px;
  color: var(--tint);
}
.home h1 { font-size: 30px; font-weight: 700; margin: 2px 0 0; }
.home p.lede { color: var(--label-2); font-size: 14px; max-width: 30rem; margin: 0 0 6px; }
.home .signed-in { font-size: 13px; color: var(--label-3); }
.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 460px;
  margin-top: 14px;
}
@media (min-width: 560px) { .tile-grid { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); max-width: 600px; } }
.tile {
  background: var(--group);
  border-radius: var(--radius);
  padding: 18px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: var(--tint);
  cursor: pointer;
  border: 0;
}
.tile:hover { background: var(--fill-quaternary); }
.tile .icon { font-size: 26px; }
.tile span { font-size: 13px; color: var(--label); font-weight: 500; }

/* ---- segmented control ---- */
.segmented {
  display: flex;
  background: var(--fill-quaternary);
  border-radius: 9px;
  padding: 2px;
  margin: 0 0 18px;
}
.segmented button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--label);
  font-weight: 500;
  font-size: 14px;
  padding: 6px 0;
  border-radius: 7px;
  cursor: pointer;
}
.segmented button.active {
  background: var(--group);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
@media (prefers-color-scheme: dark) {
  .segmented button.active { background: #636366; }
}

/* ---- cabinet tree ---- */
.tree { background: var(--group); border-radius: var(--radius); overflow: hidden; }
.tree-row {
  display: flex;
  align-items: stretch;
  border-top: 0.5px solid var(--separator);
  cursor: pointer;
  min-height: 44px;
}
.tree-row:first-child { border-top: 0; }
.tree-row:hover { background: var(--fill-quaternary); }
.tree-guide { width: 22px; flex: none; position: relative; }
.tree-guide::before {
  content: "";
  position: absolute;
  left: 11px; top: 0; bottom: 0;
  width: 1px;
  background: var(--separator);
}
.tree-main {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 0;
  flex: 1;
  min-width: 0;
}
.tree-chevron { font-size: 12px; color: var(--label-2); width: 12px; flex: none; }
.tree-chevron.leaf { visibility: hidden; }
.tree-main .icon.kind { font-size: 18px; flex: none; }
.tree-main .icon.folder { color: var(--tint); }
.tree-main .icon.doc { color: var(--label-2); }
.tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-tag { font-size: 12px; color: var(--label-3); font-variant-numeric: tabular-nums; flex: none; }

/* ---- todo ---- */
.todo-check {
  border: 0; background: none; cursor: pointer;
  color: var(--label-3);
  font-size: 22px;
  display: inline-flex;
  padding: 0;
  flex: none;
}
.todo-check.done { color: var(--green); }
.todo-check:disabled { opacity: .5; cursor: default; }
.todo-text .t-main { }
.todo-text.done .t-main { text-decoration: line-through; color: var(--label-2); }
.todo-due {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: var(--label-2); margin-top: 3px;
}
.todo-due.overdue { color: var(--red); }

/* ---- add / edit to-do form ---- */
.todo-form { padding: 12px 14px; margin-bottom: 16px; }
.todo-form-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.todo-form-text {
  width: 100%;
  resize: vertical;
  min-height: 40px;
  border: 0.5px solid var(--separator);
  border-radius: 9px;
  background: var(--bg);
  color: var(--label);
  font: inherit;
  padding: 9px 11px;
  line-height: 1.4;
}
.todo-form-text:focus { outline: 2px solid var(--tint); outline-offset: -1px; }
.todo-form-lbl { font-size: 13px; color: var(--label-2); min-width: 34px; }
.todo-form-date {
  font: inherit;
  padding: 7px 10px;
  border-radius: 9px;
  border: 0.5px solid var(--separator);
  background: var(--bg);
  color: var(--label);
}
.todo-form-check { font-size: 14px; color: var(--label); }
.todo-form-check input { width: 16px; height: 16px; accent-color: var(--tint); }
.todo-form-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.todo-form-actions .grow { flex: 1; }
.row-error { box-shadow: inset 3px 0 0 var(--red); }

/* ---- dashboard ---- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}
@media (max-width: 460px) { .stat-strip { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--group);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
}
.stat .n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--label-2); margin-top: 2px; }
.ring-row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; }
.ring { width: 60px; height: 60px; flex: none; }
.ring .track { stroke: var(--fill-quaternary); }
.ring .val { stroke: var(--tint); stroke-linecap: round; transition: stroke-dashoffset .4s; }
.ring text { fill: var(--label); font-size: 8px; font-weight: 700; }
.ring-row .rt { }
.ring-row .rt b { font-size: 15px; }
.ring-row .rt p { margin: 3px 0 0; font-size: 12.5px; color: var(--label-2); }
.areabars { padding: 12px 16px 14px; }
.areabar { display: grid; grid-template-columns: 96px 1fr 30px; align-items: center; gap: 10px; margin: 5px 0; font-size: 13px; }
.areabar .track { background: var(--fill-quaternary); border-radius: 5px; height: 10px; overflow: hidden; }
.areabar .fill { height: 100%; background: var(--tint); border-radius: 5px; }
.areabar .c { text-align: right; color: var(--label-2); font-variant-numeric: tabular-nums; }

/* ---- lifegraph ---- */
.kg-holder { border-radius: var(--radius); overflow: hidden; background: var(--group); }
.kg-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 190px);
  min-height: 520px;
  border: 0;
  background: var(--group);
}

/* ---- home actions ---- */
.home-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  margin-top: 14px;
}
.action-btn {
  flex: 1 1 0;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0.5px solid var(--separator);
  background: var(--group);
  color: var(--label);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 14px;
  border-radius: 12px;
  cursor: pointer;
}
.action-btn .icon { font-size: 16px; color: var(--tint); }
.action-btn:hover { background: var(--fill-quaternary); }
.action-btn.accent { background: var(--tint); color: var(--tint-ink); border-color: transparent; }
.action-btn.accent .icon { color: var(--tint-ink); }

/* ---- auto-width accent button (footer save, etc.) ---- */
.btn-accent {
  display: inline-block;
  border: 0;
  background: var(--tint);
  color: var(--tint-ink);
  font: inherit;
  font-weight: 650;
  padding: 9px 20px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
}
.btn-accent:hover { text-decoration: none; }
.btn-accent:disabled { opacity: .55; cursor: default; }

/* ---- note editor ---- */
.note-title {
  width: 100%;
  border: 0.5px solid var(--separator);
  background: var(--group);
  color: var(--label);
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.note-title:focus { outline: 2px solid var(--tint); outline-offset: -1px; }

/* plain-textarea fallback when EasyMDE fails to load */
.note-body {
  width: 100%;
  border: 0.5px solid var(--separator);
  background: var(--group);
  color: var(--label);
  resize: vertical;
  min-height: 320px;
  line-height: 1.6;
  font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 12px 16px 16px;
  border-radius: var(--radius);
}
.note-body:focus { outline: 2px solid var(--tint); outline-offset: -1px; }

/* ---- EasyMDE (inline markdown editor) theming ---- */
.note-md { margin-bottom: 14px; }
.note-md .EasyMDEContainer { border-radius: var(--radius); overflow: hidden; }
.note-md .editor-toolbar {
  border: 0.5px solid var(--separator);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: color-mix(in srgb, var(--group-2) 55%, var(--group));
  opacity: 1;
}
.note-md .editor-toolbar button {
  color: var(--label-2);
  border: 1px solid transparent;
}
.note-md .editor-toolbar button:hover,
.note-md .editor-toolbar button.active {
  background: var(--fill-quaternary);
  border-color: var(--separator);
  color: var(--label);
}
.note-md .editor-toolbar i.separator { border-left-color: var(--separator); border-right-color: transparent; }
.note-md .editor-toolbar::before, .note-md .editor-toolbar::after { border-top-color: var(--separator); }
.note-md .CodeMirror {
  border: 0.5px solid var(--separator);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--group);
  color: var(--label);
  font: 14.5px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding: 4px 6px;
}
.note-md .CodeMirror-cursor { border-left-color: var(--label); }
.note-md .CodeMirror-selected { background: color-mix(in srgb, var(--tint) 22%, transparent) !important; }
.note-md .CodeMirror-placeholder { color: var(--label-3) !important; }
.note-md .cm-s-easymde .cm-header { color: var(--label); line-height: 1.3; }
.note-md .cm-s-easymde .cm-comment {
  background: var(--fill-quaternary);
  border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace;
}
.note-md .cm-s-easymde .cm-link, .note-md .cm-s-easymde .cm-url { color: var(--tint); }
.note-md .cm-s-easymde .cm-quote { color: var(--label-2); }
.note-md .cm-s-easymde .cm-formatting { color: var(--label-3); }
.note-md .editor-preview, .note-md .editor-preview-side {
  background: var(--group);
  color: var(--label);
}
.note-md .editor-statusbar { display: none; }

.note-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 12px 0 4px;
  border-top: 0.5px solid var(--separator);
  flex-wrap: wrap;
}
.note-footer .grow { flex: 1; }
.area-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--label-2); }

/* ---- import ---- */
.area-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--label-2); margin: 4px 0 8px; flex-wrap: wrap; }
.area-select {
  font: inherit;
  padding: 7px 10px;
  border-radius: 9px;
  border: 0.5px solid var(--separator);
  background: var(--group);
  color: var(--label);
}
.drop-zone {
  width: 100%;
  border: 1.5px dashed var(--separator);
  background: var(--group);
  border-radius: var(--radius);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--label);
  margin-bottom: 14px;
}
.drop-zone .icon { font-size: 34px; color: var(--tint); }
.drop-zone .dz-main { font-weight: 650; }
.drop-zone .sub { font-size: 12.5px; color: var(--label-2); }
.drop-zone.over { border-color: var(--tint); background: var(--fill-quaternary); }
.drop-zone:disabled { opacity: .6; cursor: default; }
.import-status { margin-top: 12px; }
.import-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 0.5px solid var(--separator);
  font-size: 14px;
}
.import-row:first-child { border-top: 0; }
.import-row .icon { color: var(--label-2); flex: none; }
.import-row .grow { flex: 1; min-width: 0; }
.import-row .st { flex: none; font-size: 13px; color: var(--label-2); max-width: 45%; text-align: right; }
.import-row .st.ok a { color: var(--tint); }
.import-row .st.err { color: var(--red); }
.note-footer .muted { color: var(--label-2); font-size: 13px; }

/* ---- ask ---- */
.ask-disclaimer {
  font-size: 12px;
  color: var(--label-2);
  background: color-mix(in srgb, var(--orange) 12%, transparent);
  border-radius: 9px;
  padding: 8px 12px;
  margin-bottom: 12px;
  line-height: 1.4;
}
.ask-scroll {
  min-height: 200px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  padding: 4px 2px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ask-lede { color: var(--label-2); font-size: 13px; margin: 4px 0; }
.ask-starter {
  text-align: left;
  border: 0;
  background: var(--fill-quaternary);
  color: var(--label);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
}
.ask-starter:hover { background: var(--separator); }
.ask-msg { max-width: 88%; padding: 9px 13px; border-radius: 15px; line-height: 1.5; white-space: pre-wrap; }
.ask-msg.user { align-self: flex-end; background: var(--tint); color: var(--tint-ink); white-space: pre-wrap; }
.ask-msg.assistant { align-self: flex-start; background: var(--fill-quaternary); white-space: normal; }
.ask-body { white-space: normal; }
.ask-body > :first-child { margin-top: 0; }
.ask-body > :last-child { margin-bottom: 0; }
.ask-body p { margin: 0 0 8px; }
.ask-body ul, .ask-body ol { margin: 4px 0 8px; padding-left: 20px; }
.ask-body code { font-family: ui-monospace, Menlo, monospace; font-size: .92em; background: var(--separator); padding: 1px 4px; border-radius: 4px; }
.ask-body a { color: var(--tint); }
.ask-cursor { color: var(--label-3); }
.ask-note {
  font-size: 12.5px;
  color: var(--orange);
  margin-top: 6px;
}
.ask-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ask-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 240px;
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 0;
  background: var(--group);
  color: var(--label);
  cursor: pointer;
}
.ask-chip:hover { background: var(--separator); }
.ask-chip .icon { font-size: 13px; color: var(--label-2); flex: none; }
.ask-thinking { display: flex; align-items: center; gap: 8px; color: var(--label-2); font-size: 14px; align-self: flex-start; }
.ask-error { color: var(--orange); font-size: 13px; align-self: flex-start; }
.ask-inputbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 0.5px solid var(--separator);
  position: sticky;
  bottom: 0;
  background: var(--bg);
}
.ask-input {
  flex: 1;
  resize: none;
  border: 0.5px solid var(--separator);
  border-radius: 12px;
  background: var(--group);
  color: var(--label);
  font: inherit;
  padding: 9px 12px;
  min-height: 84px;
  max-height: 168px;
  line-height: 1.4;
}
.ask-input:focus { outline: 2px solid var(--tint); outline-offset: -1px; }
.ask-send {
  flex: none;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--tint);
  color: var(--tint-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ask-send .icon { font-size: 18px; }
.ask-send:disabled { opacity: .5; cursor: default; }

/* ---- auth ---- */
.auth-wrap {
  max-width: 360px;
  margin: 8vh auto 0;
  padding: 0 4px;
}
.auth-wrap .brand { justify-content: center; font-size: 19px; margin-bottom: 4px; width: 100%; }
.auth-tagline { text-align: center; color: var(--label-2); font-size: 13px; margin: 6px 0 20px; }
.auth-wrap .group { margin-bottom: 14px; }
.field-row { display: flex; flex-direction: column; padding: 8px 16px; border-top: 0.5px solid var(--separator); }
.field-row:first-child { border-top: 0; }
.field-row label { font-size: 11px; color: var(--label-2); text-transform: uppercase; letter-spacing: .03em; }
.field-row input {
  border: 0; background: none; color: var(--label);
  font: inherit; padding: 4px 0 2px; width: 100%;
}
.field-row input:focus { outline: none; }
button.primary {
  width: 100%;
  border: 0;
  background: var(--tint);
  color: var(--tint-ink);
  font-weight: 600;
  padding: 12px 0;
  border-radius: 12px;
  cursor: pointer;
}
button.primary:disabled { opacity: .5; cursor: default; }
button.linkish {
  border: 0; background: none; color: var(--tint);
  cursor: pointer; padding: 10px 0 0; display: block; margin: 0 auto;
  font-size: 14px;
}
.msg { margin: 12px 2px 0; font-size: 13px; padding: 9px 12px; border-radius: 9px; line-height: 1.4; }
.msg.err { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.msg.info { background: var(--fill-quaternary); color: var(--label-2); }
.msg.ok { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.hint { font-size: 12px; color: var(--label-2); margin: 8px 2px 0; }

/* ---- misc ---- */
.empty {
  text-align: center;
  color: var(--label-2);
  padding: 56px 22px;
}
.empty .icon { font-size: 40px; color: var(--label-3); }
.empty p { margin: 12px 0 0; }
.empty .sub { font-size: 13px; color: var(--label-3); }
.doc-file {
  background: var(--group);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
}
.doc-file canvas.pdf-page { display: block; width: 100%; border-bottom: 0.5px solid var(--separator); }
.doc-file .md-body { padding: 18px 20px; }
.doc-file .md-body :is(h1,h2,h3) { margin-top: 1.1em; }
.doc-file .md-body img { border-radius: 8px; max-width: 100%; }
.summary-text { padding: 12px 16px; white-space: pre-wrap; line-height: 1.5; }
details.disclosure { border-top: 0.5px solid var(--separator); }
details.disclosure summary { padding: 11px 16px; cursor: pointer; color: var(--tint); list-style: none; }
details.disclosure summary::-webkit-details-marker { display: none; }
details.disclosure .body {
  padding: 0 16px 14px;
  font-size: 13px;
  color: var(--label-2);
  white-space: pre-wrap;
  max-height: 340px;
  overflow: auto;
}
.menu-wrap { position: relative; display: inline-block; }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--group);
  border-radius: 12px;
  box-shadow: 0 6px 30px rgba(0,0,0,.25);
  padding: 6px;
  min-width: 210px;
  z-index: 30;
}
.menu-pop button, .menu-pop label {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: none; border: 0; cursor: pointer;
  padding: 9px 10px; border-radius: 8px;
  color: var(--label); font-size: 14px;
}
.menu-pop button:hover { background: var(--fill-quaternary); }
.menu-pop .sep { height: 0.5px; background: var(--separator); margin: 5px 4px; }
.menu-pop .check { margin-left: auto; color: var(--tint); }
.spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
button.ghost {
  border: 0.5px solid var(--separator);
  background: var(--group);
  color: var(--tint);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}
button.ghost:hover { background: var(--fill-quaternary); }
.row.destructive { color: var(--red); justify-content: center; }
.row.destructive:hover { background: color-mix(in srgb, var(--red) 10%, transparent); }
