@font-face {
  font-family: "Engravers Hille";
  src: url("/fonts/engravers-bold.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #F1F1E8;
  --panel: #FAFAF4;
  --side: #E7E7DB;
  --ink: #505D4B;        /* logo green */
  --text: #3d453a;
  --muted: #7c8577;
  --line: rgba(80, 93, 75, .22);
  --line-soft: rgba(80, 93, 75, .12);
  --danger: #9b3b2f;
  --logo: "Engravers Hille", "Engravers MT", "EngraversMT", "Engravers", "Cinzel", "Times New Roman", serif;
  --display: "Times New Roman", Times, serif;  /* headings, labels, buttons (Paige's pick) */
  --serif: "Times New Roman", Times, serif;
  --gutter: clamp(16px, 3vw, 40px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--serif); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.caps {
  font-family: var(--display); text-transform: uppercase;
  letter-spacing: .18em; font-size: 12px; color: var(--ink);
}
.muted { color: var(--muted); }
.wordmark {
  font-family: var(--logo); text-transform: uppercase; color: var(--ink);
  letter-spacing: .3em; margin-right: -.3em; white-space: nowrap; text-decoration: none; line-height: 1;
}

/* ---------- buttons + fields ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display); text-transform: uppercase; letter-spacing: .18em; font-size: 11px;
  background: var(--ink); color: var(--bg); border: 1px solid var(--ink);
  padding: 11px 18px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: opacity .2s;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { padding: 7px 12px; font-size: 10px; }
.link-btn {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  font-size: 14px; text-decoration: underline; text-underline-offset: 3px; padding: 2px;
}
.link-btn:hover { color: var(--ink); }
.link-btn.danger:hover { color: var(--danger); }

.field { display: grid; gap: 6px; }
.field > span { font-family: var(--display); text-transform: uppercase; letter-spacing: .18em; font-size: 10px; color: var(--muted); }
.input, .textarea {
  width: 100%; background: var(--panel); border: 1px solid var(--line);
  padding: 10px 12px; font-size: 16px; border-radius: 0;
}
.input:focus, .textarea:focus { outline: 2px solid rgba(80, 93, 75, .35); outline-offset: -1px; border-color: var(--ink); }
.textarea { min-height: 90px; resize: vertical; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.form-row > .field { flex: 1 1 200px; }
.error { color: var(--danger); font-size: 15px; }

/* ---------- auth pages ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 40px var(--gutter);
}
.auth-card { width: min(420px, 100%); text-align: center; display: grid; gap: 22px; }
.auth-card .wordmark { font-size: clamp(22px, 5vw, 32px); }
.auth-card form { display: grid; gap: 14px; text-align: left; }
.auth-card .btn { justify-content: center; }

/* ---------- shell ---------- */
.shell {
  display: grid; grid-template-columns: 232px 1fr; min-height: 100vh;
  /* paints the sidebar color the full height of long pages */
  background: linear-gradient(to right, var(--side) 231px, var(--line) 231px 232px, var(--bg) 232px);
}
.sidebar {
  padding: 28px 18px; display: flex; flex-direction: column; gap: 34px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .wordmark { font-size: 15px; padding-left: 10px; }
.nav { display: grid; gap: 2px; }
.nav a {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .18em; font-size: 12px;
  color: var(--muted); text-decoration: none; padding: 11px 10px; border-left: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current] { color: var(--ink); border-left-color: var(--ink); background: rgba(80, 93, 75, .07); }
.sidebar-foot { margin-top: auto; padding-left: 10px; display: grid; gap: 4px; font-size: 14px; }
.sidebar-foot .link-btn { justify-self: start; padding: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px var(--gutter); border-bottom: 1px solid var(--line); background: var(--bg);
}
.topbar .wordmark { font-size: 20px; }
.topbar-right { display: flex; gap: 16px; align-items: center; font-size: 14px; }

.main { padding: 30px var(--gutter) 80px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  letter-spacing: .14em; font-size: clamp(20px, 2.6vw, 28px); color: var(--ink); line-height: 1.2;
}
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.sub { color: var(--muted); font-size: 15px; margin-top: 4px; }

/* ---------- tabs (project tabs + section bar) ---------- */
.tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 24px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .16em; font-size: 11px;
  color: var(--muted); text-decoration: none; padding: 12px 16px; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs.sections { background: var(--panel); border: 1px solid var(--line); border-bottom: 0; margin-bottom: 0; }
.tabs.sections a[aria-current] { background: var(--bg); }

/* ---------- cards / lists ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  display: grid; gap: 6px; padding: 22px; background: var(--panel); border: 1px solid var(--line);
  text-decoration: none; transition: border-color .2s;
}
a.card:hover { border-color: var(--ink); }
.card h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .14em; font-size: 15px; color: var(--ink); }
.card .meta { color: var(--muted); font-size: 14px; }
.pill {
  justify-self: start; font-family: var(--display); text-transform: uppercase; letter-spacing: .16em;
  font-size: 9px; padding: 4px 8px; border: 1px solid var(--line); color: var(--muted);
}
.pill.active { color: var(--ink); border-color: var(--ink); }

.panel { background: var(--panel); border: 1px solid var(--line); padding: 22px; margin-bottom: 20px; }
.panel h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .16em; font-size: 13px; color: var(--ink); margin-bottom: 14px; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }

.rows { display: grid; border-top: 1px solid var(--line-soft); }
.row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 4px; border-bottom: 1px solid var(--line-soft);
}
.row .grow { flex: 1 1 200px; min-width: 0; }
.row a.title { color: var(--ink); text-decoration: none; font-size: 17px; }
.row a.title:hover { text-decoration: underline; }
.row .actions { display: flex; gap: 10px; align-items: center; }

/* ---------- items table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-top: 0; background: var(--panel); }
table.items { border-collapse: collapse; width: 100%; font-size: 15px; }
table.items th {
  font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .14em;
  font-size: 10px; color: var(--ink); text-align: left; padding: 10px 8px;
  background: #ECECE1; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.items td { border-bottom: 1px solid var(--line-soft); padding: 0; vertical-align: middle; }
table.items td.room-cell { padding: 8px; font-weight: 600; color: var(--ink); white-space: nowrap; }
table.items tr.group td { background: #F4F4EB; border-top: 1px solid var(--line); }
table.items tr.group td.room-cell { padding: 10px 8px; }
table.items .cell {
  display: block; width: 100%; min-width: 110px; border: 0; background: transparent;
  padding: 9px 8px; font-size: 15px; line-height: 1.35; resize: none; overflow: hidden;
}
table.items .cell.wide { min-width: 260px; }
table.items .cell.narrow { min-width: 54px; width: 54px; text-align: center; }
table.items .cell.link { min-width: 200px; }
table.items .cell:hover { background: rgba(80, 93, 75, .05); }
table.items .cell:focus { outline: 2px solid rgba(80, 93, 75, .45); outline-offset: -2px; background: #fff; }
table.items td { vertical-align: top; }
.link-cell { display: flex; align-items: center; gap: 2px; padding: 5px 6px; }
.link-cell a {
  flex: none; padding: 4px 8px; color: var(--ink); text-decoration: none; font-size: 14px;
  border: 1px solid var(--line); white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}
.link-cell a:hover { background: var(--ink); color: var(--bg); }
.link-cell .edit-link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; font-size: 14px; }
.link-cell .edit-link:hover { color: var(--ink); }
td.c-edited { padding: 9px 8px !important; font-size: 12px; color: var(--muted); white-space: nowrap; }
td.c-del { width: 1%; padding: 5px 6px !important; }
td.c-del button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; padding: 4px 6px; line-height: 1; }
td.c-del button:hover { color: var(--danger); }
.add-row { padding: 10px 8px; }
.add-row button { background: none; border: 0; color: var(--ink); cursor: pointer; font-size: 15px; padding: 4px 0; }
.add-row button:hover { text-decoration: underline; }
.summary { display: flex; gap: 18px; color: var(--muted); font-size: 14px; margin: 14px 0 0; flex-wrap: wrap; }

/* ---------- to-dos ---------- */
.todo { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 14px 4px; border-bottom: 1px solid var(--line-soft); }
.todo input[type=checkbox] { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--ink); cursor: pointer; }
.todo .title { font-size: 17px; cursor: pointer; }
.todo.done .title { text-decoration: line-through; color: var(--muted); }
.todo .due { font-size: 13px; color: var(--muted); }
.todo .due.overdue { color: var(--danger); }
.todo .notes { font-size: 14px; color: var(--muted); white-space: pre-wrap; margin-top: 2px; }
.todo-edit { display: grid; gap: 10px; grid-column: 2 / 4; }

/* ---------- photos + pricing in tables ---------- */
table.items th.photo-col, table.items td.photo-col { width: 1%; padding: 5px 6px !important; }
table.items img.thumb { width: 44px; height: 44px; object-fit: contain; background: #fff; border: 1px solid var(--line-soft); display: block; }
table.items th.money { text-align: right; }
table.items td.money { text-align: right; }
table.items td.money .cell.money-input { width: 96px; min-width: 96px; text-align: right; }
table.items td.markup { padding: 9px 8px !important; color: var(--muted); white-space: nowrap; font-size: 14px; }

/* ---------- Project Overview ---------- */
.ov-toolbar { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.ov-group { display: flex; gap: 10px; align-items: center; }
.ov-group select { width: auto; padding: 6px 10px; font-size: 15px; }
.ov-archived { display: flex; gap: 6px; align-items: center; font-size: 15px; color: var(--muted); cursor: pointer; }
.ov-archived input { width: 16px; height: 16px; accent-color: var(--ink); }

/* The wrap scrolls both ways so the header row and Name column can stay pinned. */
.ov-wrap { border-top: 1px solid var(--line); max-height: calc(100vh - 140px); overflow: auto; }
table.overview { width: max-content; min-width: 100%; }
table.overview th { position: sticky; top: 0; z-index: 3; }
table.overview th.sticky, table.overview td.sticky { position: sticky; left: 0; }
table.overview th.sticky { z-index: 4; }
table.overview td.sticky { z-index: 2; background: var(--panel); box-shadow: 1px 0 0 var(--line), inset 0 -1px 0 var(--line-soft); }
table.overview .cell { min-width: 120px; }
table.overview .cell.name-input { min-width: 190px; width: 190px; font-weight: 600; color: var(--ink); }
table.overview .cell.wide { min-width: 240px; }
table.overview td.c-dimensions .cell, table.overview td.c-finish .cell { min-width: 150px; }
table.overview tr.archived td { opacity: .55; }
table.overview tr.archived td.sticky { opacity: 1; color: var(--muted); }

tr.group-head td { background: #E9E9DD; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; }
.gh {
  position: sticky; left: 0; display: flex; gap: 6px 16px; align-items: center; flex-wrap: wrap;
  padding: 10px 10px; width: calc(100vw - 232px - 2 * var(--gutter) - 2px); min-width: 300px;
}
@media (max-width: 820px) { .gh { width: calc(100vw - 2 * var(--gutter) - 2px); min-width: 0; } }
.gh-label {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.gh-count { font-size: 14px; }
.gh-total { font-size: 14px; color: var(--ink); }
.gh-actions { display: flex; gap: 8px; margin-left: auto; }
.gh-note {
  flex: 1 1 100%; border: 0; background: transparent; font-style: italic; font-size: 14px; color: var(--text); padding: 2px 0;
}
.gh-note:focus { outline: none; box-shadow: 0 1px 0 var(--ink); }

.cell-select {
  border: 0; background: transparent; padding: 9px 6px; font-size: 14px; cursor: pointer; max-width: 210px;
}
.cell-select:hover { background: rgba(80, 93, 75, .05); }
.cell-select:focus { outline: 2px solid rgba(80, 93, 75, .45); outline-offset: -2px; }
td.c-status { padding: 4px 6px !important; }
.cell-select.status { border-radius: 999px; padding: 5px 10px; margin: 0; font-size: 13px; border: 1px solid transparent; }
/* One color per status (public/portal/sections.js). */
.tone-grey { background: #E4E4DA !important; color: #5f675b; }
.tone-red { background: #F2D3CC !important; color: #8f2a1c; }
.tone-orange { background: #F6DEC6 !important; color: #8a4512; }
.tone-blue { background: #D6E3F0 !important; color: #2a4f78; }
.tone-yellow { background: #F4EBB8 !important; color: #6b5a0c; }
.tone-green { background: #CFE6C4 !important; color: #2f5e22; }
.tone-teal { background: #CBE5E1 !important; color: #1f5a54; }
.tone-rose { background: #F1D4E0 !important; color: #84304f; }
.tone-indigo { background: #DCDAF1 !important; color: #3e3a7a; }
.tone-tan { background: #EADFCC !important; color: #6a5434; }
.tone-dark { background: var(--ink) !important; color: var(--bg); }
.tone-purple { background: #E6D9EC !important; color: #5b3a6b; }
.tone-pale { background: transparent !important; color: #8d9489; border: 1px dashed #b9beb4 !important; }
.dot.tone-dark { background: var(--ink) !important; }
.dot.tone-pale { border-width: 1px !important; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 2px currentColor; }

table.overview td.money { white-space: nowrap; }
table.overview td.computed { padding: 9px 8px !important; color: var(--ink); min-width: 90px; }
table.overview td.c-total { font-weight: 600; }
table.overview .cell.money-input { width: 100px; min-width: 100px; text-align: right; }
table.overview .cell.pct-input { width: 64px; min-width: 64px; text-align: right; }
.markup-cell { display: flex; align-items: flex-start; }
.markup-cell .cell-select { padding-left: 2px; padding-right: 2px; }
.na { display: block; padding: 9px 8px; color: var(--muted); }

.file-add {
  background: none; border: 1px dashed var(--line); color: var(--muted); cursor: pointer;
  font-size: 13px; padding: 4px 8px; margin: 6px; white-space: nowrap;
}
.file-add:hover { color: var(--ink); border-color: var(--ink); }
.img-cell { position: relative; padding: 5px 6px; }
.img-actions { position: absolute; top: 2px; right: 0; display: none; flex-direction: column; }
.img-cell:hover .img-actions, .img-cell:focus-within .img-actions { display: flex; }
.img-actions button, .pdf-cell button {
  background: var(--panel); border: 1px solid var(--line-soft); color: var(--muted); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 3px 5px;
}
.img-actions button:hover, .pdf-cell button:hover { color: var(--ink); }
.pdf-cell { display: flex; align-items: center; gap: 4px; padding: 6px; }
.pdf-cell a {
  color: var(--ink); text-decoration: none; font-size: 13px; border: 1px solid var(--line);
  padding: 4px 8px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pdf-cell a:hover { background: var(--ink); color: var(--bg); }
.summary-total { color: var(--ink); }
.link-add { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 2px; white-space: nowrap; }
.link-add:hover { color: var(--ink); text-decoration: underline; }
.pricing-out { margin-top: 10px; font-size: 15px; color: var(--ink); min-height: 1.4em; }
.narrow-field { flex: 0 0 90px !important; }

/* ---------- Add Item: floating button + popup ---------- */
.fab {
  position: fixed; z-index: 30;
  right: calc(24px + env(safe-area-inset-right, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: var(--bg); font-size: 32px; line-height: 1; font-family: var(--serif);
  box-shadow: 0 6px 18px rgba(40, 50, 38, .28); transition: transform .15s, box-shadow .15s;
}
.fab:hover { transform: scale(1.06); box-shadow: 0 8px 22px rgba(40, 50, 38, .34); }
.fab:focus-visible { outline: 3px solid rgba(80, 93, 75, .45); outline-offset: 3px; }

dialog.modal {
  border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 0;
  width: min(820px, calc(100% - 24px)); max-height: calc(100vh - 32px); margin: auto;
  box-shadow: 0 24px 60px rgba(30, 36, 28, .3);
}
dialog.modal::backdrop { background: rgba(40, 46, 38, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.modal-head h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .18em; font-size: 15px; color: var(--ink); }
.modal-x { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.modal-x:hover { color: var(--ink); }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 18px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.clip-form { display: grid; gap: 14px; }
.clip-grid { display: grid; grid-template-columns: 230px 1fr; gap: 24px; }
.clip-grid.no-photo { grid-template-columns: 1fr; }
.clip-photo { aspect-ratio: 1; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; position: relative; overflow: hidden; }
.clip-photo img { width: 100%; height: 100%; object-fit: contain; }
.clip-photo-empty { display: none; color: var(--muted); font-size: 14px; }
.clip-photo.empty .clip-photo-empty { display: block; }
.clip-photo-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 14px; }
.clip-source { font-size: 13px; margin-top: 8px; }
.clip-fields { display: grid; gap: 12px; align-content: start; }
.clip-fields .form-row > .field { flex: 1 1 140px; }
.pricing { border: 1px dashed var(--line); padding: 12px; background: var(--panel); }
.pricing-note { font-size: 13px; color: var(--muted); margin-bottom: 8px; font-style: italic; }
.notice { background: var(--panel); border-left: 3px solid var(--ink); padding: 10px 14px; margin-bottom: 16px; font-size: 15px; }

/* ---------- toast ---------- */
#toast {
  z-index: 60; position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--danger); }

/* ---------- phone ---------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; background: var(--bg); }
  .sidebar {
    background: var(--side);
    position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 10px 18px; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .sidebar .wordmark { padding-left: 0; font-size: 18px; }
  .nav { grid-auto-flow: column; order: 3; width: 100%; overflow-x: auto; }
  .nav a { border-left: 0; border-bottom: 2px solid transparent; padding: 8px 10px; }
  .nav a[aria-current] { border-bottom-color: var(--ink); background: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; text-align: right; }
  .sidebar-foot .who { display: none; }
  .main { padding-top: 22px; }
  .fab { right: 16px; }
  .clip-grid { grid-template-columns: 1fr; }
  .clip-photo { max-width: 240px; margin: 0 auto; width: 100%; }
}
table.overview .ro { padding: 9px 8px; font-size: 15px; line-height: 1.35; min-width: 110px; max-width: 280px; }
table.overview td.c-name .ro { min-width: 190px; font-weight: 600; color: var(--ink); }
.ov-preview { margin-left: auto; }
p.gh-note { font-style: italic; }
.status-pill { display: inline-block; margin: 6px 0; padding: 5px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
td.c-approved { padding: 6px 8px !important; white-space: nowrap; }
.approve-btn {
  background: var(--panel); border: 1px solid var(--ink); color: var(--ink); cursor: pointer;
  font-family: var(--display); text-transform: uppercase; letter-spacing: .14em; font-size: 10px; padding: 7px 12px;
}
.approve-btn:hover { background: var(--ink); color: var(--bg); }
.approve-btn.on { background: var(--ink); color: var(--bg); }
.approve-btn.on:hover { opacity: .85; }
.approved-tag { color: var(--ink); font-size: 14px; font-weight: 600; }
.approved-by { font-size: 12px; color: var(--muted); margin-top: 3px; }
.name-wrap { display: flex; align-items: flex-start; }
.drag {
  flex: none; padding: 9px 2px 9px 6px; color: #a3ab9e; cursor: grab; font-size: 16px; line-height: 1.2;
  touch-action: none; user-select: none;
}
.drag:hover { color: var(--ink); }
.name-wrap .cell.name-input { min-width: 176px; width: 176px; padding-left: 4px; }
tr.dragging td { background: #EEF0E6 !important; }
tr.dragging .drag { cursor: grabbing; color: var(--ink); }
.open-btn {
  flex: none; align-self: flex-start; margin: 6px 4px 0 0; background: none; border: 1px solid transparent;
  color: #a3ab9e; cursor: pointer; font-size: 14px; line-height: 1; padding: 3px 5px;
}
.open-btn:hover { color: var(--ink); border-color: var(--line); background: #fff; }
.thumb-btn { background: none; border: 0; padding: 0; cursor: pointer; display: block; }
.name-wrap .cell.name-input { min-width: 160px; width: 160px; }
.pd-file { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-top: 14px; font-size: 14px; }
.pd-file-label { font-family: var(--display); text-transform: uppercase; letter-spacing: .14em; font-size: 10px; color: var(--muted); width: 100%; }
.pd-file a { color: var(--ink); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-foot .pd-dup { margin-right: auto; }

/* Vendors page */
.vendor-search { max-width: 320px; }
table.vendors .cell.name-input { min-width: 200px; width: 200px; }
table.vendors .cell.user { min-width: 230px; }
table.vendors .cell.pct { min-width: 80px; width: 80px; }
table.vendors .cell.wide { min-width: 320px; }
.pw-cell { display: flex; align-items: center; gap: 2px; padding-right: 6px; }
.pw-cell .cell.pw { min-width: 130px; width: 130px; }
.pw-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 4px 6px; text-decoration: underline; }
.pw-btn:hover { color: var(--ink); }
td.empty-row { padding: 18px 10px !important; color: var(--muted); font-style: italic; }

/* Invoices */
.click-row { cursor: pointer; }
.click-row:hover td { background: rgba(80, 93, 75, .04); }
table.invoice-list td { padding: 11px 8px; }
.inv-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.invoice-doc { background: #fff; border: 1px solid var(--line); padding: clamp(20px, 4vw, 44px); max-width: 920px; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.inv-brand { font-family: var(--logo); text-transform: uppercase; letter-spacing: .3em; font-size: 22px; color: var(--ink); margin-bottom: 6px; }
.inv-meta { text-align: right; }
.inv-title { font-family: var(--display); text-transform: uppercase; letter-spacing: .16em; font-size: 15px; color: var(--ink); margin-bottom: 4px; }
.inv-paid { color: #2f6b3a; font-weight: 600; margin-top: 4px; }
.inv-to { display: flex; gap: 40px; flex-wrap: wrap; padding: 20px 0; }
.inv-to .caps { margin-bottom: 4px; }
.inv-table-wrap { overflow-x: auto; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.inv-table th { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .14em; font-size: 10px; color: var(--ink); text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.inv-table td { padding: 10px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.inv-table .money { text-align: right; white-space: nowrap; }
.inv-table .num { text-align: center; }
.inv-name { font-weight: 600; color: var(--ink); }
.inv-thumb { width: 56px; height: 56px; object-fit: contain; background: #fff; border: 1px solid var(--line-soft); display: block; }
.inv-thumb.empty { display: inline-block; background: #F4F4EB; }
.inv-table tfoot td { border-bottom: 0; padding-top: 16px; }
.inv-total-label { text-align: right; font-family: var(--display); text-transform: uppercase; letter-spacing: .16em; font-size: 12px; color: var(--ink); }
.inv-total { font-size: 19px; font-weight: 600; color: var(--ink); }
.inv-notes { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft); white-space: pre-wrap; font-size: 15px; }
.inv-public { max-width: 960px; margin: 0 auto; padding: 32px 16px 60px; }
.inv-public .invoice-doc { margin: 0 auto; }
.pick-list { display: grid; gap: 2px; max-height: 55vh; overflow: auto; }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.pick-row:hover { background: rgba(80, 93, 75, .04); }
.pick-row input { flex: none; width: 18px; height: 18px; }
.pick-name { flex: 1; display: grid; font-weight: 600; color: var(--ink); }
.pick-name .muted { font-weight: 400; font-size: 13px; }
.pick-money { white-space: nowrap; font-size: 14px; }
.danger-text { color: var(--danger); }
/* Phone: each invoice line becomes a small card — photo | name + "unit × qty" | total. */
@media (max-width: 600px) {
  .inv-meta { text-align: left; }
  .inv-table thead { display: none; }
  .inv-table tbody tr { display: grid; grid-template-columns: 56px 1fr auto; grid-template-areas: "img name total" "img unit total"; column-gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
  .inv-table tbody td { border: 0; padding: 0; }
  .inv-table .inv-img { grid-area: img; }
  .inv-table .inv-name { grid-area: name; }
  .inv-table .inv-unit { grid-area: unit; text-align: left; color: var(--muted); font-size: 14px; display: flex; gap: 4px; }
  .inv-table .inv-qty { grid-area: unit; justify-self: start; margin-left: 5.2em; color: var(--muted); font-size: 14px; }
  .inv-table .inv-qty::before { content: "× "; }
  .inv-table .inv-line-total { grid-area: total; align-self: center; }
  .inv-table tbody td.c-del { grid-area: total; align-self: start; justify-self: end; }
  .inv-table tfoot tr { display: flex; justify-content: flex-end; gap: 16px; align-items: baseline; }
  .inv-table tfoot td { padding: 14px 0 0; }
}
@media print {
  .sidebar, .topbar, .no-print, #toast { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .invoice-doc { border: 0; max-width: none; padding: 0; }
  body { background: #fff; }
}

/* ---------- To-dos → Time ---------- */
.time-bar { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: end; margin-bottom: 22px; }
.time-filter { width: auto; max-width: 100%; }
.time-rate { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.time-rate .muted { font-size: 14px; padding-bottom: 9px; }
.time-month { margin-bottom: 26px; }
.time-month h2 { display: flex; justify-content: space-between; gap: 12px; font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .16em; font-size: 13px; color: var(--ink); margin-bottom: 8px; }
.time-month h2 .muted { font-family: inherit; }
.time-month .table-wrap { border-top: 1px solid var(--line); }
table.time-table td { padding: 9px 8px; vertical-align: middle; }
table.time-table .num { text-align: right; width: 1%; white-space: nowrap; }
table.time-table .nowrap { white-space: nowrap; width: 1%; }
table.time-table .time-status { text-align: right; white-space: nowrap; width: 1%; font-size: 13px; }
table.time-table .status-pill { text-decoration: none; }
.pick-head { font-family: var(--display); text-transform: uppercase; letter-spacing: .16em; font-size: 11px; color: var(--muted); margin: 18px 0 8px; }
.pick-rate { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px; }
.pick-rate .input { width: 110px; }

/* QuickBooks */
.qbo-panel { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.qbo-panel p { margin: 4px 0 0; font-size: 14px; }
.qbo-panel.connected strong { color: #2f6b3a; }
.qbo-tag { margin-left: 10px; font-size: 12px; padding: 3px 8px; border: 1px solid var(--line); color: var(--muted); }

/* ---------- To-dos: projects on the left, sections on the right (like Asana) ---------- */
.todo-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 32px; align-items: start; }
.todo-projects { display: grid; gap: 2px; position: sticky; top: 16px; }
.todo-projects a {
  display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; font-size: 16px;
  color: var(--text); text-decoration: none; border-left: 2px solid transparent;
}
.todo-projects a:hover { background: rgba(80, 93, 75, .05); }
.todo-projects a[aria-current] { border-left-color: var(--ink); background: rgba(80, 93, 75, .08); color: var(--ink); }
.todo-projects .count { color: var(--muted); font-size: 13px; }
.todo-list-title { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .14em; font-size: 20px; color: var(--ink); margin-bottom: 18px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.todo-list-title .muted { font-family: var(--serif); text-transform: none; letter-spacing: 0; font-size: 15px; }
.todo-section { margin-bottom: 22px; }
.todo-section-head {
  display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; cursor: pointer; text-align: left;
  padding: 8px 2px; font-size: 18px; font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--line);
}
.todo-section-head .muted { font-weight: 400; font-size: 14px; }
.todo-section-head .caret { font-size: 12px; transition: transform .2s; }
.todo-section.closed .todo-section-head .caret { transform: rotate(-90deg); }
.todo-section.completed .todo-section-head { color: var(--muted); }
.todo-add { display: flex; align-items: center; gap: 14px; padding: 6px 4px; border-bottom: 1px solid var(--line-soft); }
.todo-add .plus { width: 20px; text-align: center; color: var(--muted); font-size: 18px; }
.todo-add-input { flex: 1; border: 0; background: transparent; padding: 8px 0; font-size: 16px; outline: none; }
.todo-add-input::placeholder { color: var(--muted); }
.todo-add:focus-within { background: var(--panel); }
@media (max-width: 760px) {
  .todo-layout { grid-template-columns: 1fr; gap: 18px; }
  .todo-projects { position: static; display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .todo-projects a { flex: none; border-left: 0; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 15px; }
  .todo-projects a[aria-current] { border-color: var(--ink); }
}
/* To-do rows: drag handle · checkbox · text · assignee; subtasks indented under their parent. */
.todo.v2 { grid-template-columns: 16px auto minmax(0, 1fr) auto; gap: 10px; padding: 10px 4px 10px 0; }
.todo.v2 .drag { padding: 3px 0 0; font-size: 15px; visibility: hidden; }
.todo.v2:hover .drag, .todo-block.dragging .drag { visibility: visible; }
@media (hover: none) { .todo.v2 .drag { visibility: visible; } }
.todo.v2 .todo-edit { grid-column: 3 / 5; }
.todo.v2.editing .todo-right { display: none; }
.todo-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.sub-toggle { background: none; border: 0; padding: 2px 0; cursor: pointer; font-size: 13px; color: var(--muted); }
.sub-toggle:hover { color: var(--ink); }
.sub-toggle.empty { visibility: hidden; }
.todo.v2:hover .sub-toggle.empty, .sub-toggle.empty[aria-expanded="true"] { visibility: visible; }
@media (hover: none) { .sub-toggle.empty { visibility: visible; } }
.subtasks { margin-left: 52px; border-left: 1px solid var(--line); padding-left: 10px; }
.todo.v2.sub { padding-top: 7px; padding-bottom: 7px; }
.todo.v2.sub .title { font-size: 15px; color: var(--text); }
.todo.v2.sub.done .title { color: var(--muted); }
.todo-right { display: flex; align-items: center; gap: 14px; }
.todo-add.sub { padding-left: 0; }
.todo-add.sub .todo-add-input { font-size: 15px; padding: 5px 0; }
.todo-block.dragging { background: #EEF0E6; box-shadow: 0 2px 10px rgba(0, 0, 0, .08); position: relative; z-index: 1; }
.todo-block.dragging .drag { cursor: grabbing; color: var(--ink); }
.todo-list:empty { min-height: 4px; }
.assignee { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; padding-top: 1px; }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 10px; letter-spacing: .04em; font-family: var(--serif); }
@media (max-width: 760px) { .assignee-name { display: none; } .subtasks { margin-left: 26px; } }

/* Invoice approval */
.inv-approved { color: #2a4f78; font-weight: 600; margin-top: 4px; }
.inv-tax { margin-top: 14px; font-style: italic; font-size: 14px; }
.inv-approve { max-width: 920px; margin: 24px auto 0; background: var(--panel); border: 1px solid var(--line); padding: 18px 20px; }
.inv-approve p { margin: 0 0 12px; }
.inv-approve .form-row { align-items: end; }
.inv-approved-note { max-width: 920px; margin: 22px auto 0; text-align: center; color: #2f6b3a; font-weight: 600; }

/* Paige-only project cost box above the Overview toolbar */
.ov-cost { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 40px; padding: 16px 20px; margin: 18px 0 4px; border: 1px solid var(--line); background: var(--bg); }
.ov-cost-stat { display: flex; flex-direction: column; gap: 4px; }
.ov-cost-stat strong { font-size: 18px; color: var(--ink); font-weight: 600; }
.ov-cost-stat.lead strong { font-size: 24px; }

/* Invoices tab: Ready to invoice picker + send bar */
.inv-section-head { font-size: 13px; text-transform: uppercase; letter-spacing: .18em; color: var(--ink); font-weight: 400; margin: 28px 0 12px; }
.ready-empty { font-size: 14px; }
.ready-group { margin-bottom: 16px; }
.ready-table .ready-project th { background: var(--panel); text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); }
.ready-table .ready-project a { color: var(--ink); font-weight: 600; text-decoration: none; }
.ready-table .ready-project a:hover { text-decoration: underline; }
.ready-table td { vertical-align: middle; }
.ready-row { cursor: pointer; }
.ready-row:hover td { background: var(--panel); }
.c-pick { width: 1%; text-align: center; }
.c-pick input { width: 18px; height: 18px; accent-color: var(--ink); cursor: pointer; }
.c-pick input:disabled { cursor: not-allowed; opacity: .35; }
.muted.small { font-size: 13px; }
.send-bar {
  position: sticky; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 5;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end;
  margin-top: 12px; padding: 12px 16px; background: var(--bg); border: 1px solid var(--ink); box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.send-bar > span { margin-right: auto; }
.ready-table th, .ready-table td { padding: 8px 14px; }
.ready-table td.money, .ready-table th.money { width: 130px; }
.ready-table td.num, .ready-table th.num { width: 70px; text-align: center; }
.inv-portal .invoice-doc, .inv-portal .inv-approve, .inv-portal .inv-approved-note, .inv-portal .inv-actions, .inv-portal > p.muted { max-width: 920px; margin-left: 0; margin-right: 0; }
/* Add to-do row: due date + assignee */
.todo-add { flex-wrap: wrap; }
.todo-add-input { min-width: 180px; }
.todo-add-extra { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.todo-add-field { display: flex; align-items: center; gap: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.todo-add-field input { border: 1px solid var(--line); background: var(--bg); padding: 5px 8px; font: inherit; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.todo-add-who { width: 160px; }
@media (max-width: 600px) { .todo-add-extra { width: 100%; padding-left: 34px; } .todo-add-who { flex: 1; width: auto; } }
.todo-add-btn { opacity: 0; transition: opacity .15s; }
.todo-add:focus-within .todo-add-btn, .todo-add:hover .todo-add-btn { opacity: 1; }
@media (hover: none) { .todo-add-btn { opacity: 1; } }

/* Design Files tab */
.files-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; border-style: dashed; }
.files-drop.over { border-color: var(--ink); background: var(--bg); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.file-card { margin: 0; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.file-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; background: var(--bg); overflow: hidden; text-decoration: none; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-pdf { font-size: 22px; letter-spacing: .12em; color: var(--muted); border: 1px solid var(--line); padding: 10px 16px; }
.file-card figcaption { padding: 10px 12px; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-top: 2px; }
@media (max-width: 600px) { .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }

/* Management → Chrome Clipper */
.clipper-page .panel p { margin: 0 0 10px; }
.clipper-steps { margin: 0; padding-left: 22px; line-height: 1.7; }
.clipper-key { flex: 1 1 320px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

/* Website section */
.website-intro p { margin: 0 0 10px; }
.website-intro .btn, .website-intro .form-row { margin-top: 6px; }
.website-h2 { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink); margin: 28px 0 12px; font-weight: normal; }
.website-h3 { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink); margin: 22px 0 4px; font-weight: normal; }
.small-note { font-size: 14px; margin: 0 0 10px; }
.ticket { margin-bottom: 14px; }
.ticket-ask { border-left: 3px solid #c47a2c; }
.ticket-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ticket-head h3 { margin: 0 0 2px; font-size: 18px; font-weight: normal; }
.ticket-head .muted { font-size: 13px; }
.ticket-body { white-space: pre-wrap; margin: 12px 0 0; }
.ticket-files { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ticket-file { width: 110px; text-decoration: none; color: inherit; font-size: 12px; }
.ticket-file img, .ticket-file > span:first-child { display: flex; align-items: center; justify-content: center; width: 110px; height: 82px; object-fit: cover; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.ticket-file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.ticket-thread { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.msg { padding: 8px 12px; margin: 8px 0; background: var(--bg); font-size: 15px; }
.msg-max { border-left: 3px solid var(--ink); }
.msg p { margin: 4px 0 0; white-space: pre-wrap; }
.ticket-reply { margin-top: 12px; display: grid; gap: 8px; }
.ticket-reply .form-row { justify-content: space-between; }
.site-projects { display: grid; gap: 12px; }
.site-project { display: flex; gap: 16px; align-items: center; margin: 0; padding: 14px; flex-wrap: wrap; }
.site-project-cover { width: 140px; aspect-ratio: 4 / 3; padding: 0; border: 1px solid var(--line); background: var(--bg); cursor: pointer; display: flex; align-items: center; justify-content: center; overflow: hidden; font: inherit; font-size: 13px; }
.site-project-cover img { width: 100%; height: 100%; object-fit: cover; }
.site-project-info { flex: 1 1 200px; }
.site-project-info h3 { margin: 0; font-size: 18px; font-weight: normal; }
.site-project-info p { margin: 2px 0 0; font-size: 14px; }
.site-project-actions { display: flex; gap: 12px; align-items: center; }
.site-project-actions .link-btn { font-size: 18px; padding: 0 4px; }
.wide-modal { width: min(860px, 94vw); }
.site-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.site-photo { position: relative; margin: 0; border: 1px solid var(--line); background: var(--bg); }
.site-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.site-photo figcaption { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px; font-size: 13px; }
.site-photo.add { aspect-ratio: 4 / 3; border-style: dashed; cursor: pointer; font: inherit; color: var(--ink); }
.cover-tag { position: absolute; top: 6px; left: 6px; background: var(--ink); color: #F1F1E8; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 3px 8px; }
.check-row { display: flex; align-items: center; gap: 6px; margin-top: 16px; }
.headshot-edit { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.headshot-edit img { width: 120px; aspect-ratio: 4 / 5; object-fit: cover; border: 1px solid var(--line); }
.headshot-edit div { display: grid; gap: 8px; justify-items: start; }
