* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: #1b1b1a; background: var(--surface); }
button, input, select, textarea { font: inherit; }
a { color: var(--primary); }

/* header */
.top { display: flex; align-items: center; gap: 24px; padding: 8px 20px; background: #fff; border-bottom: 3px solid var(--primary); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { height: 36px; display: block; }
.wordmark { font-weight: 700; font-size: 18px; color: var(--primary); }
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; font-weight: 600; color: #555; border-bottom: 3px solid transparent; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--accent); }
.tools { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
#search { width: 260px; padding: 7px 10px; border: 1px solid #c8c8c2; border-radius: 4px; }
.search-results { position: absolute; top: 40px; left: 0; width: 460px; max-height: 60vh; overflow: auto; background: #fff; border: 1px solid #c8c8c2; box-shadow: 0 6px 20px rgba(0,0,0,.15); z-index: 30; }
.search-results div { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #eee; }
.search-results div:hover { background: #f4f6f3; }
.search-results small { color: #666; display: block; }
.btn { display: inline-block; padding: 7px 12px; border: 1px solid var(--primary); border-radius: 4px; background: #fff; color: var(--primary); cursor: pointer; text-decoration: none; font-weight: 600; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #0b2430; }
.btn.ghost { border-color: #c8c8c2; color: #333; }
.btn.danger { border-color: var(--alert); color: var(--alert); }
.btn.small { padding: 3px 8px; font-size: 12px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: default; }

main { padding: 12px 20px 60px; }
.sheet-tabs { display: flex; gap: 2px; margin-bottom: 10px; border-bottom: 2px solid #cfd3cf; }
.sheet-tabs button { background: #e2e4de; border: 0; padding: 8px 18px; cursor: pointer; font-weight: 700; color: #35443b; border-radius: 4px 4px 0 0; }
.sheet-tabs button.active { background: var(--primary); color: #fff; }
.sheet-tabs button.list { margin-left: 14px; background: #f1f2ee; font-weight: 600; color: #4a5a50; border: 1px dashed #b9bdb5; border-bottom: 0; }
.sheet-tabs button.list.active { background: #35443b; color: #fff; border-color: #35443b; }
.group.list .group-head { background: #f6f6f2; }

/* groups */
.group { margin-bottom: 14px; background: #fff; border: 1px solid #d6d8d2; border-radius: 4px; } /* no overflow:hidden — it would make the group the sticky header's scrollport */
.group-head { display: flex; align-items: center; gap: 12px; padding: 7px 10px; background: #f1f2ee; border-bottom: 1px solid #d6d8d2; }
.group.collapsed .group-head { border-bottom: 0; }
.group-head h3 { margin: 0; font-size: 15px; color: var(--primary); }
.group.new_orders .group-head { background: #eef5d0; }
.group.new_orders .group-head h3 { color: #3a4d00; }
.group-head .meta { color: #555; font-size: 12px; }
.group-head .spacer { flex: 1; }
.badge { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 10px; background: var(--accent); color: #0b2430; font-size: 12px; font-weight: 700; text-align: center; }
.group-head select { padding: 3px 6px; font-size: 12px; }
.group.drop-target { outline: 2px dashed var(--accent); }
.group-empty { padding: 10px; color: #888; font-size: 12px; }


table.rows { min-width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13.5px; }
table.rows th { position: sticky; top: 59px; background: #fafaf7; text-align: left; padding: 4px 7px; border-bottom: 1px solid #cfd3cf; font-weight: 700; color: #333; white-space: normal; line-height: 1.15; max-height: 2.4em; overflow: hidden; vertical-align: bottom; font-size: 11px; }
table.rows td { padding: 5px 7px; border-bottom: 1px solid #ececea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.group.collapsed table { display: none; }
.group-head .fold { border: 0; background: none; cursor: pointer; color: #666; font-size: 13px; padding: 0 2px; width: 18px; }
.group-head h3 { cursor: pointer; }
.tag.past { display: inline-block; padding: 1px 7px; border-radius: 3px; background: #e9e2c6; color: #5c4b00; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.group.past .group-head { background: #f5f1e4; }
.summary { display: flex; gap: 12px; margin-bottom: 12px; }
.stat { flex: 1; background: #fff; border: 1px solid #d6d8d2; border-radius: 4px; padding: 10px 14px; min-width: 0; }
.stat-label { font-size: 11px; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--primary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 12px; color: #666; margin-top: 2px; }
.stat.hot .stat-value { color: #3a4d00; }
.stat.hot { border-color: var(--accent); background: #f7fae6; }
table.rows tr.row { cursor: pointer; }
table.rows tr.row:hover td { background: #f6f8f2; }
table.rows tr.row.selected td { background: #e9f0d2; }
table.rows tr.row.closed td { color: #6b6b6b; background: #f3f3f1; }
table.rows tr.row.dragging { opacity: .4; }
td.money, th.money { text-align: right; font-variant-numeric: tabular-nums; }
td.total { background: #ebebe8; font-weight: 600; }
td.collect { background: #fff7b3; }
tr.closed td.collect { background: #f3f3f1; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 11.5px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.flag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 3px; background: var(--alert); color: #fff; font-size: 10.5px; font-weight: 700; cursor: help; }
.grip { color: #aaa; cursor: grab; width: 14px; }

/* side panel */
.panel { position: fixed; top: 0; right: 0; height: 100%; width: 460px; background: #fff; border-left: 1px solid #c8c8c2; box-shadow: -8px 0 24px rgba(0,0,0,.12); z-index: 40; overflow: auto; padding: 16px 18px 40px; }
.panel h2 { margin: 0 0 4px; font-size: 16px; color: var(--primary); }
.panel .sub { color: #666; font-size: 12px; margin-bottom: 12px; }
.panel .close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 20px; cursor: pointer; color: #666; }
.field { margin-bottom: 9px; }
.field label { display: block; font-size: 11px; font-weight: 700; color: #444; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.field input[type=text], .field input[type=date], .field input[type=number], .field select, .field textarea { width: 100%; padding: 6px 8px; border: 1px solid #c8c8c2; border-radius: 3px; }
.field .hint { font-size: 11.5px; color: #666; margin-top: 2px; }
.field .hint.bad { color: var(--alert); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.checks label { display: inline-flex; gap: 4px; align-items: center; font-weight: 500; text-transform: none; font-size: 12.5px; }
.radio-row { display: flex; gap: 10px; align-items: center; font-size: 12.5px; flex-wrap: wrap; }
.radio-row label { white-space: nowrap; text-transform: none; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.radio-row input[type=text] { width: 120px; }
.radio-row select { width: auto; min-width: 120px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.actions .right { margin-left: auto; }
.error { color: var(--alert); font-size: 12.5px; margin-top: 8px; }
.form-card { background: #fff; border: 1px solid #d6d8d2; border-radius: 4px; padding: 18px 22px; max-width: 860px; }
.form-card h2 { margin: 0 0 12px; color: var(--primary); font-size: 16px; }
.form-card > .hint { margin: 2px 0 12px; color: #666; font-size: 12.5px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; }
.form-grid .wide { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }

/* activity */
.activity .ev { padding: 7px 0; border-bottom: 1px solid #eee; font-size: 12.5px; display: flex; gap: 8px; align-items: flex-start; }
.activity .ev time { color: #777; font-size: 11px; white-space: nowrap; }
.activity .ev .what { flex: 1; }
.activity .waiting { border: 1px solid #e0b000; background: #fffbea; border-radius: 6px; padding: 8px 10px; margin: 8px 0 12px; }
.activity .waiting h3 { margin: 0 0 4px; font-size: 13px; }
.activity .waiting-item { padding: 6px 0; border-top: 1px solid #f0e2a8; font-size: 12.5px; }
.activity .waiting-actions { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.activity .waiting-actions input[type=search] { flex: 1; min-width: 160px; font-size: 12px; padding: 3px 6px; }
.activity .waiting-found > div { margin-top: 4px; }
.activity .waiting-actions select { max-width: 100%; font-size: 12px; }
.activity .ev .undone { color: #999; text-decoration: line-through; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1b1b1a; color: #fff; padding: 10px 16px; border-radius: 4px; display: flex; gap: 14px; align-items: center; z-index: 50; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.toast button { background: var(--accent); border: 0; padding: 4px 10px; border-radius: 3px; font-weight: 700; cursor: pointer; }
.toast.bad { background: var(--alert); }

/* money */
.money-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.block { background: #fff; border: 1px solid #d6d8d2; border-radius: 4px; padding: 12px 14px; }
.block h3 { margin: 0 0 6px; font-size: 14px; color: var(--primary); display: flex; gap: 10px; align-items: center; }
.block .note { color: #666; font-size: 11.5px; margin: 4px 0 8px; }
.block .controls { display: flex; gap: 8px; align-items: center; font-size: 12px; margin-left: auto; }
.block .controls select { padding: 2px 4px; font-size: 12px; }
.block svg { width: 100%; height: auto; display: block; }
.block table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.block th, .block td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #eee; }
.block td.num, .block th.num { text-align: right; font-variant-numeric: tabular-nums; }
.block tfoot td { font-weight: 700; border-top: 2px solid #cfd3cf; }
.legend { display: flex; gap: 14px; font-size: 12px; margin: 6px 0; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; background: var(--c); vertical-align: -1px; }
.hero { font-size: 28px; font-weight: 700; color: var(--primary); }
.empty { color: #888; padding: 16px; }
@media (max-width: 1100px) { .money-grid { grid-template-columns: 1fr; } .form-grid { grid-template-columns: 1fr 1fr; } }

/* ---- sign-in pages (signin.html) and the signed-in user in the header ---- */
.signin-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.signin { width: min(440px, calc(100vw - 32px)); background: #fff; border-top: 3px solid var(--primary); border-radius: 6px; padding: 32px 32px 26px; box-shadow: 0 2px 14px rgba(0,0,0,.08); }
.signin-brand { margin-bottom: 24px; }
/* the logo fills the card's width here (36px high in the board's header) */
.signin-brand .logo { width: 100%; height: auto; max-height: 160px; object-fit: contain; object-position: left center; }
.signin-brand .wordmark { font-size: 30px; }
.signin h1 { font-size: 20px; margin: 0 0 14px; }
.signin p { line-height: 1.5; margin: 0 0 14px; color: #3a3a38; }
/* one button per line, full width: two providers on the support door never wrap against each other */
.signin .btn { display: block; width: 100%; padding: 10px 16px; background: var(--primary); color: #fff; text-align: center; font-size: 15px; }
.signin-error { color: var(--alert) !important; font-weight: 600; }
.signin .btn:disabled { opacity: .6; }
.signin .btn + .btn { margin-top: 10px; }
.who { display: flex; align-items: center; gap: 8px; color: #555; white-space: nowrap; }
.who form { margin: 0; }
/* the session ran out mid-work: sign in again in place (app.js, askToSignInAgain) */
.session-bar { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: #1b1b1a; color: #fff; padding: 10px 16px; border-radius: 4px; display: flex; gap: 14px; align-items: center; z-index: 60; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.session-bar .btn { background: var(--accent); color: #1b1b1a; border: 0; font-weight: 700; }

/* ---- import a spreadsheet (app.js, "Import a spreadsheet"): preview, decide, apply ---- */
.panel.import { width: 720px; max-width: 100vw; z-index: 45; }
.imp-sec { border: 1px solid #d6d8d2; border-radius: 4px; margin-bottom: 8px; background: #fff; }
.imp-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; background: #f1f2ee; border: 0; cursor: pointer; text-align: left; font-weight: 700; color: var(--primary); }
.imp-head .n { margin-left: auto; font-variant-numeric: tabular-nums; }
.imp-head .meta { color: #555; font-size: 12px; font-weight: 500; }
.imp-sec.needs .imp-head { background: #fff4d6; }
.imp-body { padding: 4px 10px 8px; }
.imp-row { padding: 7px 0; border-bottom: 1px solid #eee; font-size: 12.5px; }
.imp-row:last-child { border-bottom: 0; }
.imp-row .imp-who { font-weight: 600; color: #1b1b1a; }
.imp-row small { color: #666; display: block; }
.imp-row .q { margin: 4px 0; color: #3a3a38; }
.imp-row.undecided { box-shadow: inset 3px 0 0 var(--alert); padding-left: 8px; }
.imp-row label { display: flex; gap: 6px; align-items: baseline; font-size: 12.5px; padding: 2px 0; cursor: pointer; }
.imp-cells { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 12px; }
.imp-cells th, .imp-cells td { text-align: left; padding: 3px 6px; border-bottom: 1px solid #f0f0ec; vertical-align: top; }
.imp-cells th { font-size: 11px; color: #444; font-weight: 700; }
.imp-cells label { display: inline-flex; padding: 0; }
.imp-change { color: #3a3a38; }
.imp-change .old { color: #8a8a86; text-decoration: line-through; }
.imp-candidate { margin: 0 0 6px 22px; font-size: 12px; }
.imp-notes { font-size: 12.5px; color: #444; margin: 10px 0; }
.imp-notes div { margin: 3px 0; }
.imp-notice { background: #fff4d6; border: 1px solid #e3c766; border-radius: 4px; padding: 8px 10px; margin: 8px 0; font-size: 12.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
