:root { --bg:#f5f6f8; --card:#fff; --text:#1f2937; --muted:#6b7280; --border:#e5e7eb; --accent:#2563eb; --bad:#fee2e2; --bad-text:#991b1b; --exp:#f8fafc; }
* { box-sizing: border-box; }
body { margin:0; font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color:var(--text); background:var(--bg); }
a { color:var(--accent); text-decoration:none; } a:hover { text-decoration:underline; }
.topbar { display:flex; align-items:center; gap:24px; padding:10px 20px; background:#111827; color:#fff; }
.topbar .brand { color:#fff; font-weight:600; font-size:16px; }
.topbar nav { display:flex; flex-wrap:wrap; gap:6px 16px; flex:1; } .topbar nav a { color:#d1d5db; white-space:nowrap; } .topbar nav a.muted { color:#6b7280; }
.topbar form { margin:0; } .topbar .muted { color:#9ca3af; margin-right:8px; }
main { padding:20px; max-width:1600px; margin:0 auto; }
h1 { font-size:22px; margin:0 0 12px; } h2 { font-size:17px; margin:0 0 10px; } h3 { font-size:15px; margin:18px 0 8px; }
.page-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-bottom:12px; }
.actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.card { background:var(--card); border:1px solid var(--border); border-radius:8px; padding:18px; margin-bottom:18px; }
.card.narrow { max-width:520px; margin:30px auto; }
.muted { color:var(--muted); } .small { font-size:12px; } .zero { color:#c4c8cf; } .danger { color:var(--bad-text); }
.nowrap { white-space:nowrap; }
.flash { padding:10px 14px; border-radius:6px; margin-bottom:14px; }
.flash.success { background:#dcfce7; color:#166534; }
.flash ul.estimates { margin:6px 0 0; padding-left:20px; } .flash ul.estimates a { color:inherit; font-weight:600; } .flash.error { background:var(--bad); color:var(--bad-text); }
label { display:block; margin-bottom:12px; font-weight:500; }
label input, label select, label textarea { display:block; width:100%; margin-top:4px; padding:7px 9px; border:1px solid #cbd5e1; border-radius:6px; font:inherit; }
label.check input { display:inline; width:auto; margin-right:6px; }
label small { display:block; font-weight:400; margin-top:3px; }
.row { display:flex; gap:12px; } .row label { flex:1; }
.inline { display:inline-flex; align-items:center; gap:8px; } .inline label { margin:0; display:flex; align-items:center; gap:6px; }
.inline label select { margin:0; width:auto; }
button, .button { font:inherit; padding:7px 14px; border-radius:6px; border:1px solid #cbd5e1; background:#fff; cursor:pointer; color:var(--text); display:inline-block; }
button.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
button.link { border:0; background:none; padding:0; color:var(--accent); cursor:pointer; } button.link.danger { color:var(--bad-text); }
.table-wrap { overflow-x:auto; background:var(--card); border:1px solid var(--border); border-radius:8px; }
table { border-collapse:collapse; width:100%; }
th, td { padding:6px 8px; border-bottom:1px solid var(--border); text-align:left; vertical-align:top; }
th a.sort { color:inherit; text-decoration:none; }
th a.sort:hover, th a.sort.active { color:#111827; text-decoration:underline; }
th { background:#f9fafb; font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.03em; color:#374151; position:sticky; top:0; }
td.num, th.num { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
.grid td.client { min-width:200px; font-weight:500; } .grid td.cur { font-weight:500; color:var(--muted); }
.grid td.label { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.03em; white-space:nowrap; }
.grid tr.expected td { background:var(--exp); }

.grid td.annual, .grid th.annual { font-weight:600; border-left:2px solid #d1d5db; }
.grid td.project, .grid th.project { border-left:1px dashed #d1d5db; }
.grid td.mismatch { background:var(--bad) !important; color:var(--bad-text); font-weight:600; }
.grid tfoot td { font-weight:600; background:#f3f4f6; }
.grid.compact td, .grid.compact th { padding:4px 6px; }
table.list { background:var(--card); }
table.list tr.inactive td { color:var(--muted); text-decoration:line-through; }
table.list tfoot td { font-weight:600; }
.badge { display:inline-block; font-size:11px; padding:1px 6px; border-radius:4px; background:#e2e8f0; color:var(--muted); vertical-align:middle; margin-left:4px; }
label.checkbox { display:inline-flex; align-items:center; gap:4px; margin-left:10px; }
table.grid tr.archived td.client a { color:var(--muted); }
input.code { font-size:24px; letter-spacing:6px; text-align:center; max-width:200px; }
.bulk-bar { display:flex; align-items:center; gap:8px; margin:0 0 8px; }
table.grid th.check, table.grid td.check { width:28px; text-align:center; vertical-align:middle; }

/* Time entries */
.filter-bar, .apply-bar { padding:12px 16px; }
.filter-row, .apply-row { display:flex; flex-wrap:wrap; gap:10px 16px; align-items:flex-start; }
.filter-row fieldset, .apply-row fieldset { border:0; padding:0; margin:0; min-width:0; }
.filter-row legend, .apply-row legend { font-size:11px; text-transform:uppercase; letter-spacing:.03em; color:var(--muted); padding:0; margin-bottom:4px; }
.filter-row fieldset.id input { width:72px; }
.filter-row fieldset.go { align-self:flex-end; }
.filter-row input, .filter-row select, .apply-row input { padding:6px 8px; border:1px solid var(--border); border-radius:6px; }
.filter-row fieldset .small { margin:4px 0 0; max-width:320px; }
.apply-row .sum { padding:7px 0; }
.apply-row fieldset.setvals { flex:1 1 420px; }
.setgrid { display:flex; flex-wrap:wrap; gap:8px; align-items:flex-end; }
.setgrid label { display:flex; flex-direction:column; font-size:11px; color:var(--muted); }
.setgrid input { width:72px; }
.with-btn { display:inline-flex; gap:4px; align-items:center; }
button.icon { padding:5px 8px; line-height:1; }
.modal { position:fixed; inset:0; background:rgba(0,0,0,.4); display:flex; align-items:flex-start; justify-content:center; padding-top:10vh; z-index:50; }
.modal[hidden] { display:none; }
.modal-box { background:var(--card); border-radius:10px; width:min(520px, 92vw); max-height:75vh; display:flex; flex-direction:column; box-shadow:0 10px 40px rgba(0,0,0,.25); }
.modal-head { display:flex; gap:8px; padding:12px; border-bottom:1px solid var(--border); }
.modal-head input { flex:1; padding:8px 10px; border:1px solid var(--border); border-radius:6px; font-size:14px; }
.picklist { list-style:none; margin:0; padding:6px; overflow:auto; }
.picklist li[hidden] { display:none; }
.picklist button { display:block; width:100%; text-align:left; background:none; border:0; padding:8px 10px; border-radius:6px; cursor:pointer; font-size:14px; }
.picklist button:hover, .picklist button:focus { background:#f3f4f6; }
.modal-head strong { flex:1; align-self:center; }
.modal-body { display:flex; flex-direction:column; gap:12px; padding:12px; }
.modal-body label { display:flex; flex-direction:column; gap:4px; font-size:13px; }
.modal-body label.check { flex-direction:row; align-items:flex-start; gap:8px; }
.modal-body fieldset.taxes { border:1px solid var(--border); border-radius:6px; padding:8px 10px; display:flex; flex-direction:column; gap:6px; }
.modal-body fieldset.taxes legend { font-size:12px; color:var(--muted); padding:0 4px; }
.modal-body input[type=text] { width:120px; padding:6px 8px; border:1px solid var(--border); border-radius:6px; }
.modal-foot { display:flex; gap:8px; padding:10px 12px; border-top:1px solid var(--border); }
.modal-foot input { flex:1; padding:8px 10px; border:1px solid var(--border); border-radius:6px; }
.modal-box > p { margin:8px 12px 0; }
.picklist li.empty { padding:10px; }
.picklist li { display:flex; align-items:center; }
.picklist li > button:first-child { flex:1; }
.picklist button.pin { width:auto; flex:0 0 auto; padding:6px 8px; opacity:.3; filter:grayscale(1); }
.picklist button.pin.on, .picklist button.pin:hover { opacity:1; filter:none; }
.picklist .id { color:var(--muted); font-size:12px; margin-right:6px; }
button.apply { background:#16a34a; border-color:#16a34a; color:#fff; }
.entries th.check, .entries td.check { width:26px; text-align:center; }
.entries td.desc, .entries th.desc { min-width:260px; white-space:normal; }
.entries td.num, .entries th.num { text-align:right; white-space:nowrap; }
.grid tfoot tr.total td { font-weight:600; }
.grid td.paid { background:#dcfce7 !important; color:#166534; font-weight:600; }
.grid tr.paid td { border-bottom:2px solid #d1d5db; color:var(--muted); font-size:12px; }
.grid tr.actual td { border-bottom:2px solid #d1d5db; }
.view-options { display:flex; gap:20px; flex-wrap:wrap; align-items:center; margin:-4px 0 10px; }
.view-options label.checkbox { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; }
.grid td.unbilled { background:#fef9c3 !important; }
.grid td.client.unbilled a { color:#854d0e; }
.marketing .contact { border-top:1px solid var(--border); padding:10px 0; }
.marketing .contact-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; }
.marketing .contact-head .muted { margin-left:6px; }
.marketing .contact-row { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:6px; }
.marketing .contact-row .label { width:48px; font-size:11px; text-transform:uppercase; letter-spacing:.03em; color:var(--muted); }
.marketing .contact-row input, .marketing .contact-row select, .marketing .actions input[type=text] { padding:5px 8px; border:1px solid var(--border); border-radius:6px; font:inherit; }
.pill { display:inline-flex; align-items:center; gap:4px; font-size:12px; padding:2px 8px; border-radius:999px; background:#e2e8f0; }
.pill.ok { background:#dcfce7; color:#166534; } .pill.off { background:#fee2e2; color:#991b1b; } .pill.tag { background:#e0e7ff; color:#3730a3; }
.pill form.inline { gap:0; } .pill button.link { color:inherit; font-size:14px; line-height:1; }
button.trigger { background:#f59e0b; border-color:#f59e0b; color:#fff; }
table.list tr.failed td { background:var(--bad); }
table.list.compact td, table.list.compact th { padding:4px 6px; }
.pager { display:flex; gap:12px; align-items:center; }
table.contacts th.check, table.contacts td.check { width:28px; text-align:center; }
