/* Lodestar Ops - cabin at dusk theme */

:root {
  --bg: #101b14;
  --panel: #16231a;
  --panel-2: #1c2b20;
  --line: #2a3d2e;
  --line-soft: #22332a;
  --amber: #b88f5a;
  --amber-bright: #d4a96e;
  --sage: #6b825b;
  --sage-bright: #8aa374;
  --cream: #ede6d8;
  --cream-dim: #a9b4a0;
  --red: #c96a5b;
  --red-bg: #3a221e;
  --green: #7fa06f;
  --green-bg: #223323;
  --amber-bg: #3a2e1e;
  --radius: 10px;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--cream);
  line-height: 1.5;
  font-size: 14px;
}
a { color: inherit; }
::selection { background: var(--amber); color: var(--bg); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-chip {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--amber);
  object-fit: cover; flex-shrink: 0;
  background: var(--bg);
}
.brand-name { font-weight: 700; letter-spacing: 0.3px; }
.brand-sub { font-size: 11px; color: var(--cream-dim); }
.user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--cream-dim); font-size: 13px; }
.inline-form { display: inline; }

/* ---------- tab bar ---------- */
.tabbar {
  display: flex; gap: 4px;
  padding: 8px 18px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 61px; z-index: 39;
  overflow-x: auto;
}
.tab {
  text-decoration: none;
  color: var(--cream-dim); padding: 8px 14px; border-radius: 8px 8px 0 0;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; border-bottom: none;
}
.tab:hover { color: var(--cream); background: var(--panel-2); }
.tab.active { color: var(--amber-bright); background: var(--bg); border-color: var(--line); }
.tab .badge {
  background: var(--amber-bg); color: var(--amber-bright);
  border-radius: 10px; padding: 1px 7px; font-size: 11px; margin-left: 6px;
}
.tab .badge.warn { background: var(--red-bg); color: var(--red); }

/* ---------- layout ---------- */
.layout { display: flex; min-height: calc(100vh - 110px); }
.sidebar {
  width: 250px; flex-shrink: 0;
  border-right: 1px solid var(--line);
  padding: 14px 12px;
  background: var(--panel);
  overflow-y: auto;
}
main { flex: 1; padding: 18px 22px; min-width: 0; }

.side-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--cream-dim); margin: 4px 4px 10px;
}
.tree { list-style: none; }
.tree li { margin: 1px 0; }
.tree-node {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 7px;
  color: var(--cream); font-size: 13px; text-decoration: none;
}
.tree-node:hover { background: var(--panel-2); }
.tree-node .count { margin-left: auto; font-size: 11px; color: var(--cream-dim); }
.tree-children { list-style: none; padding-left: 20px; margin: 2px 0 6px; }
.tree-leaf {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 8px; border-radius: 6px;
  color: var(--cream-dim); font-size: 12.5px; text-decoration: none;
  overflow: hidden;
}
.tree-leaf:hover { color: var(--cream); background: var(--panel-2); }
.tree-leaf .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.done { background: var(--green); }
.dot.inprog { background: var(--amber); }
.dot.pending { background: var(--cream-dim); opacity: 0.5; }
.dot.blocked { background: var(--red); }
.dot.active { background: var(--sage-bright); }
.legend { margin-top: 14px; padding: 10px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: 8px; font-size: 11.5px; color: var(--cream-dim); }
.legend .row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.quicklinks { margin-top: 14px; }
.quicklinks a {
  display: block; padding: 5px 8px; color: var(--sage-bright);
  text-decoration: none; font-size: 12.5px; border-radius: 6px;
}
.quicklinks a:hover { background: var(--panel-2); color: var(--amber-bright); }

/* ---------- panels ---------- */
.panel-head { margin-bottom: 16px; }
.panel-head h1 { font-size: 20px; font-weight: 700; }
.panel-head p { color: var(--cream-dim); font-size: 13px; margin-top: 2px; }
.panel-head .actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--cream-dim); }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .s { font-size: 12px; color: var(--cream-dim); margin-top: 2px; }
.stat .v.amber { color: var(--amber-bright); }
.stat .v.green { color: var(--sage-bright); }
.stat .v.red { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 1000px) { .grid-2, .grid-2.even { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--cream-dim); margin-bottom: 12px; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; border-radius: 20px;
  padding: 2px 10px; white-space: nowrap;
}
.chip.done, .chip.active { background: var(--green-bg); color: var(--green); }
.chip.inprog { background: var(--amber-bg); color: var(--amber-bright); }
.chip.pending { background: rgba(169,180,160,0.12); color: var(--cream-dim); }
.chip.blocked { background: var(--red-bg); color: var(--red); }
.chip.overdue { background: var(--red-bg); color: var(--red); }
.chip.soon { background: var(--amber-bg); color: var(--amber-bright); }
.chip.tax { background: var(--red-bg); color: var(--red); }
.chip.compliance { background: var(--amber-bg); color: var(--amber-bright); }
.chip.license { background: var(--green-bg); color: var(--green); }
.chip.insurance { background: rgba(169,180,160,0.12); color: var(--cream-dim); }
.chip.advisor { background: var(--amber-bg); color: var(--amber-bright); }
.chip.vendor { background: var(--green-bg); color: var(--green); }
.owner {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 11px; font-weight: 700;
}
.owner.j { background: var(--amber-bg); color: var(--amber-bright); }
.owner.a { background: var(--green-bg); color: var(--green); }

/* ---------- phases / tasks ---------- */
.phase { margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.phase-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer; user-select: none;
}
.phase-head:hover { background: var(--panel-2); }
.phase-head .caret { color: var(--cream-dim); transition: transform 0.15s; font-size: 11px; }
.phase.open .phase-head .caret { transform: rotate(90deg); }
.phase-head .title { font-weight: 700; font-size: 14px; }
.phase-head .meta { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.phase-progress { display: inline-block; width: 110px; height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.phase-progress .fill { display: block; height: 100%; background: var(--sage-bright); border-radius: 4px; transition: width 0.2s; }
.phase-count { font-size: 12px; color: var(--cream-dim); }
.phase-body { display: none; padding: 4px 16px 14px; border-top: 1px solid var(--line-soft); }
.phase.open .phase-body { display: block; }
.task {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid var(--line-soft);
}
.task:last-child { border-bottom: none; }
.task-row { display: flex; align-items: flex-start; gap: 10px; width: 100%; }
.task .check {
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--cream-dim);
  flex-shrink: 0; cursor: pointer; margin-top: 2px;
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--bg);
  background: transparent; font-family: var(--font);
}
.task .check:hover { border-color: var(--amber-bright); }
.task.done .check { background: var(--green); border-color: var(--green); color: var(--bg); }
.task .text { flex: 1; min-width: 0; }
.task .text .t { font-size: 13.5px; }
.task.done .t { text-decoration: line-through; opacity: 0.6; }
.task .text .n { font-size: 12px; color: var(--cream-dim); margin-top: 2px; }
.task .right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.task .due { font-size: 11.5px; color: var(--cream-dim); }
.task .due.soon { color: var(--amber-bright); }
.task .due.overdue { color: var(--red); }
.task-notes { margin-top: 6px; }
.task-note { font-size: 12px; color: var(--cream-dim); margin: 2px 0; line-height: 1.4; }
.note-date { font-family: var(--mono); font-size: 11px; color: var(--sage-bright); margin-right: 8px; }
.del-btn {
  background: transparent; border: none; color: var(--cream-dim);
  cursor: pointer; font-size: 14px; padding: 0 4px; line-height: 1;
}
.del-btn:hover { color: var(--red); }

/* ---------- buttons / forms ---------- */
.btn {
  background: var(--amber); color: var(--bg);
  border: none; border-radius: 8px; padding: 7px 14px;
  font-weight: 700; font-size: 12.5px; cursor: pointer; font-family: var(--font);
  text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--amber-bright); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--cream-dim); }
.btn.ghost:hover { border-color: var(--amber); color: var(--amber-bright); }
.btn.small { padding: 4px 10px; font-size: 11.5px; }
.form-card {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.field label { display: block; font-size: 11px; color: var(--cream-dim); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.6px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--cream); border-radius: 7px; padding: 8px 10px; font-size: 13px;
  font-family: var(--font); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--amber); }
.form-foot { margin-top: 12px; display: flex; gap: 8px; }
details.form-card summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--amber-bright); list-style: none; }
details.form-card summary::before { content: "+ "; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--cream-dim); padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
tr.due-now td { background: var(--red-bg); }
td .sub { font-size: 11.5px; color: var(--cream-dim); margin-top: 1px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.row-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-form select, .row-form input {
  background: var(--bg); border: 1px solid var(--line); color: var(--cream);
  border-radius: 6px; padding: 4px 8px; font-size: 12px; font-family: var(--font);
}
.row-form textarea {
  background: var(--bg); border: 1px solid var(--line); color: var(--cream);
  border-radius: 6px; padding: 5px 8px; font-size: 12px; font-family: var(--font);
  width: 260px;
}
details.row-log summary { cursor: pointer; font-size: 11.5px; color: var(--sage-bright); }
details.row-log[open] summary { margin-bottom: 6px; }
.note-stack { font-size: 11.5px; color: var(--cream-dim); white-space: pre-line; max-width: 260px; }
.payer-kit { margin-top: 6px; border: 1px solid var(--line); border-left: 2px solid var(--amber); border-radius: 6px; padding: 6px 8px; background: var(--panel-2); max-width: 430px; }
.pk { display: flex; gap: 6px; font-size: 11.5px; line-height: 1.45; }
.pk + .pk { margin-top: 3px; }
.pk-l { flex: 0 0 48px; color: var(--amber-bright); font-weight: 700; text-transform: uppercase; font-size: 10px; letter-spacing: 0.04em; padding-top: 1px; }
.pk-v { color: var(--cream-dim); white-space: pre-line; min-width: 0; word-break: break-word; }
.pk-v a { color: var(--amber-bright); text-decoration: underline; }

/* ---------- charts ---------- */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-row .label { width: 130px; font-size: 12px; color: var(--cream-dim); flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { flex: 1; height: 14px; background: var(--bg); border-radius: 4px; overflow: hidden; display: flex; }
.bar-row .track .fill { height: 100%; background: var(--sage-bright); transition: width 0.2s; }
.bar-row .track .fill.amber { background: var(--amber); }
.bar-row .track .fill.red { background: var(--red); }
.bar-row .pct { width: 38px; text-align: right; font-size: 12px; color: var(--cream); font-family: var(--mono); }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-legend { font-size: 12px; color: var(--cream-dim); }
.donut-legend .row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.vbar-chart { display: flex; align-items: flex-end; gap: 14px; height: 150px; padding-top: 8px; }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.vbar .val { font-size: 11px; color: var(--cream); font-family: var(--mono); }
.vbar .bar { width: 100%; max-width: 46px; border-radius: 5px 5px 2px 2px; background: var(--amber); min-height: 3px; }
.vbar .bar.sage { background: var(--sage-bright); }
.vbar .lbl { font-size: 11px; color: var(--cream-dim); text-align: center; }

/* ---------- contacts ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.contact { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.contact .name { font-weight: 700; font-size: 14px; }
.contact .role { font-size: 11.5px; color: var(--cream-dim); margin-top: 1px; }
.contact .org { font-size: 12.5px; color: var(--sage-bright); margin-top: 6px; }
.contact .line { font-size: 12px; color: var(--cream-dim); margin-top: 2px; }
.contact .tag { margin-top: 8px; }

/* ---------- docs ---------- */
.docs-layout { display: grid; grid-template-columns: 240px 1fr; gap: 14px; }
@media (max-width: 900px) { .docs-layout { grid-template-columns: 1fr; } }
.file-tree { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.file-tree .folder { font-weight: 700; color: var(--cream); padding: 8px 8px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.7px; }
.file-tree .file {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--cream-dim);
  width: 100%; background: transparent; border: none; text-align: left; font-family: var(--font);
}
.file-tree .file:hover { background: var(--panel-2); color: var(--cream); }
.file-tree .file.active { background: var(--amber-bg); color: var(--amber-bright); }
.md-view { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; min-height: 480px; }
.md-toolbar { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); padding-bottom: 10px; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.md-toolbar .doc-name { font-weight: 700; }
.md-toolbar .engine { font-size: 11px; color: var(--cream-dim); }
.toggle { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.toggle button { background: transparent; border: none; color: var(--cream-dim); padding: 4px 12px; font-size: 11.5px; cursor: pointer; font-family: var(--font); }
.toggle button.on { background: var(--amber); color: var(--bg); font-weight: 700; }
.md-body h1 { font-size: 20px; color: var(--amber-bright); margin: 0 0 10px; }
.md-body h2 { font-size: 15px; color: var(--sage-bright); margin: 16px 0 8px; }
.md-body h3 { font-size: 13.5px; color: var(--cream); margin: 12px 0 6px; }
.md-body p { margin: 8px 0; }
.md-body ul, .md-body ol { margin: 6px 0 6px 20px; }
.md-body li { margin: 3px 0; }
.md-body code { font-family: var(--mono); font-size: 12.5px; background: var(--bg); padding: 1px 6px; border-radius: 4px; color: var(--amber-bright); }
.md-body pre { background: var(--bg); border: 1px solid var(--line-soft); border-radius: 8px; padding: 12px; overflow-x: auto; margin: 10px 0; }
.md-body pre code { background: none; padding: 0; }
.md-body blockquote { border-left: 3px solid var(--amber); padding: 2px 0 2px 12px; color: var(--cream-dim); margin: 10px 0; }
.md-body a { color: var(--sage-bright); }
.md-body table { margin: 10px 0; }
.md-body th, .md-body td { font-size: 12.5px; }
.md-body input[type="checkbox"] { accent-color: var(--sage-bright); }

/* ---------- notices / login ---------- */
.notice {
  background: var(--amber-bg); border: 1px solid var(--amber);
  color: var(--amber-bright); border-radius: 8px; padding: 8px 12px;
  font-size: 12px; margin-bottom: 14px;
}
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  width: 360px; max-width: 92vw;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 32px 28px; text-align: center;
}
.login-card .logo-chip { width: 64px; height: 64px; margin: 0 auto 14px; display: block; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: var(--cream-dim); font-size: 13px; margin-bottom: 20px; }
.login-card .field { text-align: left; margin-bottom: 14px; }
.login-card .btn { width: 100%; }
.login-error { color: var(--red); font-size: 12.5px; margin-bottom: 10px; }

.empty { color: var(--cream-dim); font-size: 13px; padding: 12px 0; }
