/* Desktop-first: this is an operator's tool, read on a laptop while running the
   quarterly cycle. The tree is the screen everything else hangs off. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #dfe3e8;
  --text: #16202c;
  --muted: #67717f;
  --accent: #1750c4;
  --good: #067647;
  --warn: #b54708;
  --bad: #b42318;
  --warn-bg: #fff6ed;
  --bad-bg: #fef3f2;
  --good-bg: #ecfdf3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

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

.container { max-width: 1180px; margin: 0 auto; padding: 18px 16px 90px; }
.narrow { max-width: 620px; }

/* ---------- nav ---------- */
.topnav {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}
.topnav a { color: var(--text); text-decoration: none; padding: 6px 2px; }
.topnav a:hover { color: var(--accent); }
.brand { font-weight: 700; color: var(--accent); }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 13px; }

.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-head h1 { flex: 1; }

h1 { font-size: 22px; margin: 8px 0 14px; display: flex; align-items: center; gap: 10px;
     flex-wrap: wrap; }
h2 { font-size: 13px; margin: 20px 0 10px; text-transform: uppercase;
     letter-spacing: 0.05em; color: var(--muted); }
.panel h2:first-child { margin-top: 0; }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { text-decoration: none; }

.small { font-size: 13px; }
.muted { color: var(--muted); }
.warn-text { color: var(--warn); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.grow { flex: 1; }
.desc { white-space: pre-wrap; margin: 10px 0 0; }
.hint { color: var(--muted); font-weight: 400; font-size: 12px; }

/* ---------- panels, cards ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin-bottom: 16px;
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
         gap: 10px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
        padding: 12px 14px; }
.card .label { color: var(--muted); font-size: 11px; text-transform: uppercase;
               letter-spacing: 0.05em; }
.card .value { font-size: 26px; font-weight: 700; margin-top: 2px;
               font-variant-numeric: tabular-nums; }
.card .value.small-value { font-size: 17px; font-weight: 600; }
.card .sub { color: var(--muted); font-size: 12px; }

.auth-box { max-width: 340px; margin: 12vh auto; }

.empty { color: var(--muted); padding: 14px; background: var(--bg);
         border-radius: 10px; font-size: 14px; }
.error-box { background: var(--bad-bg); border: 1px solid #fecdca; color: var(--bad);
             border-radius: 10px; padding: 14px; margin: 16px 0; }
.warn-box { background: var(--warn-bg); border: 1px solid #fedf89; color: var(--warn);
            border-radius: 10px; padding: 11px 14px; margin-bottom: 12px; font-size: 14px; }

/* ---------- the tree ---------- */
.tree { border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
        background: var(--surface); }
.tree-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px 7px calc(12px + var(--depth) * 22px);
  border-bottom: 1px solid #eef1f4;
}
.tree-row:last-child { border-bottom: none; }
.tree-row:hover { background: #f8fafc; }
/* Kept only so a matching descendant still has a branch to hang off. */
.tree-row.context { opacity: 0.5; }
.tree-row.benched { background: #fbfbfc; }
.tree-row.benched .tree-name { text-decoration: line-through; text-decoration-color: #c4ccd6; }
.tree-name { font-weight: 600; text-decoration: none; color: var(--text); }
.tree-name:hover { color: var(--accent); }
.tree-row .owner { font-size: 12px; color: var(--muted); text-decoration: none; }
.tree-row .owner.none { font-style: italic; opacity: 0.7; }

.level-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 5px; background: #eef2f6; color: var(--muted);
  white-space: nowrap;
}
.level-tag.PVH { background: #111827; color: #fff; }
.level-tag.TRACK { background: #4338ca; color: #fff; }
.level-tag.HOUSE { background: #1750c4; color: #fff; }
.level-tag.RGU { background: #0e7490; color: #fff; }
.level-tag.PRODUCT { background: #b45309; color: #fff; }
.level-tag.SOLUTION { background: #eef2f6; color: var(--muted); }

/* ---------- lists ---------- */
.list { display: grid; gap: 8px; }
.list-item {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; text-decoration: none; color: inherit;
}
.list-item:hover { border-color: #c6cfda; }
.list-item.benched { opacity: 0.65; }
.list-item .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list-item .meta { color: var(--muted); font-size: 13px; }

/* ---------- tables ---------- */
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600; padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}
table.grid td { padding: 8px; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr.retired td { opacity: 0.55; }
table.grid tr.over td { background: var(--warn-bg); }
table.grid tr.total-row td { font-weight: 700; border-top: 2px solid var(--border); }

dl.facts { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; margin: 0;
           font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
         background: #eef2f6; color: var(--muted); white-space: nowrap; }
.badge.RSR { background: #eff4ff; color: var(--accent); font-weight: 600; }
.badge.RSP { background: #f0f9ff; color: #0369a1; }
.badge.RSS { background: #f5f3ff; color: #6d28d9; }
.badge.BENCHED { background: var(--bad-bg); color: var(--bad); }
.badge.PLACEHOLDER { background: #fffbeb; color: var(--warn); border: 1px dashed #fedf89; }
.badge.RETIRED { background: #f1f3f6; color: var(--muted); }
.badge.OWNER { background: var(--good-bg); color: var(--good); font-weight: 600; }
.badge.CO_LEAD { background: #eef2f6; color: var(--muted); }
.badge.ENTRY { background: var(--good-bg); color: var(--good); font-weight: 600; }
.badge.LOOP { background: #f5f3ff; color: #6d28d9; }
.badge.QUARTER { background: #eff4ff; color: var(--accent); font-weight: 600; }
.badge.ON { background: var(--good-bg); color: var(--good); font-weight: 600; }

/* ---------- forms ---------- */
form.stack { display: grid; gap: 12px; }
form.row-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
form.row-form.tight { gap: 5px; align-items: center; }
form.inline { display: inline; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.check, label.inline-check {
  display: flex; align-items: center; gap: 7px; color: var(--text);
}
label.row-check { padding: 8px 4px; border-bottom: 1px solid #eef1f4; }
input, select, textarea, button {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); max-width: 100%;
}
input[type="checkbox"] { width: 17px; height: 17px; padding: 0; }
textarea { min-height: 80px; }
button {
  background: var(--accent); border-color: var(--accent); color: #fff; cursor: pointer;
  font-weight: 600; padding-inline: 16px;
}
button:hover { filter: brightness(1.08); }
button.secondary { background: #fff; color: var(--accent); }
button.link { background: none; border: none; color: var(--accent); padding: 2px 4px;
              font-weight: 500; font-size: 13px; }
button.link.danger-link { color: var(--bad); }
button.big { width: 100%; padding-block: 12px; font-size: 16px; }

.button-link {
  display: inline-block; background: var(--accent); color: #fff; text-decoration: none;
  padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 14px;
}
.button-link.secondary { background: #fff; color: var(--accent);
                         border: 1px solid var(--border); }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
           margin-bottom: 14px; background: var(--surface); padding: 12px;
           border: 1px solid var(--border); border-radius: 10px; }
.filters label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.filters input, .filters select { padding: 7px 9px; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
           margin-top: 12px; }
