/* Light mode, same palette as the QX business app. Left sidebar, phone first. */
:root {
  --bg: #f4efe4; --panel: #ffffff; --line: #e3dccb; --soft: #efe8da; --side: #fbf8f1;
  --radius: 18px; --shadow: 0 1px 2px #26226214, 0 8px 24px #2622620f;
  --navy: #262262; --ink: #17143f; --copper: #cf945f; --focus: #0776b4; --muted: #6b6874;
  --current: #ece5d6; --bad: #b3261e; --good: #1d6b4a; --warn: #8a5a00;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--navy); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.shell { display: flex; flex-direction: column; min-height: 100vh; }
.sidebar { background: var(--side); border-bottom: 1px solid var(--line); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--navy); color: #fff; font-size: 13px; }
.sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
.sidebar nav a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 600; }
.sidebar nav a:hover, .sidebar nav a.current { background: var(--current); }
.who { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.link-button { background: none; border: 0; padding: 8px 0; color: var(--navy); text-decoration: underline; cursor: pointer; font: inherit; }
.content { flex: 1; padding: 20px 16px 48px; max-width: 1180px; width: 100%; min-width: 0; }
@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .sidebar { width: 230px; flex: none; position: sticky; top: 0; height: 100vh; border-bottom: 0; border-right: 1px solid var(--line); padding: 22px 14px; gap: 22px; }
  .sidebar nav { flex-direction: column; flex-wrap: nowrap; gap: 2px; }
  .who { margin-top: auto; flex-direction: column; align-items: flex-start; padding: 0 6px; }
  .content { padding: 32px 40px 64px; }
}

.page-head { margin-bottom: 20px; }
.page-head p { margin: 0; }
.head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 12px 0; }
.stat { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; }
.estimate { display: inline-block; font-size: 12px; font-weight: 600; color: var(--warn); background: #fbf1dc; border-radius: 999px; padding: 2px 10px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 8px; background: var(--soft); color: var(--ink); white-space: nowrap; }
.badge.bad { background: #f8e1df; color: var(--bad); }
.badge.warn { background: #fbf1dc; color: var(--warn); }
.badge.good { background: #dff0e7; color: var(--good); }
.note { background: #fbf1dc; border-radius: 12px; padding: 10px 14px; }
.flash { border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; font-weight: 600; }
.flash.good { background: #dff0e7; color: var(--good); }
.flash.bad { background: #f8e1df; color: var(--bad); }
.empty { color: var(--muted); padding: 12px 0; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
tfoot td, tfoot th { font-weight: 800; border-bottom: 0; }
table.grid input { width: 100%; min-width: 80px; }

.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
label.check { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea { font: inherit; padding: 10px 12px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); max-width: 100%; }
input[type=checkbox] { min-height: auto; width: 20px; height: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--navy); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button.quiet { background: var(--current); color: var(--ink); }
.button.danger { background: #f8e1df; color: var(--bad); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form label { flex: 1 1 140px; }

.login { max-width: 380px; margin: 12vh auto; padding: 0 16px; display: flex; flex-direction: column; gap: 16px; }
.login form { display: flex; flex-direction: column; gap: 10px; }
.login input[type=submit] { background: var(--navy); color: #fff; border: 0; font-weight: 700; cursor: pointer; }
.good-text { color: var(--good); }
.bad-text { color: var(--bad); }
h3 { font-size: .95rem; margin: 18px 0 6px; }
.changes { margin: 0; padding-left: 18px; }
.inline-form.compact { flex-wrap: nowrap; align-items: flex-end; }
.inline-form.compact label { flex: 0 1 auto; }
