/* Studio Select - Swiss editorial, black on white */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #111; --paper: #fff; --grey: #f4f3f1; --line: #e3e1dd; --mut: #767470;
  --green: #1e7b34; --green-bg: #e9f5ec; --red: #b32424; --red-bg: #faecec;
  --amber: #8a6d1a; --amber-bg: #faf3dd;
}
body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; color: var(--ink); background: var(--grey); line-height: 1.45; }
a { color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px; }
header.top { background: var(--ink); color: #fff; }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; }
.brand { font-weight: 700; letter-spacing: .35em; text-transform: uppercase; font-size: 15px; }
.brand small { letter-spacing: .12em; font-weight: 400; opacity: .65; display: block; font-size: 10px; }
nav.crumbs { font-size: 13px; color: var(--mut); margin-bottom: 18px; }
nav.crumbs a { text-decoration: none; }
nav.crumbs a:hover { text-decoration: underline; }
h1 { font-size: 26px; letter-spacing: -.01em; margin-bottom: 4px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .14em; margin: 26px 0 12px; }
.sub { color: var(--mut); font-size: 13.5px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 18px; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn { display: inline-block; border: 1px solid var(--ink); background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 7px; font-size: 13.5px; cursor: pointer; text-decoration: none; font-family: inherit; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { padding: 5px 11px; font-size: 12.5px; }
.btn.approve { border-color: var(--green); background: var(--green); }
.btn.decline { border-color: var(--red); background: transparent; color: var(--red); }
.btn:disabled { opacity: .45; cursor: default; }
input, select, textarea { font-family: inherit; font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }
textarea { width: 100%; min-height: 70px; }
label.fld { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--mut); margin-bottom: 4px; }
.grid { display: grid; gap: 16px; }
.grid.cols3 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid.cols4 { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }

/* budget bar */
.budget { min-width: 260px; }
.budget .lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--mut); margin-bottom: 4px; }
.budget .lbl b { color: var(--ink); font-size: 13px; }
.budget .track { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.budget .fill { height: 100%; background: var(--green); border-radius: 99px; transition: width .4s; }
.budget .fill.over { background: var(--red); }

/* item cards */
.item-card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.item-card .img { aspect-ratio: 4/3; background: var(--grey); display: block; width: 100%; object-fit: cover; }
.item-card .body { padding: 12px 14px; flex: 1; }
.item-card .body h3 { font-size: 14px; margin-bottom: 3px; }
.item-card .meta { font-size: 12.5px; color: var(--mut); }
.item-card .price { font-size: 14px; margin-top: 6px; }
.item-card .foot { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.pill { display: inline-block; font-size: 11.5px; padding: 3px 10px; border-radius: 99px; letter-spacing: .03em; }
.pill.approved { color: var(--green); background: var(--green-bg); }
.pill.declined { color: var(--red); background: var(--red-bg); }
.pill.pending { color: var(--amber); background: var(--amber-bg); }
.pill.draft { color: var(--mut); background: var(--grey); }
.pill.sent { color: #1d4d8a; background: #e8f0fa; }
.pill.signed, .pill.paid { color: var(--green); background: var(--green-bg); }
.pill.partly_paid { color: var(--amber); background: var(--amber-bg); }
.pill.invoiced { color: #1d4d8a; background: #e8f0fa; }

/* doc tables */
table.doc { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.doc th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--mut); border-bottom: 2px solid var(--ink); padding: 8px 8px; }
table.doc td { border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: top; }
table.doc td.num, table.doc th.num { text-align: right; white-space: nowrap; }
table.doc img.thumb { width: 52px; height: 40px; object-fit: cover; border-radius: 5px; background: var(--grey); }
.totals { margin-left: auto; max-width: 330px; width: 100%; font-size: 13.5px; margin-top: 14px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { border-top: 2px solid var(--ink); font-weight: 700; font-size: 15px; margin-top: 5px; padding-top: 9px; }

/* doc header */
.doc-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2px solid var(--ink); padding-bottom: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.logo-mark { font-weight: 700; letter-spacing: .4em; font-size: 18px; text-transform: uppercase; }
.doc-head .from { font-size: 12.5px; color: var(--mut); margin-top: 6px; }
.doc-head .to { text-align: right; font-size: 13px; }

.comment { font-size: 12.5px; background: var(--grey); border-radius: 7px; padding: 7px 10px; margin-top: 8px; }
.comment b { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.muted { color: var(--mut); }
.flash { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 13.5px; opacity: 0; transition: opacity .3s; pointer-events: none; }
.flash.show { opacity: 1; }
.sig-line { border-bottom: 1px dashed var(--mut); height: 64px; margin-bottom: 6px; display:flex; align-items:flex-end; }
.sig-line img { max-height: 60px; }
.sig-name { font-family: "Snell Roundhand", "Segoe Script", cursive; font-size: 26px; }
canvas.sigpad { border: 1px solid var(--line); border-radius: 7px; background: #fff; touch-action: none; width: 100%; }
.checkline { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.bar-note { font-size: 11.5px; color: var(--mut); }

.print-only { display: none; }
@media print {
  body { background: #fff; }
  .print-only { display: block; }
  header.top, .no-print, nav.crumbs, .flash { display: none !important; }
  .card { border: none; padding: 0; }
  .wrap { max-width: none; padding: 0; }
}

/* project dashboard (modelled on the Houzz Pro project list) */
.wrap.wide { max-width: 1480px; }
.proj-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.proj-card { display: flex; flex-direction: column; gap: 4px; min-height: 128px; padding: 14px 16px; background: var(--paper);
  border: 1px solid var(--line); border-top: 4px solid var(--bar); border-radius: 10px; text-decoration: none; font-size: 14px; }
.proj-card:hover { border-color: #c9c6c0; border-top-color: var(--bar); }
.proj-card .sub { font-size: 12.5px; }
.filters { margin-bottom: 14px; gap: 10px; }
details.filter { position: relative; }
details.filter summary { list-style: none; cursor: pointer; font-size: 13.5px; padding: 8px 30px 8px 12px; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative; }
details.filter summary::-webkit-details-marker { display: none; }
details.filter summary::after { content: ''; position: absolute; right: 12px; top: 50%; margin-top: -2px; border: 4px solid transparent; border-top-color: var(--ink); }
details.filter .menu { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; min-width: 200px; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.08); display: grid; gap: 8px; }
.table-card { padding: 0; overflow-x: auto; }
table.projects { font-size: 13.5px; }
table.projects th { white-space: nowrap; cursor: pointer; user-select: none; border-bottom: 1px solid var(--line); padding: 12px 10px; background: #fbfaf9; }
table.projects th[data-col]::after { content: ' \2195'; color: #bbb; font-size: 11px; }
table.projects th.asc::after { content: ' \2191'; color: var(--ink); }
table.projects th.desc::after { content: ' \2193'; color: var(--ink); }
table.projects td { padding: 11px 10px; vertical-align: middle; white-space: nowrap; }
table.projects tbody tr:hover td { background: #fbfaf9; }
table.projects .sticky { position: sticky; left: 0; background: #fff; z-index: 1; border-right: 1px solid var(--line); }
table.projects th.sticky { background: #fbfaf9; }
.proj-name { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.proj-name .bar { flex: none; width: 5px; height: 20px; border-radius: 3px; }
.client { display: inline-flex; align-items: center; gap: 8px; }
.avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; letter-spacing: .02em; }
.linkish { background: none; border: none; padding: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; text-decoration: none; }
.linkish:hover { text-decoration: underline; }
.tags { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tag { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--grey); border: 1px solid var(--line); }
/* project status: blue open, green in progress, amber on hold, grey closed */
.pill.st-open, .status-select.st-open { color: #1d4d8a; background: #e8f0fa; }
.pill.st-in_progress, .status-select.st-in_progress { color: var(--green); background: var(--green-bg); }
.pill.st-on_hold, .status-select.st-on_hold { color: var(--amber); background: var(--amber-bg); }
.pill.st-closed, .status-select.st-closed { color: var(--mut); background: var(--grey); }
.status-select { border: none; border-radius: 99px; font-size: 12px; padding: 4px 10px; cursor: pointer; appearance: auto; }
@media (max-width: 640px) {
  .wrap { padding: 16px; }
  #psearch { min-width: 0; width: 100%; }
  .proj-cards { grid-template-columns: 1fr 1fr; }
}

/* bulk selection on the project dashboard */
table.projects td.sel, table.projects th.sel { width: 44px; padding-right: 0; left: 0; border-right: none; }
table.projects .sticky.name { left: 44px; }
table.projects tr.picked td { background: #f6f5f2; }
.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--ink); color: #fff; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 12px; position: sticky; top: 8px; z-index: 6; }
.bulkbar .btn.ghost { color: #fff; border-color: #555; }
.bulkbar select { padding: 5px 10px; font-size: 12.5px; }
.bulkbar .linkish { color: #ccc; }
.bulkbar[hidden] { display: none; }
