:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #1d2327;
  --muted: #5b6770;
  --line: #ddd8cd;
  --accent: #b5652b;
  --accent-ink: #ffffff;
  --danger: #a4332b;
  --ok: #2f6b3f;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15191c;
    --surface: #1d2226;
    --ink: #eef0f1;
    --muted: #9aa5ad;
    --line: #2e353a;
    --accent: #e08a4c;
    --accent-ink: #15191c;
    --danger: #ef8a80;
    --ok: #86c797;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); font: 1rem/1.6 var(--sans);
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; }

/* Header and footer */
.site-header, .site-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 960px; width: 100%; margin: 0 auto; padding: 20px 16px;
}
.brand { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.site-nav { display: flex; align-items: center; gap: 16px; font-size: .95rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--ink); }
.site-nav form { margin: 0; }
/* Phones: the links wrap under the name instead of pushing the page sideways. */
@media (max-width: 760px) {
  .site-header { flex-wrap: wrap; gap: 6px 16px; }
  .site-nav { flex-wrap: wrap; gap: 4px 14px; }
}
.site-footer { color: var(--muted); font-size: .85rem; }
.site-footer a { color: var(--muted); }
main { flex: 1; width: 100%; }

/* Links styled as buttons, and plain buttons in the nav */
.link-button {
  background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer;
}
.link-button:hover { color: var(--ink); }

/* Coming-soon homepage */
/* Front page */
.home { max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }
.eyebrow {
  margin: 0 0 14px; color: var(--accent); font-size: .8rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
}
.lede { color: var(--muted); font-size: 1.12rem; line-height: 1.65; max-width: 40em; }
.hero {
  position: relative; overflow: hidden; margin: 8px 0 0; padding: clamp(56px, 10vw, 112px) clamp(20px, 6vw, 72px);
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
}
/* A faint drawing-sheet grid, fading out towards the text. */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(105deg, transparent 35%, #000 100%);
  -webkit-mask-image: linear-gradient(105deg, transparent 35%, #000 100%);
  opacity: .7;
}
.hero::after {
  content: ""; position: absolute; right: -60px; bottom: -60px; width: 280px; height: 280px; pointer-events: none;
  border: 2px solid var(--accent); border-radius: 50%; opacity: .14;
}
.hero-inner { position: relative; max-width: 640px; }
.hero h1 { font-size: clamp(2.2rem, 5.4vw, 3.6rem); line-height: 1.08; margin: 0 0 20px; letter-spacing: -.01em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-actions .button { padding: 12px 22px; border-radius: 8px; }

.home-section { margin-top: clamp(56px, 8vw, 88px); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section-head a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.section-head a:hover { color: var(--accent); }
.section-title { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 24px; }

.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.service { background: var(--surface); padding: 26px 24px 28px; }
.service-num { display: block; color: var(--accent); font: 600 .85rem/1 var(--sans); letter-spacing: .08em; margin-bottom: 18px; }
.service h3 { font-size: 1.25rem; margin: 0 0 10px; }
.service p { margin: 0; color: var(--muted); font-size: .95rem; }

.insight-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.insight-card {
  display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.insight-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.insight-meta { color: var(--muted); font-size: .82rem; letter-spacing: .02em; }
.insight-card h3 { font-size: 1.25rem; line-height: 1.3; margin: 10px 0 10px; }
.insight-card p { margin: 0 0 18px; color: var(--muted); font-size: .95rem; flex: 1; }
.insight-more { color: var(--accent); font-weight: 600; font-size: .92rem; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; counter-reset: step; }
.steps li { counter-increment: step; display: flex; flex-direction: column; gap: 6px; padding-top: 18px; border-top: 2px solid var(--line); }
.steps li::before { content: counter(step); font: 400 2rem/1 var(--serif); color: var(--accent); margin-bottom: 6px; }
.steps strong { font-size: 1.05rem; }
.steps span { color: var(--muted); font-size: .95rem; }
.how-sign-in { margin: 28px 0 0; color: var(--muted); }

.footer-nav { display: flex; gap: 18px; }

/* Insights pages */
.public-page { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
.public-head { max-width: 720px; margin: 24px 0 40px; }
.public-head h1, .article-head h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.12; margin: 0 0 16px; }
.article { max-width: 760px; }
.article .crumbs a { color: var(--muted); }
.article-head { margin: 8px 0 28px; }
.article-byline { color: var(--muted); font-size: .9rem; margin: 18px 0 0; }
.draft-flag { display: inline-block; padding: 4px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--danger); color: var(--danger); font-size: .85rem; }
.case-box {
  display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  padding: 16px 20px; margin: 0 0 32px; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; background: var(--surface); font-size: .92rem;
}
.case-box dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.case-box dt { color: var(--muted); }
.case-box dd { margin: 0; }
.case-box a { font-weight: 600; white-space: nowrap; }
.prose { font-size: 1.07rem; line-height: 1.75; }
.prose h2 { font-size: 1.55rem; margin: 2em 0 .6em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose li { margin-bottom: .55em; }
.prose em { font-style: italic; }
.prose blockquote { margin: 1.4em 0; padding-left: 1em; border-left: 3px solid var(--accent); color: var(--muted); }
.more-insights { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.more-insights h2 { font-size: 1.4rem; margin: 0 0 20px; }
body:has(.home) .site-header, body:has(.home) .site-footer,
body:has(.public-page) .site-header, body:has(.public-page) .site-footer { max-width: 1080px; }
@media (max-width: 520px) {
  .site-nav { gap: 12px; font-size: .9rem; }
  .hero::after { display: none; }
}

/* Content pages and allauth forms */
.page { max-width: 460px; margin: 24px auto 64px; padding: 0 16px; }
.page.wide { max-width: 760px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 28px 24px;
}
.card h1 { font-size: 1.8rem; margin: 0 0 16px; }
.card h2 { font-size: 1.3rem; margin: 24px 0 8px; }
.card p { color: var(--muted); }

.card form p, .card form > div { margin: 0 0 14px; }
.card label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
.card input[type=text], .card input[type=email], .card input[type=password],
.card input[type=number], .card input:not([type]), .card select, .card textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
.card input:focus, .card select:focus, .card textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.card input[type=checkbox] { margin-right: 6px; }
.card .helptext, .card small { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }
.card ul.errorlist { color: var(--danger); padding-left: 18px; margin: 4px 0; font-size: .9rem; }
.card button, .button {
  display: inline-block; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer;
  color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 6px; text-decoration: none;
}
.card button[type=submit] + button, .card button.secondary {
  color: var(--ink); background: transparent; border: 1px solid var(--line);
}
.card a + a { margin-left: 16px; }
.card img { max-width: 100%; height: auto; background: #fff; padding: 8px; border-radius: 6px; }
.card code, .card pre { font-size: .9rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.card table { width: 100%; border-collapse: collapse; }
.card th, .card td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }

.messages { list-style: none; max-width: 760px; margin: 0 auto 16px; padding: 0 16px; }
.messages li {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 10px 14px; margin-bottom: 8px;
}

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.tile h3 { margin: 0 0 6px; font-size: 1.1rem; }
.tile p { margin: 0; font-size: .92rem; }
.badge {
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.card td small { display: block; color: var(--muted); }
.card td.actions { text-align: right; }
.card td.actions form { margin: 0; }
.card button.small { padding: 4px 10px; font-size: .85rem; }
.button-link { margin-left: 12px; }

/* Files: sidebar and list, laid out like the Finder */
body:has(.drive) .site-header, body:has(.drive) .site-footer { max-width: 1160px; }
.drive {
  display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px;
  max-width: 1160px; width: 100%; margin: 8px auto 64px; padding: 0 16px;
}
.drive-side { font-size: .95rem; }
.drive-side nav { display: flex; flex-direction: column; gap: 2px; }
.drive-side a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drive-side a:hover { background: var(--surface); }
.drive-side a.active { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.drive-side svg { flex: none; width: 18px; height: 18px; color: var(--accent); }
.drive-side h2 {
  font: 600 .78rem/1 var(--sans); letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); margin: 22px 10px 8px;
}

.drive-main { position: relative; min-width: 0; border-radius: 10px; }
.drive-main.dragging { outline: 2px dashed var(--accent); outline-offset: 6px; }
/* Dragging a row onto a folder (files.js). */
.drive-list tr.being-dragged td { opacity: .5; }
.drive-list tr.drop-target td { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.drive-list tr.drop-target td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.drive-side a.drop-target, .crumbs a.drop-target { background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--ink); }
.crumbs a.drop-target { border-radius: 4px; }
.drive-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.drive-bar h1 { font-size: 1.7rem; margin: 0; overflow-wrap: anywhere; }
.drive-summary { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.drive-actions { display: flex; gap: 8px; }
.drive-actions form { margin: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.drive-section { font-size: 1.15rem; margin: 28px 0 6px; }
.drive-hint { color: var(--muted); font-size: .85rem; text-align: center; margin: 18px 0 0; }

.button.secondary { color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
.button.danger, .card button.danger { color: var(--danger); }

.drive-list { width: 100%; border-collapse: collapse; font-size: .95rem; table-layout: fixed; }
.drive-list th {
  text-align: left; font-weight: 500; font-size: .85rem; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.drive-list th a { color: inherit; text-decoration: none; }
.drive-list th a:hover { color: var(--ink); }
.sort-arrow { margin-left: 4px; }
.drive-list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.drive-list tbody tr:hover td { background: var(--surface); }
/* Fixed columns; long names are cut short with an ellipsis, as in the Finder. */
.drive-list .col-check { width: 34px; padding-right: 0; cursor: default; }
.drive-list .col-check input { display: block; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.drive-list tbody tr:has(.col-check input:checked) td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.drive-list .col-icon { width: 46px; padding-right: 0; }
.drive-list .col-kind { width: 28%; }
.drive-list .col-size { width: 96px; }
.drive-list .col-date { width: 150px; }
.drive-list .col-menu { width: 52px; text-align: right; }
.drive-list .icon { display: block; width: 28px; height: 28px; }
.drive-list .col-name, .drive-list .col-kind, .drive-list .col-name small {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drive-list .col-name { font-size: 1.02rem; }
.drive-list .col-name a { color: var(--ink); text-decoration: none; }
.drive-list .col-name a:hover { color: var(--accent); text-decoration: underline; }
.drive-list .col-name small { display: block; color: var(--muted); font-size: .82rem; }
.drive-list td.col-kind, .drive-list td.col-size, .drive-list td.col-date { color: var(--muted); white-space: nowrap; }
.drive-empty { color: var(--muted); text-align: center; padding: 40px 10px; margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* File type colours */
.icon-doc { color: #b05ee8; }
.icon-pdf { color: #e5484d; }
.icon-word { color: #2b7cd3; }
.icon-sheet { color: #1f9d55; }
.icon-slides { color: #e0702a; }
.icon-image { color: #12a594; }
.icon-archive { color: #8a8f98; }
.icon-media { color: #d6409f; }
.icon-mail { color: #3e63dd; }

/* Row menu */
.row-menu { position: relative; display: inline-block; }
.row-menu summary {
  list-style: none; cursor: pointer; width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 6px; color: var(--muted);
}
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu summary:hover, .row-menu[open] summary { background: var(--bg); color: var(--ink); }
.row-menu summary svg { width: 20px; height: 20px; }
.row-menu .menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 210px;
  display: flex; flex-direction: column; padding: 6px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.row-menu .menu form { margin: 0; }
.row-menu .menu a, .row-menu .menu button {
  display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 5px; background: none;
  font: inherit; font-size: .92rem; text-align: left; color: var(--ink); text-decoration: none; cursor: pointer;
}
.row-menu .menu a:hover, .row-menu .menu button:hover { background: var(--bg); }
.row-menu .menu .danger { color: var(--danger); }
.row-menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }

/* New folder / rename dialog */
.drive-dialog { width: min(420px, calc(100vw - 32px)); color: var(--ink); }
.drive-dialog::backdrop { background: rgba(0, 0, 0, .35); }
.drive-dialog h2 { margin: 0 0 14px; font-size: 1.3rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Upload progress */
.upload-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 20; width: min(360px, calc(100vw - 32px));
  max-height: 50vh; overflow: auto; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.upload-panel h2 { font: 600 1rem/1.3 var(--sans); margin: 0 0 8px; }
.upload-panel ul { list-style: none; margin: 0; padding: 0; }
.upload-panel li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 6px 0; font-size: .88rem; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-status { color: var(--muted); }
.upload-panel progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--accent); }
.upload-panel li.failed .upload-status { grid-column: 1 / -1; color: var(--danger); }

/* Ticked rows: download them together. Floats over the page so the list doesn't jump when it appears. */
.selection-bar {
  position: fixed; left: 50%; bottom: 20px; z-index: 15; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px);
  margin: 0; padding: 8px 10px 8px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}
.selection-bar[hidden] { display: none; }
.selection-bar [data-selection-count] { margin-right: 10px; font-size: .92rem; white-space: nowrap; }
.selection-bar .button { padding: 6px 14px; }

/* Clicking anywhere on a folder's row opens it */
.drive-list tr.is-folder { cursor: pointer; }
.drive-list tr.is-folder:active td { background: var(--line); }
.row-menu .menu { transform-origin: top right; }
.row-menu .menu.up { top: auto; bottom: calc(100% + 4px); transform-origin: bottom right; --menu-shift: 6px; }
/* Opened by right-clicking the row: files.js puts it where the pointer is */
.row-menu .menu.at-pointer { right: auto; bottom: auto; transform-origin: top left; }

/* Public links */
.link-row { display: flex; gap: 8px; margin: 0 0 10px; }
.card .link-row input { flex: 1; min-width: 0; font-size: .9rem; }
.card .link-row button { flex: none; }
.link-off { margin: 0 0 8px; }
.share-list { margin-top: 18px; }
.share-done { margin: 24px 0 0; }
.drive.public { grid-template-columns: minmax(0, 1fr); max-width: 960px; }
body:has(.drive.public) .site-header, body:has(.drive.public) .site-footer { max-width: 960px; }
.public-file { text-align: center; }
.public-file-icon { width: 72px; height: 72px; margin: 4px auto 12px; display: block; }
.card.public-file h1 { font-size: 1.5rem; overflow-wrap: anywhere; margin-bottom: 6px; }
.public-file-actions { display: flex; justify-content: center; gap: 10px; margin: 20px 0 8px; }
.card .public-file-actions a + a { margin-left: 0; }
.public-file-note { font-size: .85rem; }

/* Motion: menus, dialogs and panels ease in and out, and pages glide between each other.
   Everything here is skipped for people who ask their system for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  .drive-list td, .drive-side a, .row-menu summary, .row-menu .menu a, .row-menu .menu button,
  .button, .card button, .crumbs a {
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
  }
  .button:active, .card button:active { transform: scale(.97); }

  .row-menu[open] .menu { animation: menu-in .17s cubic-bezier(.2, .8, .2, 1); }
  .row-menu.closing .menu { animation: menu-out .12s ease-in forwards; }
  .drive-dialog[open] { animation: pop-in .2s cubic-bezier(.2, .8, .2, 1); }
  .drive-dialog[open]::backdrop { animation: fade-in .2s ease-out; }
  .upload-panel:not([hidden]) { animation: rise-in .25s cubic-bezier(.2, .8, .2, 1); }
  .messages li { animation: rise-in .3s cubic-bezier(.2, .8, .2, 1); }

  /* Page changes: header and sidebar stay put while the content moves. */
  .site-header { view-transition-name: site-header; }
  #page { view-transition-name: page; }
  .drive-side { view-transition-name: drive-side; }
  .drive-main { view-transition-name: drive-main; }
  ::view-transition-group(*) { animation-duration: .28s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  html:active-view-transition-type(forward) ::view-transition-old(drive-main) { animation: .16s cubic-bezier(.4, 0, 1, 1) both slide-out-left; }
  html:active-view-transition-type(forward) ::view-transition-new(drive-main) { animation: .3s cubic-bezier(.2, .8, .2, 1) both slide-in-right; }
  html:active-view-transition-type(back) ::view-transition-old(drive-main) { animation: .16s cubic-bezier(.4, 0, 1, 1) both slide-out-right; }
  html:active-view-transition-type(back) ::view-transition-new(drive-main) { animation: .3s cubic-bezier(.2, .8, .2, 1) both slide-in-left; }
  /* The same slides when htmx swaps the list in place (files.js sets data-slide). */
  html[data-slide="forward"]::view-transition-old(drive-main) { animation: .16s cubic-bezier(.4, 0, 1, 1) both slide-out-left; }
  html[data-slide="forward"]::view-transition-new(drive-main) { animation: .3s cubic-bezier(.2, .8, .2, 1) both slide-in-right; }
  html[data-slide="back"]::view-transition-old(drive-main) { animation: .16s cubic-bezier(.4, 0, 1, 1) both slide-out-right; }
  html[data-slide="back"]::view-transition-new(drive-main) { animation: .3s cubic-bezier(.2, .8, .2, 1) both slide-in-left; }
}
@keyframes menu-in { from { opacity: 0; transform: translateY(var(--menu-shift, -6px)) scale(.96); } }
@keyframes menu-out { to { opacity: 0; transform: translateY(var(--menu-shift, -6px)) scale(.97); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes slide-out-left { to { opacity: 0; transform: translateX(-36px); } }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(36px); } }
@keyframes slide-out-right { to { opacity: 0; transform: translateX(36px); } }
@keyframes slide-in-left { from { opacity: 0; transform: translateX(-36px); } }

/* Move: folder tree */
.folder-picker { border: 0; padding: 0; margin: 0 0 18px; }
.folder-picker legend { font-weight: 600; margin-bottom: 8px; }
.card .folder-picker label {
  display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0;
  padding: 6px 8px 6px calc(8px + var(--depth, 0) * 20px); border-radius: 6px; cursor: pointer;
}
.card .folder-picker label:hover { background: var(--bg); }

@media (max-width: 760px) {
  .drive { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .drive-side nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .drive-side h2 { margin: 10px 10px 6px; }
  .drive-list .col-kind { display: none; }
}
@media (max-width: 520px) {
  .drive-list .col-date { display: none; }
  .drive-list td, .drive-list th { padding-left: 6px; padding-right: 6px; }
}

/* Period tabs (contracts inbox) */
.range { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; }
.card .range a { margin: 0; padding: 4px 10px; border-radius: 6px; font-size: .88rem; color: var(--muted); text-decoration: none; }
.card .range a.active { background: var(--accent); color: var(--accent-ink); }
.card label.link-label { margin: 14px 0 6px; font-weight: 600; }
.card label.link-label span { font-weight: 400; color: var(--muted); }

/* "Keep me signed in" on the sign-in page: tick box beside its label */
.card p:has(> input[type=checkbox]) { display: flex; align-items: center; gap: 8px; }
.card p:has(> input[type=checkbox]) input { order: -1; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.card p:has(> input[type=checkbox]) label { margin: 0; font-weight: 400; cursor: pointer; }

/* Contracts */
.page.wider { max-width: 1060px; }
.contracts .card + .card { margin-top: 16px; }
.contracts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.contracts-head h1 { font-size: 1.8rem; margin: 0; }
.card .contracts-head h1 { font-size: 1.5rem; }
.contracts .crumbs { margin: 0 0 10px; }
.tab-count {
  display: inline-block; min-width: 1.4em; padding: 0 6px; margin-left: 2px; border-radius: 99px;
  font-size: .75rem; line-height: 1.5; text-align: center; background: var(--line); color: var(--ink);
}
.range a.active .tab-count { background: rgba(255, 255, 255, .25); color: inherit; }

.contract-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px;
  padding: 16px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink); text-decoration: none; transition: border-color .15s ease, transform .15s ease;
}
.contract-card:hover { border-color: var(--accent); }
.contract-card h2 { font-size: 1.15rem; margin: 0 0 4px; }
.contract-card p { margin: 0; color: var(--muted); font-size: .9rem; }
.contract-card-main { min-width: 0; }
.contracts-empty { text-align: center; }

.status-pill {
  flex: none; display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600;
  white-space: nowrap; border: 1px solid currentColor; color: var(--muted);
}
.status-pill.big { font-size: .9rem; padding: 5px 14px; }
.status-pill[data-status="received"] { color: #b5652b; }
.status-pill[data-status="in_review"] { color: #2b7cd3; }
.status-pill[data-status="advice_sent"], .status-pill[data-status="replied"] { color: var(--ok); }
@media (prefers-color-scheme: dark) {
  .status-pill[data-status="received"] { color: #e08a4c; }
  .status-pill[data-status="in_review"] { color: #79b2f0; }
}

.inbox-card { padding: 8px 12px; overflow-x: auto; }
.card table.inbox { min-width: 720px; }
.card .inbox th { font-size: .8rem; font-weight: 500; color: var(--muted); }
.card .inbox td { vertical-align: top; padding: 10px 6px; }
.card .inbox td small { display: block; color: var(--muted); font-size: .8rem; }
.card .inbox .ref a { font-weight: 600; white-space: nowrap; }
.inbox tr.urgent td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.flag { color: var(--danger); font-weight: 600; font-size: .85rem; }
.overdue { color: var(--danger); font-weight: 600; }
.quiet, .card p.quiet { color: var(--muted); }

.contract-form .field { margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.contract-form .field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.contract-form legend, .contract-form .field-label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px; }
.card label.choice {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 9px 12px; font-weight: 400; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px;
}
.card label.choice:has(input:checked) { border-color: var(--accent); background: var(--bg); }
.card label.choice input { margin: 0; accent-color: var(--accent); }
.field-check { display: flex; align-items: flex-end; }
.field-check label.choice { width: 100%; }
.card .field-error { color: var(--danger); font-size: .88rem; margin: 6px 0 0; }
.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.card .form-actions a + a { margin: 0; }

.dropzone {
  border: 2px dashed var(--line); border-radius: 10px; padding: 22px 18px; text-align: center;
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone.small { padding: 14px; margin-top: 14px; }
.dropzone.dragging { border-color: var(--accent); background: var(--bg); }
.card .dropzone p { margin: 0; }
.link-like { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.card button.link-like { padding: 0; background: none; color: var(--accent); font-weight: inherit; }
.dropzone-files { list-style: none; margin: 10px 0 0; padding: 0; text-align: left; }
.dropzone-files:empty { display: none; }
.dropzone-files li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 2px 10px;
  padding: 8px 10px; border-top: 1px solid var(--line); font-size: .9rem;
}
.dropzone-files progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--accent); }
.dropzone-files li.failed .upload-status { color: var(--danger); }
.card button.file-remove {
  width: 26px; height: 26px; padding: 0; border-radius: 50%; line-height: 1; font-size: 1.1rem;
  color: var(--muted); background: transparent; border: 1px solid var(--line);
}

.submission-sub { margin: 4px 0 0; color: var(--muted); }
.card .notice { background: var(--bg); border-left: 3px solid var(--ok); padding: 10px 14px; border-radius: 6px; color: var(--ink); }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 16px 0 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.details .notes { white-space: normal; }
.status-form { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.card .status-form label { margin: 0; }
.card .status-form select { width: auto; }

.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.doc-list .icon { flex: none; width: 26px; height: 26px; }
.doc-main { flex: 1; min-width: 0; }
.doc-main a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.doc-main a:hover { color: var(--accent); text-decoration: underline; }
.doc-main small { display: block; color: var(--muted); font-size: .82rem; }
.card .doc-download { font-size: .9rem; margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 6px 0 6px 18px; position: relative; color: var(--ink); }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.timeline time { display: block; color: var(--muted); font-size: .8rem; }
/* A single article on its own reads better wide than as a lone narrow card. */
.home .insight-card:only-child { grid-column: 1 / -1; max-width: 760px; }

/* Articles: legal references coloured like syntax highlighting (see insights/highlight.py). */
:root {
  --hl-case: #7c3aed; --hl-law: #1d6fd6; --hl-cite: #c2410c; --hl-money: #15803d; --hl-date: #0f766e;
  --code: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --hl-case: #c4a5ff; --hl-law: #7cb5ff; --hl-cite: #ffa36b; --hl-money: #6fdc9a; --hl-date: #5fd4c4; }
}
.prose em, .hl-key em { color: var(--hl-case); font-style: italic; }
.prose strong, .hl-key strong { color: var(--accent); font-weight: 700; }
.hl-law, .hl-cite {
  font-family: var(--code); font-size: .86em; padding: .05em .35em; border-radius: 4px; white-space: nowrap;
}
.hl-law { color: var(--hl-law); background: color-mix(in srgb, var(--hl-law) 10%, transparent); }
.hl-cite { color: var(--hl-cite); background: color-mix(in srgb, var(--hl-cite) 10%, transparent); }
.hl-money { color: var(--hl-money); font-weight: 600; font-variant-numeric: tabular-nums; }
.hl-date { color: var(--hl-date); }
.hl-key {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 28px; padding: 10px 14px;
  border: 1px dashed var(--line); border-radius: 8px; font-size: .82rem;
}
.hl-key-label { color: var(--muted); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .72rem; }

/* Staff-only bar for comparing alternative drafts of an article */
.style-tests { margin: 8px 0 24px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.style-tests-title { margin: 0 0 10px; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.style-tests-title span { color: var(--muted); font-weight: 400; letter-spacing: 0; text-transform: none; }
.style-tests-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.style-tests-tabs a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .88rem;
  transition: border-color .15s ease;
}
.style-tests-tabs a:hover { border-color: var(--accent); }
.style-tests-tabs a.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.style-tests-score { font: 600 1.15rem/1 var(--code); color: var(--accent); white-space: nowrap; }
.style-tests-score small { font-size: .7rem; color: var(--muted); font-weight: 400; }
.style-tests-note { margin: 12px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.55; }
