/* Served as /styles.css (stored as .txt so the Worker bundles it as text). */
/* Drystone Web brand fonts, self-hosted (src/brand.tsx). */
@font-face { font-family: "Archivo"; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/archivo-700.woff2) format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 800; font-style: normal; font-display: swap; src: url(/fonts/archivo-800.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/instrument-sans-400.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url(/fonts/instrument-sans-500.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url(/fonts/instrument-sans-600.woff2) format("woff2"); }

/* Drystone Web tokens (drystone-web-handoff/design/tokens.css), mapped onto the app's variables.
   Limestone grounds, slate ink, moss for action, gorse used sparingly. Flat: hairlines, not shadows. */
:root {
  --limestone: #EEEDE8;
  --limestone-raised: #F8F7F4;
  --line: #D3D1C8;
  --ink: #1F2427;
  --ink-muted: #5C6366;
  --moss: #3E5A3A;
  --on-moss: #FFFFFF;
  --moss-soft: #DDE5D8;
  --gorse: #D9A23A;
  --gorse-deep: #8A5E0F;
  --slate: #2E3A40;
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-sans: "Instrument Sans", "Segoe UI", system-ui, sans-serif;

  --bg: var(--limestone);
  --surface: var(--limestone-raised);
  --sunken: #F2F1EC;
  --text: var(--ink);
  --muted: var(--ink-muted);
  --border: var(--line);
  --border-strong: #BEBBB0;
  --heading: var(--ink);
  --accent: var(--moss);
  --accent-hover: #2F4A2C;
  --accent-text: var(--on-moss);
  --accent-soft: var(--moss-soft);
  --link: var(--moss);
  --danger: #A63D2A;
  --warn-bg: #F4EAD3;
  --warn-text: var(--gorse-deep);
  --st-needs: var(--gorse-deep);
  --st-waiting: var(--slate);
  --st-hold: #7A6A4A;
  --st-done: #8A8E89;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  /* Flat brand: "shadows" are hairline rings; hover swaps the ring to moss. */
  --shadow: 0 0 0 1px var(--line);
  --shadow-lift: 0 0 0 1px var(--moss);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --limestone: #1A1C1B;
    --limestone-raised: #232625;
    --line: #3A3E3C;
    --ink: #ECEDEA;
    --ink-muted: #A3A8A5;
    --moss: #8DB585;
    --on-moss: #1A1C1B;
    --moss-soft: #24331F;
    --gorse: #E3B04B;
    --gorse-deep: #E3B04B;
    --slate: #0F1416;
    --sunken: #1E2120;
    --border-strong: #4A4F4C;
    --accent-hover: #A3C59C;
    --danger: #E38B79;
    --warn-bg: #33291A;
    --st-waiting: #9FB2BA;
    --st-hold: #C2AE84;
    --st-done: #8A8E89;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; color: var(--heading); font-family: var(--font-display); letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
code { background: var(--sunken); border: 1px solid var(--border); padding: 0.05em 0.35em; border-radius: 5px; word-break: break-all; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 8px; padding-bottom: 72px; flex: 1 0 auto; width: 100%; }
.narrow { max-width: 680px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }

/* ---------------------------------------------------------------- Header */
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 14px 20px; max-width: 1120px; margin: 0 auto; width: 100%;
}
.brand { display: inline-flex; align-items: center; color: var(--ink); justify-self: start; }
.brand:hover { text-decoration: none; color: var(--ink); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { flex: none; color: var(--ink); }
.wordmark-text { display: inline-flex; align-items: baseline; gap: 6px; line-height: 1; }
.wm-main { font-family: var(--font-display); font-weight: 800; font-size: 24px; letter-spacing: -0.035em; color: var(--ink); }
.wm-second { font-weight: 500; font-size: 15px; color: var(--moss); white-space: nowrap; }
.site-footer { background: var(--slate); color: #ECEDEA; flex-shrink: 0; }
.site-footer .wrap { display: flex; align-items: center; gap: 12px; padding-top: 22px; padding-bottom: 22px; font-size: 0.92rem; }
.site-footer .brand-mark { color: #ECEDEA; }
.site-footer strong { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.01em; }
.topnav { display: flex; align-items: center; gap: 4px; justify-self: center; }
.topnav a { color: var(--text); font-weight: 500; padding: 8px 14px; border-radius: var(--radius); }
.topnav a:hover { background: var(--surface); text-decoration: none; }
.top-right { justify-self: end; display: flex; align-items: center; gap: 10px; }
.menu.me summary { cursor: pointer; border-radius: var(--radius); }
.menu.me summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu.me .menu-body { width: 240px; display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.menu.me .menu-body > a, .menu.me .menu-body button.link { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.menu.me .menu-body > a:hover, .menu.me .menu-body button.link:hover { background: var(--sunken); text-decoration: none; }
.me-name { display: flex; flex-direction: column; padding: 6px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; overflow-wrap: anywhere; }

/* Project header: name centered with pill navigation underneath */
.project-head { text-align: center; padding: 18px 16px 22px; }
.project-name { display: inline-block; font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; color: var(--heading); letter-spacing: -0.035em; line-height: 1.1; }
.project-name:hover { text-decoration: none; opacity: 0.85; }
.pills { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.pills a {
  padding: 7px 14px; border-radius: var(--radius); color: var(--text); font-weight: 600; font-size: 0.92rem;
  background: var(--surface); border: 1px solid var(--border);
}
.pills a:hover { background: var(--surface); text-decoration: none; }
.pills a.active { background: var(--moss); border-color: var(--moss); color: var(--on-moss); }

/* ---------------------------------------------------------------- Surfaces */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px;
}
/* A sheet is the white page that project tools sit on. */
.sheet {
  background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--line);
  padding: 28px 40px 40px; max-width: 960px; margin: 0 auto;
}
.sheet .card { box-shadow: none; }
.sheet-title { text-align: center; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.lead { font-size: 1.1rem; color: var(--muted); margin: -8px auto 16px; max-width: 640px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.wrap-row { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Page title: centered, with actions on the left like a sheet header */
.page-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 16px; margin: 4px 0 24px; }
.page-actions { justify-self: start; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.page-title { text-align: center; }
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-head h2, .section-head h1 { margin: 0; }
.section-head h2 a { color: inherit; }
.crumbs { margin: 0 0 8px; font-size: 0.9rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid .card { margin: 0; }
.doc-card { color: var(--text); display: block; transition: box-shadow 0.25s ease, transform 0.25s ease; }
.doc-card:hover { text-decoration: none; box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.doc-card h2 { font-size: 1.05rem; }
.doc-card p { margin: 0.35em 0 0; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); border: 2px dashed var(--border); border-radius: var(--radius); }
.flash { background: var(--accent-soft); color: var(--text); padding: 10px 16px; border-radius: var(--radius); margin: 8px auto 16px; max-width: 680px; text-align: center; }
.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); padding: 10px 14px; border-radius: 10px; margin: 0 0 16px; }
.warning { background: var(--warn-bg); color: var(--warn-text); padding: 8px 12px; border-radius: 10px; }
.badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: middle;
}
.status-quarantined { background: var(--warn-bg); color: var(--warn-text); }
.status-discarded, .status-ignored { background: var(--border); color: var(--muted); }
.email-callout { text-align: center; color: var(--muted); margin: 28px auto 0; max-width: 680px; overflow-wrap: anywhere; font-size: 0.95rem; }

/* ---------------------------------------------------------------- Forms */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 0.92rem; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
input, select, textarea, button, .button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
  font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); outline-offset: 0; }
textarea { resize: vertical; line-height: 1.55; }
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; width: 22px; height: 22px; margin: 0; flex: none; cursor: pointer;
  border: 2px solid var(--border-strong); border-radius: 6px; background: var(--surface); display: inline-grid; place-content: center;
  transition: background 0.12s, border-color 0.12s;
}
input[type=checkbox]:hover { border-color: var(--accent); }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after {
  content: ""; width: 6px; height: 11px; border: solid var(--accent-text); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg);
}
input[type=checkbox]:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 1px; }
.input-suffix { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); overflow: hidden; }
.input-suffix:focus-within { border-color: var(--accent); }
.input-suffix input { border: 0 !important; border-radius: 0 !important; min-width: 0; outline: none !important; }
.input-suffix span { padding: 0 12px; color: var(--muted); font-weight: 400; white-space: nowrap; background: var(--sunken); align-self: stretch; display: flex; align-items: center; }
.title-input { font-size: 1.6rem !important; font-weight: 800 !important; border: 0 !important; padding-left: 2px !important; text-align: center; color: var(--heading); }
.title-input:focus { outline: none !important; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; min-height: 40px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; font-weight: 700; font-size: 0.92rem; line-height: 1.25; white-space: nowrap; color: var(--text);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
button:hover, .button:hover { text-decoration: none; border-color: var(--ink); color: var(--text); transform: translateY(-1px); }
.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.danger { color: var(--danger); }
.small.button, button.small { padding: 6px 12px; min-height: 32px; font-size: 0.84rem; }
button.link { background: none; border: 0; padding: 0; color: var(--link); font-weight: 400; font-size: inherit; border-radius: 0; }
form.stack > button { align-self: flex-start; }
.file-input { flex-direction: row; align-items: center; font-weight: 600; cursor: pointer; color: var(--link); position: relative; }
.file-input input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------------------------------------------------------------- Editor */
.editor { border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; background: var(--surface); }
.editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.editor-bar { display: flex; align-items: center; gap: 4px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--sunken); flex-wrap: wrap; }
.editor-bar .seg { border: 0; background: none; padding: 4px 12px; font-size: 0.85rem; color: var(--muted); }
.editor-bar .seg.active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.editor-bar .tools { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.editor-bar .tools[hidden] { display: none; }
.editor-bar .tool { border: 0; background: none; width: 32px; height: 32px; padding: 0; color: var(--muted); font-size: 0.95rem; font-weight: 400; border-radius: 8px; }
.editor-bar .tool:hover { background: var(--surface); color: var(--text); }
.editor-bar .tool b, .editor-bar .tool i { font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; }
.editor textarea { border: 0 !important; border-radius: 0 !important; outline: none !important; background: var(--surface) !important; padding: 14px 16px !important; }
.editor .preview { padding: 14px 16px; min-height: 120px; }

/* ---------------------------------------------------------------- Rendered markdown */
.prose { overflow-wrap: anywhere; line-height: 1.65; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.4em; }
.prose img { max-width: 100%; border-radius: 8px; }
.prose blockquote { margin: 0; padding: 2px 16px; border-left: 4px solid var(--border-strong); color: var(--muted); }
.prose pre { background: var(--sunken); border: 1px solid var(--border); padding: 12px; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose table { border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; }
pre.email-body { white-space: pre-wrap; background: var(--sunken); padding: 12px; border-radius: 10px; max-height: 400px; overflow: auto; }

/* ---------------------------------------------------------------- Avatars */
.avatar {
  --hue: 160;
  width: 36px; height: 36px; border-radius: var(--radius); flex: none; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #F8F7F4; background: hsl(var(--hue) 20% 38%); letter-spacing: 0.02em;
}
.avatar-sm { width: 26px; height: 26px; font-size: 0.65rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar.more { background: var(--border-strong); color: var(--text); }
.avatar.h0 { --hue: 4; } .avatar.h1 { --hue: 24; } .avatar.h2 { --hue: 44; } .avatar.h3 { --hue: 88; }
.avatar.h4 { --hue: 140; } .avatar.h5 { --hue: 170; } .avatar.h6 { --hue: 192; } .avatar.h7 { --hue: 212; }
.avatar.h8 { --hue: 236; } .avatar.h9 { --hue: 268; } .avatar.h10 { --hue: 300; } .avatar.h11 { --hue: 330; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar + .avatar { margin-left: -6px; }
.project-card .avatar-stack { margin-top: 6px; }

/* ---------------------------------------------------------------- Home (projects) */
.home-head { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 20px 0 28px; }
.home-head h1 { margin: 0; font-size: 2.1rem; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 280px)); justify-content: center; gap: 20px; margin-bottom: 20px; }
.project-card {
  display: flex; flex-direction: column; gap: 6px; min-height: 170px; padding: 22px 22px 18px; color: var(--text);
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); border-top: 5px solid var(--accent);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.project-card:hover { text-decoration: none; box-shadow: var(--shadow-lift); transform: translateY(-4px); }
.project-card h2 { margin: 0; font-size: 1.2rem; }
.project-card p { margin: 0; flex: 1; font-size: 0.92rem; }
.project-card .badge { align-self: flex-start; margin: 0; }
.project-card.archived { border-top-color: var(--border-strong); opacity: 0.8; }
.assigned { margin-top: 36px; }

/* ---------------------------------------------------------------- Project home: the card table */
.people-strip { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 26px; }
.card-table { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.tool-card {
  position: relative; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 20px 20px 22px; min-height: 300px; transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.tool-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-4px); }
.tool-card h2 { text-align: center; margin: 0 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.tool-card h2 a { color: inherit; }
.tool-card h2 a:hover { text-decoration: none; }
/* The whole card is clickable: stretch the title link over it. */
.tool-card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.tool-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 0.92rem; }
.tool-list .row { align-items: flex-start; gap: 10px; }
.tool-list strong { display: block; color: var(--text); line-height: 1.3; }
.clamp { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tool-empty { color: var(--muted); text-align: center; margin: 40px 12px; font-size: 0.95rem; }
.box { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-radius: 4px; flex: none; margin-top: 2px; }
.progress { display: flex; align-items: center; gap: 10px; margin: -4px 0 14px; }
.progress .bar { position: relative; flex: 1; height: 6px; border-radius: var(--radius-sm); background: var(--border); overflow: hidden; }
.progress .bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); background: var(--accent); border-radius: inherit; }
.progress .bar.w0 { --w: 0%; }
.progress .bar.w5 { --w: 5%; }
.progress .bar.w10 { --w: 10%; }
.progress .bar.w15 { --w: 15%; }
.progress .bar.w20 { --w: 20%; }
.progress .bar.w25 { --w: 25%; }
.progress .bar.w30 { --w: 30%; }
.progress .bar.w35 { --w: 35%; }
.progress .bar.w40 { --w: 40%; }
.progress .bar.w45 { --w: 45%; }
.progress .bar.w50 { --w: 50%; }
.progress .bar.w55 { --w: 55%; }
.progress .bar.w60 { --w: 60%; }
.progress .bar.w65 { --w: 65%; }
.progress .bar.w70 { --w: 70%; }
.progress .bar.w75 { --w: 75%; }
.progress .bar.w80 { --w: 80%; }
.progress .bar.w85 { --w: 85%; }
.progress .bar.w90 { --w: 90%; }
.progress .bar.w95 { --w: 95%; }
.progress .bar.w100 { --w: 100%; }
.doc-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.doc-tiles li { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 0.85rem; }
.doc-icon {
  width: 52px; height: 64px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: 2px 2px 0 var(--border); position: relative;
}
.doc-icon::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: 12px; height: 2px; background: var(--border-strong);
  box-shadow: 0 7px 0 var(--border-strong), 0 14px 0 var(--border-strong), 0 21px 0 var(--border);
}
.doc-tile-title { font-weight: 600; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------------------------------------------------------------- Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
ul.list.card { padding: 4px 22px; }

/* Message board */
.threads { list-style: none; padding: 0; margin: 0; }
.threads li + li { border-top: 1px solid var(--border); }
.thread-link { display: flex; gap: 14px; align-items: center; padding: 16px 12px; color: var(--text); border-radius: 12px; }
.thread-link:hover { background: var(--sunken); text-decoration: none; }
.threads.card { padding: 6px; }
.sheet .threads.card { border: 0; padding: 0; }
.thread-title { font-weight: 700; font-size: 1.02rem; color: var(--text); }
.thread-link .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.count {
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-text);
  font-weight: 800; font-size: 0.78rem; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.pager { display: flex; justify-content: space-between; margin-top: 12px; }

/* A thread */
.sheet > h1 { text-align: center; font-size: 2rem; margin: 6px 0 22px; }
.message header, .comment header { margin-bottom: 12px; }
.sheet .message.card { border: 0; padding: 0 0 24px; border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 8px; }
.message .prose { font-size: 1.05rem; }
.comments { margin-left: 50px; }
.comment { padding: 18px 0; border-bottom: 1px solid var(--border); }
.comment-form { margin-top: 20px; }
.sheet .comment-form.card { border: 0; padding: 0; }
.comment-actions { flex-wrap: wrap; }
.comment-actions .grow { min-width: 200px; }
.attachments { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.attachments li { background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 12px; font-size: 0.88rem; }

/* ---------------------------------------------------------------- To-dos */
.todo-list { margin-bottom: 28px; }
.sheet .todo-list.card { border: 0; padding: 0; }
.todo-list h2 { font-size: 1.3rem; }
.todos { list-style: none; padding: 0; margin: 0 0 8px; }
.todo { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.todo:last-child { border-bottom: 0; }
.todo-title { color: var(--text); font-size: 1rem; }
.todo.done .todo-title { text-decoration: line-through; color: var(--muted); }
.assignee { font-size: 0.82rem; color: var(--muted); white-space: nowrap; background: var(--sunken); padding: 2px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.due { font-size: 0.78rem; font-weight: 700; padding: 2px 9px; border-radius: var(--radius-sm); background: var(--sunken); border: 1px solid var(--border); white-space: nowrap; color: var(--muted); }
.due.overdue { color: var(--danger); border-color: currentColor; background: color-mix(in srgb, var(--danger) 8%, transparent); }
.add-todo { display: grid; grid-template-columns: 1fr 170px 150px auto; align-items: center; gap: 8px; margin-top: 10px; padding: 12px; background: var(--sunken); border-radius: 12px; }
.completed summary { cursor: pointer; margin-top: 10px; }
.new-list { padding: 14px; background: var(--sunken); }
.sheet .new-list.card { border: 2px dashed var(--border); }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; width: 280px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow-lift);
}

/* ---------------------------------------------------------------- Docs */
.doc h1 { font-size: 2rem; }
.sheet .doc.card { border: 0; padding: 0; }
.doc .prose { font-size: 1.05rem; max-width: 720px; margin: 0 auto; }
.doc-form .editor textarea { min-height: 55vh; }
.sheet .doc-form.card { border: 0; padding: 0; }

/* ---------------------------------------------------------------- Files */
.table { width: 100%; border-collapse: collapse; padding: 0; overflow: hidden; }
.sheet .table.card { border: 0; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.table td a { overflow-wrap: anywhere; font-weight: 600; }
.num { text-align: right !important; white-space: nowrap; }

/* ---------------------------------------------------------------- Inbox */
.inbound-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.inbound-actions select { width: auto; }

/* ---------------------------------------------------------------- Small fixes */
label small { font-weight: 400; }
ul.list.card { margin-bottom: 16px; }
.stack > p { margin: 0; }
section > h2 { margin-top: 8px; }
/* Sign-in and other single-card pages */
main > .narrow.card { margin-top: 40px; padding: 32px; border-radius: var(--radius-lg); }
main > .narrow.card h1 { text-align: center; }
main > .narrow.card > p { text-align: center; }
main > .narrow.card form.stack > button { align-self: stretch; }
/* Docs: centered title with actions underneath, like a printed page */
.doc .section-head { flex-direction: column; text-align: center; gap: 12px; }
.doc > p.muted { text-align: center; margin-bottom: 28px; }

/* ---------------------------------------------------------------- Project header extras */
.project-desc { max-width: 640px; margin: 8px auto 0; color: var(--muted); font-size: 1.02rem; }
.project-links { margin: 12px 0 0; }
.project-links .button { gap: 8px; font-weight: 600; }
.project-links .icon:last-child { opacity: 0.6; }
.pills a { display: inline-flex; align-items: center; gap: 7px; }
.pills a .icon { opacity: 0.75; }
.pills a.active .icon { opacity: 1; }
.pills a.private { border-style: dashed; }
.pills a.private.active { border-style: solid; }
.pill-divider { width: 1px; align-self: stretch; background: var(--border-strong); margin: 4px 4px; }
.tool-card h2 { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tool-icon {
  width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.section-title { margin: 36px 0 18px; }

/* ---------------------------------------------------------------- Status */
.status-chip {
  --c: var(--muted); display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: var(--radius-sm);
  font-size: 0.78rem; font-weight: 700; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
}
.status-chip::before { content: ""; width: 9px; height: 7px; background: var(--c); clip-path: polygon(4% 10%, 96% 0, 100% 92%, 0 100%); }
.st-needs_me { --c: var(--st-needs); }
.st-waiting { --c: var(--st-waiting); }
.st-in_progress { --c: var(--accent); }
.st-on_hold { --c: var(--st-hold); }
.st-done { --c: var(--st-done); }
.project-card .status-chip { align-self: flex-start; }
.private-note { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 0.85rem; margin: -12px 0 20px; }
.private-note.center { margin: 0 0 14px; }
.status-banner {
  display: flex; align-items: center; gap: 12px; max-width: 760px; margin: 0 auto 22px; padding: 12px 16px;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 14px; color: var(--text);
}
.status-banner:hover { text-decoration: none; border-color: var(--accent); }
.status-current { text-align: center; padding: 20px; border-radius: 14px; background: var(--sunken); margin-bottom: 24px; }
.status-current .status-chip { font-size: 0.9rem; margin-bottom: 10px; }
.status-current .prose { max-width: 520px; margin: 0 auto; }
.status-options { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.status-options legend { font-weight: 700; margin-bottom: 8px; font-size: 0.92rem; }
.status-option {
  flex-direction: row; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  cursor: pointer; font-weight: 400; border-left: 5px solid var(--c);
}
.status-option:has(input:checked) { background: color-mix(in srgb, var(--c) 9%, var(--surface)); border-color: var(--c); }
.status-option input { accent-color: var(--c); margin: 3px 0 0; width: 18px; height: 18px; flex: none; }
.status-form + section { margin-top: 32px; }
.status-option span { display: flex; flex-direction: column; }
.status-option small { color: var(--muted); }
.status-history { list-style: none; padding: 0; margin: 0; }
.status-history li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.status-history li div { flex-basis: 100%; }

/* Status board (dashboard) */
.board { margin: 0 0 12px; }
.board-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.board-col { background: color-mix(in srgb, var(--c) 7%, var(--bg)); border-radius: var(--radius-lg); padding: 14px; border-top: 4px solid var(--c); }
.board-col h2 { font-size: 1rem; display: flex; align-items: center; gap: 8px; margin: 2px 4px 12px; color: var(--text); }
.board-count { background: var(--c); color: var(--limestone-raised); border-radius: var(--radius-sm); font-size: 0.75rem; padding: 1px 8px; }
.board-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.board-card { background: var(--surface); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.board-name { font-weight: 800; color: var(--heading); }
.board-card p { margin: 4px 0 0; color: var(--text); }
.board-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.signal { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-sm); }
.signal.new { background: var(--accent-soft); color: var(--accent); }
.signal.overdue { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.board-change { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.board-change select { width: auto; flex: 1; padding: 5px 8px; font-size: 0.85rem; border-radius: 8px; }
.board-empty { margin: 4px 4px 6px; }
.board-other { text-align: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin-top: 14px; }

/* ---------------------------------------------------------------- Notes */
.note-new { margin-bottom: 28px; }
.note-new > button { align-self: flex-end; }
.note { padding: 18px 0; border-top: 1px solid var(--border); }
.note h3 { margin: 0 0 2px; font-size: 1.05rem; }
.note.pinned { background: var(--warn-bg); border-radius: 12px; padding: 16px; border: 0; margin-bottom: 10px; }
.note header { margin-bottom: 10px; align-items: flex-start; }

/* ---------------------------------------------------------------- Thread email address */
.thread-address { margin-top: 28px; padding: 16px 18px; border-radius: 14px; background: var(--sunken); border: 1px solid var(--border); }
.thread-address p { margin: 0; }
.copy-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.copy-row code { font-size: 0.92rem; padding: 6px 10px; background: var(--surface); }

@media (max-width: 860px) {
  .board-columns { grid-template-columns: 1fr; }
}

/* Status nudge after posting */
.nudge {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin: -8px 0 20px; border-radius: 12px; background: var(--accent-soft); font-size: 0.92rem;
}
.nudge span { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Profile photos */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.4rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.photo-settings h3 { margin: 0 0 2px; }
.photo-settings p { margin: 0 0 10px; }
.photo-settings label.button { flex-direction: row; font-weight: 700; cursor: pointer; position: relative; }
.crop { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.crop-stage {
  width: min(280px, 100%); aspect-ratio: 1; border-radius: 16px; overflow: hidden; cursor: grab; touch-action: none;
  background: repeating-conic-gradient(var(--sunken) 0 25%, var(--surface) 0 50%) 0 0 / 20px 20px; position: relative;
}
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { width: 100%; height: 100%; display: block; }
/* Show how it'll look as a round avatar. */
.crop-stage::after { content: ""; position: absolute; inset: 0; border-radius: 22%; box-shadow: 0 0 0 999px rgb(0 0 0 / 0.3); pointer-events: none; }
.crop-zoom { flex-direction: row; align-items: center; gap: 10px; width: min(280px, 100%); font-weight: 600; }
.crop-zoom input { flex: 1; accent-color: var(--accent); }
.crop-actions { justify-content: center; }

/* ---------------------------------------------------------------- What's new */
.unread-dot { display: inline-block; width: 10px; height: 8px; clip-path: polygon(4% 10%, 96% 0, 100% 92%, 0 100%); background: var(--link); margin-right: 7px; vertical-align: middle; position: relative; top: -1px; }
.thread-link.is-unread .thread-title { color: var(--heading); }
.since { max-width: 760px; margin: 0 auto 22px; padding: 14px 18px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); }
.since h2 { font-size: 1rem; margin: 0 0 10px; }
.since ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.since li { display: flex; align-items: center; gap: 10px; font-size: 0.93rem; }

/* ---------------------------------------------------------------- Approvals */
.approval { margin: 18px 0 24px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--border); background: var(--sunken); }
.approval:empty { display: none; }
.approval h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 1.02rem; }
.approval.ap-pending { border-color: color-mix(in srgb, var(--slate) 45%, transparent); background: color-mix(in srgb, var(--slate) 7%, var(--surface)); }
.approval.ap-approved { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.approval.ap-approved h3 { color: var(--accent); }
.approval.ap-changes { border-color: color-mix(in srgb, var(--gorse-deep) 45%, transparent); background: color-mix(in srgb, var(--gorse-deep) 8%, var(--surface)); }
.approval-note { background: var(--surface); border-radius: 10px; padding: 10px 12px; margin: 8px 0; white-space: pre-wrap; }
.approval-actions { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px; }
.approval-actions details { flex: 1; min-width: 220px; }
.approval-actions details[open] summary { margin-bottom: 10px; }
.approval-actions summary { list-style: none; cursor: pointer; }
.approval-actions summary::-webkit-details-marker { display: none; }
.approval-request { margin-top: 10px; }
.approval-start { margin: 14px 0 22px; }
.approval-start .approval-request { margin: 0; }
.approval-start .approval-request[open] { padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--sunken); }
.approval-request summary { list-style: none; cursor: pointer; }
.approval-request summary::-webkit-details-marker { display: none; }
.approval-request form { margin-top: 10px; }
.approval-history { margin-top: 10px; color: var(--muted); }
.approval-history ul { margin: 6px 0 0; padding-left: 18px; }
.approvals-waiting { max-width: 760px; margin: 0 auto 22px; padding: 14px 18px; border-radius: 14px; background: var(--surface); border-left: 5px solid var(--slate); box-shadow: var(--shadow); }
.approvals-waiting.for-client { background: color-mix(in srgb, var(--slate) 8%, var(--surface)); }
.approvals-waiting h2 { font-size: 1rem; margin: 0 0 8px; }
.approvals-waiting ul { margin: 0; padding-left: 18px; }
.signal.awaiting { background: color-mix(in srgb, var(--slate) 12%, transparent); color: var(--slate); }

/* ---------------------------------------------------------------- Timeline */
.timeline { max-width: 900px; margin: 0 auto 24px; position: relative; }
.timeline ol { list-style: none; margin: 0; padding: 4px 0 0; display: flex; gap: 0; overflow-x: auto; }
.timeline li { flex: 1 0 120px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; position: relative; padding: 0 6px; }
.timeline li::before { content: ""; position: absolute; top: 11px; left: 0; right: 0; height: 3px; background: var(--border-strong); }
.timeline li:first-child::before { left: 50%; }
.timeline li:last-child::before { right: 50%; }
.timeline li:only-child::before { display: none; }
.timeline li.done::before { background: var(--accent); }
.tl-dot {
  width: 24px; height: 22px; border-radius: 5px; background: var(--surface); border: 3px solid var(--border-strong); position: relative;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 800; color: var(--accent-text);
}
.timeline li.done .tl-dot { background: var(--accent); border-color: var(--accent); }
.timeline li.next .tl-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline li.late .tl-dot { border-color: var(--danger); }
.tl-title { font-weight: 700; font-size: 0.88rem; line-height: 1.25; }
.tl-date { font-size: 0.78rem; color: var(--muted); }
.timeline li.late .tl-date { color: var(--danger); font-weight: 700; }
.tl-edit { position: absolute; right: 0; top: -22px; }
.milestone-edit li { gap: 10px; }
.milestone-edit input[type=date] { width: auto; }
.add-milestone { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; padding: 14px; }

/* ---------------------------------------------------------------- Search */
.topnav a { display: inline-flex; align-items: center; gap: 6px; }
.narrow-sheet { max-width: 760px; }
.search-form { display: flex; gap: 8px; margin-bottom: 20px; }
.home-search { width: 100%; max-width: 520px; margin: 0; }
.home-search input { flex: 1; min-width: 0; }
.home-results { width: 100%; max-width: 640px; }
.results-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 18px 8px 4px; font-family: var(--font-body, inherit); }
.project-hits .hit-icon { background: var(--accent); color: #fff; }
.project-hits + .search-results { border-top: 1px solid var(--border); }
.home-results:not(:empty) { background: var(--surface, #F8F7F4); border: 1px solid var(--border); border-radius: 8px; padding: 4px 12px; }
.search-results { list-style: none; margin: 0; padding: 0; }
.search-results li + li { border-top: 1px solid var(--border); }
.search-hit { display: flex; gap: 12px; padding: 14px 8px; color: var(--text); border-radius: 10px; }
.search-hit:hover { background: var(--sunken); text-decoration: none; }
.search-hit .grow { display: flex; flex-direction: column; gap: 3px; }
.hit-icon { width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.hit-snippet { font-size: 0.9rem; color: var(--muted); }
mark { background: color-mix(in srgb, var(--gorse) 40%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------------------------------------------------------------- Image previews */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin: 14px 0 0; }
.image-grid.single { grid-template-columns: minmax(0, 480px); }
.image-grid a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--sunken); }
.image-grid img { display: block; width: 100%; height: 160px; object-fit: cover; transition: transform 0.2s; }
.image-grid.single img { height: auto; max-height: 420px; object-fit: contain; }
.image-grid a:hover img { transform: scale(1.02); }

/* ---------------------------------------------------------------- Email receipts and send log */
.receipts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 12px 0 0; font-size: 0.8rem; color: var(--muted); }
.receipt-ok { color: var(--accent); }
.receipt-failed { color: var(--danger); font-weight: 700; cursor: help; }
.subtabs { display: flex; justify-content: center; gap: 6px; margin: 0 0 18px; }
.subtabs a { padding: 6px 16px; border-radius: var(--radius-sm); color: var(--text); font-weight: 600; border: 1px solid var(--border); background: var(--surface); }
.subtabs a.active { background: var(--moss); border-color: var(--moss); color: var(--on-moss); }
.subtabs a:hover { text-decoration: none; }
.email-filter { margin-bottom: 16px; }
.email-filter input[name=to] { min-width: 200px; }
.email-status { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 9px; border-radius: var(--radius-sm); cursor: help; }
.email-status.sent { background: var(--accent-soft); color: var(--accent); }
.email-status.failed { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.error-text { color: var(--danger); margin-top: 4px; max-width: 220px; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- Notifications */
.bell { position: relative; width: 44px; height: 44px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.bell:hover { background: var(--surface); text-decoration: none; }
.bell.has-new { color: var(--heading); }
.bell-count {
  position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-sm);
  background: var(--moss); color: var(--on-moss); font-size: 0.68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.inbox-alert { display: block; margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-text); font-weight: 600; }
.notif-day h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 0 6px; }
.notifs { list-style: none; margin: 0; padding: 0; }
.notifs li a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; color: var(--text); }
.notifs li a:hover { background: var(--sunken); text-decoration: none; }
.notifs li .grow { display: flex; flex-direction: column; gap: 2px; }
.notif-text strong:last-child { color: var(--heading); }
.notifs li.is-new a { background: color-mix(in srgb, var(--link) 7%, var(--surface)); }
.notifs li.is-important .notif-text::before { content: "■"; color: var(--gorse); margin-right: 6px; font-size: 0.7rem; vertical-align: middle; }
.new-pill { font-size: 0.7rem; font-weight: 800; color: var(--link); background: color-mix(in srgb, var(--link) 12%, transparent); padding: 2px 8px; border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------- Time tracking and invoices */
.time-sheet { max-width: 1040px; }
.log-time {
  display: grid; grid-template-columns: 150px 1fr 170px 120px; gap: 10px 12px; align-items: end;
  padding: 16px; background: var(--moss-soft); border-radius: var(--radius-lg); margin-bottom: 24px;
}
.log-time label { font-size: 0.85rem; }
.log-time input, .log-time select { height: 44px; }
.lt-desc { grid-column: 1 / 4; }
.lt-submit { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.lt-submit .muted { text-align: right; min-height: 1.2em; }
.duration-input { display: flex; }
.duration-input input { border-radius: var(--radius) 0 0 var(--radius) !important; min-width: 0; }
.duration-input select { width: auto; border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; background: var(--sunken); }
.time-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.period-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.period-tabs a { padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.88rem; }
.period-tabs a:hover { text-decoration: none; border-color: var(--ink); }
.period-tabs a.active { background: var(--moss); border-color: var(--moss); color: var(--on-moss); }
.filter-row label { flex-direction: row; align-items: center; gap: 6px; font-weight: 600; }
.filter-row input[type=date], .filter-row select { width: auto; padding: 7px 10px; }
.time-totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.time-totals > div { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.tt-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tt-value { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; }
.time-table td, .time-table th { padding: 10px 10px; }
.time-table .sel { width: 36px; padding-right: 0; }
.time-table tr.invoiced td { color: var(--muted); }
.time-table tr.invoiced td strong { color: var(--muted); font-weight: 600; }
.nowrap { white-space: nowrap; }
.show-sm { display: none; }
.table-scroll { overflow-x: auto; }
.actions-cell { text-align: right; }
.invoice-bar {
  position: sticky; bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--moss); border-radius: var(--radius-lg);
}
.invoice-bar input { width: auto; flex: 0 1 260px; }
.invoice-bar [data-selection-summary] { font-weight: 600; }
.invoice-bar button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.invoices { margin-top: 36px; }
.inv-status { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 2px 9px; border-radius: var(--radius-sm); background: var(--sunken); color: var(--muted); border: 1px solid var(--line); }
.inv-sent { background: color-mix(in srgb, var(--slate) 10%, transparent); color: var(--st-waiting); border-color: transparent; }
.inv-paid { background: var(--moss-soft); color: var(--moss); border-color: transparent; }
.invoice-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 0 0 16px; }
.invoice-doc { max-width: 820px; }
.invoice-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.invoice-from strong { font-family: var(--font-display); font-size: 1.3rem; letter-spacing: -0.02em; }
.invoice-meta h1 { margin: 0 0 8px; text-align: right; }
.invoice-meta dl { display: grid; grid-template-columns: auto auto; gap: 2px 16px; margin: 0; font-size: 0.92rem; }
.invoice-meta dt { color: var(--muted); }
.invoice-meta dd { margin: 0; text-align: right; font-weight: 600; }
.invoice-title { margin-bottom: 14px; }
.invoice-lines tfoot td { border-top: 2px solid var(--ink); border-bottom: 0; padding-top: 14px; }
.invoice-total { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; }
.invoice-timeline { margin-top: 18px; }

@media print {
  .topbar, .site-footer, .no-print, .flash, .crumbs { display: none !important; }
  body { background: #fff; }
  main.wrap { padding: 0; }
  .sheet { border: 0; padding: 0; max-width: none; }
}

/* ---------------------------------------------------------------- Phones */
@media (max-width: 860px) {
  .card-table { grid-template-columns: 1fr; }
  .tool-card { min-height: 0; }
  .tool-empty { margin: 16px 8px; }
}
@media (max-width: 720px) {
  .log-time { grid-template-columns: 1fr 1fr; }
  .show-sm { display: inline; }
  .time-table td, .time-table th { padding: 10px 6px; }
  .lt-desc { grid-column: 1 / -1; }
  .time-totals { grid-template-columns: 1fr 1fr; }
  .invoice-meta h1 { text-align: left; }
  .topbar { grid-template-columns: auto 1fr auto; padding: 10px 12px; }
  .topnav { justify-self: center; gap: 0; }
  .topnav a { padding: 8px 10px; }
  .top-right { gap: 4px; }
  .status-banner { flex-wrap: wrap; }
  .status-banner .grow { flex-basis: 100%; order: 3; }
  .project-grid { grid-template-columns: 1fr; }
  .nav-label { display: none; }
  .add-milestone { grid-template-columns: 1fr auto; }
  .add-milestone input[name=title] { grid-column: 1 / -1; }
  .tl-edit { position: static; display: block; text-align: center; margin-top: 8px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .wm-second { display: none; }
  .wm-main { font-size: 21px; }
  .brand-mark { width: 28px; height: 28px; }
  .project-head { padding: 10px 8px 16px; }
  .project-name { font-size: 1.5rem; }
  .pills { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; margin: 12px -16px 0; padding: 0 16px 4px; scrollbar-width: none; }
  .pills a { flex: none; }
  .sheet { padding: 20px 16px 28px; border-radius: 14px; margin: 0 -4px; }
  .page-head { grid-template-columns: 1fr; text-align: center; }
  .page-actions { justify-self: center; order: 2; padding: 0; }
  .page-spacer { display: none; }
  .two { grid-template-columns: 1fr; }
  .todo { flex-wrap: wrap; row-gap: 4px; }
  .todo .grow { flex-basis: calc(100% - 40px); }
  .todo form + .grow + .assignee, .todo form + .grow + .due { margin-left: 34px; }
  .add-todo { grid-template-columns: 1fr 1fr; }
  .add-todo input[name=title] { grid-column: 1 / -1; }
  .comments { margin-left: 0; }
  .hide-sm { display: none; }
  .thread-link { padding: 12px 6px; }
  .card { padding: 16px; }
  ul.list.card { padding: 4px 16px; }
  h1, .sheet > h1 { font-size: 1.6rem; }
  .home-head h1 { font-size: 1.7rem; }
}

@media (max-width: 480px) {
  .wordmark-text { display: none; }
}
