/* DOCFLOW - visual language ported from HOOMAHOO Office Assistant (HOA).
   Palette tokens, font roles and component shapes match D:\HOOMAHOO GUI\STYLE_GUIDE.md.
   Dark theme only. Gold is the one accent. Text on gold is always black. No white:
   the lightest colour is a light grey (owner's decision, 25 Sep 2026). */

:root {
  --bg: #1A1A1D;
  --card: #242428;
  --surface: #2E2E33;
  --border: #3A3A40;
  --gold: #F1B811;
  --gold-pressed: #DDA60D;
  --text: #C9C9CE;          /* no white anywhere: the lightest colour is this grey */
  --text-muted: #A0A0A5;
  --stop: #B23B3B;
  --stop-pressed: #8F2E2E;
  --status-a: #3AA35A;
  --status-b: #4C8FD1;
  --status-c: #D19A3A;
  --status-d: #B23B3B;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Segoe UI Emoji", Tahoma, sans-serif;
  font-size: 14px;
  margin: 0;
}

a { color: var(--gold); }

/* ---------- Header: logo, DOCFLOW, subtitle sized to the title ---------- */
.hoo-header { display: flex; align-items: center; gap: 12px; padding: 15px 20px; background: var(--bg); }
.hoo-header .brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.hoo-header img { height: 52px; width: auto; display: block; }
.hoo-header .titles { display: inline-flex; flex-direction: column; }
.hoo-header .app-title { color: var(--gold); font-weight: 800; font-size: 24px; line-height: 1.1; letter-spacing: 1px; white-space: nowrap; }
.hoo-header .app-subtitle { color: var(--text-muted); font-size: 12px; line-height: 1.2; margin-top: 3px; white-space: nowrap; }
.hoo-header .spacer { flex: 1; }
.hoo-header .who { color: var(--text-muted); font-size: 12px; text-align: right; }

/* ---------- Ribbon (HOOMAHOO Office Assistant core/ribbon.py) ----------
   Group tabs exactly two tiles wide; each drops a panel of square tiles,
   two per row; an open tab turns gold with black text; a tab holding the
   current screen shows its title in gold. Log out is the last, standalone
   tile at the right edge. */
.ribbon {
  --tile: 76px; --tile-gap: 2px;
  --tab-width: calc(2 * (var(--tile) + 2 * var(--tile-gap)) + 2px);
  display: flex; flex-wrap: wrap; align-items: stretch; position: relative; z-index: 20;
  background: var(--card); border: 1px solid var(--border); min-height: var(--tile); margin: 0 10px;
}
.ribbon-group { position: relative; }
.ribbon-tab {
  width: var(--tab-width); height: var(--tile); border: 0; background: var(--card); color: var(--text-muted);
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: 1px; cursor: pointer; padding: 0 8px;
}
.ribbon-tab:hover { background: var(--surface); }
.ribbon-tab.has-active { color: var(--gold); }
.ribbon-tab[aria-expanded="true"] { background: var(--gold); color: #000; }
.ribbon-tab:focus-visible, .tile-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.ribbon-panel { position: absolute; top: 100%; left: -1px; display: none; background: var(--border); padding: 1px; }
.ribbon-panel.open { display: block; }
.ribbon-panel.align-right { left: auto; right: -1px; }
.ribbon-panel .tiles { display: grid; grid-template-columns: repeat(2, var(--tile)); gap: calc(2 * var(--tile-gap));
  padding: var(--tile-gap); background: var(--card); }
.tile-btn {
  width: var(--tile); height: var(--tile); background: var(--card); color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 10px 3px 0; text-decoration: none; cursor: pointer; border: 0; font: inherit;
}
.tile-btn:hover { background: var(--surface); }
.tile-btn .icon { color: var(--gold); font-size: 20px; line-height: 1; height: 24px;
  font-family: "Segoe UI Symbol", "Segoe UI", "DejaVu Sans", sans-serif; }
.tile-btn .label { font-size: 10.5px; line-height: 1.2; margin-top: 6px; text-align: center; }
.tile-btn.active { background: var(--gold); color: #000; }
.tile-btn.active .icon { color: #000; }
.ribbon-end { margin: 0 0 0 auto; }
/* Page title under the ribbon (as the Office Assistant's gold tool caption). */
.page-title { margin: 0 0 12px; color: var(--gold); font-size: 17px; font-weight: 700; letter-spacing: .3px; }
a.btn { text-decoration: none; }
.page-title .sep { color: var(--text-muted); font-weight: 400; margin: 0 8px; }
/* ---------- Content ---------- */
.hoo-content { padding: 16px 20px 40px; max-width: 1100px; margin: 0 auto; }

.hoo-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.hoo-card > .card-title {
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
  margin: -4px 0 14px;
  text-transform: none;
}

/* ---------- Forms ---------- */
label { display: block; color: var(--text); font-size: 13px; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field .hint { color: var(--text-muted); font-size: 11px; margin-top: 3px; }
.field.invalid input, .field.invalid select {
  border: 1px solid var(--stop) !important;
  box-shadow: 0 0 0 1px var(--stop);
}
.field.invalid .hint.error { color: var(--stop); font-style: italic; }

input[type=text], input[type=date], input[type=email], input[type=number], select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 8px;
  font-size: 13px;
  font-family: inherit;
  border-radius: 2px;
}
input:disabled { color: var(--text-muted); }
textarea { min-height: 70px; resize: vertical; }
/* v26: comment boxes grow with their text (auto-grow.js); the Comment column takes the free width. */
textarea.auto-grow { overflow-y: hidden; line-height: 1.45; }
textarea.comment-box { min-height: 44px; width: 100%; }
.review-table { table-layout: fixed; }
.review-table td { word-wrap: break-word; }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 180px; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 2px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--gold); color: #000; }
.btn-primary:hover { background: var(--gold-pressed); }
.btn-secondary { background: var(--surface); color: var(--text); font-weight: 400; }
.btn-secondary:hover { background: var(--border); }
.btn-stop { background: var(--stop); color: var(--text); }
.btn-stop:hover { background: var(--stop-pressed); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-row { text-align: center; margin-top: 18px; }

/* ---------- Progress bar (segmented, gold) ---------- */
.hoo-progress { margin: 14px 0; }
.hoo-progress .track {
  background: var(--bg);
  height: 12px;
  border-radius: 2px;
  display: flex;
  gap: 3px;
  padding: 2px;
  overflow: hidden;
}
.hoo-progress .seg { flex: 0 0 14px; height: 100%; background: var(--border); border-radius: 1px; }
.hoo-progress .seg.filled { background: var(--gold); }
.hoo-progress .status-line { color: var(--text-muted); font-size: 11px; font-style: italic; margin-top: 6px; }

/* ---------- Per-file upload progress (§7.1 Step 4a) ---------- */
.upload-row { margin: 10px 0; }
.upload-row .upload-name { font-size: 13px; margin-bottom: 4px; }
.upload-row .bar-track { background: var(--bg); height: 8px; border-radius: 2px; overflow: hidden; }
.upload-row .bar-fill { background: var(--gold); height: 100%; width: 0%; transition: width 0.2s; }
.upload-row .upload-status { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ---------- Tables / file lists ---------- */
table.hoo-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.hoo-table th, table.hoo-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
table.hoo-table th { background: var(--surface); color: var(--text-muted); font-weight: 600; font-size: 12px; }
table.hoo-table tr.dup-flag td { background: rgba(241, 184, 17, 0.08); }
.dup-note { color: var(--gold); font-size: 11px; font-style: italic; }
.folder-heading { color: var(--text-muted); font-size: 12px; padding: 6px 0 2px; font-style: italic; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.badge-a { background: var(--status-a); color: var(--bg); }
.badge-b { background: var(--status-b); color: var(--bg); }
.badge-c { background: var(--status-c); color: #000; }
.badge-d { background: var(--status-d); color: var(--bg); }
.badge-n { background: var(--gold); color: #000; }
.badge-open { background: var(--status-c); color: #000; }
.badge-closed { background: var(--status-a); color: var(--bg); }
.badge-rejected { background: var(--status-d); color: var(--bg); }
.badge-muted { background: var(--surface); color: var(--text-muted); }
.badge-overdue { background: var(--stop); color: var(--bg); }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); padding: 12px; border-radius: 2px; }
.kpi .value { color: var(--gold); font-size: 26px; font-weight: 700; }
.kpi .label { color: var(--text-muted); font-size: 12px; }

/* ---------- Queue list ---------- */
.queue-item {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--border); padding: 10px 12px; margin-bottom: 8px; border-radius: 2px;
}
.queue-item .num { color: var(--gold); font-weight: 700; }
.queue-item .meta { color: var(--text-muted); font-size: 12px; }
.queue-item .spacer { flex: 1; }
.pickup-btn { font-style: italic; background: none; border: none; color: var(--gold); cursor: pointer; font-size: 13px; }
.pickup-btn.bored { font-style: normal; color: var(--text-muted); }
.pickup-btn.urgent { font-style: normal; color: var(--stop); text-transform: uppercase; font-weight: 700; }

/* ---------- Misc ---------- */
.muted { color: var(--text-muted); }
.error-box { background: rgba(178,59,59,0.15); border: 1px solid var(--stop); color: var(--text); padding: 8px 10px; border-radius: 2px; margin-bottom: 12px; font-size: 13px; }
.success-box { background: rgba(46,143,79,0.15); border: 1px solid #2E8F4F; color: var(--text); padding: 8px 10px; border-radius: 2px; margin-bottom: 12px; font-size: 13px; }
.center { text-align: center; }

/* ---------- Added for the gap-bridging release ---------- */
.small { font-size: 12px; }
.strong { font-weight: 700; }
.error-text { color: #E06C6C; }
.ok-text { color: var(--status-a); }
.link-btn { background: none; border: none; color: var(--gold); cursor: pointer; font-size: 13px; padding: 0 4px; font-family: inherit; }
.link-btn.danger { color: #E06C6C; }
.link-btn.muted { color: var(--text-muted); }
.link-btn.strong { font-weight: 700; }
.btn-row.left { text-align: left; }
.row.gap { gap: 8px; align-items: center; }
.row.gap > input, .row.gap > select { width: auto; flex: 1; min-width: 140px; }
label.inline { display: inline-flex; align-items: center; gap: 4px; margin-right: 12px; font-weight: 400; }
label.inline input { width: auto; }
input[type=time], input[type=datetime-local], input[type=file] {
  background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 6px 8px; font-family: inherit; border-radius: 2px;
}
fieldset { border: none; padding: 0; margin: 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
code { background: var(--surface); padding: 1px 5px; border-radius: 2px; }
h4 { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin: 14px 0 6px; }
.subnav { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 14px; font-size: 13px; }
.subnav a { color: var(--text-muted); text-decoration: none; }
.subnav a:hover { color: var(--gold); }
.support-banner { background: var(--stop); color: var(--text); padding: 6px 20px; font-size: 13px; }
.support-banner .link-btn { color: var(--text); text-decoration: underline; }
.hoo-card.inner { background: var(--surface); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filter-bar select, .filter-bar input[type=text] { width: auto; min-width: 120px; }
.filter-bar input[type=date] { width: auto; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.type-tile { display: flex; flex-direction: column; gap: 4px; padding: 14px; background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: var(--text); border-radius: 2px; }
.type-tile:hover { border-color: var(--gold); }
.type-tile b { color: var(--gold); font-size: 18px; }
.checklist li { margin: 6px 0; }
.checklist li.done::marker { color: var(--status-a); }
.checklist li.done { color: var(--text-muted); text-decoration: line-through; }
.muted-row td { color: var(--text-muted); }
.audit-note { color: var(--text-muted); font-size: 11px; white-space: pre-line; border-left: 2px solid var(--gold); padding-left: 6px; margin-top: 4px; }
.fix-panel { border: 1px solid var(--stop); background: rgba(178, 59, 59, 0.08); padding: 12px 14px; margin-bottom: 14px; border-radius: 2px; }
.fix-title { color: #E06C6C; font-weight: 700; margin-bottom: 4px; }
.counter { font-weight: 700; font-variant-numeric: tabular-nums; }
.counter.bad { color: #E06C6C; }
.counter.good { color: var(--status-a); }
input.pending { border-color: var(--gold) !important; box-shadow: 0 0 0 1px var(--gold); }
.bar-track { background: var(--bg); height: 8px; border-radius: 2px; overflow: hidden; }
.bar-track.big { height: 14px; }
.bar-fill { background: var(--gold); height: 100%; width: 0; transition: width .3s; }
.upload-overall { margin-bottom: 10px; }
.upload-overall .upload-status { font-size: 12px; color: var(--text); margin-top: 4px; }
.kpi-alert .value { color: #E06C6C; }
.trend .tbar { height: 6px; margin: 2px 0; border-radius: 2px; }
.trend .tbar.sub { background: var(--gold); }
.trend .tbar.ret { background: var(--status-b); }
details { margin: 6px 0; }
summary { cursor: pointer; }

/* ---------- Drop menu with checkboxes (v24, _multiselect.html) ---------- */
details.ms { position: relative; margin: 0; min-width: 150px; }
details.ms > summary.ms-summary {
  list-style: none; display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text); padding: 6px 8px; font-size: 13px; border-radius: 2px;
}
details.ms > summary.ms-summary::-webkit-details-marker { display: none; }
details.ms > summary.ms-summary::after { content: "\25BE"; margin-left: auto; color: var(--text-muted); }
details.ms[open] > summary.ms-summary { border-color: var(--gold); }
details.ms .ms-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.ms .ms-panel {
  position: absolute; top: calc(100% + 2px); left: 0; z-index: 30; min-width: 240px; max-width: 360px;
  max-height: 280px; overflow-y: auto; background: var(--card); border: 1px solid var(--gold); padding: 6px 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
details.ms .ms-actions { display: flex; gap: 10px; padding: 2px 0 6px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
details.ms .ms-actions .link-btn { padding: 0; font-size: 12px; }
details.ms label.ms-opt { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; margin: 0; padding: 3px 0; cursor: pointer; }
details.ms label.ms-opt input { width: auto; margin-top: 2px; accent-color: var(--gold); }
details.ms.ms-disabled > summary.ms-summary { color: var(--text-muted); }
.hoo-content.wide { max-width: 1560px; }
/* People registry edited in place (v24): every cell is a field; Save per row. */
.people-table td { vertical-align: top; padding: 4px 5px; }
.people-table input[type=text], .people-table input[type=email], .people-table select { padding: 5px 6px; min-width: 0; }
.people-table details.ms { min-width: 120px; }
.people-table details.ms > summary.ms-summary { padding: 5px 6px; }
.people-table tr.dirty td { background: rgba(241, 184, 17, 0.06); }
.people-table tr.new-row td { background: var(--surface); }
.people-table .row-actions { white-space: nowrap; }
.people-table .row-actions .btn { padding: 5px 12px; }
.people-table .row-error { color: #E06C6C; font-size: 12px; white-space: normal; margin-top: 4px; max-width: 220px; }
.people-table .state { font-size: 12px; }
.people-table input[type=checkbox] { width: auto; accent-color: var(--gold); transform: scale(1.2); margin-top: 8px; }
.roles-table td { vertical-align: middle; }
/* v25: a project role nobody holds (or an unset/untested mailbox) gets a red box. */
.roles-table tr.role-missing td { background: rgba(178, 59, 59, 0.14); border-top: 2px solid var(--stop); border-bottom: 2px solid var(--stop); }
.roles-table tr.role-missing td:first-child { border-left: 2px solid var(--stop); }
.roles-table tr.role-missing td:last-child { border-right: 2px solid var(--stop); }
.roles-table tr.role-missing .role-cell { color: #E06C6C; }
.btn.btn-small { padding: 5px 12px; }
.inline-table td { vertical-align: middle; padding: 4px 6px; }
.inline-table tr.new-row td { background: var(--surface); }
table.hoo-table.week-table { width: auto; }
.week-table td { vertical-align: middle; padding: 4px 10px; }
.week-table td:first-child { min-width: 70px; }
.week-table input[type=time] { width: 120px; }
.week-table input[type=checkbox], .check-line input { width: auto; accent-color: var(--gold); transform: scale(1.2); }
label.check-line { margin: 4px 0 6px; font-size: 13px; }
.roles-table .role-cell { color: var(--gold); font-weight: 700; white-space: nowrap; }
.roles-table td.na { color: var(--text-muted); }
.roles-table input[type=checkbox] { width: auto; accent-color: var(--gold); transform: scale(1.2); }
.pickup-btn.calm { font-style: italic; }

/* ---------- Sign-up and subscriptions (v22) ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.plan-card { position: relative; display: block; background: var(--surface); border: 1px solid var(--border); padding: 14px;
  border-radius: 2px; cursor: pointer; font-weight: 400; }
.plan-card:hover { border-color: var(--gold); }
.plan-card input[type=radio] { position: absolute; top: 14px; right: 14px; width: auto; }
.plan-card:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.plan-card .plan-name { color: var(--gold); font-size: 18px; font-weight: 700; }
.plan-card .plan-price { font-size: 22px; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.plan-card .plan-price span { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.cycle-switch { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 12px; }
.steps { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.steps .now { color: var(--gold); font-weight: 700; }
.steps .done { color: var(--status-a); }
.terms-text { background: var(--surface); border: 1px solid var(--border); padding: 10px 12px; max-height: 220px; overflow-y: auto;
  font-size: 13px; line-height: 1.5; white-space: pre-line; margin-bottom: 10px; }
.billing-banner { background: var(--gold); color: #000; padding: 6px 20px; font-size: 13px; }
.billing-banner a { color: #000; font-weight: 700; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }
.site-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.site-tile-grid .hoo-card { margin: 0; }
@media (max-width: 600px) {
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 6px; }
}
