*, *::before, *::after { box-sizing: border-box; }

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/hanken-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/hanken-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/newsreader-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/newsreader-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ================================================================ tokens */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --line: #e3e0d8;
  --line-soft: #efede7;
  --line-strong: #cfcbc0;
  --fg: #1f1e1b;
  --fg-2: #4a4843;
  --muted: #5f5c55;
  --faint: #706c64;
  --prose: #26251f;
  --accent: #2a6584;
  --accent-hover: #1d4a62;
  --accent-fg: #ffffff;
  --accent-soft: #dce7ec;
  --accent-ring: #e3eef3;
  --warn: #9a4a12;
  --warn-soft: #f6e9dc;
  --warn-strong: #7a3a0e;
  --dot: #c2601e;
  --danger: #a7362a;
  --ok: #3d6b4f;
  --mark: #f7e7a1;
  --shadow-pop: 0 24px 60px rgba(31, 30, 27, 0.25);

  --sans: "Hanken Grotesk", "Helvetica Neue", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171714;
    --surface: #201f1c;
    --surface-2: #262521;
    --line: #34322d;
    --line-soft: #2b2a26;
    --line-strong: #46433c;
    --fg: #eceae4;
    --fg-2: #cdc9c0;
    --muted: #b3afa6;
    --faint: #9c978d;
    --prose: #e4e1da;
    --accent: #7db3d1;
    --accent-hover: #a9cde0;
    --accent-fg: #10222c;
    --accent-soft: #1f3340;
    --accent-ring: #10222c;
    --warn: #e39a62;
    --warn-soft: #3a2817;
    --warn-strong: #f0b887;
    --dot: #e08a4f;
    --danger: #e58a7e;
    --ok: #8cc2a0;
    --mark: #5c4c16;
    --shadow-pop: 0 24px 60px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

/* ================================================================ base */

body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.5 var(--sans);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { margin: 0; }

h1 {
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }

p { margin: 0; }

code, kbd, .slug {
  font-family: var(--mono);
  font-size: 0.86em;
}

code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--line-soft);
}

mark {
  background: var(--mark);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon { flex: none; width: 18px; height: 18px; }
.task-meta .icon { width: 13px; height: 13px; stroke-width: 2; }
.topsearch .icon { width: 16px; height: 16px; }
.group-link .icon, .trash .icon { width: 17px; height: 17px; }
.btn .icon { width: 16px; height: 16px; }

/* ================================================================ header and nav */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 8px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
}
.brand:hover { color: var(--fg); }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { stroke: var(--surface); }
.brand-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.mainnav {
  display: flex;
  gap: 2px;
  flex: 1 1 auto;
}

.mainnav a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.mainnav a:hover { background: var(--line-soft); color: var(--fg); }
.mainnav a[aria-current="page"] {
  background: var(--line-soft);
  color: var(--fg);
  font-weight: 600;
}
.mainnav .nav-search { display: none; }

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.count.hot { background: var(--warn-soft); color: var(--warn-strong); }
.mainnav a[aria-current="page"] .count:not(.hot) { background: var(--surface); }

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topsearch {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}
.topsearch .icon {
  position: absolute;
  left: 14px;
  color: var(--faint);
  pointer-events: none;
}
.topsearch input {
  width: 240px;
  height: 40px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
}
.topsearch input::placeholder { color: var(--faint); }
.topsearch input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); background: var(--surface); }

.iconbtn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}
.iconbtn:hover { background: var(--line-soft); color: var(--fg); }
.iconbtn[aria-current="page"] { background: var(--line-soft); color: var(--fg); }
.iconbtn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot);
  border: 2px solid var(--surface);
}
.iconbtn.danger:hover { color: var(--danger); }

.account { position: relative; }
.account > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.account > summary::-webkit-details-marker { display: none; }
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  min-width: 220px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
}
.account-menu .who {
  padding: 6px 10px 10px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--faint);
  overflow-wrap: anywhere;
}
.account-menu .who strong { display: block; color: var(--fg); font-size: 15px; }
.account-menu a,
.account-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.account-menu a:hover,
.account-menu button:hover { background: var(--line-soft); color: var(--fg); }
.account-menu form { margin: 0; }

/* ================================================================ page shells */

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.page-wide {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.page-split {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 96px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 40px;
}
.page-split > .main { flex: 999 1 560px; min-width: 0; }
.page-split > .side {
  flex: 1 1 280px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 24px;
}

.lede { margin-top: 8px; color: var(--muted); }

.summary {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  color: var(--muted);
}

.warn { color: var(--warn); font-weight: 600; }

.hint, .footnote {
  font-size: 13px;
  color: var(--faint);
}
.footnote {
  margin-top: 40px;
  text-align: center;
}

.empty { color: var(--faint); }

/* A white box with a hairline border: lists, panels, prose. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.list-card { margin-top: 24px; }

.empty-state {
  margin-top: 32px;
  padding: 28px 24px;
  text-align: center;
}
.empty-state p + p { margin-top: 6px; }

/* Side panels with small uppercase headings. */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.panel > h2,
.panel-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.panel .hint { margin-top: 10px; }

.section { margin-top: 32px; }
.section + .section { margin-top: 28px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  min-height: 32px;
}
.section-head h2 { font-size: 18px; }
.section-head .hint { flex: none; }

.group-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.group-link:hover { color: var(--accent); }
.group-link .icon { color: var(--faint); }

/* ================================================================ controls */

button, input, select, textarea { font: inherit; color: inherit; }

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); color: var(--fg); border-color: var(--faint); }
.btn-primary, button.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
.btn-small, button.btn-small { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }
.btn-quiet, button.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--line-soft); border-color: transparent; }
.btn-danger:hover { color: var(--danger); }
.btn[aria-pressed="true"] { background: var(--line-soft); }

.field, input.field, select.field, textarea.field {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
}
select.field { padding-right: 8px; }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.field::placeholder { color: var(--faint); }

.label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.row-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.row-form .field { flex: 1 1 200px; width: auto; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}
a.badge:hover { color: var(--accent); }
.badge-accent { background: var(--accent-soft); color: var(--accent-hover); }
.badge-warn { background: var(--warn-soft); color: var(--warn-strong); }

.tag { color: var(--faint); font-size: 13px; }

.status { min-height: 1.5em; color: var(--faint); font-size: 13px; }
.status.conflict, .error { color: var(--danger); }
p.error {
  margin: 16px 0;
  padding: 10px 14px;
  border: 1px solid var(--warn-soft);
  border-radius: 10px;
  background: var(--warn-soft);
  color: var(--warn-strong);
}

/* ================================================================ task rows */

.tasks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tasks > li + li { border-top: 1px solid var(--line-soft); }
.tasks .empty { padding: 14px 16px; }
.tasks .empty:not(:only-child) { display: none; }
.tasks .empty:only-child + li { border-top: 0; }

.task {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  padding: 0 8px 0 4px;
}
.task:hover { background: var(--surface-2); }

.task .tick { margin: 0; flex: none; }
.task .tick label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 46px;
  cursor: pointer;
}
.task input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.task input[type="checkbox"]:disabled { cursor: default; }

.task-body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 11px 0 10px;
  overflow-wrap: anywhere;
}

.task.done .task-title {
  color: var(--faint);
  text-decoration: line-through;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin-top: 2px;
  font-size: 13px;
  color: var(--faint);
}
.task-meta:empty { display: none; }
.task-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.task-meta a { color: var(--faint); }
.task-meta a:hover { color: var(--accent); }
.task-meta .overdue { color: var(--warn); font-weight: 600; }
.task-meta .now { color: var(--accent); font-weight: 600; }

/* The group heading names the note and its owner already. */
.in-group .task-note, .in-group .shared-by { display: none; }

.task-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  align-self: center;
  flex: none;
}
.task-actions select {
  height: 34px;
  max-width: 160px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font-size: 13px;
}
.task .trash {
  width: 36px;
  height: 36px;
  color: var(--faint);
  opacity: 0;
}
.task:hover .trash,
.task .trash:focus-visible { opacity: 1; }
.task .trash:hover { color: var(--danger); }
@media (hover: none) {
  .task .trash { opacity: 1; }
}

.quick-add {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 8px 8px 4px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.quick-add .plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  flex: none;
  color: var(--faint);
}
.quick-add input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
}
.quick-add input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.quick-add .btn { height: 40px; border-radius: 8px; }

/* ================================================================ rendered markdown */

.markdown {
  overflow-wrap: anywhere;
}
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p, .markdown ul, .markdown ol, .markdown blockquote, .markdown pre { margin: 0 0 1em; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  margin: 1.4em 0 0.4em;
  font-family: var(--sans);
  line-height: 1.3;
  letter-spacing: 0;
}
.markdown h1 { font-size: 24px; font-weight: 600; }
.markdown h2 { font-size: 20px; }
.markdown h3 { font-size: 17px; }
.markdown h4 { font-size: 15px; }
.markdown ul, .markdown ol { padding-left: 1.4em; }
.markdown li + li { margin-top: 0.2em; }
.markdown li:has(> input[type="checkbox"]) { list-style: none; margin-left: -1.4em; }
.markdown input[type="checkbox"] { margin: 0 8px 0 0; accent-color: var(--faint); }
.markdown input.task-check:enabled { accent-color: var(--accent); cursor: pointer; }
.markdown li:has(> input.task-check:checked) { color: var(--faint); text-decoration: line-through; }
.markdown blockquote {
  padding-left: 1em;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.markdown pre {
  overflow-x: auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-size: 14px;
  line-height: 1.5;
}
.markdown pre code { padding: 0; background: none; }
.markdown table { border-collapse: collapse; font-family: var(--sans); font-size: 14px; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.markdown hr { border: 0; border-top: 1px solid var(--line); margin: 1.5em 0; }
.markdown img { max-width: 100%; }

/* ================================================================ toast */

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--fg);
  color: var(--bg);
  box-shadow: var(--shadow-pop);
}

#toast[hidden] { display: none; }

.tz-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  width: calc(100% - 48px);
  max-width: 1072px;
  margin: 16px auto 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--warn-soft);
  color: var(--warn-strong);
}
.tz-banner[hidden] { display: none; }
#push-toggle[hidden] { display: none; }
.tz-banner p { flex: 1 1 320px; margin: 0; }
.tz-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ================================================================ notes and note page */

.new-note {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.new-note .field {
  flex: 1 1 280px;
  width: auto;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border-color: var(--line-strong);
  border-radius: 10px;
}
.new-note .btn { height: 44px; padding: 0 18px; }
.new-note .icon { width: 17px; height: 17px; stroke-width: 2; }

.notes-group {
  margin: 36px 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.notes-group + .note-list + .notes-group { margin-top: 32px; }

.note-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  color: var(--fg);
  text-decoration: none;
}
.note-item + .note-item { border-top: 1px solid var(--line-soft); }
.note-item:hover { background: var(--surface-2); color: var(--fg); }
.note-item:hover .note-item-title { color: var(--accent); }
.note-pin { display: flex; color: var(--faint); }
.note-pin .icon { width: 16px; height: 16px; }
.note-item-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  overflow-wrap: anywhere;
}
.note-item-title { font-weight: 600; }
.note-item-tags { font-size: 13px; color: var(--muted); }
.note-item-when { flex: none; font-size: 13px; color: var(--faint); }

.notes-foot { margin-top: 16px; text-align: left; }
.empty-state .empty { margin: 0; }

/* Note page: read view, editor and side column. */

.note-page.editing { max-width: 928px; padding-top: 20px; }
.note-page.editing .note-read,
.note-edit { display: none; }
.note-page.editing .note-edit { display: block; }

.note-actions {
  float: right;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px 16px;
}
.note-actions .btn { padding: 0 14px; }

.note-flags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 13px;
  color: var(--muted);
}
.note-flags:empty { display: none; }
.note-flags .badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  color: var(--fg-2);
}
.note-flags .badge-accent { color: var(--accent-hover); background: var(--accent-ring); }
.note-flags .badge-warn { color: var(--warn-strong); background: var(--warn-soft); }
.note-flags .badge .icon { width: 13px; height: 13px; }
.note-flag { display: inline-flex; align-items: center; gap: 5px; }
.note-flag .icon { width: 15px; height: 15px; }
.note-tag { color: var(--muted); text-decoration: none; }
.note-tag:hover { color: var(--accent); }

.note-title { margin-top: 8px; overflow-wrap: anywhere; }
.note-byline { margin-top: 8px; font-size: 13px; color: var(--faint); }

.note-body {
  clear: both;
  margin-top: 28px;
  padding: 36px 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  color: var(--prose);
}
.note-body .markdown h1,
.note-body .markdown h2,
.note-body .markdown h3,
.note-body .markdown h4 { color: var(--fg); }
.note-body .markdown h2 { margin-top: 32px; }
.note-body code { font-size: 15px; }
.note-body .markdown pre,
.note-body .markdown table { font-size: 14px; }
.note-body:has(.markdown:empty) { display: none; }

.edit-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 0;
  background: var(--bg);
}
.edit-state, .edit-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}
.edit-tools { gap: 8px; }
.edit-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.edit-bar .status { min-height: 0; font-size: 14px; }
.edit-bar .status.saved { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); }
.edit-bar .status .icon { width: 16px; height: 16px; stroke-width: 2.2; }
.edit-tools .btn { padding: 0 18px; }

.editor-form { margin-top: 12px; border-radius: 14px; }
.editor-form:focus-within { border-color: var(--line-strong); }
.editor-title,
.editor-body {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
}
.editor-title {
  padding: 28px 36px 18px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.editor-body {
  min-height: 320px;
  padding: 24px 36px 32px;
  resize: vertical;
  color: var(--prose);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.75;
}
.editor-title:focus-visible,
.editor-body:focus-visible { outline: none; box-shadow: inset 3px 0 0 var(--accent); }
.editor-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 36px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--faint);
}
.editor-foot code { padding: 0; background: none; font-size: 12px; color: var(--fg-2); }

.note-tasks { margin-top: 36px; }
.in-note .task-note, .in-note .shared-by { display: none; }

.project-members { margin-top: 36px; }
.member-group {
  margin: 20px 0 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.member-group .hint { font-weight: 500; }
.member-list { list-style: none; margin: 0; padding: 0; }
.member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.member + .member { border-top: 1px solid var(--line-soft); }
.member .icon { width: 17px; height: 17px; color: var(--faint); }
.member-title { flex: 1 1 auto; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.member-title a { color: var(--fg); text-decoration: none; }
.member-title a:hover { color: var(--accent); }
.member .kind { flex: none; font-size: 13px; color: var(--faint); text-transform: capitalize; }

/* Side column */

.note-meta { display: flex; flex-direction: column; gap: 14px; }
.panel.note-meta > h2 { margin: 0; }
.meta-field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.meta-field .label { margin: 0; }
.meta-field .field { min-height: 38px; border-radius: 10px; }
.meta-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-chips .badge { font-size: 13px; padding: 2px 10px; }
.add-project > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  list-style: none;
  cursor: pointer;
}
.add-project > summary::-webkit-details-marker { display: none; }
.add-project > summary:hover { color: var(--fg); border-color: var(--faint); }
.add-project > summary .icon { width: 16px; height: 16px; }
.add-project form { margin-top: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.meta-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.meta-flags form { margin: 0; }
.meta-flags .btn { font-weight: 500; }
.meta-flags .btn[aria-pressed="true"] { background: var(--bg); }
.note-meta .empty { font-size: 14px; }

.share-private { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.share-private .icon { width: 16px; height: 16px; }
.share-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.share-mini li { display: flex; align-items: center; gap: 10px; }
.share-mini .share-who { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.share-mini .share-role { font-size: 13px; color: var(--faint); text-transform: capitalize; }
.share-waiting { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--warn); }
.share-manage { margin-top: 14px; }

.share-summary .avatar,
.share-body .avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--warn-soft);
  color: var(--warn-strong);
  font-size: 13px;
  font-weight: 700;
}
.share-body .avatar { width: 34px; height: 34px; font-size: 14px; }
.share-summary .avatar-me,
.share-body .avatar-me { background: var(--accent-soft); color: var(--accent-hover); }
.share-summary .avatar-link,
.share-body .avatar-link { background: var(--line-soft); color: var(--muted); }
.share-summary .avatar-invite,
.share-body .avatar-invite { background: transparent; border: 1.5px dashed var(--line-strong); color: var(--faint); }
.share-summary .avatar .icon,
.share-body .avatar .icon { width: 16px; height: 16px; }

.attachments .files { list-style: none; margin: 0; padding: 0; }
.attachments .files li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}
.attachments .files .icon { width: 16px; height: 16px; color: var(--faint); }
.attachments .files a {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg);
  text-decoration: none;
}
.attachments .files a::after { content: ""; position: absolute; inset: 0; }
.attachments .files li:hover a { color: var(--accent); }
.attachments .files .size { flex: none; font-size: 13px; color: var(--faint); }
.attachments .files .empty { min-height: 0; font-size: 14px; }
.upload { margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
.upload.htmx-request { opacity: 0.6; pointer-events: none; }
.upload-field { display: flex; align-items: center; gap: 8px; }
.upload-field .label { margin: 0; }
.upload-field .field { flex: 1 1 auto; width: auto; min-height: 36px; }
.upload-drop {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}
.upload-drop:hover { color: var(--fg); border-color: var(--faint); }
.upload-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.upload-drop .icon { width: 16px; height: 16px; }
.upload-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.attachments > .hint { margin-top: 8px; font-size: 12px; }

/* Share dialog */

.share-dialog {
  width: min(580px, calc(100% - 32px));
  max-height: calc(100% - 96px);
  margin: 72px auto auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow-pop);
  overflow: auto;
}
.share-dialog::backdrop { background: rgba(31, 30, 27, 0.42); }
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 0;
}
.dialog-head h2 { font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.dialog-head .lede { margin-top: 6px; font-size: 14px; }
.dialog-head form { margin: 0; }

.share-status { margin: 16px 24px 0; }
.share-suggestion {
  margin: 16px 24px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--warn-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.share-suggestion p { flex: 1 1 260px; font-size: 14px; color: var(--warn-strong); overflow-wrap: anywhere; }
.share-suggestion strong { font-weight: 600; }
.share-suggestion-actions { display: flex; gap: 8px; }
.btn-dark, button.btn-dark { border-color: var(--fg); background: var(--fg); color: var(--surface); }
.btn-dark:hover { border-color: var(--fg-2); background: var(--fg-2); color: var(--surface); }

.share-people { padding: 20px 24px 0; }
.share-heading {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.share-list { list-style: none; margin: 0; padding: 0; }
.share-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 6px 0;
}
.share-row + .share-row { border-top: 1px solid var(--line-soft); }
.share-row .share-who { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.share-row .who { display: block; }
.share-detail { display: block; font-size: 13px; color: var(--faint); }
.share-row .faint { color: var(--faint); }
.share-row .role,
.share-row .share-role { flex: none; font-size: 14px; color: var(--muted); text-transform: capitalize; }
.btn-remove, button.btn-remove { color: var(--danger); }
.btn-remove:hover { color: var(--danger); }
.share-email { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.share-email input.field { flex: 1 1 220px; width: auto; min-width: 0; height: 42px; border-color: var(--line-strong); border-radius: 10px; }
.share-email select.field { flex: none; width: auto; height: 42px; border-color: var(--line-strong); border-radius: 10px; }
.share-email .btn { height: 42px; padding: 0 18px; }
.share-people .hint, .share-links .hint { margin-top: 8px; }

.share-links {
  margin-top: 20px;
  padding: 20px 24px 24px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.link-once {
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--accent-soft);
  border-radius: 12px;
  background: var(--surface);
}
.link-once label { display: block; font-size: 14px; font-weight: 600; }
.link-once-row { margin-top: 8px; display: flex; gap: 8px; }
.link-once-row .field { flex: 1 1 auto; min-width: 0; background: var(--bg); font-family: var(--mono); font-size: 13px; }
.share-link { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.share-expiry { flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; }
.share-expiry .label { margin: 0; }

@media (prefers-color-scheme: dark) {
  .share-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
}

@media (max-width: 760px) {
  .note-actions { float: none; margin: 0 0 12px; }
  .note-body { margin-top: 20px; padding: 22px 18px; font-size: 17px; }
  .note-page.editing { padding-top: 8px; }
  .edit-tools .hint { display: none; }
  .editor-title { padding: 20px 18px 14px; font-size: 28px; }
  .editor-body { padding: 18px; }
  .editor-foot { padding: 12px 18px; }
  .note-item { padding: 12px 14px; gap: 10px; }
  .share-dialog { width: calc(100% - 16px); max-height: calc(100% - 32px); margin-top: 16px; }
  .dialog-head { padding: 18px 18px 0; }
  .share-status, .share-suggestion { margin-left: 18px; margin-right: 18px; }
  .share-people { padding: 18px 18px 0; }
  .share-links { padding: 18px; }
}

/* ================================================================ tables, table, row */

.tables-lede { max-width: 60ch; }
.tables-empty { margin-top: 28px; padding: 20px; }

.table-cards {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 16px;
}

/* The name link covers the card; the home note link sits above it. */
.table-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.table-card:hover { border-color: var(--line-strong); }
.table-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 18px;
  font-weight: 600;
}
.table-card-title .icon { width: 20px; height: 20px; stroke-width: 1.7; color: var(--accent); }
.table-card-title a { color: var(--fg); text-decoration: none; }
.table-card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
}
.table-card-title a:focus-visible { outline: none; }
.table-card:has(.table-card-title a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.table-card-desc { font-size: 14px; color: var(--muted); }
.table-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  font-size: 13px;
  color: var(--faint);
}
.table-card-meta .slug { font-size: 12px; }
.table-home { display: inline-flex; align-items: center; gap: 4px; }
.table-home .icon { width: 13px; height: 13px; stroke-width: 1.9; }
.table-card .table-home a { position: relative; z-index: 1; color: inherit; }
.table-card .table-home a:hover { color: var(--accent); }

.table-page, .row-page { padding-top: 36px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--accent); }
.back-link .icon { width: 14px; height: 14px; stroke-width: 2; }

.table-title {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
}
.table-title .slug { font-size: 13px; color: var(--faint); }
.table-desc { max-width: 70ch; }
.table-note {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--faint);
}
.table-note > span { display: inline-flex; align-items: center; gap: 6px; }
.table-note .icon { width: 14px; height: 14px; }
.table-note a { color: inherit; }
.table-note a:hover { color: var(--accent); }
.table-page p.error { margin: 24px 0 0; }

.grid-tools {
  margin-top: 24px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.grid-tools select,
.grid-tools input[type="text"] {
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--fg);
  font-size: 14px;
}
.grid-tools input[type="text"] { width: 12em; min-width: 0; }
.grid-tools select:focus,
.grid-tools input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.grid-tools .hint { margin: -4px 0 0; }

.grid-tools-top {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.grid-view { display: flex; align-items: center; gap: 8px; }
.grid-view label { font-size: 14px; font-weight: 600; color: var(--muted); }
.grid-tools .grid-view select { height: 38px; padding: 0 10px; font-size: 15px; font-weight: 600; }

details.schema { margin-left: auto; font-size: 14px; }
details.schema > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
details.schema > summary::-webkit-details-marker { display: none; }
details.schema > summary:hover,
details.schema[open] > summary { background: var(--surface-2); color: var(--fg); }
details.schema > summary .icon { width: 15px; height: 15px; }
.schema-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: min(720px, 100%);
  max-height: 60vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
}
.schema-pop table { width: 100%; border-collapse: collapse; }
.schema-pop th,
.schema-pop td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}
.schema-pop th { background: var(--surface-2); color: var(--muted); font-weight: 600; white-space: nowrap; }
.schema-pop tr:last-child td { border-bottom: 0; }
.schema-pop td:first-child, .schema-pop td:nth-child(3) { white-space: nowrap; }

.grid-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.grid-filters-lead { font-size: 14px; color: var(--muted); }
.filter-row { display: flex; align-items: center; gap: 8px; }
.filter-row + .filter-row::before { content: "and"; font-size: 14px; color: var(--muted); }
.filter-row[hidden], .filter-add[hidden], .filter-remove[hidden] { display: none; }
.filter-row .filter-remove { width: 36px; height: 36px; color: var(--faint); }
.filter-remove .icon { width: 15px; height: 15px; stroke-width: 2.2; }
.filter-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.filter-add:hover { color: var(--fg); border-color: var(--faint); }
.filter-add .icon { width: 14px; height: 14px; stroke-width: 2; }
.grid-filters .btn { height: 36px; border-radius: 9px; }

.grid table { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid-scroll { overflow-x: auto; }
.grid th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.grid td {
  min-width: 8em;
  max-width: 28em;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  overflow-wrap: anywhere;
}
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid td.empty { padding: 20px 16px; text-align: center; }
.grid-empty { padding: 20px 16px; }
.grid .row-link { font-weight: 600; text-decoration: none; }
.grid .row-link:hover { text-decoration: underline; }
.grid td a:not(.row-link) { text-decoration: none; }
.grid td a:not(.row-link):hover { text-decoration: underline; }

.grid .sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  text-decoration: none;
}
.grid .sort .icon { width: 12px; height: 12px; stroke-width: 2.2; color: var(--faint); opacity: 0.6; }
.grid .sort:hover { color: var(--fg); }
.grid .sort.sorted { color: var(--fg); font-weight: 700; }
.grid .sort.sorted .icon { color: var(--accent); opacity: 1; stroke-width: 2.4; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--line-soft);
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.pill + .pill { margin-left: 4px; }

.grid-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.grid-foot .btn { height: 30px; font-size: 13px; }

#table-grid > .grid {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}
#table-grid > .grid th { background: var(--surface-2); border-top: 1px solid var(--line); }
#table-grid .grid-foot { background: var(--surface-2); }

.embed-card {
  margin: 0 0 1em;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.embed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.embed-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.embed-title .icon { width: 15px; height: 15px; color: var(--faint); }
.embed-view { font-weight: 400; color: var(--faint); }
.embed-head a { font-weight: 600; text-decoration: none; }
.embed-head a:hover { text-decoration: underline; }
.embed-card .grid th { padding: 9px 14px; border-bottom-color: var(--line-soft); font-size: 13px; }
.embed-card .grid td { padding: 10px 14px; }
.embed-card .grid-foot { padding: 8px 14px; border-top-color: var(--line-soft); color: var(--faint); }

.row-page { row-gap: 24px; }
.row-head { flex: 1 1 100%; }
.row-head h1 { margin-top: 8px; }
.row-main { display: flex; flex-direction: column; gap: 20px; }

.row-fields { padding: 8px 24px; border-radius: 14px; }
.row-fields dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
}
.row-fields dt { padding: 12px 12px 12px 0; font-size: 14px; color: var(--muted); }
.row-fields dd { margin: 0; padding: 12px 0; overflow-wrap: anywhere; }
.row-fields dt:not(:first-of-type),
.row-fields dd:not(:first-of-type) { border-top: 1px solid var(--line-soft); }

.row-body {
  padding: 28px 32px;
  border-radius: 14px;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  color: var(--prose);
}

.row-note { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--faint); }
.row-note .icon { width: 14px; height: 14px; }

.row-side .panel > h2 { margin-bottom: 6px; }
.row-links ul { list-style: none; margin: 0; padding: 0; }
.row-links li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 0;
}
.row-links li + li { border-top: 1px solid var(--line-soft); }
.row-links .icon { color: var(--faint); }
.row-link-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.row-link-text a { color: var(--fg); text-decoration: none; }
.row-link-text a:hover { color: var(--accent); }
.row-link-rel { flex: none; font-size: 12px; color: var(--faint); }
.row-links li.missing { color: var(--faint); }
.row-links li.missing .row-link-text { font-style: italic; }

.row-side .attachments {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.row-side .attachments > h2 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.row-side .files { list-style: none; margin: 0; padding: 0; }
.row-side .files li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}
.row-side .files li + li { border-top: 1px solid var(--line-soft); }
.row-side .files a { flex: 1 1 auto; min-width: 0; color: var(--fg); text-decoration: none; overflow-wrap: anywhere; }
.row-side .files a:hover { color: var(--accent); }
.row-side .files .meta { flex: none; font-size: 13px; color: var(--faint); }
.row-side .files .empty { color: var(--faint); font-size: 14px; }
.row-side .upload { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.row-side .upload select {
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: 14px;
}
.row-side .upload input[type="file"] {
  width: 100%;
  padding: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
}
.row-side .upload input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
.row-side .upload button[type="submit"] {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}
.row-side .upload button[type="submit"]:hover { background: var(--surface-2); }

@media (max-width: 760px) {
  .table-page, .row-page { padding-top: 24px; }
  .filter-row { flex: 1 1 100%; flex-wrap: wrap; }
  .filter-row + .filter-row::before { flex: 1 1 100%; }
  .filter-row select { flex: 1 1 0; min-width: 0; }
  .grid-tools .filter-row input[type="text"] { flex: 1 1 100%; width: auto; order: 1; }
  .filter-row .filter-remove { order: 0; }
  .row-fields { padding: 4px 16px; }
  .row-fields dl { grid-template-columns: minmax(96px, 120px) minmax(0, 1fr); }
  .row-body { padding: 20px; font-size: 17px; }
}

/* ================================================================ search, settings, shared and auth pages */

.search-form {
  margin-top: 20px;
  display: flex;
  gap: 8px;
}
.search-box {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.search-box .icon { width: 19px; height: 19px; color: var(--muted); }
.search-box input {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: 17px;
}
.search-box input:focus { outline: none; }
.search-box input::placeholder { color: var(--faint); }
.search-form .btn { height: 52px; padding: 0 20px; border-radius: 12px; }

.chips {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font-size: 13px;
  text-decoration: none;
}
.chip:hover { border-color: var(--line-strong); color: var(--fg); }
.chip[aria-current] {
  border-color: var(--accent);
  background: var(--accent-ring);
  color: var(--accent-hover);
  font-weight: 600;
}
.chip .icon { width: 14px; height: 14px; }

.search-count { margin: 28px 0 10px; font-size: 14px; color: var(--muted); }
.search-empty { margin-top: 28px; padding: 20px; color: var(--faint); }
.search-page p.error { margin-top: 28px; }

.hits { margin: 0; padding: 0; list-style: none; }
.hits > li { padding: 16px 20px; overflow-wrap: anywhere; }
.hits > li + li { border-top: 1px solid var(--line-soft); }
.hit-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 13px;
  color: var(--faint);
}
.hit-meta a { color: var(--muted); }
.hit-meta .kind { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--muted); }
.hit-meta .icon { width: 14px; height: 14px; }
.hit-title { margin-top: 4px; font-size: 17px; font-weight: 600; }
.hit-title a { color: var(--fg); text-decoration: none; }
.hit-title a:hover { color: var(--accent); }
.snippet { margin-top: 4px; color: var(--fg-2); }

.pager {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.search-tips { padding: 18px 20px; }
.panel.search-tips > h2 { margin-bottom: 4px; }
.search-tips > .hint:first-of-type { margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.search-tips > .hint:last-child { margin-top: 14px; }
.search-tips dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 14px;
  align-items: baseline;
  font-size: 14px;
}
.search-tips dd { margin: 0; color: var(--fg-2); }
.search-tips dt code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--accent-ring);
  color: var(--accent-hover);
  font-size: 12.5px;
  white-space: nowrap;
}
.search-tips dd code, .search-tips .hint code { padding: 0; background: none; }

.settings-page { display: flex; flex-direction: column; gap: 20px; }
.settings-page > h1 { margin-bottom: 8px; }
.settings-page > section {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.settings-page .lede { margin: 4px 0 14px; font-size: 14px; }
.settings-title { display: flex; align-items: center; gap: 10px; }
.settings-title .count { min-width: 22px; height: 22px; padding: 0 7px; }
.settings-page p.error { margin: 0 0 14px; }
.plan-limits {
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
  font-size: 14px;
}
.plan-limits dt { padding: 8px 12px 8px 0; color: var(--muted); }
.plan-limits dd { margin: 0; padding: 8px 0; }
.plan-limits dt:not(:first-of-type),
.plan-limits dd:not(:first-of-type) { border-top: 1px solid var(--line-soft); }
#plan .row-form + .row-form { margin-top: 10px; }
#notifications h3 { margin: 22px 0 0; }
#notifications h3:first-of-type { margin-top: 14px; }
#notifications .row-form + .row-form,
#notifications .shares + .row-form,
#notifications .steps + .row-form { margin-top: 14px; }
#notifications .hint { margin-top: 6px; }
.device-this {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

#pending-shares > .status { margin-bottom: 10px; color: var(--ok); font-size: 14px; }
.shares { margin: 0; padding: 0; list-style: none; }
.shares > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}
.shares > li:last-child { padding-bottom: 0; }
.share-what { flex: 1 1 300px; min-width: 0; overflow-wrap: anywhere; }
.share-what a { color: var(--fg); font-weight: 600; text-decoration: none; }
.share-what a:hover { color: var(--accent); }
.share-what .who { display: block; font-size: 14px; color: var(--muted); }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share-actions form { margin: 0; }
.share-what strong { font-weight: 600; }
.offered-page > .share-actions { margin: 16px 0 28px; }
.offered-page > .meta-chips { margin-top: 10px; }
.offered-page > .public-tasks { margin-top: 32px; }
.shared-page > .footnote { margin-top: 0; }

.link-once { margin-bottom: 14px; }
.link-once .hint { margin-top: 6px; }
.copy-row { display: flex; gap: 8px; }
.copy-row .field {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 13px;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.steps > li { position: relative; min-width: 0; padding-left: 40px; }
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 700;
}
.steps > li > p:first-child { margin: 2px 0 8px; }
.steps > li > p:only-child { margin-bottom: 0; }
.steps .hint { margin-top: 6px; }
.steps .row-form { gap: 12px; }
.steps form { margin: 0; }
#test-status { min-height: 0; font-size: 14px; color: var(--fg-2); }

.settings-page > .settings-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-account .lede { margin-bottom: 0; }
.settings-account form { margin: 0; }

.public-page { max-width: 720px; margin: 0 auto; padding: 64px 24px 48px; }
.public-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--muted);
  font-size: 13px;
}
.public-pill .icon { width: 14px; height: 14px; }
.public-page > h1 { margin-top: 16px; font-size: 44px; line-height: 1.12; overflow-wrap: anywhere; }
.public-prose {
  margin-top: 28px;
  padding: 36px 40px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--prose);
  font: 18px/1.65 var(--serif);
}
.public-prose .markdown h1, .public-prose .markdown h2, .public-prose .markdown h3 { color: var(--fg); }
.public-tasks { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.public-tasks h2 {
  margin-bottom: 10px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.public-tasks ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.public-tasks li { display: flex; align-items: baseline; gap: 10px; overflow-wrap: anywhere; }
.public-tasks li::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  transform: translateY(2px);
}
.public-foot { margin-top: 64px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--faint); }
.public-foot .brand-mark { width: 16px; height: 16px; }
.public-foot .brand-mark rect { fill: var(--faint); }
.public-abuse { margin-top: 8px; font-size: 13px; color: var(--faint); }

.auth-page { display: flex; justify-content: center; padding: 96px 16px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
}
.auth-card .brand-mark { width: 40px; height: 40px; }
.auth-card h1 { font-size: 28px; }
.auth-card p { color: var(--muted); }
.auth-card .btn { margin-top: 8px; }

@media (max-width: 760px) {
  .search-form .btn { padding: 0 16px; }
  .hits > li { padding: 14px 16px; }
  .settings-page > section { padding: 20px 16px; }
  .public-page { padding: 32px 16px 40px; }
  .public-page > h1 { font-size: 34px; }
  .public-prose { padding: 22px 18px; font-size: 18px; }
  .public-foot { margin-top: 40px; }
  .auth-page { padding: 48px 16px; }
}

/* ================================================================ admin */
.admin-page .grid td { vertical-align: middle; }
.admin-page .grid form { margin: 0; }
.quota-form { display: flex; gap: 6px; }
.quota-form .field { width: 9em; height: 32px; padding: 0 8px; font-size: 13px; }
.quota-form .btn, .admin-page .grid .btn { height: 32px; font-size: 13px; }
.admin-next { margin-top: 14px; }

/* ================================================================ narrow screens */

@media (max-width: 760px) {
  body { font-size: 16px; }

  .topbar-inner { padding: 8px 16px; gap: 8px 12px; }
  .topsearch { display: none; }
  .topbar-tools { margin-left: auto; }

  .mainnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    justify-content: space-around;
    gap: 0;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .mainnav a {
    position: relative;
    flex: 1 1 0;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 54px;
    padding: 4px 2px;
    font-size: 12px;
    line-height: 1.15;
    text-align: center;
  }
  .mainnav a[aria-current="page"] { background: transparent; color: var(--accent); }
  .mainnav .count {
    position: absolute;
    top: 2px;
    left: calc(50% + 6px);
    min-width: 18px;
    height: 18px;
    font-size: 11px;
  }
  .mainnav .nav-search { display: flex; }

  body.has-nav { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(80px + env(safe-area-inset-bottom)); }

  .page, .page-wide, .page-split { padding: 28px 16px 48px; }
  .page-split { gap: 24px; }
  h1 { font-size: 32px; }

  .task .tick label { width: 44px; height: 48px; }
}
