/* OneDash — built on the component vocabulary of the OTF and BYC dashboards */

:root {
  --bg:        #f5f5f5;
  --surface:   #ffffff;
  --line:      #e8e8e8;
  --row:       #f5f5f5;
  --ink:       #1a1a1a;
  --muted:     #888888;
  --faint:     #aaaaaa;

  --pos:       #16a34a;
  --pos-bg:    #dcfce7;
  --neg:       #dc2626;
  --neg-bg:    #fee2e2;
  --zero:      #888888;
  --zero-bg:   #f3f4f6;

  --accent:    #ee5a24;   /* overridden per entity */
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: "IBM Plex Sans", 'Trebuchet MS', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.num, td.num, .mono {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

button { font: inherit; cursor: pointer; border: 1px solid transparent; background: none; color: inherit; }
input, select { font: inherit; }
input:focus-visible, button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ================= sign in ================= */

.signin-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }

.signin-card {
  width: 100%; max-width: 760px;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px #0001;
}

.brand-panel { background: #1a1a1a; color: #fff; padding: 34px 30px; display: flex; flex-direction: column; }
.brand-name { font-size: 20px; font-weight: 700; margin-top: 18px; letter-spacing: -0.01em; }
.brand-line { color: #999; font-size: 13px; margin-top: 4px; max-width: 26ch; }
.brand-props { list-style: none; margin-top: auto; padding-top: 28px; display: grid; gap: 10px; }
.brand-props li { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #ccc; }
.brand-props i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.brand-props em { margin-left: auto; font-style: normal; color: #777; font-size: 11px; }

.signin-form { padding: 38px 34px; }
.signin-form h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.signin-form .sub { color: var(--muted); font-size: 13px; margin: 4px 0 22px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #999; margin-bottom: 5px; }
input[type="email"], input[type="password"] {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 6px; background: #fbfbfb; color: var(--ink);
}
.btn-primary { width: 100%; background: #1a1a1a; color: #fff; padding: 11px; font-weight: 700; border-radius: 6px; margin-top: 8px; }
.btn-primary:hover { background: #000; }
.btn-primary:disabled { opacity: .55; cursor: default; }
.notice { margin-top: 12px; font-size: 12.5px; color: var(--neg); min-height: 18px; }

@media (max-width: 640px) {
  .signin-card { grid-template-columns: 1fr; max-width: 400px; }
  .brand-panel { padding: 24px; }
  .brand-props { margin-top: 20px; padding-top: 0; }
  .signin-form { padding: 26px 24px 30px; }
}

/* ================= shell ================= */

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; box-shadow: 0 1px 3px #0001; }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wordmark { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.topbar .spacer { flex: 1; }
.who { font-size: 11px; color: var(--muted); }
.btn-quiet { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 6px 11px; border-color: var(--line); border-radius: 20px; }
.btn-quiet:hover { color: var(--ink); background: #fafafa; }

.segmented { display: inline-flex; background: #f0f0f0; border-radius: 20px; padding: 2px; }
.segmented button { padding: 6px 15px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #999; border-radius: 20px; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px #0002; }

select {
  padding: 6px 12px; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink);
}

main { max-width: 1180px; margin: 0 auto; padding: 16px; }
.state { padding: 60px 16px; text-align: center; color: var(--muted); }
.state strong { display: block; color: var(--ink); font-weight: 700; margin-bottom: 4px; }

/* ================= shared components ================= */

.section-title {
  font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); border-left: 3px solid var(--accent); padding-left: 8px;
  margin: 18px 0 10px;
}
.section-title:first-child { margin-top: 0; }
.section-title small { color: var(--faint); font-weight: 700; letter-spacing: .04em; text-transform: none; font-size: 10px; margin-left: 7px; }

.card {
  background: var(--surface); border-radius: 12px; border: 1px solid var(--line);
  box-shadow: 0 1px 4px #0001; padding: 16px; margin-bottom: 14px;
}

.chip-pos, .chip-neg, .chip-zero {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 100px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chip-pos { color: var(--pos); background: var(--pos-bg); }
.chip-neg { color: var(--neg); background: var(--neg-bg); }
.chip-zero { color: var(--zero); background: var(--zero-bg); }

/* KPI cards */

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi-card {
  background: var(--surface); border-radius: 12px; box-shadow: 0 1px 4px #0001;
  border: 1px solid var(--line); padding: 14px; text-align: center;
  position: relative; overflow: hidden; min-width: 0;
}
.kpi-card .accent-strip { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.kpi-label { font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #999; margin-bottom: 4px; }
.kpi-value { font-size: 26px; font-weight: 900; color: var(--ink); letter-spacing: -.02em; line-height: 1.15; }
.kpi-sub { font-size: 10px; color: var(--faint); margin-top: 4px; }
.kpi-foot { margin-top: 7px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Goal bars — the OTF dashboard's bar idiom, plain HTML so text never scales */

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-name {
  font-size: 10px; color: #555; font-weight: 600; width: 112px; flex: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-track { flex: 1; height: 20px; background: #f0f0f0; border-radius: 100px; position: relative; min-width: 40px; }
.bar-fill { height: 100%; border-radius: 100px; background: var(--accent); }
.bar-mark { position: absolute; top: 2px; bottom: 2px; width: 2px; background: #9aa3ad; border-radius: 2px; }
.bar-num { width: 74px; flex: none; text-align: right; font-size: 11px; font-weight: 700; }

/* stacked composition bars */
.bar-stack { flex: 1; height: 20px; border-radius: 100px; overflow: hidden; display: flex; background: #f0f0f0; min-width: 40px; position: relative; }
.bar-seg { height: 100%; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 2px 0 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #999; }
.legend-item i { width: 9px; height: 9px; border-radius: 2px; }

/* Tables */

.table-wrap { overflow-x: auto; }
table.kpi-table { width: 100%; font-size: 11px; border-collapse: collapse; }
table.kpi-table th {
  text-align: right; padding: 7px 10px; font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; color: #888;
  border-bottom: 2px solid #f0f0f0; white-space: nowrap;
}
table.kpi-table th:first-child, table.kpi-table td:first-child { text-align: left; }
table.kpi-table td { padding: 7px 10px; border-bottom: 1px solid var(--row); color: #333; white-space: nowrap; text-align: right; }
table.kpi-table tbody tr:hover td { background: #fafafa; }
table.kpi-table tr.total-row td { background: #fafafa; font-weight: 800; color: var(--ink); border-top: 2px solid var(--line); border-bottom: none; }
td.spark-cell { width: 1%; padding: 3px 10px; }
.flag { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.flag.ok { background: var(--pos); }
.flag.warn { background: #d97706; }
.flag.bad { background: var(--neg); }

/* ================= portfolio header ================= */

.hero-grid { display: grid; grid-template-columns: 250px 1fr; gap: 26px; align-items: start; }
.hero-label { font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #999; }
.hero-value { font-size: 40px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; margin: 3px 0 6px; }
.hero-asof { margin-top: 14px; font-size: 10px; color: var(--faint); line-height: 1.7; }

.split { display: flex; height: 12px; border-radius: 100px; overflow: hidden; background: #f0f0f0; }
.split-seg { height: 100%; }

/* weekly trend — HTML columns, no viewBox scaling */
.trend { margin-top: 18px; }
.trend-cols { display: flex; align-items: flex-end; gap: 5px; height: 150px; }
.trend-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.trend-seg { width: 100%; }
.trend-axis { display: flex; gap: 5px; margin-top: 6px; }
.trend-axis span { flex: 1; text-align: center; font-size: 9px; color: var(--faint); white-space: nowrap; overflow: hidden; }

.entity-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.entity-head h2 { font-size: 15px; font-weight: 800; letter-spacing: .02em; color: var(--accent); text-transform: uppercase; }
.entity-head .period { font-size: 11px; color: var(--muted); }
.entity-head .vs { font-size: 10px; color: var(--faint); margin-left: auto; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.colophon { max-width: 1180px; margin: 0 auto; padding: 8px 16px 40px; font-size: 10.5px; color: var(--faint); line-height: 1.7; }
.colophon code { font-family: "IBM Plex Mono", monospace; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 18px; }
  .hero-value { font-size: 32px; }
  .two-col { grid-template-columns: 1fr; }
  .bar-name { width: 92px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
