/* Elang Notes — design tokens and components.
   One accent (teal), cool neutrals, quiet borders. Bootstrap supplies the reset and form controls. */

/* Three palettes, all drawn from the app icon (teal, mint, deep teal):
     light  — cool paper with a deep-teal sidebar band
     dark   — teal-black, mint accents (not neutral grey)
     sepia  — warm reading paper with an espresso sidebar, still teal for actions
   data-theme holds the resolved palette; data-bs-theme is light/dark for Bootstrap's own parts.
   The sidebar gets its own --en-side-* tokens, mapped onto the normal ones inside .sidebar. */

:root,
[data-theme="light"] {
  --en-bg: #edf3f2;
  --en-surface: #ffffff;
  --en-ink: #13201f;
  --en-ink-2: #34423f;
  --en-muted: #5c6c69;
  --en-line: #d5e1de;
  --en-line-strong: #bccecb;
  --en-hover: rgba(14, 124, 123, 0.07);
  --en-accent: #0e7c7b;
  --en-accent-hover: #0a6463;
  --en-accent-ink: #ffffff;
  --en-accent-soft: #d8efeb;
  --en-danger: #b3261e;
  --en-danger-soft: #fbe9e7;
  --en-ok: #1d7a46;
  --en-star: #d99a16;
  --en-code-bg: #f1f6f5;
  --en-shadow: 0 1px 2px rgba(10, 40, 38, 0.06), 0 6px 18px rgba(10, 40, 38, 0.06);
  --en-focus: 0 0 0 3px rgba(14, 124, 123, 0.28);

  --en-side-bg: #0f4a49;
  --en-side-ink: #eef8f6;
  --en-side-ink-2: #cfe4e0;
  --en-side-muted: #8ab5ae;
  --en-side-line: rgba(255, 255, 255, 0.12);
  --en-side-hover: rgba(255, 255, 255, 0.08);
  --en-side-active: rgba(159, 227, 220, 0.17);
  --en-side-field: rgba(0, 0, 0, 0.16);
  --en-side-accent: #9fe3dc;
  --en-side-accent-ink: #0a3a39;

  --en-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --en-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --en-radius: 8px;
  --en-radius-lg: 12px;
  --en-sidebar-w: 248px;
  --en-sidebar-w-collapsed: 60px;
  --en-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --bs-body-bg: var(--en-bg);
  --bs-body-color: var(--en-ink);
  --bs-border-color: var(--en-line);
  --bs-body-font-family: var(--en-font);
  --bs-link-color-rgb: 14, 124, 123;
  --bs-link-hover-color-rgb: 10, 100, 99;
}

[data-theme="dark"] {
  --en-bg: #0f1819;
  --en-surface: #152224;
  --en-ink: #e2eeec;
  --en-ink-2: #bdd0cc;
  --en-muted: #809f9a;
  --en-line: #223533;
  --en-line-strong: #2f4845;
  --en-hover: rgba(159, 227, 220, 0.07);
  --en-accent: #4fd1c5;
  --en-accent-hover: #72ddd3;
  --en-accent-ink: #062321;
  --en-accent-soft: #143836;
  --en-danger: #f2766b;
  --en-danger-soft: #3a1f1d;
  --en-ok: #5fd08e;
  --en-star: #f2c14e;
  --en-code-bg: #0c1415;
  --en-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.3);
  --en-focus: 0 0 0 3px rgba(79, 209, 197, 0.35);

  --en-side-bg: #0a1213;
  --en-side-ink: #dcebe8;
  --en-side-ink-2: #b7ccc8;
  --en-side-muted: #6f8f8a;
  --en-side-line: rgba(255, 255, 255, 0.07);
  --en-side-hover: rgba(255, 255, 255, 0.05);
  --en-side-active: rgba(79, 209, 197, 0.14);
  --en-side-field: rgba(255, 255, 255, 0.04);
  --en-side-accent: #4fd1c5;
  --en-side-accent-ink: #062321;

  --bs-body-bg: var(--en-bg);
  --bs-body-color: var(--en-ink);
  --bs-border-color: var(--en-line);
  --bs-link-color-rgb: 79, 209, 197;
  --bs-link-hover-color-rgb: 114, 221, 211;
}

[data-theme="sepia"] {
  --en-bg: #efe7d7;
  --en-surface: #fbf6ec;
  --en-ink: #2b2418;
  --en-ink-2: #4b4030;
  --en-muted: #7c6e58;
  --en-line: #e0d3bc;
  --en-line-strong: #cdbd9f;
  --en-hover: rgba(92, 70, 36, 0.07);
  --en-accent: #0d6f6d;
  --en-accent-hover: #0a5a58;
  --en-accent-ink: #ffffff;
  --en-accent-soft: #dde9dc;
  --en-danger: #a3361f;
  --en-danger-soft: #f6e2d8;
  --en-ok: #3c7a2d;
  --en-star: #c07f0a;
  --en-code-bg: #f4ecdd;
  --en-shadow: 0 1px 2px rgba(60, 44, 20, 0.07), 0 6px 18px rgba(60, 44, 20, 0.07);
  --en-focus: 0 0 0 3px rgba(13, 111, 109, 0.28);

  --en-side-bg: #3a2e22;
  --en-side-ink: #f5ecdc;
  --en-side-ink-2: #e2d4bc;
  --en-side-muted: #b09f84;
  --en-side-line: rgba(255, 255, 255, 0.1);
  --en-side-hover: rgba(255, 255, 255, 0.07);
  --en-side-active: rgba(232, 184, 106, 0.18);
  --en-side-field: rgba(0, 0, 0, 0.16);
  --en-side-accent: #e8b86a;
  --en-side-accent-ink: #33250f;

  --bs-body-bg: var(--en-bg);
  --bs-body-color: var(--en-ink);
  --bs-border-color: var(--en-line);
  --bs-link-color-rgb: 13, 111, 109;
  --bs-link-hover-color-rgb: 10, 90, 88;
}

/* the sidebar band: its components keep using the normal tokens, remapped here */
.sidebar {
  --en-ink: var(--en-side-ink);
  --en-ink-2: var(--en-side-ink-2);
  --en-muted: var(--en-side-muted);
  --en-line: var(--en-side-line);
  --en-line-strong: var(--en-side-line);
  --en-hover: var(--en-side-hover);
  --en-surface: var(--en-side-active);
  --en-bg: var(--en-side-field);
  --en-accent: var(--en-side-accent);
  --en-focus: 0 0 0 3px rgba(255, 255, 255, 0.28);
  color: var(--en-ink);
}

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--en-bg);
  color: var(--en-ink);
  font-family: var(--en-font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { text-underline-offset: 2px; }
kbd {
  font-family: var(--en-mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: transparent;
  color: var(--en-muted);
  border: 1px solid var(--en-line-strong);
}
:focus-visible { outline: none; box-shadow: var(--en-focus); border-radius: 6px; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--en-radius); font-weight: 550; padding: 0.55rem 1rem; font-size: 14.5px; }
.btn:focus-visible { box-shadow: var(--en-focus); }
.btn-accent { background: var(--en-accent); color: var(--en-accent-ink); border: 1px solid var(--en-accent); }
.btn-accent:hover, .btn-accent:focus-visible { background: var(--en-accent-hover); border-color: var(--en-accent-hover); color: var(--en-accent-ink); }
.btn-accent:active { transform: translateY(1px); }
.btn-quiet { background: var(--en-surface); color: var(--en-ink); border: 1px solid var(--en-line-strong); }
.btn-quiet:hover { background: var(--en-hover); color: var(--en-ink); border-color: var(--en-line-strong); }
.btn-link-inline { background: none; border: 0; padding: 0; color: var(--bs-link-color); text-decoration: underline; text-underline-offset: 2px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border: 0; border-radius: 7px; background: transparent; color: var(--en-muted); font-size: 16px;
}
.icon-btn:hover { background: var(--en-hover); color: var(--en-ink); }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label { font-size: 13.5px; font-weight: 600; color: var(--en-ink-2); }
.field-msg { font-size: 13px; color: var(--en-muted); }
.field-msg.is-error { color: var(--en-danger); }
.field-static { padding: 0.5rem 0; color: var(--en-muted); }
.form-control, .form-select {
  background-color: var(--en-surface); color: var(--en-ink);
  border: 1px solid var(--en-line-strong); border-radius: var(--en-radius);
  padding: 0.55rem 0.75rem; font-size: 15px;
}
.form-control:focus, .form-select:focus { border-color: var(--en-accent); box-shadow: var(--en-focus); background-color: var(--en-surface); color: var(--en-ink); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--en-danger); background-image: none; padding-right: 0.75rem; }
.check { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 14px; color: var(--en-ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--en-accent); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: 14px; }

/* ---------- Flash messages ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
.flash {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.65rem 0.85rem; border-radius: var(--en-radius);
  font-size: 14px; border: 1px solid var(--en-line); background: var(--en-surface);
  animation: flash-in 180ms var(--en-ease);
}
.flash i { margin-top: 1px; }
.flash-success { border-color: color-mix(in srgb, var(--en-ok) 35%, var(--en-line)); }
.flash-success i { color: var(--en-ok); }
.flash-error { border-color: color-mix(in srgb, var(--en-danger) 40%, var(--en-line)); background: var(--en-danger-soft); }
.flash-error i { color: var(--en-danger); }
.flash-info i { color: var(--en-accent); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 650; color: var(--en-ink); text-decoration: none; letter-spacing: -0.01em; }
.brand:hover { color: var(--en-ink); }
.brand-lg { font-size: 18px; }

/* ---------- Auth pages ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-aside {
  position: relative;
  background: var(--en-side-bg);
  padding: 2.5rem clamp(2rem, 5vw, 4.5rem);
  display: flex; flex-direction: column; justify-content: center; gap: 1.75rem;
}
.auth-aside .brand { position: absolute; top: 2.25rem; color: var(--en-side-ink); }
.auth-aside .brand img { border-radius: 6px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22); }
.auth-aside .auth-pitch { color: var(--en-side-ink); }
.auth-pitch { font-size: clamp(22px, 2.2vw, 28px); line-height: 1.25; letter-spacing: -0.02em; font-weight: 600; max-width: 22ch; margin: 0; color: var(--en-ink); }
.specimen {
  margin: 0; max-width: 460px; background: var(--en-surface); border: 1px solid var(--en-line);
  border-radius: var(--en-radius-lg); box-shadow: var(--en-shadow); padding: 1.25rem 1.35rem 1.1rem;
  transform: rotate(-0.6deg);
}
.specimen-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--en-muted); margin-bottom: 0.6rem; }
.specimen-book i { margin-right: 0.25rem; }
.specimen-title { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 0.35rem; }
.specimen-text { font-size: 14px; color: var(--en-ink-2); margin: 0 0 0.9rem; }
.specimen-code { border: 1px solid var(--en-line); border-radius: var(--en-radius); background: var(--en-code-bg); overflow: hidden; }
.specimen-code-bar { display: flex; justify-content: space-between; padding: 0.35rem 0.7rem; font-size: 12px; color: var(--en-muted); border-bottom: 1px solid var(--en-line); font-family: var(--en-mono); }
.specimen-copy { font-family: var(--en-font); }
.specimen-code pre { margin: 0; padding: 0.75rem 0.9rem; font-family: var(--en-mono); font-size: 13px; line-height: 1.6; color: var(--en-ink); white-space: pre; overflow-x: auto; }
.tk-k { color: var(--en-accent); font-weight: 600; }
.tk-s { color: #a8551b; }
[data-theme="dark"] .tk-s { color: #e7a56b; }
.specimen-tags { display: flex; gap: 0.4rem; margin-top: 0.85rem; }
.specimen-tags span { font-size: 12px; color: var(--en-accent); background: var(--en-accent-soft); padding: 0.1rem 0.5rem; border-radius: 999px; }

.auth-main { display: grid; place-items: center; padding: 2.5rem 1.25rem; }
.auth-card { width: 100%; max-width: 380px; }
.auth-title { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 1.5rem; }
.auth-lead { color: var(--en-ink-2); margin: -0.75rem 0 1.5rem; }
.auth-alt { margin-top: 1.5rem; font-size: 14px; color: var(--en-muted); text-align: center; }
.brand-mobile { display: none; margin-bottom: 2rem; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .brand-mobile { display: inline-flex; }
  .auth-main { place-items: start center; padding-top: 3rem; }
}

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; flex: 0 0 var(--en-sidebar-w); width: var(--en-sidebar-w);
  background: var(--en-side-bg); border-right: 0;
  display: flex; flex-direction: column; padding: 0.75rem 0.6rem; gap: 0.35rem;
  overflow-y: auto; overflow-x: hidden;
  transition: width 200ms var(--en-ease), flex-basis 200ms var(--en-ease);
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0.15rem 0.2rem 0.5rem 0.5rem; }
.sidebar .brand { font-size: 15px; white-space: nowrap; }

.new-note {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.5rem 0.7rem; margin-bottom: 0.5rem;
  border: 1px solid var(--en-line-strong); border-radius: var(--en-radius);
  background: var(--en-surface); color: var(--en-ink); font-weight: 600; font-size: 14px;
  white-space: nowrap;
}
.new-note kbd { margin-left: auto; }
.sidebar .new-note { background: var(--en-side-accent); color: var(--en-side-accent-ink); border-color: transparent; }
.sidebar .new-note:hover { filter: brightness(1.06); }
.sidebar .new-note kbd { color: inherit; border-color: currentColor; opacity: 0.55; }
.sidebar .brand img { border-radius: 6px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22); }
.sidebar .nav-item.is-active, .sidebar .nav-sub.is-active { box-shadow: none; }
.new-note:disabled { opacity: 0.55; cursor: not-allowed; }

.nav-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: 0.6rem; }
.nav-heading { font-size: 12px; font-weight: 600; color: var(--en-muted); padding: 0.4rem 0.7rem 0.2rem; }
.nav-item {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.4rem 0.7rem;
  border-radius: 7px; color: var(--en-ink-2); text-decoration: none; font-size: 14px; white-space: nowrap;
  width: 100%; border: 0; background: transparent; text-align: left;
}
.nav-item i { font-size: 15px; width: 18px; text-align: center; color: var(--en-muted); flex: 0 0 18px; }
.nav-item:hover { background: var(--en-hover); color: var(--en-ink); }
.nav-item.is-active { background: var(--en-surface); color: var(--en-ink); font-weight: 600; box-shadow: 0 0 0 1px var(--en-line); }
.nav-item.is-active i { color: var(--en-accent); }
.nav-item.is-disabled { opacity: 0.5; cursor: default; }
.nav-item.is-disabled:hover { background: transparent; color: var(--en-ink-2); }
.nav-soon { margin-left: auto; font-size: 11px; color: var(--en-muted); border: 1px solid var(--en-line-strong); border-radius: 999px; padding: 0 0.4rem; line-height: 1.5; }
.panel-text .nav-soon { margin-left: 0; }

.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 1px; padding-top: 0.6rem; border-top: 1px solid var(--en-line); }
.theme-switch { display: flex; gap: 2px; margin: 0.35rem 0.4rem; padding: 2px; border: 1px solid var(--en-line); border-radius: 8px; background: var(--en-bg); }
.theme-switch button { flex: 1; border: 0; background: transparent; color: var(--en-muted); border-radius: 6px; padding: 0.2rem 0; font-size: 14px; }
.theme-switch button[aria-pressed="true"] { background: var(--en-surface); color: var(--en-accent); box-shadow: 0 0 0 1px var(--en-line); }

/* Collapsed (desktop) */
.sidebar-collapsed .sidebar { flex-basis: var(--en-sidebar-w-collapsed); width: var(--en-sidebar-w-collapsed); }
.sidebar-collapsed .sidebar .nav-label,
.sidebar-collapsed .sidebar .nav-soon,
.sidebar-collapsed .sidebar .nav-heading { display: none; }
.sidebar-collapsed .sidebar-top { flex-direction: column; gap: 0.5rem; padding-left: 0.2rem; }
.sidebar-collapsed .new-note, .sidebar-collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar-collapsed .theme-switch { flex-direction: column; margin: 0.35rem 0.2rem; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1rem, 4vw, 3rem); }
.mobile-bar { display: none; }
.sidebar-scrim { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 1040; left: 0; top: 0; width: 280px; flex-basis: auto;
    transform: translateX(-100%); transition: transform 220ms var(--en-ease); box-shadow: var(--en-shadow);
  }
  .sidebar-collapsed .sidebar { width: 280px; }
  .sidebar-collapsed .sidebar .nav-label, .sidebar-collapsed .sidebar .nav-soon, .sidebar-collapsed .sidebar .nav-heading { display: revert; }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 1030; background: rgba(0, 0, 0, 0.35); }
  .mobile-bar {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--en-line); background: var(--en-surface); position: sticky; top: 0; z-index: 10;
  }
}

/* ---------- Pages & panels ---------- */
.page { max-width: 880px; }
.page-narrow { max-width: 620px; }
.page-head { margin-bottom: 1.5rem; }
.page-title { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
.page-sub { color: var(--en-muted); margin: 0.25rem 0 0; }
.panel {
  background: var(--en-surface); border: 1px solid var(--en-line); border-radius: var(--en-radius-lg);
  padding: 1.25rem 1.4rem; margin-bottom: 1rem;
}
.panel-muted { background: transparent; border-style: dashed; }
.panel-title { font-size: 16px; font-weight: 650; margin: 0 0 0.75rem; }
.panel-text { color: var(--en-ink-2); margin: 0 0 1rem; max-width: 68ch; }
.panel-text:last-child { margin-bottom: 0; }
.facts { margin: 0; display: grid; gap: 0.6rem; }
.facts div { display: grid; grid-template-columns: 140px 1fr; gap: 1rem; }
.facts dt { font-weight: 500; color: var(--en-muted); }
.facts dd { margin: 0; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
@media (max-width: 520px) { .facts div { grid-template-columns: 1fr; gap: 0; } }
.pill { font-size: 12px; border-radius: 999px; padding: 0.05rem 0.5rem; }
.pill-ok { color: var(--en-ok); background: color-mix(in srgb, var(--en-ok) 12%, transparent); }

.tabs { display: flex; gap: 1.25rem; border-bottom: 1px solid var(--en-line); margin-bottom: 1.25rem; }
.tab { padding: 0.5rem 0; color: var(--en-muted); text-decoration: none; font-weight: 550; font-size: 14.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--en-ink); }
.tab.is-active { color: var(--en-ink); border-bottom-color: var(--en-accent); }

/* ---------- Error page ---------- */
.error-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; padding: 1.5rem; text-align: center; }
.error-code { font-family: var(--en-mono); color: var(--en-accent); font-size: 15px; margin: 0; }
.error-message { font-size: 22px; font-weight: 600; max-width: 32ch; margin: 0 0 1rem; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.stat-alert .stat-value { color: var(--en-danger); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dash-grid .panel { margin-bottom: 0; }
@media (max-width: 760px) { .dash-grid { grid-template-columns: 1fr; } }
.stat {
  display: flex; flex-direction: column; gap: 0.1rem; padding: 1rem 1.2rem; text-decoration: none; color: var(--en-ink);
  background: var(--en-surface); border: 1px solid var(--en-line); border-radius: var(--en-radius-lg);
}
.stat:hover { border-color: var(--en-line-strong); color: var(--en-ink); }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13.5px; color: var(--en-muted); }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr 1fr; } }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-top: 1px solid var(--en-line); }
.plain-list li:first-child { border-top: 0; }
.plain-list a { color: var(--en-ink); text-decoration: none; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plain-list a:hover { color: var(--en-accent); }
.muted { color: var(--en-muted); font-size: 13.5px; white-space: nowrap; }

/* ---------- Buttons (extra) ---------- */
.btn-sm { padding: 0.3rem 0.65rem; font-size: 13.5px; }
.btn-text { border: 0; background: none; padding: 0.2rem 0.3rem; color: var(--en-muted); font-size: 13.5px; font-weight: 550; border-radius: 6px; }
.btn-text:hover { color: var(--en-ink); background: var(--en-hover); }
.btn-text.danger:hover { color: var(--en-danger); }
.btn-danger { background: var(--en-danger); border: 1px solid var(--en-danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.93); color: #fff; background: var(--en-danger); }
.btn-danger-quiet { background: transparent; border: 1px solid color-mix(in srgb, var(--en-danger) 45%, var(--en-line)); color: var(--en-danger); }
.btn-danger-quiet:hover { background: var(--en-danger-soft); color: var(--en-danger); }
.icon-btn[aria-pressed="true"] { color: var(--en-accent); }
.icon-btn[data-note-flag="favorite"][aria-pressed="true"] { color: var(--en-star); }

/* ---------- Notes: list + editor ---------- */
.notes-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 100vh; }
.list-pane { border-right: 1px solid var(--en-line); background: var(--en-bg); overflow-y: auto; display: flex; flex-direction: column; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1rem 0.6rem 1.15rem; position: sticky; top: 0; background: var(--en-bg); z-index: 2; }
.list-title { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.list-hint { font-size: 13px; color: var(--en-muted); margin: -0.2rem 1.15rem 0.5rem; }
.note-list { list-style: none; margin: 0; padding: 0 0.5rem 1rem; }
.list-group-label { font-size: 12px; font-weight: 600; color: var(--en-muted); padding: 0.7rem 0.65rem 0.25rem; }
.note-row {
  display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0.65rem; border-radius: var(--en-radius);
  text-decoration: none; color: var(--en-ink); border: 1px solid transparent;
}
.note-row:hover { background: var(--en-hover); color: var(--en-ink); }
.note-row.is-active { background: var(--en-surface); border-color: var(--en-line); box-shadow: inset 3px 0 0 var(--en-accent); }
.note-row-title { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-row-excerpt {
  font-size: 13.5px; color: var(--en-ink-2); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line;
}
.note-row-meta { display: flex; align-items: center; gap: 0.4rem; font-size: 12.5px; color: var(--en-muted); }
.note-row-meta .fav { color: var(--en-star); }
.list-more { display: block; text-align: center; padding: 0.6rem; font-size: 14px; }
.list-empty { padding: 1.5rem 1.15rem; color: var(--en-muted); font-size: 14px; }

.editor-pane { overflow-y: auto; background: var(--en-surface); display: flex; flex-direction: column; min-width: 0; }
.editor-pane > .flash-stack { margin: 1rem 1.5rem 0; }
/* flex: none — as a flex item with min-height:100% it could shrink to one screen while the note
   overflowed it, and the sticky bars (whose limit is this box) were pushed away on long notes. */
.editor { display: flex; flex-direction: column; flex: 1 0 auto; min-height: 100%; }
.editor-bar {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1rem 0.6rem 1.5rem;
  border-bottom: 1px solid var(--en-line); position: sticky; top: 0; background: var(--en-surface); z-index: 5;  /* above the sticky formatting toolbar, so its menus are not covered */
}
.editor-actions { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }
.editor-actions form { margin: 0; }
.back-to-list { display: none; }
.save-status { font-size: 13px; color: var(--en-muted); display: inline-flex; align-items: center; gap: 0.4rem; }
.save-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--en-ok); }
.save-status[data-state="pending"]::before, .save-status[data-state="saving"]::before { background: var(--en-muted); }
.save-status[data-state="saving"]::before { animation: pulse 900ms ease-in-out infinite; }
.save-status[data-state="offline"]::before { background: #c98a0b; }
.save-status[data-state="error"] { color: var(--en-danger); }
.save-status[data-state="error"]::before { background: var(--en-danger); }
@keyframes pulse { 50% { opacity: 0.3; } }

.editor-recovery, .editor-conflict {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 1rem 1.5rem 0;
  padding: 0.6rem 0.85rem; border-radius: var(--en-radius); font-size: 14px;
  border: 1px solid color-mix(in srgb, #c98a0b 40%, var(--en-line)); background: color-mix(in srgb, #c98a0b 8%, var(--en-surface));
}
.editor-recovery[hidden], .editor-conflict[hidden] { display: none; }

.editor-body { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 780px; margin: 0 auto; padding: 2rem 1.5rem 1rem; }
.note-title, .note-title-static {
  border: 0; outline: 0; background: transparent; color: var(--en-ink); width: 100%;
  font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; padding: 0; margin: 0 0 1rem;
}
.note-title::placeholder, .note-body::placeholder { color: var(--en-muted); opacity: 0.7; }
.note-title:focus-visible, .note-body:focus-visible { box-shadow: none; }
.note-body {
  flex: 1; min-height: 60vh; border: 0; outline: 0; resize: none; background: transparent; color: var(--en-ink);
  font: inherit; font-size: 16px; line-height: 1.7; padding: 0; tab-size: 4;
}
.note-plain { white-space: pre-wrap; font-size: 16px; line-height: 1.7; color: var(--en-ink-2); tab-size: 4; }
.editor-body.is-readonly { opacity: 0.85; }
.editor-foot { max-width: 780px; width: 100%; margin: 0 auto; padding: 0.75rem 1.5rem 1.5rem; font-size: 12.5px; color: var(--en-muted); }
.editor-empty { margin: auto; text-align: center; color: var(--en-muted); padding: 2rem; }
.editor-empty i { font-size: 32px; display: block; margin-bottom: 0.5rem; opacity: 0.6; }

.editor-notice {
  display: flex; gap: 0.6rem; align-items: flex-start; margin: 1rem auto 0; width: calc(100% - 3rem); max-width: 732px;
  padding: 0.55rem 0.8rem; border-radius: var(--en-radius); font-size: 13.5px; color: var(--en-ink-2);
  background: var(--en-accent-soft); border: 1px solid color-mix(in srgb, var(--en-accent) 25%, var(--en-line));
}
.editor-notice i { color: var(--en-accent); margin-top: 1px; }

/* Rendered note content (imported notes; later also the rich editor's read view) */
.note-rich { font-size: 16px; line-height: 1.7; color: var(--en-ink); overflow-wrap: anywhere; }
.note-rich > * + * { margin-top: 0.55em; }
.note-rich p, .note-rich div { margin: 0; }
.note-rich h1, .note-rich h2, .note-rich h3, .note-rich h4, .note-rich h5, .note-rich h6 {
  font-weight: 650; letter-spacing: -0.01em; line-height: 1.3; margin: 1.1em 0 0.3em;
}
.note-rich h1 { font-size: 24px; } .note-rich h2 { font-size: 21px; } .note-rich h3 { font-size: 18px; }
.note-rich h4, .note-rich h5, .note-rich h6 { font-size: 16px; }
.note-rich ul, .note-rich ol { padding-left: 1.5rem; margin: 0.3em 0; }
.note-rich blockquote { border-left: 3px solid var(--en-line-strong); margin: 0.5em 0; padding: 0.1em 0 0.1em 1rem; color: var(--en-ink-2); }
.note-rich hr { border: 0; border-top: 1px solid var(--en-line); margin: 1.2em 0; opacity: 1; }
.note-rich em { color: var(--en-ink-2); }
.note-rich table { border-collapse: collapse; margin: 0.6em 0; font-size: 14.5px; display: block; overflow-x: auto; max-width: 100%; }
.note-rich th, .note-rich td { border: 1px solid var(--en-line-strong); padding: 0.35rem 0.6rem; vertical-align: top; }
.note-rich th { background: var(--en-bg); font-weight: 600; }
.note-rich ul[data-type="taskList"] { list-style: none; padding-left: 0.2rem; }
.note-rich ul[data-type="taskList"] > li { display: flex; gap: 0.55rem; align-items: flex-start; }
.note-rich ul[data-type="taskList"] > li > label { margin-top: 0.3em; }
.note-rich ul[data-type="taskList"] > li input { width: 15px; height: 15px; accent-color: var(--en-accent); cursor: pointer; }
.note-rich:not(.prose-editor) ul[data-type="taskList"] > li input, .ProseMirror[contenteditable="false"] ul[data-type="taskList"] > li input { pointer-events: none; }
.note-rich ul[data-type="taskList"] > li[data-checked="true"] > div { color: var(--en-muted); text-decoration: line-through; }

.code-wrap { border: 1px solid var(--en-line); border-radius: var(--en-radius); background: var(--en-code-bg); margin: 0.7em 0; overflow: hidden; }
.code-bar { display: flex; align-items: center; justify-content: space-between; padding: 0.25rem 0.4rem 0.25rem 0.8rem; border-bottom: 1px solid var(--en-line); }
.code-lang { font-family: var(--en-mono); font-size: 12px; color: var(--en-muted); }
.code-copy { display: inline-flex; align-items: center; gap: 0.35rem; border: 0; background: transparent; color: var(--en-muted); font-size: 12.5px; font-weight: 550; padding: 0.2rem 0.45rem; border-radius: 6px; }
.code-copy:hover { background: var(--en-hover); color: var(--en-ink); }
.code-copy.is-done { color: var(--en-ok); }
.note-rich pre, .note-rich code, .specimen-code pre { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }  /* show "===" as typed */
.note-rich pre { margin: 0; padding: 0.8rem 0.95rem; font-family: var(--en-mono); font-size: 13.5px; line-height: 1.6; white-space: pre; overflow-x: auto; tab-size: 4; color: var(--en-ink); background: transparent; }
.note-rich pre code { font: inherit; color: inherit; background: none; padding: 0; white-space: inherit; }
.note-rich code { font-family: var(--en-mono); font-size: 0.9em; background: var(--en-code-bg); padding: 0.05em 0.3em; border-radius: 4px; }
.clipboard-buffer { position: fixed; top: -1000px; left: -1000px; opacity: 0; }

.confirm-dialog {
  border: 1px solid var(--en-line); border-radius: var(--en-radius-lg); padding: 1.4rem 1.5rem 1.2rem;
  width: min(420px, calc(100vw - 2rem)); background: var(--en-surface); color: var(--en-ink); box-shadow: var(--en-shadow);
}
.confirm-dialog::backdrop { background: rgba(10, 12, 14, 0.4); }
.confirm-dialog[open] { animation: flash-in 160ms var(--en-ease); }
.dialog-title { font-size: 17px; font-weight: 650; margin: 0 0 0.5rem; }
.dialog-text { color: var(--en-ink-2); margin: 0 0 1.25rem; font-size: 14.5px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

@media (max-width: 900px) {
  .notes-layout { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - 49px); }
  .list-pane, .editor-pane { overflow: visible; }  /* the page scrolls, so sticky bars sit under the mobile header */
  .has-note .list-pane { display: none; }
  .notes-page:not(.has-note) .editor-pane { display: none; }
  .back-to-list { display: inline-grid; }
  .editor-bar { padding-left: 0.5rem; top: 49px; }
  .list-head { top: 49px; }
  .editor-body { padding: 1.25rem 1rem 1rem; }
  .note-title { font-size: 24px; }
}

/* ---------- Rich editor ---------- */
.editor-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.5rem;
  padding: 0.35rem 1rem 0.35rem 1.25rem; border-bottom: 1px solid var(--en-line);
  position: sticky; top: 49px; z-index: 2; background: var(--en-surface);
}
.tb-group { display: flex; gap: 1px; padding-right: 0.5rem; border-right: 1px solid var(--en-line); }
.tb-group:last-child, .tb-group.tb-end { border-right: 0; }
.tb-end { margin-left: auto; }
.editor-toolbar button {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 6px;
  background: transparent; color: var(--en-ink-2); font-size: 16px;
}
.editor-toolbar button:hover { background: var(--en-hover); color: var(--en-ink); }
.editor-toolbar button[aria-pressed="true"] { background: var(--en-accent-soft); color: var(--en-accent); }
.editor-surface { flex: 1; display: flex; flex-direction: column; min-height: 50vh; }
.editor-surface .ProseMirror {
  flex: 1; outline: none; min-height: 50vh; padding-bottom: 30vh;
  white-space: pre-wrap; word-wrap: break-word; tab-size: 4; caret-color: var(--en-accent);
}
.editor-surface .ProseMirror:focus-visible { box-shadow: none; }
.ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder); color: var(--en-muted); opacity: 0.75; float: left; height: 0; pointer-events: none;
}
.ProseMirror a { cursor: text; }
.ProseMirror img.ProseMirror-separator { display: none; }
.ProseMirror-selectednode { outline: 2px solid color-mix(in srgb, var(--en-accent) 50%, transparent); border-radius: 6px; }
.ProseMirror .selectedCell { background: color-mix(in srgb, var(--en-accent) 12%, transparent); }
.ProseMirror table { display: table; }
.ProseMirror td > p, .ProseMirror th > p { margin: 0; }
.ProseMirror .tableWrapper { overflow-x: auto; margin: 0.6em 0; }
.ProseMirror .tableWrapper table { margin: 0; }

/* code block inside the editor */
.code-bar { gap: 0.25rem; }
.code-lang-select {
  border: 1px solid transparent; background: transparent; color: var(--en-muted); font-family: var(--en-mono);
  font-size: 12px; padding: 0.1rem 0.25rem; border-radius: 5px; cursor: pointer; margin-right: auto;
}
.code-lang-select:hover { border-color: var(--en-line-strong); color: var(--en-ink); }
.code-lang-select:focus-visible { outline: none; box-shadow: var(--en-focus); }
.code-lines-toggle { border: 0; background: transparent; color: var(--en-muted); border-radius: 6px; padding: 0.15rem 0.35rem; font-size: 13px; }
.code-lines-toggle:hover { background: var(--en-hover); color: var(--en-ink); }
.show-line-numbers .code-lines-toggle { color: var(--en-accent); }
.code-body { display: flex; align-items: stretch; }
.code-gutter {
  display: none; flex: 0 0 auto; padding: 0.8rem 0.55rem 0.8rem 0.75rem; text-align: right;
  font-family: var(--en-mono); font-size: 13.5px; line-height: 1.6; color: var(--en-muted); opacity: 0.7;
  border-right: 1px solid var(--en-line); user-select: none; -webkit-user-select: none;
}
.code-gutter span { display: block; }
.show-line-numbers .code-gutter { display: block; }
.code-body pre { flex: 1; min-width: 0; }

/* syntax colours (highlight.js classes from lowlight) */
.hljs-comment, .hljs-quote { color: #6a737d; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-doctag { color: #0e7c7b; font-weight: 600; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #a8551b; }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: #6f42c1; }
.hljs-title, .hljs-section, .hljs-title.function_, .hljs-title.class_ { color: #1f5fbf; }
.hljs-variable, .hljs-template-variable, .hljs-params { color: #b0306b; }
.hljs-type, .hljs-name, .hljs-selector-id, .hljs-selector-class { color: #1f5fbf; }
.hljs-attr, .hljs-property { color: #8a5a00; }
.hljs-meta, .hljs-deletion { color: #b3261e; }
.hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: 700; }
[data-bs-theme="dark"] .hljs-comment, [data-bs-theme="dark"] .hljs-quote { color: #8b949e; }
[data-bs-theme="dark"] .hljs-keyword, [data-bs-theme="dark"] .hljs-selector-tag,
[data-bs-theme="dark"] .hljs-built_in, [data-bs-theme="dark"] .hljs-doctag { color: #3bbfb5; }
[data-bs-theme="dark"] .hljs-string, [data-bs-theme="dark"] .hljs-regexp,
[data-bs-theme="dark"] .hljs-addition, [data-bs-theme="dark"] .hljs-attribute { color: #e7a56b; }
[data-bs-theme="dark"] .hljs-number, [data-bs-theme="dark"] .hljs-literal,
[data-bs-theme="dark"] .hljs-symbol, [data-bs-theme="dark"] .hljs-bullet { color: #c3a6ff; }
[data-bs-theme="dark"] .hljs-title, [data-bs-theme="dark"] .hljs-section,
[data-bs-theme="dark"] .hljs-type, [data-bs-theme="dark"] .hljs-name,
[data-bs-theme="dark"] .hljs-selector-id, [data-bs-theme="dark"] .hljs-selector-class { color: #79b8ff; }
[data-bs-theme="dark"] .hljs-variable, [data-bs-theme="dark"] .hljs-template-variable,
[data-bs-theme="dark"] .hljs-params { color: #f28bc0; }
[data-bs-theme="dark"] .hljs-attr, [data-bs-theme="dark"] .hljs-property { color: #e3c07b; }
[data-bs-theme="dark"] .hljs-meta, [data-bs-theme="dark"] .hljs-deletion { color: #f2766b; }

@media (max-width: 900px) {
  .editor-toolbar { top: 98px; padding-left: 0.5rem; overflow-x: auto; flex-wrap: nowrap; }
  .tb-end { margin-left: 0; }
}

/* ---------- Version history ---------- */
.history-dialog {
  border: 1px solid var(--en-line); border-radius: var(--en-radius-lg); padding: 0; background: var(--en-surface);
  color: var(--en-ink); box-shadow: var(--en-shadow); width: min(980px, calc(100vw - 2rem)); height: min(680px, calc(100vh - 3rem));
}
.history-dialog[open] { display: flex; flex-direction: column; animation: flash-in 160ms var(--en-ease); }
.history-dialog::backdrop { background: rgba(10, 12, 14, 0.4); }
.history-head { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1rem 0.7rem 1.25rem; border-bottom: 1px solid var(--en-line); }
.history-head .dialog-title { margin: 0; }
.history-body { flex: 1; display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 0; }
.history-list { list-style: none; margin: 0; padding: 0.5rem; overflow-y: auto; border-right: 1px solid var(--en-line); }
.history-item {
  display: flex; flex-direction: column; gap: 0.1rem; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 0.5rem 0.65rem; border-radius: var(--en-radius); color: var(--en-ink);
}
.history-item:hover { background: var(--en-hover); }
.history-item.is-active { background: var(--en-accent-soft); }
.history-when { font-weight: 600; font-size: 14px; }
.history-what { font-size: 12.5px; color: var(--en-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-empty { padding: 0.75rem; color: var(--en-muted); font-size: 14px; }
.history-preview { overflow-y: auto; padding: 1rem 1.5rem; min-width: 0; }
.history-meta { font-size: 13px; color: var(--en-muted); margin-bottom: 0.75rem; }
.history-content { font-size: 15px; }
.history-foot { display: flex; align-items: center; gap: 1rem; justify-content: flex-end; padding: 0.75rem 1.25rem; border-top: 1px solid var(--en-line); }
.history-hint { font-size: 13px; color: var(--en-muted); margin-right: auto; }
@media (max-width: 700px) {
  .history-body { grid-template-columns: 1fr; grid-template-rows: 40% 60%; }
  .history-list { border-right: 0; border-bottom: 1px solid var(--en-line); }
  .history-hint { display: none; }
}

/* ---------- Todos & reminders ---------- */
.page-wide { max-width: 980px; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.filter-select { width: auto; padding-right: 2.25rem; }
.tab-count { font-size: 12px; color: var(--en-muted); margin-left: 0.2rem; font-variant-numeric: tabular-nums; }
.tab-count.is-alert { color: var(--en-danger); font-weight: 650; }
.todo-add { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.todo-add > .form-control:first-of-type { flex: 1 1 280px; }
.todo-add-date { width: 150px; } .todo-add-time { width: 110px; } .todo-add-priority { width: 115px; }
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.todo-row {
  display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.6rem 0.75rem; border-radius: var(--en-radius);
  background: var(--en-surface); border: 1px solid var(--en-line);
}
.todo-row:hover { border-color: var(--en-line-strong); }
.todo-row.is-flash { box-shadow: var(--en-focus); }
.todo-check { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--en-accent); cursor: pointer; flex: 0 0 18px; }
.todo-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.todo-title, .todo-title-static { border: 0; background: none; padding: 0; text-align: left; color: var(--en-ink); font-weight: 550; font-size: 15px; }
.todo-title:hover { color: var(--en-accent); }
.todo-row.is-done .todo-title, .todo-row.is-done .todo-title-static { color: var(--en-muted); text-decoration: line-through; }
.todo-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.8rem; align-items: center; font-size: 12.5px; color: var(--en-muted); }
.todo-due.is-overdue, .todo-row.is-overdue .todo-due { color: var(--en-danger); font-weight: 600; }
.todo-note { color: var(--en-muted); text-decoration: none; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-note:hover { color: var(--en-accent); }
.todo-desc { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { font-size: 11.5px; padding: 0.05rem 0.45rem; border-radius: 999px; border: 1px solid var(--en-line-strong); color: var(--en-ink-2); text-transform: capitalize; }
.chip-urgent { color: #fff; background: var(--en-danger); border-color: var(--en-danger); }
.chip-high { color: var(--en-danger); border-color: color-mix(in srgb, var(--en-danger) 45%, var(--en-line)); }
.chip-low { color: var(--en-muted); }
.chip-muted { color: var(--en-muted); }
.reminder-icon { color: var(--en-accent); margin-top: 1px; }
.field-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 140px; }
.field-row > .field.grow { flex: 3 1 260px; }
.reminder-add { display: flex; flex-direction: column; gap: 0.75rem; }
.todo-dialog { width: min(520px, calc(100vw - 2rem)); }
.dialog-spacer { flex: 1; }

/* note page panel */
.note-tasks { width: calc(100% - 3rem); max-width: 732px; margin: 0.75rem auto 0; border: 1px solid var(--en-line); border-radius: var(--en-radius); background: var(--en-bg); }
.note-tasks > summary { cursor: pointer; padding: 0.45rem 0.75rem; font-size: 13.5px; font-weight: 600; color: var(--en-ink-2); list-style: none; display: flex; gap: 0.4rem; align-items: center; }
.note-tasks > summary::-webkit-details-marker { display: none; }
.note-tasks > summary::after { content: "\F282"; font-family: "bootstrap-icons"; margin-left: auto; font-weight: 400; color: var(--en-muted); transition: transform 150ms var(--en-ease); }
.note-tasks[open] > summary::after { transform: rotate(180deg); }
.note-tasks-body { padding: 0 0.75rem 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.todo-list-compact .todo-row { padding: 0.4rem 0.6rem; }
.todo-list-compact:empty { display: none; }
.note-inline-form { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.note-inline-form .form-control { flex: 1 1 200px; }
.note-inline-form .form-select { width: auto; }

/* ---------- Notification bell ---------- */
.sidebar-top-actions { display: flex; align-items: center; gap: 0.1rem; }
.sidebar-collapsed .sidebar-top-actions { flex-direction: column; }
.bell { position: relative; }
.bell-badge {
  position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--en-danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center;
}
.mobile-bar .bell { margin-left: 0.1rem; }
.notif-panel {
  position: fixed; z-index: 1060; max-height: min(70vh, 560px); display: flex; flex-direction: column;
  background: var(--en-surface); border: 1px solid var(--en-line); border-radius: var(--en-radius-lg); box-shadow: var(--en-shadow);
  animation: flash-in 140ms var(--en-ease);
}
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 0.9rem 0.5rem; border-bottom: 1px solid var(--en-line); font-size: 14.5px; }
.notif-list { list-style: none; margin: 0; padding: 0.3rem; overflow-y: auto; }
.notif-item { display: flex; gap: 0.6rem; padding: 0.55rem 0.6rem; border-radius: var(--en-radius); color: var(--en-ink); text-decoration: none; }
.notif-item:hover { background: var(--en-hover); color: var(--en-ink); }
.notif-item i { color: var(--en-muted); margin-top: 2px; }
.notif-item.is-unread { background: var(--en-accent-soft); }
.notif-item.is-unread i { color: var(--en-accent); }
.notif-body { display: flex; flex-direction: column; min-width: 0; }
.notif-title { font-weight: 600; font-size: 14px; }
.notif-text { font-size: 13px; color: var(--en-ink-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-when { font-size: 12px; color: var(--en-muted); }
.notif-empty { padding: 1rem 0.8rem; color: var(--en-muted); font-size: 14px; }
.notif-foot { display: block; text-align: center; padding: 0.55rem; border-top: 1px solid var(--en-line); font-size: 13.5px; }

/* ---------- Attachments in notes ---------- */
/* Pictures sit in the text at a readable size: never wider than the column, never taller than
   ~half a screen. width:auto overrides the stored width attribute; double-click opens the original. */
.note-rich img { display: block; max-width: 100%; max-height: min(55vh, 520px); width: auto; height: auto; object-fit: contain;
  border-radius: var(--en-radius); border: 1px solid var(--en-line); margin: 0.6em 0; cursor: zoom-in; }
.ProseMirror img.ProseMirror-selectednode { outline: 3px solid color-mix(in srgb, var(--en-accent) 55%, transparent); }
.note-rich a[data-attachment] {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem; border: 1px solid var(--en-line-strong);
  border-radius: var(--en-radius); background: var(--en-bg); color: var(--en-ink); text-decoration: none; font-size: 14px;
}
.note-rich a[data-attachment]::before { content: "\F4B3"; font-family: "bootstrap-icons"; color: var(--en-accent); }
.note-rich a[data-attachment]:hover { border-color: var(--en-accent); }

/* ---------- Small menus (details/summary) ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 230px; padding: 0.3rem;
  background: var(--en-surface); border: 1px solid var(--en-line); border-radius: var(--en-radius); box-shadow: var(--en-shadow);
}
.menu-list a { display: flex; gap: 0.55rem; align-items: center; padding: 0.45rem 0.6rem; border-radius: 6px; color: var(--en-ink); text-decoration: none; font-size: 14px; white-space: nowrap; }
.menu-list a:hover { background: var(--en-hover); color: var(--en-ink); }
.menu-list i { color: var(--en-muted); }
.export-form { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------- Subscriptions ---------- */
.billing-banner {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.6rem 0.9rem; margin-bottom: 1rem;
  border-radius: var(--en-radius); font-size: 14px; border: 1px solid var(--en-line);
}
.editor-pane > .billing-banner { margin: 1rem 1.5rem 0; }
.billing-error { background: var(--en-danger-soft); border-color: color-mix(in srgb, var(--en-danger) 35%, var(--en-line)); }
.billing-error i { color: var(--en-danger); }
.billing-warn { background: color-mix(in srgb, #c98a0b 10%, var(--en-surface)); border-color: color-mix(in srgb, #c98a0b 40%, var(--en-line)); }
.billing-info { background: var(--en-accent-soft); }
.billing-banner-link { margin-left: auto; font-weight: 600; white-space: nowrap; }
.sub-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.75rem; }
.sub-head .panel-title { margin-bottom: 0.1rem; }
.status-pill { font-size: 12.5px; font-weight: 600; padding: 0.15rem 0.65rem; border-radius: 999px; border: 1px solid var(--en-line-strong); }
.status-active, .status-trial { color: var(--en-ok); border-color: color-mix(in srgb, var(--en-ok) 45%, var(--en-line)); }
.status-grace_period { color: #c98a0b; border-color: color-mix(in srgb, #c98a0b 45%, var(--en-line)); }
.status-expired, .status-cancelled { color: var(--en-danger); border-color: color-mix(in srgb, var(--en-danger) 45%, var(--en-line)); }
.auto-renew { margin-top: 1rem; }
.usage { display: flex; flex-direction: column; gap: 0.9rem; }
.usage-label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 0.3rem; }
.meter { height: 6px; border-radius: 999px; background: var(--en-hover); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--en-accent); border-radius: 999px; }
.meter.is-full > span { background: var(--en-danger); }
.meter-0 { width: 0%; }
.meter-5 { width: 5%; }
.meter-10 { width: 10%; }
.meter-15 { width: 15%; }
.meter-20 { width: 20%; }
.meter-25 { width: 25%; }
.meter-30 { width: 30%; }
.meter-35 { width: 35%; }
.meter-40 { width: 40%; }
.meter-45 { width: 45%; }
.meter-50 { width: 50%; }
.meter-55 { width: 55%; }
.meter-60 { width: 60%; }
.meter-65 { width: 65%; }
.meter-70 { width: 70%; }
.meter-75 { width: 75%; }
.meter-80 { width: 80%; }
.meter-85 { width: 85%; }
.meter-90 { width: 90%; }
.meter-95 { width: 95%; }
.meter-100 { width: 100%; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.9rem; }
.plan-card { border: 1px solid var(--en-line); border-radius: var(--en-radius-lg); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; background: var(--en-surface); }
.plan-card.is-current { border-color: var(--en-accent); box-shadow: inset 0 0 0 1px var(--en-accent); }
.plan-card h2, .plan-card h3 { font-size: 17px; font-weight: 650; margin: 0; }
.plan-price { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
.plan-price span { font-size: 13.5px; font-weight: 400; color: var(--en-muted); margin-left: 0.25rem; }
.plan-limits { list-style: none; padding: 0; margin: 0 0 0.75rem; font-size: 14px; color: var(--en-ink-2); display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.plan-limits li::before { content: "\F272"; font-family: "bootstrap-icons"; color: var(--en-accent); margin-right: 0.45rem; }
.plan-note { margin-top: 1rem; font-size: 13.5px; }
.danger-panel { border-color: color-mix(in srgb, var(--en-danger) 30%, var(--en-line)); }
.public-page { background: var(--en-bg); }
.public-bar { display: flex; justify-content: space-between; align-items: center; padding: 1rem clamp(1rem, 4vw, 3rem); }
.public-bar nav { display: flex; gap: 1rem; align-items: center; font-size: 14.5px; }
.pricing { max-width: 1040px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 3rem) 4rem; }
.pricing-title { font-size: clamp(26px, 3.4vw, 38px); font-weight: 650; letter-spacing: -0.02em; max-width: 22ch; margin: 0 0 0.75rem; }
.pricing-sub { color: var(--en-ink-2); max-width: 62ch; margin: 0 0 2rem; }

/* ---------- Admin ---------- */
.page-admin { max-width: 1200px; }
.admin-search { display: flex; gap: 0.5rem; max-width: 460px; margin-bottom: 1rem; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.admin-grid .panel { margin-bottom: 0; }
.admin-form { display: flex; flex-direction: column; gap: 0.6rem; margin: 1rem 0; padding-top: 1rem; border-top: 1px solid var(--en-line); }
.admin-form .btn { align-self: flex-start; }
.admin-actions { margin-top: 1rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--en-line); border-radius: var(--en-radius-lg); background: var(--en-surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--en-muted); padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--en-line); white-space: nowrap; }
.data-table td { padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--en-line); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table code { font-size: 12.5px; }
.data-table tr.is-muted td { color: var(--en-muted); }
.data-table .chip { margin-right: 0.25rem; }
.filter-links { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.filter-links a { font-size: 13.5px; padding: 0.25rem 0.7rem; border-radius: 999px; border: 1px solid var(--en-line-strong); color: var(--en-ink-2); text-decoration: none; }
.filter-links a.is-active { background: var(--en-accent-soft); border-color: var(--en-accent); color: var(--en-accent); }
.checks { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.plan-form { max-width: 760px; }

/* ---------- Notebook shortcuts ---------- */
.list-filter {
  max-width: 170px; border: 1px solid var(--en-line-strong); border-radius: 7px; background: var(--en-surface);
  color: var(--en-ink-2); font-size: 13px; padding: 0.2rem 0.4rem; cursor: pointer;
}
.list-filter:focus-visible { outline: none; box-shadow: var(--en-focus); }
.nav-with-toggle { display: flex; align-items: center; }
.nav-with-toggle .nav-item { flex: 1; min-width: 0; }
.nav-toggle { border: 0; background: transparent; color: var(--en-muted); width: 28px; height: 28px; border-radius: 6px; flex: 0 0 28px; }
.nav-toggle:hover { background: var(--en-hover); color: var(--en-ink); }
.nav-toggle i { display: inline-block; transition: transform 150ms var(--en-ease); font-size: 12px; }
.nav-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
.nav-sublist { list-style: none; margin: 0 0 0.3rem; padding: 0 0 0 1.55rem; max-height: 40vh; overflow-y: auto; }
.nav-sub { display: flex; align-items: center; gap: 0.5rem; padding: 0.28rem 0.6rem; border-radius: 6px; color: var(--en-ink-2); text-decoration: none; font-size: 13.5px; }
.nav-sub:hover { background: var(--en-hover); color: var(--en-ink); }
.nav-sub.is-active { background: var(--en-surface); color: var(--en-ink); font-weight: 600; box-shadow: 0 0 0 1px var(--en-line); }
.nav-sub-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub-count { font-size: 12px; color: var(--en-muted); font-variant-numeric: tabular-nums; }
.nav-sub-empty { font-size: 13px; color: var(--en-muted); padding: 0.3rem 0.6rem; }
.sidebar-collapsed .nav-toggle, .sidebar-collapsed .nav-sublist { display: none; }

/* ---------- Note meta: notebook + tags ---------- */
.note-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem;
  width: 100%; max-width: 780px; margin: 0 auto; padding: 1rem 1.5rem 0; font-size: 13.5px; color: var(--en-muted);
}
.meta-notebook { display: inline-flex; align-items: center; gap: 0.35rem; }
.meta-notebook select {
  border: 1px solid transparent; background: transparent; color: var(--en-ink-2); font-size: 13.5px;
  padding: 0.15rem 0.3rem; border-radius: 6px; max-width: 220px; cursor: pointer;
}
.meta-notebook select:hover { border-color: var(--en-line-strong); }
.meta-notebook select:focus-visible { outline: none; box-shadow: var(--en-focus); }
.meta-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.tag-chips { display: contents; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 0.2rem; font-size: 12.5px; color: var(--en-accent);
  background: var(--en-accent-soft); padding: 0.05rem 0.25rem 0.05rem 0.55rem; border-radius: 999px;
}
.tag-chip:not(:has(.tag-remove)) { padding-right: 0.55rem; }
.tag-remove { border: 0; background: transparent; color: inherit; font-size: 14px; line-height: 1; padding: 0 0.25rem; border-radius: 999px; opacity: 0.7; }
.tag-remove:hover { opacity: 1; background: color-mix(in srgb, var(--en-accent) 18%, transparent); }
.tag-input { border: 0; background: transparent; color: var(--en-ink); font-size: 13.5px; width: 110px; padding: 0.15rem 0.2rem; outline: 0; }
.tag-input::placeholder { color: var(--en-muted); }
.editor-body { padding-top: 1.25rem; }
.row-notebook { display: inline-flex; align-items: center; gap: 0.2rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Sidebar search + palette ---------- */
.nav-search { margin-bottom: 0.4rem; border: 1px solid var(--en-line); background: var(--en-bg); }
.nav-search kbd { margin-left: auto; }
.sidebar-collapsed .nav-search { border-color: transparent; background: transparent; }
.mobile-search { margin-left: auto; }

.palette {
  border: 1px solid var(--en-line); border-radius: var(--en-radius-lg); padding: 0; margin: 12vh auto auto;
  width: min(640px, calc(100vw - 2rem)); background: var(--en-surface); color: var(--en-ink); box-shadow: var(--en-shadow);
}
.palette::backdrop { background: rgba(10, 12, 14, 0.35); }
.palette[open] { animation: flash-in 140ms var(--en-ease); }
.palette-input-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--en-line); color: var(--en-muted); }
.palette-input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--en-ink); font-size: 17px; }
.palette-input::-webkit-search-cancel-button { display: none; }
.palette-input:focus-visible, .search-input:focus-visible, .tag-input:focus-visible { box-shadow: none; }
@media (max-width: 600px) {
  .palette { margin-top: 1rem; }
  .palette-foot > span, .palette-input-row kbd, .palette-foot kbd { display: none; }
}
.palette-results { list-style: none; margin: 0; padding: 0.35rem; max-height: min(60vh, 520px); overflow-y: auto; }
.palette-group { font-size: 12px; font-weight: 600; color: var(--en-muted); padding: 0.55rem 0.65rem 0.2rem; }
.palette-group:empty { display: none; }
.palette-row {
  display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.5rem 0.65rem; border-radius: var(--en-radius);
  color: var(--en-ink); text-decoration: none;
}
.palette-row i { color: var(--en-muted); margin-top: 2px; }
.palette-row.is-active, .palette-row:hover { background: var(--en-hover); color: var(--en-ink); }
.palette-row.is-active i { color: var(--en-accent); }
.palette-row-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.palette-row-title { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-row-snippet { font-size: 13px; color: var(--en-ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.palette-row-meta { font-size: 12px; color: var(--en-muted); white-space: nowrap; margin-top: 2px; }
.palette-empty { padding: 1.25rem 0.9rem; color: var(--en-muted); font-size: 14px; }
.palette-foot { display: flex; gap: 1rem; align-items: center; padding: 0.5rem 1rem; border-top: 1px solid var(--en-line); font-size: 12px; color: var(--en-muted); }
.palette-foot kbd { margin-right: 0.2rem; }
.palette-foot a { margin-left: auto; }
mark { background: color-mix(in srgb, #f2c230 45%, transparent); color: inherit; padding: 0 0.1em; border-radius: 3px; }
[data-bs-theme="dark"] mark { background: color-mix(in srgb, #f2c230 30%, transparent); }

/* ---------- Notebooks / tags pages ---------- */
.inline-create { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; max-width: 560px; }
.inline-create .form-control { flex: 1; min-width: 200px; }
.inline-create-msg { flex-basis: 100%; }
.entity-list { list-style: none; margin: 0; padding: 0; background: var(--en-surface); border: 1px solid var(--en-line); border-radius: var(--en-radius-lg); overflow: hidden; }
.entity-row { display: flex; align-items: center; border-top: 1px solid var(--en-line); }
.entity-row:first-child { border-top: 0; }
.entity-main { flex: 1; display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1rem; color: var(--en-ink); text-decoration: none; min-width: 0; }
.entity-main:hover { background: var(--en-hover); color: var(--en-ink); }
.entity-icon { color: var(--en-muted); }
.entity-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-count { margin-left: auto; font-size: 13px; color: var(--en-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.entity-actions { display: flex; gap: 0.15rem; padding: 0 0.6rem; }
.dialog-actions-spaced { margin-top: 1rem; }

/* ---------- Search page ---------- */
.search-form { display: flex; flex-direction: column; gap: 0.65rem; margin-bottom: 1.25rem; }
.search-box { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.9rem; background: var(--en-surface); border: 1px solid var(--en-line-strong); border-radius: var(--en-radius); color: var(--en-muted); }
.search-box:focus-within { border-color: var(--en-accent); box-shadow: var(--en-focus); }
.search-input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--en-ink); font-size: 16px; }
.search-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.search-filters .form-select { width: auto; max-width: 220px; }
.search-count { color: var(--en-muted); font-size: 14px; margin: 0 0 0.6rem; }
.search-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.search-hit { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.75rem 0.95rem; border-radius: var(--en-radius); background: var(--en-surface); border: 1px solid var(--en-line); color: var(--en-ink); text-decoration: none; }
.search-hit:hover { border-color: var(--en-line-strong); color: var(--en-ink); }
.search-hit-title { font-weight: 600; }
.search-hit-snippet { font-size: 14px; color: var(--en-ink-2); line-height: 1.5; }
.search-hit-meta { display: flex; gap: 0.75rem; font-size: 12.5px; color: var(--en-muted); }
.pill-muted { color: var(--en-muted); border: 1px solid var(--en-line-strong); }
.pager { display: flex; gap: 0.5rem; margin-top: 1rem; }
.search-help code { font-size: 0.9em; background: var(--en-code-bg); padding: 0.05em 0.3em; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .specimen { transform: none; }
}

/* ---------- payments ---------- */
.status-pay-paid { color: var(--en-ok); border-color: color-mix(in srgb, var(--en-ok) 45%, var(--en-line)); }
.status-pay-pending { color: #c98a0b; border-color: color-mix(in srgb, #c98a0b 45%, var(--en-line)); }
.status-pay-refunded { color: var(--en-muted); }
.plan-card form { margin-top: auto; }
.pay-status { text-align: center; padding: 2.5rem 1.75rem; }
.pay-state .spinner-border { width: 2.25rem; height: 2.25rem; margin-bottom: 1rem; }
.pay-state .panel-text { max-width: 30rem; margin-left: auto; margin-right: auto; }
.pay-icon { display: block; font-size: 2.5rem; margin-bottom: 0.75rem; color: var(--en-danger); }
.pay-icon.is-ok { color: var(--en-ok); }
.pay-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.pay-invoice { margin: 1.5rem 0 0; }
.fake-flag { font-size: 13px; padding: 0.5rem 0.75rem; border-radius: var(--en-radius); margin-bottom: 1.25rem;
  background: color-mix(in srgb, #c98a0b 12%, var(--en-surface)); border: 1px dashed color-mix(in srgb, #c98a0b 55%, var(--en-line)); }
.fake-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }

/* invoice: a plain document, prints on one A4 page */
.invoice-page { background: var(--en-bg); }
.invoice { max-width: 760px; margin: 2rem auto; padding: 2.5rem; background: var(--en-surface); color: var(--en-ink);
  border: 1px solid var(--en-line); border-radius: var(--en-radius-lg); }
.invoice-head { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.invoice-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; margin: 0 0 0.25rem; }
.invoice-meta { text-align: right; }
.invoice-meta h1 { font-size: 1.6rem; margin: 0 0 0.25rem; letter-spacing: 0.01em; }
.invoice-meta p { margin: 0; }
.invoice-stamp { display: inline-block; margin-top: 0.5rem !important; padding: 0.1rem 0.7rem; border-radius: 999px; font-weight: 700;
  font-size: 13px; color: var(--en-ok); border: 1.5px solid var(--en-ok); }
.invoice-stamp.is-refunded { color: var(--en-muted); border-color: var(--en-muted); }
.invoice-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
.invoice-facts dt { font-size: 12.5px; color: var(--en-muted); font-weight: 500; }
.invoice-facts dd { margin: 0.15rem 0 0; }
.invoice-lines { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; }
.invoice-lines th, .invoice-lines td { padding: 0.6rem 0.25rem; border-bottom: 1px solid var(--en-line); text-align: left; }
.invoice-lines thead th { font-size: 12.5px; color: var(--en-muted); font-weight: 500; }
.invoice-lines tfoot th { border-bottom: 0; font-size: 1.05rem; }
.invoice-lines .num, .data-table .num { text-align: right; white-space: nowrap; }
.invoice-actions { display: flex; gap: 0.5rem; margin-top: 1.5rem; }
@media (max-width: 640px) {
  .invoice { margin: 0; border-radius: 0; border: 0; padding: 1.5rem 1rem; }
  .invoice-head { flex-direction: column; gap: 1rem; }
  .invoice-meta { text-align: left; }
  .invoice-facts { grid-template-columns: 1fr; }
}
@media print {
  .invoice-page { background: #fff; }
  .invoice { margin: 0; border: 0; padding: 0; max-width: none; color: #000; background: #fff; }
  .no-print { display: none !important; }
}

/* ---------- offline page (PWA) ---------- */
.offline-page { background: var(--en-bg); min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.offline { max-width: 26rem; text-align: center; }
.offline img { margin-bottom: 1.25rem; }
.offline h1 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.offline p { color: var(--en-muted); margin-bottom: 1.25rem; }
.nav-item[hidden] { display: none; }
