/* Dogwood Power | Operations Tracker. Plain, calm, one muted green accent. */
:root {
  --text: #262626;
  --muted: #5c5c5c;
  --faint: #8a8a8a;
  --line: #d9d9d9;
  --line-soft: #e8e8e8;
  --bg: #ffffff;
  --side: #f5f6f4;
  --hover: #f3f5f3;
  --accent: #2f4f3e;
  --accent-dark: #243d30;
  --accent-tint: #e7efe9;
  --late: #8a2f22;
  --late-tint: #f3e3e0;
  --soon: #6b5516;
  --soon-tint: #f6efdc;
  --font: Calibri, Carlito, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); }
h1, h2, h3 { font-weight: 600; margin: 0; color: var(--text); }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 8px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }
.hidden { display: none !important; }

/* Buttons */
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 6px 14px; border-radius: 3px; cursor: pointer; line-height: 1.3; }
.btn:hover { background: var(--hover); border-color: #bdbdbd; }
.btn:focus-visible, .nav a:focus-visible, .linkbtn:focus-visible, th button:focus-visible, tr.row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { color: var(--late); border-color: #d8b8b2; }
.btn.danger:hover { background: var(--late-tint); }
.btn.small { padding: 3px 10px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* Layout */
.shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.shell.with-demo { min-height: calc(100vh - 36px); }
.demo-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; background: #f2eede; border-bottom: 1px solid #ddd5b4; padding: 6px 16px; font-size: 14px; color: #4f4521; min-height: 36px; }
.demo-bar strong { font-weight: 600; }
.demo-bar label { display: inline-flex; gap: 6px; align-items: center; }
.demo-bar select { padding: 2px 6px; border: 1px solid #cfc7a3; background: #fff; border-radius: 3px; }
.demo-bar .spacer { flex: 1; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 18px 0 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.with-demo .side { height: calc(100vh - 36px); top: 36px; }
.brand { padding: 0 18px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.brand .name { font-size: 17px; font-weight: 600; color: var(--accent); }
.brand .sub { font-size: 13px; color: var(--muted); }
.nav { list-style: none; margin: 0; padding: 0; }
.nav .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 12px 18px 4px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 7px 18px; color: var(--text); text-decoration: none; border-left: 3px solid transparent; }
.nav a:hover { background: #ebeee9; }
.nav a.active { background: #fff; border-left-color: var(--accent); font-weight: 600; color: var(--accent); }
.nav .count { font-size: 12px; background: var(--late-tint); color: var(--late); border-radius: 9px; padding: 0 7px; font-weight: 600; }
.side-foot { margin-top: auto; padding: 14px 18px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.side-foot .who { color: var(--text); font-size: 14px; }
.side-foot .concept { margin-top: 10px; font-size: 12px; color: var(--faint); }
.main { padding: 22px 24px 40px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 20px; margin-bottom: 14px; }
.page-head .titles { flex: 1; min-width: 260px; }
.page-head .sub { color: var(--muted); margin-top: 3px; max-width: 760px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.note { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: #fafbfa; padding: 8px 12px; margin: 0 0 14px; color: var(--muted); font-size: 14px; max-width: 900px; }
.foot { margin-top: 30px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--faint); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.toolbar input[type=search] { min-width: 220px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 3px; }
.toolbar select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 3px; background: #fff; max-width: 200px; }
.toolbar label.check { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: var(--muted); }
.toolbar .meta { margin-left: auto; color: var(--muted); font-size: 14px; white-space: nowrap; }
.toolbar input[type=search] { min-width: 180px; width: 200px; }
.toolbar .filter { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: var(--muted); }

/* Tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 3px; }
table.grid { border-collapse: collapse; width: 100%; font-size: 14px; }
table.grid th { text-align: left; font-weight: 600; background: #f7f8f7; border-bottom: 1px solid var(--line); padding: 0; white-space: nowrap; position: sticky; top: 0; }
table.grid th button { background: none; border: 0; padding: 8px 9px; font-weight: 600; cursor: pointer; width: 100%; text-align: left; display: flex; gap: 6px; align-items: center; }
table.grid th button:hover { background: #eef1ee; }
table.grid th .arrow { color: var(--accent); font-size: 11px; }
table.grid td { padding: 7px 9px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.row { cursor: pointer; }
table.grid tr.row:hover td { background: var(--hover); }
table.grid td.num, table.grid th.num { text-align: right; }
table.grid td.num { font-variant-numeric: tabular-nums; }
table.grid td.text { max-width: 170px; }
table.grid td.main { max-width: 250px; }
table.grid td.long { max-width: 200px; min-width: 120px; }
table.grid td .clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.grid td.wrap .clip { white-space: normal; }
table.grid td.ref { white-space: nowrap; color: var(--muted); font-size: 13.5px; }
table.grid tfoot td { white-space: nowrap; font-weight: 600; background: #f7f8f7; border-top: 1px solid var(--line); }
.tag { display: inline-block; font-size: 11px; border: 1px solid var(--line); color: var(--muted); border-radius: 3px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }
.empty { padding: 26px 14px; color: var(--muted); text-align: center; }
.date { white-space: nowrap; }
.date.overdue { color: var(--late); font-weight: 600; }
.date.soon { color: var(--soon); font-weight: 600; }
.date small { display: block; font-weight: 400; font-size: 12px; }
.pill { display: inline-block; font-size: 13px; padding: 1px 9px; border-radius: 10px; border: 1px solid transparent; white-space: nowrap; }
.pill.ok { background: var(--accent-tint); color: var(--accent); border-color: #cddfd3; }
.pill.neutral { background: #eeeeee; color: #454545; border-color: #e0e0e0; }
.pill.warn { background: var(--soon-tint); color: var(--soon); border-color: #e7dcb6; }
.pill.bad { background: var(--late-tint); color: var(--late); border-color: #e6c8c2; }
.pill.muted { background: #fff; color: #777; border-color: #d0d0d0; }
.progress { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.bar { width: 44px; height: 6px; background: #e4e6e4; border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }

/* Home */
.stats { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; max-width: 760px; }
.stat { border: 1px solid var(--line); border-radius: 3px; padding: 10px 14px; background: #fff; }
.stat .n { font-size: 28px; font-weight: 600; line-height: 1.1; }
.stat .t { color: var(--muted); font-size: 14px; }
.stat.late .n { color: var(--late); }
.stat.soon .n { color: var(--soon); }
.section { margin-bottom: 22px; }
.section > h2 { margin-bottom: 6px; display: flex; gap: 10px; align-items: baseline; }
.section > h2 .hint { font-size: 13.5px; font-weight: 400; color: var(--muted); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.counts td, .counts th { padding: 7px 10px; }
.counts a { color: var(--text); text-decoration: none; font-weight: 600; }
.counts a:hover { text-decoration: underline; }
.feed { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 3px; }
.feed li { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); font-size: 14.5px; }
.feed li:last-child { border-bottom: 0; }
.feed .when { display: block; color: var(--faint); font-size: 12.5px; }
.attn { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 3px; }
.attn li { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.attn li:hover { background: var(--hover); }
.attn li:last-child { border-bottom: 0; }
.ok-line { color: var(--muted); padding: 10px 12px; border: 1px solid var(--line); border-radius: 3px; }

/* Side panel */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.22); z-index: 20; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: #fff; border-left: 1px solid var(--line); z-index: 21; display: flex; flex-direction: column; box-shadow: -2px 0 8px rgba(0,0,0,.08); }
.panel header { padding: 14px 18px 10px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.panel header .t { flex: 1; min-width: 0; }
.panel header h2 { font-size: 18px; overflow-wrap: anywhere; }
.panel header .sub { color: var(--muted); font-size: 13.5px; }
.panel header .x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; color: var(--muted); }
.panel .body { flex: 1; overflow-y: auto; padding: 8px 18px 20px; }
.panel footer { border-top: 1px solid var(--line); padding: 10px 18px; display: flex; gap: 8px; align-items: center; background: #fafafa; flex-wrap: wrap; }
.panel footer .spacer { flex: 1; }
fieldset { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
fieldset legend { font-weight: 600; color: var(--accent); padding: 0 0 6px; border-bottom: 1px solid var(--line-soft); width: 100%; margin-bottom: 8px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 13.5px; color: var(--muted); }
.field input, .field select, .field textarea { padding: 6px 8px; border: 1px solid var(--line); border-radius: 3px; background: #fff; width: 100%; min-width: 0; }
.field textarea { min-height: 64px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .toolbar input:focus, .toolbar select:focus, .card input:focus, .card select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field input[readonly], .field input:disabled, .field select:disabled, .field textarea:disabled { background: #f4f4f4; color: #444; }
.field .calc { background: #f4f6f4; }
.field .hint { font-size: 12.5px; color: var(--faint); }
.field.invalid input, .field.invalid select { border-color: var(--late); }
.field .err { color: var(--late); font-size: 12.5px; }
.banner { border: 1px solid #e6c8c2; background: var(--late-tint); color: var(--late); padding: 8px 12px; border-radius: 3px; margin: 10px 0; font-size: 14px; }
.banner.info { border-color: #cddfd3; background: var(--accent-tint); color: var(--accent); }
.confirm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--late); font-size: 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; background: #262626; color: #fff; padding: 8px 14px; border-radius: 3px; z-index: 40; font-size: 14px; }

/* Cards, settings, auth */
.card { border: 1px solid var(--line); border-radius: 3px; padding: 14px 16px; margin-bottom: 16px; max-width: 900px; background: #fff; }
.card > h2 { margin-bottom: 4px; }
.card p.sub { color: var(--muted); font-size: 14px; }
.card .fields { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 10px 0; }
.card .row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.users td, .users th { padding: 6px 8px; }
.users select { padding: 3px 6px; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: #fafaf9; }
.auth .box { width: 100%; max-width: 410px; background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 26px 28px 22px; }
.auth h1 { font-size: 20px; color: var(--accent); }
.auth .sub { color: var(--muted); margin: 4px 0 16px; font-size: 14.5px; }
.auth .field { margin-bottom: 12px; }
.auth .btn.primary { width: 100%; padding: 8px; margin-top: 4px; }
.auth .small { font-size: 13px; color: var(--muted); margin-top: 14px; }
.auth .concept { font-size: 12px; color: var(--faint); margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.mfa-qr { display: block; width: 168px; height: 168px; border: 1px solid var(--line); margin: 8px 0; }
code { background: #f1f1f1; padding: 1px 5px; border-radius: 3px; font-size: 13.5px; overflow-wrap: anywhere; }
.diff { font-size: 13px; color: var(--muted); }
.diff b { color: var(--text); font-weight: 600; }

/* Tablet and small screens */
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 0 0; }
  .with-demo .side { height: auto; top: 0; }
  .brand { border-bottom: 0; margin-bottom: 0; padding-bottom: 8px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
  .nav { display: flex; overflow-x: auto; padding: 0 10px; white-space: nowrap; }
  .nav .label { display: none; }
  .nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 12px; gap: 8px; }
  .nav a.active { border-bottom-color: var(--accent); }
  .side-foot { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 8px 18px; margin-top: 0; }
  .side-foot .concept { display: none; }
  .main { padding: 16px; }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .fields { grid-template-columns: 1fr; }
}
@media print {
  .side, .demo-bar, .toolbar, .actions, .panel, .scrim { display: none !important; }
  .shell { display: block; }
}
