@font-face { font-family: 'Gloock'; src: url('/fonts/Gloock-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Jost'; src: url('/fonts/Jost-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Jost'; src: url('/fonts/Jost-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }

:root {
  --ink: #231f20;
  --muted: #6e6a6b;
  --line: #e4e0e2;
  --bg: #f6f8f9;
  --card: #ffffff;
  --accent: #c37aff;
  --accent-deep: #7c3aed;
  --tint: #f5edff;
  --danger: #b42318;
  --radius: 8px;
  /* Status colors (soft fill, dark text), shared by tasks, invoices, clients and proposals. */
  --st-waiting: #fdf3c7; --st-waiting-ink: #7a5a00;
  --st-ready: #fde7f1; --st-ready-ink: #9d1b5c;
  --st-send: #d9f2ee; --st-send-ink: #0f5f58;
  --st-progress: #f5edff; --st-progress-ink: #7c3aed;
  --st-review: #ffead6; --st-review-ink: #9a4500;
  --st-invoice: #fde4e2; --st-invoice-ink: #b42318;
  --st-invoiced: #e2ebfd; --st-invoiced-ink: #2346a8;
  --st-paid: #e2f4e8; --st-paid-ink: #1d6b3d;
  --st-neutral: #eef2f4; --st-neutral-ink: #3d4450;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 'Jost', system-ui, sans-serif; }
h1, h2 { font-family: 'Gloock', Georgia, serif; font-weight: 400; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(28px, 4.4vw, 36px); letter-spacing: -0.01em; }
h2 { font-size: 21px; }
a { color: var(--accent-deep); }
button, input, select, textarea { font: inherit; color: inherit; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 16px clamp(16px, 4vw, 40px); background: var(--card); border-bottom: 1px solid var(--line); }
.topbar img { height: 28px; display: block; }
.topbar nav { display: flex; gap: 4px; margin-right: auto; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: var(--radius); }
.topbar nav a[aria-current='page'] { color: var(--ink); background: var(--tint); }
.link-button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px 4px; }

main { max-width: 1280px; margin: 0 auto; padding: clamp(24px, 5vw, 48px) clamp(16px, 4vw, 40px) 80px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: var(--radius); padding: 12px 20px; background: var(--accent); color: var(--ink); font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: #b45ff9; }
.btn.secondary { background: var(--card); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--tint); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn[hidden] { display: none; }
:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: clamp(18px, 3vw, 28px); }
.card + .card { margin-top: 20px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 12px 10px; }
td { padding: 14px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr[data-href] { cursor: pointer; }
tbody tr[data-href]:hover td { background: #fbf8ff; }

.pill { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 99px; white-space: nowrap; }
.pill.unpaid { background: var(--st-neutral); color: var(--st-neutral-ink); }
.pill.overdue { background: var(--st-invoice); color: var(--st-invoice-ink); }
.pill.paid { background: var(--st-paid); color: var(--st-paid-ink); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; cursor: pointer; display: grid; gap: 2px; }
.stat:hover { border-color: var(--accent); }
.stat[aria-pressed='true'] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #fbf8ff; }
.stat-label { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat strong { font-family: 'Gloock', Georgia, serif; font-weight: 400; font-size: clamp(22px, 3vw, 28px); line-height: 1.25; }
.stat-count { font-size: 14px; color: var(--muted); }
.stat.overdue:not(.zero) strong { color: var(--danger); }
.list-tools { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

.status-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.status-line { margin-left: 8px; color: var(--muted); }
.mark-paid { display: flex; align-items: center; gap: 10px; }
.mark-paid label { margin: 0; white-space: nowrap; }
.mark-paid input { width: auto; }
.status-bar .error { flex-basis: 100%; margin: 0; }
.bulk-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; padding: 14px 18px; background: var(--tint); border-color: var(--accent); position: sticky; top: 12px; z-index: 1; }
.bulk-bar[hidden] { display: none; }
.bulk-bar + .card { margin-top: 0; }
.bulk-bar strong { margin-right: auto; }
.bulk-bar .error { flex-basis: 100%; margin: 0; }
.btn.danger, .link-button.danger { color: var(--danger); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .link-button { padding: 0 6px; }
.link-button:hover { color: var(--ink); text-decoration: underline; }
.link-button.danger:hover { color: var(--danger); }
.btn.danger:hover { background: #fdecea; }
th.check, td.check { width: 1%; padding-right: 0; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent-deep); cursor: pointer; }
.send-card { margin-bottom: 20px; }
.send-head p { margin: 4px 0 0; }
.send-card .actions { margin-top: 16px; }

.show-sm { display: none; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 8px; }
.empty .btn { margin-top: 16px; }

label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #d3cfd1; border-radius: var(--radius); background: #fff; }
textarea { min-height: 84px; resize: vertical; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.field-note { font-size: 13px; color: var(--muted); margin-top: 6px; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; background: var(--bg); }
.segmented label { margin: 0; font-weight: 400; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: block; padding: 8px 18px; border-radius: 6px; cursor: pointer; }
.segmented input:checked + span { background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent-deep); }

.lines { margin-top: 8px; }
.line { display: grid; gap: 10px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.line.flat { grid-template-columns: 28px 1fr 160px 40px; }
.line.hourly { grid-template-columns: 28px 1fr 100px 120px 110px 40px; }
.line .amount { padding-top: 11px; text-align: right; font-variant-numeric: tabular-nums; }
.line .remove { width: 40px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 22px; cursor: pointer; border-radius: var(--radius); }
.line .remove:hover { background: var(--tint); color: var(--ink); }
.line-head { display: grid; gap: 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.line-head.flat { grid-template-columns: 28px 1fr 160px 40px; }
.line-head.hourly { grid-template-columns: 28px 1fr 100px 120px 110px 40px; }
.grip { width: 28px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius); background: none; color: var(--muted); cursor: grab; touch-action: none; }
.grip:hover, .grip:focus-visible { background: var(--tint); color: var(--accent-deep); }
.line.dragging { background: var(--tint); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(35, 31, 32, .12); position: relative; z-index: 1; }
.line.dragging .grip { cursor: grabbing; }
.line-head .r { text-align: right; }
.total-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 16px; padding-top: 16px; border-top: 2px solid var(--accent); flex-wrap: wrap; }
.total-row strong { font-family: 'Gloock', Georgia, serif; font-weight: 400; font-size: 28px; }

.actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }
.error { color: var(--danger); margin: 12px 0 0; }
.pdf-frame { width: 100%; height: min(80vh, 1000px); border: 1px solid var(--line); border-radius: 12px; background: #fff; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); }
.login img { height: 34px; margin-bottom: 24px; }
.login .btn { width: 100%; justify-content: center; margin-top: 16px; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar nav { order: 3; width: 100%; }
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .line.flat, .line.hourly { grid-template-columns: 28px 1fr 1fr 40px; }
  .line .grip { grid-row: span 2; height: 100%; min-height: 44px; }
  .line .desc { grid-column: 2 / -1; }
  .line.flat [data-f=amount] { grid-column: 2 / 4; }
  .line.hourly .amount { grid-column: 2 / 4; text-align: left; padding-top: 0; }
  .line-head { display: none; }
  .stats { grid-template-columns: 1fr; gap: 8px; margin-bottom: 24px; }
  .stat { grid-template-columns: 1fr auto; align-items: center; padding: 12px 16px; }
  .stat strong { grid-column: 2; grid-row: 1 / 3; font-size: 24px; }
  td a { white-space: nowrap; }
  .mark-paid { flex-wrap: wrap; }
  td, th { padding-left: 8px; padding-right: 8px; }
}

/* Ready to invoice. */
.unbilled-card { margin-bottom: 20px; border-color: #f5d9a8; }
.unbilled-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.unbilled-head strong { display: block; font-family: 'Gloock', Georgia, serif; font-weight: 400; font-size: 28px; line-height: 1.2; }
.unbilled-head p { margin: 0; }
.unbilled-card ul { list-style: none; margin: 14px 0 0; padding: 0; }
.unbilled-card li { display: grid; grid-template-columns: 1fr auto 110px auto; gap: 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.unbilled-card li .field-note { margin: 0; }
.unbilled-card .btn { padding: 8px 14px; }


.logged { background: #fffaf0; border: 1px solid #f5d9a8; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.logged[hidden] { display: none; }
.logged-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.logged-head .btn { padding: 8px 14px; }
.logged ul { list-style: none; margin: 10px 0 0; padding: 0; }
.logged li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.logged label { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 0; }
.logged input { width: 18px; height: 18px; accent-color: var(--accent-deep); }
.line input[readonly] { background: var(--bg); color: var(--muted); }

@media (max-width: 720px) {
  .unbilled-card li { grid-template-columns: 1fr auto; }
  .unbilled-card li .field-note { grid-row: 2; }
  .list-tools { flex-wrap: wrap; }
}

/* Tasks board: one editable table like the Notion view. */
.board-tools { align-items: center; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-select { width: auto; min-width: 160px; padding: 8px 12px; }
.board { padding: 8px 0 0; }
.board .error, .board .empty { margin: 12px 20px; }
.board-scroll { overflow-x: auto; }
.board-table { min-width: 900px; table-layout: fixed; }
.board-table th { padding: 10px 6px; }
.board-table th:first-child, .board-table td:first-child { padding-left: 16px; }
.board-table th:nth-child(1) { width: 34%; }
.board-table th:nth-child(2), .board-table th:nth-child(3) { width: 13%; }
.board-table th:nth-child(4) { width: 200px; }
.board-table th:nth-child(5) { width: 70px; }
.board-table th:nth-child(6) { width: 156px; }
.board-table tbody tr:not(.new-row) .cell[type=date][value=""]:not(:focus):not(:hover) { color: transparent; } 
.board-table tbody tr:not(.new-row) .cell[type=date][value=""]:not(:focus):not(:hover)::-webkit-calendar-picker-indicator { opacity: 0; }
.board-table th:nth-child(7) { width: 76px; }
.board-table td { padding: 4px 6px; vertical-align: middle; }
.board-table tbody tr:hover td { background: #fbf8ff; }
.cell { width: 100%; border: 1px solid transparent; background: transparent; padding: 8px; border-radius: 6px; font-size: 15px; text-overflow: ellipsis; }
.cell:hover:not(:disabled):not([readonly]):not(.status-pill) { border-color: var(--line); background: #fff; }
.status-pill.cell:hover:not(:disabled) { filter: brightness(.96); }
.cell:focus { border-color: var(--accent); background: #fff; outline: none; box-shadow: 0 0 0 2px var(--tint); }
select.cell { cursor: pointer; }
select.cell:disabled { color: var(--muted); cursor: default; opacity: .7; }
.cell.title { font-weight: 600; }
.cell.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell.late { color: var(--danger); font-weight: 600; }
.new-row td { background: var(--bg); border-top: 0; }
.new-row .cell:not(.status-pill) { border-color: var(--line); background: #fff; }
.new-row .cell.title { font-weight: 400; }
.add-task { padding: 8px 12px; }
.board-table .remove { width: 36px; height: 36px; border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; border-radius: var(--radius); opacity: 0; }
.board-table tr:hover .remove, .board-table .remove:focus-visible { opacity: 1; }
.board-table .remove:hover { background: #fdecea; color: var(--danger); }

/* Status colors follow the Notion board. */
.status-pill { display: inline-block; width: auto; max-width: 100%; border-radius: 99px; padding: 5px 12px; font-size: 14px; font-weight: 600; border: 1px solid transparent; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-waiting { background: var(--st-waiting); color: var(--st-waiting-ink); }
.st-ready { background: var(--st-ready); color: var(--st-ready-ink); }
.st-ready_to_send { background: var(--st-send); color: var(--st-send-ink); }
.st-in_progress { background: var(--st-progress); color: var(--st-progress-ink); }
.st-review { background: var(--st-review); color: var(--st-review-ink); }
.st-ready_to_invoice { background: var(--st-invoice); color: var(--st-invoice-ink); }
.st-invoiced { background: var(--st-invoiced); color: var(--st-invoiced-ink); }
.st-paid { background: var(--st-paid); color: var(--st-paid-ink); }
/* The open status menu shows each choice in its own color too. */
select.status-pill option { background: var(--st-neutral); color: var(--st-neutral-ink); }
select.status-pill option[value='waiting'] { background: var(--st-waiting); color: var(--st-waiting-ink); }
select.status-pill option[value='ready'], select.status-pill option[value='Lead'] { background: var(--st-ready); color: var(--st-ready-ink); }
select.status-pill option[value='ready_to_send'] { background: var(--st-send); color: var(--st-send-ink); }
select.status-pill option[value='in_progress'], select.status-pill option[value='Sent'] { background: var(--st-progress); color: var(--st-progress-ink); }
select.status-pill option[value='review'], select.status-pill option[value='Paused'] { background: var(--st-review); color: var(--st-review-ink); }
select.status-pill option[value='ready_to_invoice'], select.status-pill option[value='Rejected'] { background: var(--st-invoice); color: var(--st-invoice-ink); }
select.status-pill option[value='invoiced'] { background: var(--st-invoiced); color: var(--st-invoiced-ink); }
select.status-pill option[value='paid'], select.status-pill option[value='Active'] { background: var(--st-paid); color: var(--st-paid-ink); }

@media (max-width: 720px) {
  .board-tools .segmented { width: 100%; overflow-x: auto; }
  .board-tools .segmented span { white-space: nowrap; padding: 8px 12px; }
  .filters, .filter-select { width: 100%; }
}

/* Open a task from its row, Notion style. */
.title-cell { position: relative; }
.title-cell .cell.title { padding-right: 72px; }
.open-task { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; text-decoration: none; opacity: 0; }
.open-task.has-notes { opacity: .75; }
.board-table tr:hover .open-task, .open-task:focus-visible { opacity: 1; }
.open-task:hover { color: var(--accent-deep); border-color: var(--accent); }
@media (hover: none) { .open-task { opacity: 1; } }

/* Task detail panel. */
.panel-backdrop { position: fixed; inset: 0; background: rgba(35, 31, 32, .18); z-index: 20; }
.task-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--card); border-left: 1px solid var(--line); box-shadow: -12px 0 32px rgba(35, 31, 32, .12); z-index: 21; overflow-y: auto; padding: 18px clamp(18px, 4vw, 40px) 40px; display: flex; flex-direction: column; }
body.panel-open { overflow: hidden; }
.panel-top { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.panel-top .field-note { margin: 0; }
.panel-title { font-family: 'Gloock', Georgia, serif; font-size: 30px; font-weight: 400 !important; line-height: 1.2; padding: 6px 8px; margin: 10px -8px 14px; }
.props { display: grid; gap: 2px; margin-bottom: 22px; }
.prop { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 12px; min-height: 40px; }
.prop-label { font-size: 14px; color: var(--muted); }
.prop .cell, .prop .status-pill { justify-self: start; width: auto; min-width: 200px; max-width: 100%; }
.prop .status-pill { min-width: 0; }
.prop-text { padding: 0 8px; }
.hours-cell { display: flex; align-items: center; gap: 4px; }
.hours-cell .cell { min-width: 0; width: 80px; text-align: left; }
.hours-cell .field-note { margin: 0; }
.notes-label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; }
.panel-notes { flex: 1; min-height: 320px; border: 1px solid transparent; padding: 8px; margin: 0 -8px; font-size: 16px; line-height: 1.6; resize: none; }
.panel-notes:hover { border-color: var(--line); }
.panel-notes:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--tint); }
.panel-foot { margin-top: 16px; }

@media (max-width: 720px) {
  .task-panel { border-left: 0; }
  .prop { grid-template-columns: 90px 1fr; }
  .prop .cell { min-width: 0; width: 100%; }
  .prop .hours-cell .cell { width: 80px; }
}

/* Billed rows are read-only text, and long views page in. */
.cell-text { display: block; padding: 8px; font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
tr.billed .cell.title { font-weight: 400; color: var(--muted); }
.show-more { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 16px; border-top: 1px solid var(--line); }
.show-more .field-note { margin: 0; }

/* Home: work on the left, money on the right. */
.home-head { margin-bottom: 24px; }
.home { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 24px; align-items: start; }
.home .card + .card, .home-money > * + * { margin-top: 16px; }
.home-add { display: grid; grid-template-columns: 1fr 180px auto; gap: 10px; padding: 12px; }
.home-add .error { grid-column: 1 / -1; margin: 0; }
.home-group { padding: 18px 20px 8px; }
.home-group h2 { font-size: 19px; margin-bottom: 6px; }
.home-group.overdue h2 { color: var(--danger); }
.home-task { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 8px; margin: 0 -8px; border-top: 1px solid var(--line); border-radius: 8px; color: inherit; text-decoration: none; }
.home-group h2 + .home-task { border-top: 0; }
.home-task:hover { background: #fbf8ff; }
.home-task .status-pill { justify-self: start; font-size: 13px; padding: 3px 10px; }
.ht-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-title .field-note { display: block; font-weight: 400; margin: 0; overflow: hidden; text-overflow: ellipsis; }
.ht-due { font-size: 14px; color: var(--muted); white-space: nowrap; }
.ht-due.late, .field-note.late { color: var(--danger); font-weight: 600; }
.home-all { display: inline-block; margin-top: 12px; }

.home-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.home-stat { display: grid; gap: 2px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; }
.home-stat:hover { border-color: var(--accent); }
.home-stat strong { font-family: 'Gloock', Georgia, serif; font-weight: 400; font-size: 24px; line-height: 1.25; }
.home-stat .stat-label { font-size: 12px; }
.home-stat.overdue:not(.zero) strong { color: var(--danger); }
.home-stat.paid:not(.zero) strong { color: #1d6b3d; }
.home-money .unbilled-card { margin-bottom: 0; }
.home-money .unbilled-card li { grid-template-columns: 1fr auto auto; }
.home-money .unbilled-card li .field-note { display: none; }
.home-chase h2 { font-size: 19px; margin-bottom: 6px; }
.home-invoice { display: flex; justify-content: space-between; gap: 12px; padding: 10px 8px; margin: 0 -8px; border-top: 1px solid var(--line); border-radius: 8px; color: inherit; text-decoration: none; }
.home-chase h2 + .home-invoice { border-top: 0; }
.home-invoice:hover { background: #fbf8ff; }
.home-invoice .field-note { display: block; margin: 0; }

@media (max-width: 900px) {
  .home { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .home-add { grid-template-columns: 1fr auto; }
  .home-add input { grid-column: 1 / -1; }
  .home-task { grid-template-columns: minmax(0, 1fr) auto; }
  .home-task .status-pill { grid-column: 1 / -1; }
}
.home-group .count, .task-group .count, .client-group .count, .home-money h2 .count, .home-work h2 .count { display: inline-block; min-width: 22px; padding: 1px 7px; margin-left: 6px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; font-weight: 600; text-align: center; vertical-align: 3px; }

/* Clients list. */
.inline-add { display: flex; gap: 8px; }
.inline-add input { width: 240px; }
.client-group { padding: 18px 20px 6px; }
.client-group + .client-group { margin-top: 16px; }
.client-group h2 { font-size: 19px; display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.client-group h2 .link-button { margin-left: auto; font-family: 'Jost', system-ui, sans-serif; font-size: 14px; }
.client-table { table-layout: fixed; }
.client-table th:nth-child(1) { width: 30%; }
.client-table td { vertical-align: middle; }
.client-table td a { font-weight: 600; color: var(--ink); text-decoration: none; }
.client-table td .field-note { margin: 2px 0 0; }
.client-table tbody tr { cursor: pointer; }
.client-table tbody tr:hover td { background: #fbf8ff; }

/* Client page. */
.client-head { margin-bottom: 24px; }
.crumb-link { font-size: 14px; color: var(--muted); text-decoration: none; }
.crumb-link:hover { color: var(--accent-deep); text-decoration: underline; }
.client-name { font-family: 'Gloock', Georgia, serif; font-size: clamp(30px, 4.4vw, 40px); line-height: 1.15; padding: 4px 8px; margin: 4px -8px 10px; }
.client-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.client-tags .status-pill { width: auto; }
.lead-active { background: var(--st-paid); color: var(--st-paid-ink); }
.lead-lead { background: var(--st-ready); color: var(--st-ready-ink); }
.lead-paused { background: var(--st-review); color: var(--st-review-ink); }
.lead-inactive, .lead-none { background: var(--st-neutral); color: var(--st-neutral-ink); }
.type-chip { border: 1px dashed #cfcacd; background: none; color: var(--muted); border-radius: 99px; padding: 4px 12px; font-size: 14px; cursor: pointer; }
.type-chip:hover { border-color: var(--accent); color: var(--ink); }
.type-chip[aria-pressed='true'] { border: 1px solid var(--accent); background: var(--tint); color: var(--accent-deep); font-weight: 600; }
.retainer-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-color: #e2ccff; background: #fdfaff; }
.retainer-card strong { display: block; font-family: 'Gloock', Georgia, serif; font-weight: 400; font-size: 26px; line-height: 1.2; }
.retainer-done { color: inherit; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; }
.retainer-done:hover { color: var(--accent-deep); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.section-head h2, .client-projects h2, .details h2, .links h2, .home-money .card > h2 { font-size: 19px; }
.section-head .btn { padding: 8px 14px; }
.client-invoices .home-invoice .num { display: inline-flex; gap: 10px; align-items: center; }
.project-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 150px 36px; gap: 8px; align-items: center; padding: 4px 0; border-top: 1px solid var(--line); }
.client-projects h2 { margin-bottom: 6px; }
.client-projects h2 + .project-row { border-top: 0; }
.project-row .field-note { margin: 0; white-space: nowrap; }
.project-row .merge { font-size: 14px; color: var(--muted); }
.project-row .remove, .link-row .remove, .phase-head .remove { width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; border-radius: var(--radius); }
.project-row .remove:hover, .link-row .remove:hover, .phase-head .remove:hover { background: #fdecea; color: var(--danger); }
.details h2 { margin-bottom: 8px; }
.detail { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.detail > span { font-size: 14px; color: var(--muted); }
.detail .cell { font-size: 15px; }
.links h2 { margin-bottom: 6px; }
.link-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); }
.links h2 + .link-row { border-top: 0; }
.link-row a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-add { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; margin-top: 10px; }
.link-add input { padding: 8px 10px; font-size: 14px; }
.link-add .btn { padding: 8px 12px; }
.client-notes { min-height: 140px; margin-top: 8px; font-size: 15px; line-height: 1.6; }
.home-money > .link-button.danger { display: block; margin: 18px 0 0 auto; }

/* Save toast. */
#toast { position: fixed; right: 20px; bottom: 20px; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; opacity: 0; transform: translateY(8px); transition: opacity .18s, transform .18s; pointer-events: none; z-index: 30; }
#toast.show { opacity: 1; transform: none; }
#toast.error-toast { background: var(--danger); }

@media (max-width: 720px) {
  .inline-add, .inline-add input { width: 100%; }
  .project-row { grid-template-columns: minmax(0, 1fr) auto 36px; }
  .project-row .merge { grid-column: 1 / -1; order: 1; }
  .detail { grid-template-columns: 105px 1fr; }
  .link-add { grid-template-columns: 1fr auto; }
  .link-add input[name=label] { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* Page loading bar. */
/* Grows once toward the right and holds, so it reads as progress instead of looping. */
body.loading::before { content: ''; position: fixed; top: 0; left: 0; z-index: 40; height: 3px; width: 85%; background: var(--accent); border-radius: 0 3px 3px 0; transform-origin: left; animation: loading 2.4s cubic-bezier(.1, .7, .2, 1) both; }
@keyframes loading { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { body.loading::before { animation: none; opacity: .6; } }

/* Client logos: the image on white, or initials on a soft color from the name. */
.logo { --hue: 270; flex: none; display: inline-grid; place-items: center; overflow: hidden; border-radius: 8px; background: hsl(var(--hue) 70% 94%); color: hsl(var(--hue) 45% 32%); font-weight: 600; letter-spacing: .02em; line-height: 1; user-select: none; }
.logo.has-img { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.logo-sm { width: 28px; height: 28px; font-size: 11px; border-radius: 7px; }
.logo-lg { width: 64px; height: 64px; font-size: 22px; border-radius: 14px; }
.logo-lg img { padding: 6px; }
.client-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.client-cell > div, .client-cell > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.client-title { display: flex; align-items: center; gap: 14px; margin: 6px 0 10px; }
.client-title .client-name { margin: 0; flex: 1; min-width: 0; }
.logo-menu { position: relative; }
.logo-menu summary { list-style: none; cursor: pointer; border-radius: 16px; }
.logo-menu summary::-webkit-details-marker { display: none; }
.logo-menu summary:hover .logo { box-shadow: 0 0 0 2px var(--accent); }
.logo-menu .menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 15; width: 230px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(35, 31, 32, .14); }
.menu-item { display: block; width: 100%; text-align: left; padding: 9px 10px; margin: 0; border: 0; border-radius: 8px; background: none; font-size: 15px; font-weight: 400; cursor: pointer; }
.menu-item:hover:not(:disabled) { background: var(--tint); }
.menu-item:disabled { color: var(--muted); cursor: default; }
.menu-item.danger { color: var(--danger); }
.menu-note { margin: 4px 10px 6px; font-size: 13px; color: var(--muted); }

/* ---- Polish pass (design audit 2026-10-30) ---- */

/* Browser surfaces in the palette. */
html { accent-color: var(--accent-deep); scrollbar-color: #cfc8d6 transparent; }
::selection { background: #e9d8ff; color: var(--ink); }
input, textarea { caret-color: var(--accent-deep); }
a { text-underline-offset: 3px; }
h1 { font-size: 36px; }

/* Numbers are data: the body face, tabular, not the headline serif. Labels read as plain words, not small caps. */
.stat strong, .home-stat strong, .unbilled-head strong, .retainer-head strong, .total-row strong {
  font-family: 'Jost', system-ui, sans-serif; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.2;
}
.stat strong, .home-stat strong { font-size: 24px; }
.stat-label, .home-stat .stat-label { font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.unbilled-head { align-items: baseline; }
.unbilled-head h2, .retainer-head h2 { font-size: 19px; }
.unbilled-head strong { font-size: 24px; }
.retainer-head { display: flex; align-items: baseline; gap: 14px; }
.retainer-head strong { font-size: 22px; }
.total-row strong { font-size: 26px; }

/* Two button sizes everywhere: regular for page actions, small inside cards and rows. */
.btn { min-height: 40px; padding: 9px 18px; font-size: 15px; border-radius: 9px; }
.btn.secondary { border-color: #ddd7dc; }
.unbilled-card .btn, .section-head .btn, .logged-head .btn, .link-add .btn, .add-task, .retainer-card .btn, .home-add .btn {
  min-height: 34px; padding: 6px 14px; font-size: 14px;
}
.btn:active:not(:disabled) { transform: translateY(1px); }

/* Main links in lists read as names, not blue links. */
td a:not(.btn):not(.status-pill):not(.open-task) { color: var(--ink); font-weight: 600; text-decoration: none; }
td a:not(.btn):not(.status-pill):not(.open-task):hover { color: var(--accent-deep); text-decoration: underline; }

/* Drawn remove icons, one style for every row. */
.remove { display: inline-grid; place-items: center; }

/* Inline-edit fields show they're editable without looking like a form. */
.details .cell, .project-row .cell { border-bottom-color: var(--line); border-radius: 6px 6px 0 0; }
.details .cell:hover, .project-row .cell:hover { border-radius: 6px; }
.details .cell::placeholder { color: #9b9599; }

/* Retainer card: heading and amount on one line, action on the right. */
.retainer-card { padding-top: 18px; padding-bottom: 18px; }

/* Phone: comfortable tap sizes. */
@media (max-width: 720px) {
  h1 { font-size: 30px; }
  .type-chip { min-height: 36px; padding: 6px 14px; }
  .remove, .project-row .remove, .link-row .remove, .board-table .remove { width: 40px; height: 40px; }
  .status-pill { min-height: 34px; }
  .topbar nav a { padding: 8px 12px; }
}
.crumb-link { display: inline-block; padding: 6px 0; }

/* Billing period and cap. */
.period-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.period-head h2 { font-size: 19px; }
.period-head .field-note { margin: 0; }
.period-figures { display: flex; align-items: baseline; gap: 12px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.period-figures strong { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.period-figures span:not(.field-note) { font-size: 17px; font-weight: 500; }
.period-figures .field-note { margin: 0; }
.cap-bar { height: 8px; margin-top: 12px; border-radius: 99px; background: #efecf2; overflow: hidden; }
.cap-bar span { display: block; height: 100%; border-radius: 99px; background: #1d6b3d; transition: width .25s ease-out; }
.cap-msg { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.period-card.cap-near { border-color: #f5d9a8; background: #fffcf5; }
.period-card.cap-near .cap-bar span { background: #c77700; }
.period-card.cap-near .cap-msg { color: #8a4b00; font-weight: 600; }
.period-card.cap-over { border-color: #f3c4bf; background: #fff8f7; }
.period-card.cap-over .cap-bar span { background: var(--danger); }
.period-card.cap-over .cap-msg { color: var(--danger); font-weight: 600; }
.billing-soon h2 { font-size: 19px; margin-bottom: 6px; }
.billing-soon h2 + .home-invoice { border-top: 0; }
.home-invoice.cap-near .field-note { color: #8a4b00; }
.home-invoice.cap-over .field-note { color: var(--danger); }
.held-tag { position: absolute; right: 74px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 600; color: #8a4b00; background: #fff4e0; border-radius: 99px; padding: 2px 8px; pointer-events: none; }
.hold-toggle { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; cursor: pointer; }
.hold-toggle input { width: 18px; height: 18px; }
.cap-line { margin: 0 0 6px; }
.logged li.rolls label { color: var(--muted); }
.roll-note { font-size: 12px; font-weight: 600; color: #8a4b00; background: #fff4e0; border-radius: 99px; padding: 1px 8px; margin-right: 6px; }
.cap-warning { margin: 10px 0 0; text-align: right; font-weight: 600; color: var(--danger); }
.cap-warning[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .cap-bar span { transition: none; } }

/* Projects: links from the client page, project page grouped by billing period. */
.project-link { min-width: 0; padding: 8px; color: var(--ink); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-link:hover { color: var(--accent-deep); text-decoration: underline; }
.sep-tag { font-size: 11px; font-weight: 600; color: var(--accent-deep); background: var(--tint); border-radius: 99px; padding: 2px 8px; margin-left: 4px; vertical-align: 1px; }
.period-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.period-group-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.period-group-head h3 a { color: var(--ink); text-decoration: none; }
.period-group-head h3 a:hover { color: var(--accent-deep); text-decoration: underline; }
.period-group-head h3 .field-note { display: inline; margin-left: 6px; font-weight: 400; }
.period-group-head .num { color: var(--muted); font-size: 14px; white-space: nowrap; }
.period-group-head + .home-task { border-top: 0; }
.details > .btn { margin-top: 14px; width: 100%; justify-content: center; }
.hold-detail .hold-toggle { font-size: 14px; }

/* Period view and the period card link. */
a.period-card { display: block; color: inherit; text-decoration: none; }
a.period-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(35, 31, 32, .06); }
.period-open { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--accent-deep); }
a.period-card:hover .period-open { text-decoration: underline; }
.client-title h1 { margin: 0; }
.retainer-note { margin: 8px 0 0; text-align: right; }

/* Clients / Internal tabs. */
.area-tabs { margin: -12px 0 18px; }
.area-tabs button { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; }
.area-tabs button > span { display: block; padding: 8px 18px; border-radius: 6px; }
.area-tabs button[aria-selected='true'] > span { background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); font-weight: 600; }
.area-tabs .count { display: inline-block; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--bg); font-size: 12px; }
.internal-table th:nth-child(1) { width: auto; }
#remove-group { display: block; padding: 6px 0 0; }

/* Period view: this invoice and the next, side by side. */
.pv-top { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin: 6px 0 14px; }
.pv-top h1 { margin: 0; }
.pv-top .field-note { margin: 4px 0 0; }
.pv-cap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; }
.pv-cap .cap-bar { margin: 0; grid-column: 1 / -1; }
.pv-cap > span:first-of-type { font-weight: 600; font-variant-numeric: tabular-nums; }
.pv-cap .cap-msg { margin: 0; text-align: right; }
.pv-cap.cap-near .cap-bar span { background: #c77700; }
.pv-cap.cap-near .cap-msg { color: #8a4b00; font-weight: 600; }
.pv-cap.cap-over .cap-bar span { background: var(--danger); }
.pv-cap.cap-over .cap-msg { color: var(--danger); font-weight: 600; }
.pv-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 8px; }
.pv-col { padding: 16px 18px 8px; }
.pv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 8px; }
.pv-head h2 { font-size: 19px; }
.pv-head .num { color: var(--muted); font-size: 14px; white-space: nowrap; }
.pv-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.pv-title { flex: 1; min-width: 0; }
.pv-title a { display: block; color: var(--ink); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-title a:hover { color: var(--accent-deep); text-decoration: underline; }
.pv-title .field-note { display: block; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-tag { flex: none; font-size: 11px; font-weight: 600; color: #8a4b00; background: #fff4e0; border-radius: 99px; padding: 2px 8px; }
.pv-tag.over { color: var(--danger); background: #fdecea; }
.pv-hours { flex: none; min-width: 48px; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; background: none; font: inherit; font-variant-numeric: tabular-nums; text-align: right; cursor: pointer; color: var(--ink); }
.pv-hours:hover { border-color: var(--line); background: #fff; }
.pv-hours-input { flex: none; width: 64px; padding: 6px 8px; }
.pv-move { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--accent-deep); cursor: pointer; }
.pv-move:hover { background: var(--tint); border-color: var(--accent); }
.pv-empty { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }
.pv-fold { margin-top: 16px; padding: 0 18px; }
.pv-fold summary { display: flex; align-items: baseline; gap: 12px; padding: 14px 0; cursor: pointer; list-style: none; font-weight: 600; }
.pv-fold summary::-webkit-details-marker { display: none; }
.pv-fold summary::before { content: ''; width: 7px; height: 7px; border-right: 1.7px solid var(--muted); border-bottom: 1.7px solid var(--muted); transform: rotate(-45deg); align-self: center; transition: transform .15s; }
.pv-fold[open] summary::before { transform: rotate(45deg); }
.pv-fold summary .field-note { margin: 0; font-weight: 400; }
.pv-fold-link { margin-left: auto; font-weight: 600; font-size: 14px; color: var(--accent-deep); }
.pv-fold .pv-row:last-child { padding-bottom: 14px; }
.pv-note { margin-top: 10px; }
@media (max-width: 720px) {
  .pv-board { grid-template-columns: minmax(0, 1fr); }
  .pv-cap .cap-msg { text-align: left; grid-column: 1 / -1; }
  .pv-move, .pv-hours { min-height: 40px; }
  .pv-move { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .pv-fold summary::before { transition: none; } }
.prop .hold-toggle + .link-button { display: block; padding: 6px 0 0; font-size: 14px; }
.pv-board > .card + .card { margin-top: 0; }
.pv-col, .pv-fold { min-width: 0; }

/* Payments without an invoice. */
.retainer-head .field-note { margin: 0; }
.section-actions { display: flex; align-items: center; gap: 10px; }
.payment-form { display: grid; grid-template-columns: 1fr 150px 1.4fr auto; gap: 8px; margin: 6px 0 12px; }
.payment-form[hidden] { display: none; }
.payment-form input { padding: 8px 10px; font-size: 14px; }
.payment-form .btn { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.payment-row .num { display: inline-flex; gap: 8px; align-items: center; }
.payment-row .remove { width: 30px; height: 30px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: var(--radius); }
.payment-row .remove:hover { background: #fdecea; color: var(--danger); }
.received-row { align-items: center; }
.received-row .client-cell { color: inherit; text-decoration: none; }
.received-row .btn { min-height: 34px; padding: 6px 14px; font-size: 14px; }
@media (max-width: 720px) { .payment-form { grid-template-columns: 1fr 1fr; } .payment-form input[name=note] { grid-column: 1 / -1; } }

/* Invoice number and title, edited in place. */
.invoice-names { min-width: 0; flex: 1; }
.invoice-names .cell { display: block; margin-left: -8px; }
.invoice-number { font-family: 'Gloock', Georgia, serif; font-size: 36px; line-height: 1.15; padding: 2px 8px; max-width: 420px; }
.invoice-title { font-size: 17px; font-weight: 500; padding: 4px 8px; max-width: 520px; }
.invoice-title::placeholder { color: #a39da1; font-weight: 400; }
.invoice-names p { margin: 4px 0 0; }
@media (max-width: 720px) { .invoice-number { font-size: 30px; } }
.retainer-done .field-note { display: block; margin: 2px 0 0; }

/* Extra projects: badge on the board, chips in the task panel. */
.project-cell { display: flex; align-items: center; gap: 4px; }
.project-cell .cell { min-width: 0; }
.extra-badge { flex: none; font-size: 11px; font-weight: 600; color: var(--accent-deep); background: var(--tint); border-radius: 99px; padding: 2px 7px; cursor: default; }
.also-in { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.also-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--tint); color: var(--accent-deep); font-size: 14px; font-weight: 500; }
.also-chip button { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 99px; background: none; color: inherit; cursor: pointer; }
.also-chip button:hover { background: #e2ccff; }
.prop .also-add { min-width: 0; width: auto; color: var(--muted); }
@media (max-width: 720px) { .also-chip button { width: 32px; height: 32px; } }
.prop .hold-toggle input.cell { min-width: 0; width: 18px; height: 18px; padding: 0; flex: none; }
.prop .hold-toggle { justify-content: flex-start; }

/* Task panel: files and comments. */
.panel-notes { flex: none; min-height: 220px; }
.panel-section { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.panel-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-section h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.add-files { cursor: pointer; font-weight: 600; color: var(--accent-deep); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.file-grid > .field-note { grid-column: 1 / -1; margin: 0; }
.file-card { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.file-card:hover { border-color: var(--accent); }
.file-open { display: grid; gap: 2px; padding: 10px; color: inherit; text-decoration: none; }
.file-card.is-image .file-open { padding: 0 0 8px; }
.file-card img { display: block; width: 100%; height: 96px; object-fit: cover; background: var(--bg); margin-bottom: 6px; }
.file-card.is-image .file-name, .file-card.is-image .field-note { padding: 0 10px; }
.file-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--tint); color: var(--accent-deep); margin-bottom: 6px; }
.file-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .field-note { margin: 0; }
.file-remove { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .92); color: var(--muted); cursor: pointer; opacity: 0; }
.file-card:hover .file-remove, .file-remove:focus-visible { opacity: 1; }
.file-remove:hover { color: var(--danger); }
.drop-hint { margin: 8px 0 0; }
.task-panel.dropping { box-shadow: inset 0 0 0 3px var(--accent), -12px 0 32px rgba(35, 31, 32, .12); }
.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment + .comment { border-top: 1px solid var(--line); }
.comment-avatar { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 99px; background: var(--tint); color: var(--accent-deep); font-size: 11px; font-weight: 600; }
.comment-body { min-width: 0; flex: 1; }
.comment-meta { display: flex; align-items: baseline; gap: 8px; }
.comment-meta .field-note { margin: 0; }
.comment-delete { margin-left: auto; padding: 0; font-size: 13px; opacity: 0; }
.comment:hover .comment-delete, .comment-delete:focus-visible { opacity: 1; }
.comment-text { margin-top: 2px; overflow-wrap: anywhere; }
.comment-form { margin-top: 8px; }
.comment-form textarea { min-height: 64px; font-size: 15px; }
.comment-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.comment-actions .field-note { margin: 0; }
.comment-actions .btn { min-height: 34px; padding: 6px 14px; font-size: 14px; }
.author-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.author-pick .field-note { flex-basis: 100%; margin: 0; }
.author-pick input { width: 160px; padding: 8px 10px; }
.author-pick .btn { min-height: 36px; padding: 6px 14px; font-size: 14px; }
@media (hover: none) { .file-remove, .comment-delete { opacity: 1; } }

/* Notion-style notes. */
.panel-notes { flex: none; min-height: 220px; border: 1px solid transparent; border-radius: 8px; margin: 0 -8px; padding: 4px 8px; cursor: text; }
.panel-notes:hover { border-color: var(--line); }
.panel-notes:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--tint); }
.notes-loading { color: var(--muted); white-space: pre-wrap; }
.notes-doc { min-height: 200px; outline: none; font-size: 16px; line-height: 1.65; }
.notes-doc > * + * { margin-top: .55em; }
.notes-doc p { margin: 0; }
.notes-doc h1, .notes-doc h2, .notes-doc h3 { font-family: 'Jost', system-ui, sans-serif; font-weight: 600; line-height: 1.25; margin: 1.1em 0 .3em; }
.notes-doc h1 { font-size: 24px; }
.notes-doc h2 { font-size: 20px; }
.notes-doc h3 { font-size: 17px; }
.notes-doc > :first-child { margin-top: 0; }
.notes-doc ul, .notes-doc ol { margin: .3em 0; padding-left: 1.4em; }
.notes-doc li > p { margin: 0; }
.notes-doc ul[data-type='taskList'] { list-style: none; padding-left: 2px; }
.notes-doc ul[data-type='taskList'] li { display: flex; gap: 8px; align-items: flex-start; }
.notes-doc ul[data-type='taskList'] li > label { flex: none; margin: 4px 0 0; }
.notes-doc ul[data-type='taskList'] li > label input { width: 16px; height: 16px; accent-color: var(--accent-deep); cursor: pointer; }
.notes-doc ul[data-type='taskList'] li > div { flex: 1; min-width: 0; }
.notes-doc ul[data-type='taskList'] li[data-checked='true'] > div { color: var(--muted); text-decoration: line-through; }
.notes-doc blockquote { margin: .5em 0; padding-left: 14px; border-left: 3px solid #e2ccff; color: #4a4547; }
.notes-doc pre { background: #f4f2f5; border-radius: 8px; padding: 10px 12px; font-size: 14px; overflow-x: auto; }
.notes-doc code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: #f4f2f5; border-radius: 4px; padding: 1px 4px; }
.notes-doc pre code { background: none; padding: 0; }
.notes-doc hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.notes-doc a { color: var(--accent-deep); }
.notes-doc p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: #a39da1; float: left; height: 0; pointer-events: none; }
.slash-menu { z-index: 40; width: 260px; max-height: 300px; overflow-y: auto; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(35, 31, 32, .16); }
.slash-item { display: grid; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; font: inherit; }
.slash-item strong { font-size: 14px; font-weight: 600; }
.slash-item span { font-size: 12px; color: var(--muted); }
.slash-item.is-active, .slash-item:hover { background: var(--tint); }
.slash-empty { padding: 8px 10px; font-size: 14px; color: var(--muted); }

/* Search in the top bar. */
.search { position: relative; width: min(340px, 34vw); }
.search input { padding: 8px 12px 8px 34px; border-radius: 99px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.6' stroke='%236e6a6b' stroke-width='1.6' fill='none'/%3E%3Cpath d='M10.6 10.6 14 14' stroke='%236e6a6b' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 12px 50% / 15px; border-color: var(--line); font-size: 15px; }
.search input:focus { background-color: #fff; border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--tint); }
.search-results { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: min(480px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow-y: auto; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(35, 31, 32, .16); }
.search-results[hidden] { display: none; }
.sr-group + .sr-group { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.sr-title { padding: 6px 10px 2px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sr-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.sr-row:hover, .sr-row:focus-visible { background: var(--tint); outline: none; }
.sr-row .status-pill, .sr-row .pill { flex: none; font-size: 11px; padding: 2px 8px; }
.sr-text { min-width: 0; display: grid; }
.sr-main { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-row mark { background: #f3e3ff; color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-empty { margin: 0; padding: 14px 10px; color: var(--muted); font-size: 14px; }
@media (max-width: 720px) {
  .search { order: 4; width: 100%; }
  .search-results { left: 0; right: auto; width: 100%; }
}
#signout { white-space: nowrap; }
.sr-row > .status-pill, .sr-row > .pill { width: 112px; text-align: center; overflow: hidden; text-overflow: ellipsis; }
.sr-row > .logo { margin: 0 42px 0 42px; }
@media (max-width: 720px) { .sr-row > .status-pill, .sr-row > .pill { width: 96px; } .sr-row > .logo { margin: 0 34px; } }
@media (max-width: 720px) { .sr-row > .status-pill { display: none; } }

/* Proposals */
.proposal-draft { background: var(--st-neutral); color: var(--st-neutral-ink); }
.proposal-sent { background: var(--st-progress); color: var(--st-progress-ink); }
.proposal-approved { background: var(--st-paid); color: var(--st-paid-ink); }
.proposal-rejected { background: var(--st-invoice); color: var(--st-invoice-ink); }
.proposal-new h2 { font-size: 19px; margin-bottom: 10px; }
.proposal-new-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 10px; }
.proposal-new-fields [hidden] { display: none; }
.proposal-text { width: 100%; margin-top: 10px; font-size: 15px; line-height: 1.6; }
.proposal-text.tall { min-height: 320px; }
.phase-head { display: flex; align-items: center; gap: 8px; }
.phase-name { flex: 1; font-family: 'Gloock', Georgia, serif; font-size: 20px; }
.phase-terms { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin-top: 6px; }
.add-phase { justify-self: start; }
.home-stats.one { grid-template-columns: 1fr; }
a.type-chip { text-decoration: none; border-style: solid; }
@media (max-width: 767px) {
  .proposal-new-fields, .phase-terms { grid-template-columns: 1fr; }
}
