:root {
  --navy: #122a52; --navy-2: #1d3d72; --navy-50: #eef2f9; --ink: #1b2433; --muted: #5f6b7d;
  --line: #dde3ec; --bg: #f5f7fb; --card: #fff; --gold: #c9a227;
  --green: #1e7d4f; --green-bg: #e6f4ec; --red: #b42318; --red-bg: #fdecea; --amber: #a15c07; --amber-bg: #fff4e0;
  --radius: 12px; --tap: 48px;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.4;
  -webkit-text-size-adjust: 100%; padding-bottom: calc(24px + var(--safe-bottom));
}
a { color: var(--navy-2); }
button, input, select, textarea { font: inherit; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  background: var(--navy); color: #fff; padding: calc(8px + var(--safe-top)) 12px 8px; min-height: 60px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex: 1; min-width: 0; }
.brand-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: #fff; color: var(--navy); font-weight: 800; letter-spacing: .5px; border-bottom: 3px solid var(--gold); flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 18px; letter-spacing: .3px; }
.brand-text small { opacity: .8; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { display: inline-grid; place-items: center; min-width: var(--tap); height: var(--tap); border: 0; border-radius: 10px; background: transparent; color: #fff; font-size: 28px; text-decoration: none; cursor: pointer; }
.icon-btn:hover, .icon-btn:focus-visible { background: rgba(255,255,255,.12); }
#settingsBtn { font-size: 24px; }

main { max-width: 1100px; margin: 0 auto; padding: 12px; outline: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack > * + * { margin-top: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 10px; }
.sample-banner { background: var(--amber-bg); color: var(--amber); border: 1px solid #f3d9a8; border-radius: 10px; padding: 8px 12px; font-size: 14px; margin-bottom: 12px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 18px; border-radius: 10px; border: 1px solid var(--navy); background: var(--navy); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy-2); }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: var(--navy-50); }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.success { background: var(--green); border-color: var(--green); }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.fab-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Jobs list */
.job-card { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s; }
.job-card:hover { box-shadow: 0 4px 14px rgba(18,42,82,.12); }
.job-card h3 { font-size: 17px; color: var(--navy); }
.job-meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.job-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 12px; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-weight: 700; font-size: 16px; }
.progress { height: 8px; background: var(--navy-50); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.progress > span { display: block; height: 100%; background: var(--navy-2); border-radius: 99px; }
.progress.warn > span { background: #d98b06; }
.progress.over > span { background: var(--red); }
.next-item { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 14px; }
.jobs-grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 760px) { .jobs-grid { grid-template-columns: 1fr 1fr; } }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--navy-50); color: var(--navy); white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.gray { background: #eef0f3; color: #4a5565; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* Job header + tabs */
.job-head h2 { color: var(--navy); }
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
@media (min-width: 760px) { .summary-grid { grid-template-columns: repeat(4, 1fr); } }
.summary-grid .cell { background: var(--navy-50); border-radius: 10px; padding: 8px 10px; }
.tabs { position: sticky; top: calc(60px + var(--safe-top)); z-index: 10; display: flex; gap: 4px; background: var(--bg); padding: 6px 0 8px; margin-bottom: 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 1 auto; min-width: 0; min-height: 52px; border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 10px; font-weight: 700; font-size: 11.5px; cursor: pointer; text-decoration: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 3px; text-align: center; line-height: 1.1; white-space: nowrap; }
.tab-ico { width: 21px; height: 21px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 600px) { .tab { flex-direction: row; gap: 6px; font-size: 14px; min-height: var(--tap); } .tab-ico { width: 18px; height: 18px; } }
.tab[aria-selected="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Lists (mobile-friendly rows) */
.list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.item { display: block; width: 100%; text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; cursor: pointer; color: inherit; min-height: 56px; }
.item:last-child { border-bottom: 0; }
.item:hover, .item:focus-visible { background: #fafbfd; }
.item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.item-title { font-weight: 700; }
.item-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.item-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 8px; margin-top: 6px; font-size: 13px; }
.item-grid .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.item.overdue { border-left: 4px solid var(--red); }
.totals { background: var(--navy); color: #fff; }
.totals .k { color: rgba(255,255,255,.75); }
.totals .item-sub { color: rgba(255,255,255,.75); }
.totals.item { cursor: default; }
.totals.item:hover { background: var(--navy); }

/* Desktop table for budget */
table.grid { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
table.grid th, table.grid td { padding: 10px 10px; border-bottom: 1px solid var(--line); }
table.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); background: #fafbfd; }
table.grid th.num { text-align: right; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: #fafbfd; }
table.grid tfoot td { font-weight: 800; background: var(--navy-50); }
.only-desktop { display: none; }
@media (min-width: 760px) { .only-desktop { display: block; } .only-mobile { display: none; } }

/* Schedule */
.seg { display: inline-flex; border: 1px solid var(--navy); border-radius: 10px; overflow: hidden; }
.seg button { min-height: 40px; padding: 0 14px; border: 0; background: #fff; color: var(--navy); font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.gantt { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; -webkit-overflow-scrolling: touch; margin-bottom: 12px; max-height: max(360px, calc(100vh - 230px)); overscroll-behavior-x: contain; }
.gantt-inner { position: relative; --we-bg: #eef1f6; --day-line: #f1f3f7; }
.g-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); min-height: 44px; }
.g-row:last-child { border-bottom: 0; }
.g-label { position: sticky; left: 0; z-index: 4; flex: none; width: 128px; background: #fff; border: 0; border-right: 1px solid var(--line); border-left: 4px solid var(--gc, transparent); padding: 5px 8px 5px 6px; font-size: 13px; line-height: 1.2; display: flex; flex-direction: column; justify-content: center; cursor: pointer; text-align: left; color: inherit; font-family: inherit; }
.g-label > span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.g-label small { color: var(--muted); font-size: 11px; }
.g-track { position: relative; flex: none; background-image: var(--gbg); }
.g-bar { position: absolute; top: 10px; height: 24px; border-radius: 6px; background: var(--navy-2); color: #fff; font-size: 11px; line-height: 24px; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; min-width: 6px; z-index: 2; }
.g-bar.complete { background: var(--green); }
.g-bar.inprogress { background: #2f6fd6; }
.g-bar.overdue { background: var(--red); }
.g-bar.notstarted { background: #8b9ab3; }
.g-grp { background: #f7f9fc; min-height: 40px; }
.g-grp .g-label { background: #f2f5fa; font-weight: 700; }
.g-glabel .grp-caret { display: inline-block; width: 12px; color: var(--muted); }
.g-sum { position: absolute; top: 15px; height: 10px; background: var(--gc, var(--navy)); border-radius: 2px; cursor: pointer; z-index: 2; opacity: .9; }
.g-sum::before, .g-sum::after { content: ''; position: absolute; top: 6px; border: 6px solid transparent; border-top-color: var(--gc, var(--navy)); }
.g-sum::before { left: -1px; border-left-width: 0; } .g-sum::after { right: -1px; border-right-width: 0; }
.g-head { display: flex; position: sticky; top: 0; z-index: 6; background: #fafbfd; border-bottom: 1px solid var(--line); }
.g-head .g-corner { background: #fafbfd; font-weight: 700; color: var(--muted); cursor: default; z-index: 7; border-left-color: transparent; }
.g-cal { flex: none; }
.g-months, .g-days { display: flex; }
.g-mon { flex: none; height: 22px; border-left: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--navy); overflow: visible; }
.g-mon span { position: sticky; left: 134px; display: inline-block; padding: 3px 6px; white-space: nowrap; }
.g-day { flex: none; height: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-left: 1px solid #edf0f4; font-size: 11px; line-height: 1.05; color: var(--ink); }
.g-day b { font-weight: 700; } .g-day i { font-style: normal; font-size: 9.5px; color: var(--muted); }
.g-day.we { background: #e9edf3; } .g-day.we b { color: #5b6678; }
.g-day.today { background: var(--gold); color: #1d1d1d; border-radius: 6px 6px 0 0; } .g-day.today i { color: #3a3a3a; }
.g-todaycol { position: absolute; top: 54px; bottom: 0; background: rgba(214, 163, 38, .16); border-left: 2px solid var(--gold); z-index: 1; pointer-events: none; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: -4px 0 12px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* Modal (bottom sheet on phones) */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,20,40,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + var(--safe-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.2); }
@media (min-width: 640px) { .modal-backdrop { align-items: center; } .modal { border-radius: 16px; } }
.modal h2 { margin-bottom: 12px; color: var(--navy); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.field input, label.field select, label.field textarea {
  min-height: var(--tap); border: 1px solid #c8d1de; border-radius: 10px; padding: 8px 12px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 400; width: 100%;
}
label.field textarea { min-height: 80px; resize: vertical; }
label.field input:focus, label.field select:focus, label.field textarea:focus { outline: 2px solid var(--navy-2); outline-offset: 0; border-color: var(--navy-2); }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; }
.check input { width: 22px; height: 22px; flex: none; }
.help { font-size: 12px; color: var(--muted); font-weight: 400; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal-actions .spacer { flex: 1; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: calc(20px + var(--safe-bottom)); transform: translateX(-50%) translateY(calc(100% + 40px + var(--safe-bottom))); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 60; transition: transform .25s; max-width: 92vw; font-size: 15px; }
#toast.show { transform: translateX(-50%) translateY(0); }

/* Import mapping */
.map-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.map-table td, .map-table th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.map-table select { min-height: 40px; width: 100%; border: 1px solid #c8d1de; border-radius: 8px; padding: 4px 8px; background: #fff; }
.preview { overflow: auto; max-height: 180px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.preview table { border-collapse: collapse; }
.preview td { padding: 3px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.qb-label { display: inline-block; background: #2ca01c; color: #fff; font-weight: 800; font-size: 11px; padding: 2px 6px; border-radius: 4px; letter-spacing: .3px; vertical-align: middle; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.mini-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 15px; }
.mini-stats .stat-label { font-size: 11px; }
.seg button[data-zoom] { min-width: 40px; padding: 0 10px; }

/* ---- Change order e-approval ---- */
.client-view #settingsBtn, .client-view #backBtn { display: none !important; }
.client-view .brand { pointer-events: none; }
.item.awaiting { border-left: 4px solid #d98b06; }
.email-preview { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; background: #fafbfd; }
.email-preview > div { padding: 3px 0; border-bottom: 1px solid var(--line); }
.email-preview pre { white-space: pre-wrap; word-break: break-word; font-family: inherit; margin: 8px 0 0; }
.letterhead { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 2px solid var(--navy); }
.letterhead .lh-logo { width: 52px; height: 52px; flex: none; }
.letterhead strong { color: var(--navy); font-size: 18px; }
.co-desc { background: var(--navy-50); border-radius: 10px; padding: 12px; margin: 12px 0; font-size: 17px; font-weight: 600; }
.co-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.co-table td { padding: 9px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.co-table tr.total td { font-weight: 800; font-size: 17px; color: var(--navy); border-bottom: 0; border-top: 2px solid var(--navy); }
.co-table.meta td:first-child { color: var(--muted); width: 38%; }
.sig-wrap { position: relative; border: 2px dashed #9aa8bf; border-radius: 12px; background: #fff; margin-top: 4px; }
.sig-wrap canvas { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; border-radius: 10px; }
.sig-line { position: absolute; left: 14px; right: 14px; bottom: 34px; border-bottom: 1px solid #c3ccda; font-size: 12px; color: #9aa8bf; font-weight: 400; pointer-events: none; padding-bottom: 2px; }
.sig-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; text-align: center; }
.sig-box img { max-width: 100%; height: 120px; object-fit: contain; }
.empty-sig { color: var(--muted); padding: 30px 8px; }
.wrap-any { word-break: break-all; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; }
@media print {
  .topbar, .no-print, #toast, .tabs { display: none !important; }
  body { background: #fff; padding: 0; }
  main { padding: 0; max-width: none; }
  .card { border: 0; padding: 0; }
  .badge { border: 1px solid #999; }
  body { font-size: 13px; }
  .co-table { font-size: 13px; }
  .co-table td { padding: 5px 4px; }
  .co-desc { font-size: 14px; padding: 8px; margin: 8px 0; }
  .sig-box img { height: 90px; }
  .doc h3 { margin-top: 10px !important; }
}

/* ---- QuickBooks cost code hierarchy ---- */
.item.group-head { background: var(--navy-50); cursor: default; }
.item.group-head[data-cc] { cursor: pointer; }
.item.group-head .item-title { color: var(--navy); }
.item.child { padding-left: 28px; border-left: 3px solid #c9d4e6; }
table.grid tr.group-row td { background: var(--navy-50); font-weight: 700; }
table.grid tr.child-row td:first-child, .map-table td.indent { padding-left: 26px; }
.indent { display: inline-block; padding-left: 14px; }
.choice { border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; background: #fafbfd; }
.choice .check { align-items: flex-start; padding: 6px 0; }
.choice .check input { margin-top: 2px; }

/* Schedule: dependencies, sections, template */
.item-deps { font-size: 13px; color: var(--navy-2); margin-top: 4px; line-height: 1.35; overflow-wrap: anywhere; }
.item-kids { font-size: 12px; color: var(--muted); margin-top: 6px; }
.sec-tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--navy); background: var(--navy-50); border-radius: 6px; padding: 1px 6px; margin-right: 2px; }
.sched-meta { margin-top: 6px; }
.sec-filter { display: block; margin-bottom: 10px; }
.sec-filter select { width: 100%; }
.deps-editor { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); }
.deps-editor > * + * { margin-top: 8px; }
.deps-title { font-weight: 600; font-size: 14px; }
.dep-row { display: grid; grid-template-columns: 1fr 76px 40px; gap: 6px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.dep-row .dep-name { grid-column: 1 / 3; grid-row: 1; } .dep-row .dep-x { grid-column: 3; grid-row: 1; } .dep-row select { grid-column: 1; grid-row: 2; } .dep-row input { grid-column: 2; grid-row: 2; width: 100%; }
.dep-row.pending { grid-template-columns: 1fr 40px; } .dep-row.pending .dep-name { grid-column: 1; } .dep-row.pending .dep-x { grid-column: 2; } .dep-row.pending { color: var(--amber); background: var(--amber-bg); }
.dep-name { font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.dep-row select, .dep-row input, .dep-add select, .dep-add input { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; background: #fff; font-size: 16px; min-width: 0; }
.dep-x { min-width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--red); font-size: 22px; cursor: pointer; }
.dep-add { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dep-add #depPick { grid-column: 1 / -1; }
.dep-add #depType { grid-column: 1 / 2; }
.dep-add #depLag { width: 100%; }
.dep-add #depAdd { grid-column: 1 / -1; }
@media (min-width: 760px) { .dep-add { grid-template-columns: 2fr 1fr 80px auto; } .dep-add #depPick, .dep-add #depType, .dep-add #depAdd { grid-column: auto; } }
.tpl-line { padding: 8px 0; border-top: 1px dashed var(--line); }
.tpl-sec { padding: 0; }
.tpl-sec > summary { padding: 12px 14px; cursor: pointer; min-height: var(--tap); list-style-position: inside; }
.tpl-task { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 15px; }

/* Selection documents (IndexedDB attachments) */
.att-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); }
.att-box > * + * { margin-top: 8px; }
.att-row { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px 4px 4px 8px; }
.att-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: var(--tap); border: 0; background: transparent; text-align: left; cursor: pointer; padding: 4px 0; color: inherit; }
.att-icon { font-size: 22px; flex: none; }
.att-meta { display: flex; flex-direction: column; min-width: 0; }
.att-name { font-weight: 600; font-size: 15px; color: var(--navy); overflow-wrap: anywhere; }
.att-count { white-space: nowrap; }
.viewer { position: fixed; inset: 0; z-index: 80; background: #0a1220; display: flex; flex-direction: column; padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; color: #fff; }
.viewer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; -webkit-overflow-scrolling: touch; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; }
.viewer-meta { color: #c9d3e3; }
@media print { .viewer { display: none !important; } }

/* Plans / Photos tabs (Dropbox links) */
.dbx-ico { width: 22px; height: 22px; flex: none; }
.big-open { min-height: 60px; font-size: 18px; gap: 10px; background: #0061fe; border-color: #0061fe; }
.big-open:hover { background: #0057e5; }
.links-empty { color: var(--ink); }
.links-empty .btn .dbx-ico { width: 20px; height: 20px; }
.howto { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 15px; }
.link-item { display: grid; grid-template-columns: 30px 1fr; gap: 4px 10px; align-items: center; cursor: default; }
.link-ico { font-size: 22px; text-align: center; }
.link-main { min-width: 0; }
.link-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 6px; margin-top: 6px; }
.link-actions .btn { padding: 0 8px; }
@media (min-width: 600px) { .link-item { grid-template-columns: 30px 1fr auto; } .link-actions { grid-column: auto; display: flex; margin-top: 0; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.chip { border: 1px solid var(--line); background: var(--navy-50); color: var(--navy); border-radius: 99px; padding: 6px 12px; font-size: 14px; font-weight: 600; min-height: 36px; cursor: pointer; }

/* v1.6 schedule: groups, view toggle, calendar, link to estimate */
.seg-views { display: flex; width: 100%; margin: 0 0 10px; } .seg-views button { flex: 1; }
.seg-sm button { min-height: 34px; padding: 0 10px; font-size: 13px; }
.grp-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-bottom: 10px; } .grp-tools .sec-filter { flex: 1 1 200px; margin: 0; }
.grp { border-bottom: 1px solid var(--line); } .grp:last-child { border-bottom: 0; }
.grp-head { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: #f2f5fa; border: 0; border-left: 5px solid var(--gc); border-bottom: 1px solid var(--line); padding: 10px 12px 10px 9px; min-height: 52px; cursor: pointer; color: inherit; font: inherit; }
.grp-head.closed { border-bottom: 0; }
.grp-caret { color: var(--muted); width: 14px; flex: none; }
.grp-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--gc); flex: none; }
.grp-main { display: flex; flex-direction: column; min-width: 0; } .grp-name { font-weight: 800; } .grp-meta { font-size: 12.5px; color: var(--muted); }
[data-testid=task-list] .item[data-task] { border-left: 4px solid var(--gc, transparent); }
.grp-row { display: grid; grid-template-columns: 14px 1fr auto 40px 40px 40px; gap: 6px; align-items: center; margin-bottom: 6px; }
.grp-row input, .grp-new input { min-height: 44px; }
.grp-mv { min-height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 16px; cursor: pointer; } .grp-mv:disabled { opacity: .35; }
.grp-n { text-align: right; min-width: 22px; }
.grp-new { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.est-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fbfcfe; }
.est-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 40px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.est-row:last-child { border-bottom: 0; } .est-name { display: block; } .est-nums { color: var(--muted); margin-top: 2px; }
.est-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 8px; }
.est-add select { min-width: 0; width: 100%; }
.item.flash, tr.flash { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 40% { background: #fff4c7; box-shadow: inset 0 0 0 2px var(--gold); } 100% { background: inherit; box-shadow: none; } }
.cc-tasks { color: var(--navy); }
.cal { padding: 10px; }
.cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.cal-head .cal-title { flex: 1; text-align: center; font-size: 17px; }
.cal-nav { color: var(--navy); font-size: 30px; min-width: 44px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 2px 0; }
.cal-day { position: relative; min-height: 54px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 3px 2px 2px; display: flex; flex-direction: column; align-items: stretch; gap: 2px; cursor: pointer; color: inherit; font: inherit; overflow: hidden; }
.cal-day.we { background: #f1f4f8; } .cal-day.other { opacity: .45; }
.cal-day.today .cal-num { background: var(--gold); color: #1d1d1d; border-radius: 99px; }
.cal-day.sel { border-color: var(--navy); box-shadow: inset 0 0 0 2px var(--navy); }
.cal-num { align-self: center; font-size: 13px; font-weight: 700; min-width: 22px; text-align: center; line-height: 20px; }
.cal-bars { display: flex; flex-direction: column; gap: 2px; padding: 0 2px; } .cal-bars i { display: block; height: 4px; border-radius: 2px; }
.cal-chips { display: none; }
.cal-more, .cal-n { position: absolute; right: 3px; top: 3px; font-size: 9.5px; color: var(--muted); font-weight: 700; } .cal-n { display: none; }
.cal-agenda h4 { margin: 12px 2px 8px; font-size: 15px; }
.cal-item { border-left: 5px solid var(--c); }
@media (min-width: 700px) {
  .cal-day { min-height: 92px; align-items: stretch; }
  .cal-num { align-self: flex-start; }
  .cal-bars { display: none; } .cal-chips { display: flex; flex-direction: column; gap: 2px; }
  .cal-chip { font-size: 11px; background: color-mix(in srgb, var(--c) 18%, #fff); border-left: 3px solid var(--c); padding: 1px 4px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
}

/* ---- v1.6.1 company logo ---- */
.brand-logo { border-bottom: 0; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.brand-logo img { width: 30px; height: auto; display: block; }
.dash-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 16px 12px; margin: 4px 0 14px; }
.dash-logo img { width: 132px; height: 132px; display: block; }
.dash-tag { font-size: 12px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase; color: #6b7280; }
@media (min-width: 700px) { .dash-logo img { width: 150px; height: 150px; } }
.icon-note { display: flex; gap: 10px; align-items: flex-start; background: var(--navy-50); border-radius: 10px; padding: 10px; }
.icon-note img { border-radius: 10px; flex: none; box-shadow: 0 1px 3px rgba(0,0,0,.2); }

/* ---- v2.0 cloud: sign in, sync status, team, upload ---- */
.sync-pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 600; flex: none; cursor: pointer; white-space: nowrap; }
.sync-pill[hidden] { display: none; }
.sync-pill[data-state=offline], .sync-pill[data-state=error] { background: #f59e0b; border-color: #f59e0b; color: #1b2433; }
.sync-pill[data-state=syncing], .sync-pill[data-state=pending] { background: rgba(255,255,255,.2); }
@media (max-width: 380px) { .sync-pill .sync-l { display: none; } }
.login-view #settingsBtn, .login-view #backBtn, .login-view #syncPill { display: none !important; }
.login { max-width: 440px; margin: 8px auto 12px; }
.login-logo { text-align: center; } .login-logo img { width: 120px; height: 120px; }
.login-sent { background: var(--navy-50); border-radius: 10px; padding: 10px 12px; }
.login-steps { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.login-foot { max-width: 440px; margin: 0 auto; }
.link-btn { background: none; border: 0; color: var(--navy-2); text-decoration: underline; padding: 4px 0; cursor: pointer; font: inherit; text-align: left; }
.upload-banner { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; border-color: #f2c46d; background: #fff8e8; margin-bottom: 12px; }
.upload-row { cursor: pointer; }
.upload-row input[type=checkbox] { width: 22px; height: 22px; flex: none; }
.team-row .fab-row { gap: 6px; }

.otp-input { font-size: 28px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.otp-input::placeholder { color: #c3cad6; }
