/* Cog Machina Console - app shell. Brand palette from www.cogmachina.com.
   ASCII only (RB charset notes). */

:root {
  --ink-0: #0c0e12;
  --ink-1: #12151c;
  --ink-2: #1a1e28;
  --ink-3: #242a37;
  --text-hi: #eef0f4;
  --text-mid: #a8afbd;
  --text-low: #6b7280;
  /* Brand accent: azure blue as of 2026-09-02 (was brass gold). Matches
     www.cogmachina.com; Ravenbreath's own brand stays gold. */
  --accent: #4a9eff;
  --accent-hi: #7fbaff;
  --accent-dim: rgba(74, 158, 255, 0.14);
  --on-accent: #06131f;  /* text on a filled accent surface */
  /* Legacy aliases - existing rules still say --brass*. */
  --brass: var(--accent);
  --brass-hi: var(--accent-hi);
  --brass-dim: var(--accent-dim);
  --good: #5fbf7d;
  --warn: #e0a53f;
  --radius: 10px;
  --font-head: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--ink-0); color: var(--text-mid);
  font-family: var(--font-body); font-size: 15px; line-height: 1.55;
}

a { color: var(--brass-hi); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2 { font-family: var(--font-head); color: var(--text-hi); letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.02rem; margin-bottom: 12px; }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

.side {
  background: var(--ink-1); border-right: 1px solid var(--ink-3);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text-hi); padding: 2px 8px; }
.brand:hover { text-decoration: none; }
.brand svg { width: 24px; height: 24px; color: var(--brass); flex: none; }
.brand span { font-family: var(--font-head); font-weight: 700; font-size: 0.98rem; }
.brand b { color: var(--brass); }

.side nav { display: grid; gap: 2px; }
.side nav a {
  color: var(--text-mid); padding: 9px 10px; border-radius: 8px; font-size: 0.94rem;
}
.side nav a:hover { color: var(--text-hi); background: var(--ink-2); text-decoration: none; }
.side nav a.on { color: var(--brass-hi); background: var(--brass-dim); font-weight: 600; }

.side-foot { margin-top: auto; padding: 0 10px; font-size: 0.85rem; display: grid; gap: 2px; }
.side-foot .who { color: var(--text-hi); font-weight: 600; }

.main { padding: 30px 34px 60px; max-width: 1060px; }

.page-top { margin-bottom: 24px; }
.page-top p { color: var(--text-low); margin-top: 4px; }
.page-top h1 .chip { vertical-align: middle; margin-left: 8px; }

/* ---------- tiles ---------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 26px; }
.tile { background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: var(--radius); padding: 16px 18px; }
.tile-n {
  font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; color: var(--text-hi);
  font-variant-numeric: tabular-nums;
}
.tile-l { font-size: 0.82rem; color: var(--text-low); margin-top: 2px; }

/* ---------- panels & tables ---------- */

.panel {
  background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 20px; overflow-x: auto;
}
.panel .empty { color: var(--text-low); font-size: 0.9rem; }
.panel > p { font-size: 0.94rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th {
  font-family: var(--font-head); font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-low);
  text-align: left; padding: 6px 12px 8px; border-bottom: 1px solid var(--ink-3);
  white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid rgba(36, 42, 55, 0.6); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td .sub { color: var(--text-low); font-size: 0.84rem; margin-top: 3px; max-width: 480px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 0.85rem; }

/* ---------- chips ---------- */

.chip {
  display: inline-block; font-family: var(--font-head); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 10px; border-radius: 999px; border: 1px solid transparent;
}
.chip-ok   { color: var(--good); border-color: var(--good); background: rgba(95, 191, 125, 0.1); }
.chip-mid  { color: var(--brass-hi); border-color: var(--brass); background: var(--brass-dim); }
.chip-warn { color: var(--warn); border-color: var(--warn); background: rgba(224, 165, 63, 0.12); }
.chip-off  { color: var(--text-low); border-color: var(--ink-3); background: var(--ink-1); }

/* ---------- pricing editor ---------- */

td .hi { color: var(--text-hi); font-weight: 600; }
.cur { color: var(--text-low); margin-right: 2px; font-size: 0.85rem; }
input.money {
  width: 92px; background: var(--ink-0); border: 1px solid var(--ink-3);
  border-radius: 7px; color: var(--text-hi); padding: 5px 8px;
  font-family: var(--font-body); font-size: 0.88rem; text-align: right;
  font-variant-numeric: tabular-nums;
}
input.money:focus { outline: none; border-color: var(--brass); }
.flash-ok {
  background: rgba(95, 191, 125, 0.1); border: 1px solid var(--good);
  color: var(--good); border-radius: 8px; padding: 9px 14px;
  font-size: 0.9rem; margin-bottom: 18px;
}

/* ---------- forms ---------- */

.inline-form { display: inline; }
.btn-mini {
  font-family: var(--font-head); font-weight: 600; font-size: 0.78rem;
  background: var(--brass-dim); color: var(--brass-hi);
  border: 1px solid var(--brass); border-radius: 999px; padding: 3px 12px; cursor: pointer;
}
.btn-mini:hover { background: var(--accent); color: var(--on-accent); }

select {
  background: var(--ink-0); color: var(--text-hi); border: 1px solid var(--ink-3);
  border-radius: 7px; padding: 5px 8px; font-family: var(--font-body); font-size: 0.86rem;
}

/* ---------- licensing panels (customer detail) ---------- */

.form-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px;
}
.form-row input[type="text"], .form-row input[type="date"] {
  background: var(--ink-0); color: var(--text-hi); border: 1px solid var(--ink-3);
  border-radius: 7px; padding: 5px 9px; font-family: var(--font-body); font-size: 0.86rem;
}
.form-row input:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-dim); }
.form-row input[type="date"] { color-scheme: dark; }
.hint { color: var(--text-low); font-size: 0.84rem; }
.panel > .hint { display: block; margin: -6px 0 12px; }

.key-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.key-line code {
  font-family: var(--font-mono); font-size: 0.88rem; color: var(--brass-hi);
  background: var(--ink-0); border: 1px solid var(--ink-3); border-radius: 7px;
  padding: 6px 11px; letter-spacing: 0.03em; word-break: break-all;
}

.tile-n .chip { font-size: 0.85rem; vertical-align: 3px; }

/* ---------- auto-save indicator (pricing et al.) ---------- */

.save-cell { min-width: 110px; }
.save-state {
  font-family: var(--font-head); font-size: 0.76rem; font-weight: 600;
  letter-spacing: 0.04em; color: var(--text-low);
}
.save-state.ok { color: var(--good); }
.save-state.err { color: var(--warn); }

/* ---------- customer x add-on matrix ---------- */

.matrix-table th, .matrix-table td { text-align: center; }
.matrix-table th:first-child, .matrix-table td:first-child { text-align: left; min-width: 220px; }
.matrix-table .sub-th { margin-top: 3px; }
.matrix-toggle { width: 17px; height: 17px; accent-color: var(--brass); cursor: pointer; }
.matrix-toggle:disabled { cursor: wait; opacity: 0.5; }
.deal-note { color: var(--brass-hi); font-size: 0.78rem; margin-top: 2px; }
.matrix-table .hint { display: block; }

/* ---------- bolt-on catalog editor (pricing) ---------- */

/* makeControl inside table cells: the .ctl wrapper flattens out. */
td .ctl { display: block; }
.money-cell { text-align: right; white-space: nowrap; }
.money-cell .cur { margin-right: 4px; }
.money-cell .ctl { display: inline-block; vertical-align: middle; }

.bolt-name {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-hi); font: 600 0.95rem var(--font-body); padding: 4px 6px; margin-left: -6px;
  width: 100%; min-width: 140px;
}
.bolt-desc {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-low); font: 400 0.88rem var(--font-body); padding: 4px 6px; margin-left: -6px;
  width: 100%;
}
.bolt-name:hover, .bolt-desc:hover { border-color: var(--ink-3); }
.bolt-name:focus, .bolt-desc:focus {
  outline: none; background: var(--ink-0); border-color: var(--brass); color: var(--text-hi);
}
/* Description soaks up whatever width the row has left. */
.desc-th, .bolt-desc-cell { width: 100%; }
.bolt-name-cell { white-space: nowrap; }

/* Drag to reorder */
.drag-cell { width: 26px; padding-right: 0; }
.drag-handle {
  cursor: grab; color: var(--text-low); font-size: 0.9rem; letter-spacing: -2px;
  user-select: none; padding: 4px 2px; display: inline-block;
}
.drag-handle:hover { color: var(--brass-hi); }
.drag-handle:active { cursor: grabbing; }
tr.dragging { opacity: 0.45; background: var(--brass-dim); }
h2 .save-state { margin-left: 10px; text-transform: none; }

.addon-create { align-items: end; }
.addon-create .ctl input, .addon-create .ctl select { min-width: 150px; }
.addon-create .ctl-grow { flex: 1 1 240px; }
.addon-create .ctl-grow input { width: 100%; }
.addon-create button { margin-bottom: 2px; }

/* ---------- auth screen ---------- */

.auth-body {
  display: grid; place-items: center; min-height: 100vh; padding: 24px;
  background:
    radial-gradient(55% 70% at 70% 20%, rgba(74, 158, 255, 0.1), transparent 60%),
    var(--ink-0);
}
.auth-card {
  width: min(400px, 100%); background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: 14px; padding: 38px 34px; text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.auth-mark { width: 42px; height: 42px; color: var(--brass); margin-bottom: 14px; }
.auth-card h1 { font-size: 1.25rem; margin-bottom: 8px; }
.auth-sub { font-size: 0.92rem; color: var(--text-mid); margin-bottom: 18px; }
.auth-err {
  background: rgba(224, 100, 63, 0.12); border: 1px solid rgba(224, 100, 63, 0.5);
  color: #e8a08c; border-radius: 8px; padding: 8px 12px; font-size: 0.88rem; margin-bottom: 14px;
}
.auth-dev {
  background: var(--brass-dim); border: 1px solid var(--brass); border-radius: 8px;
  padding: 8px 12px; font-size: 0.88rem; margin-bottom: 14px; color: var(--text-mid);
}
.auth-dev code { font-family: var(--font-mono); color: var(--brass-hi); font-size: 1.05rem; letter-spacing: 0.12em; }
.auth-card form { display: grid; gap: 12px; }
.auth-card input[type="email"], .auth-card input[type="text"] {
  background: var(--ink-0); border: 1px solid var(--ink-3); border-radius: 8px;
  color: var(--text-hi); padding: 11px 13px; font-size: 0.98rem; text-align: center;
}
.auth-card input:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-dim); }
.auth-card button {
  font-family: var(--font-head); font-weight: 600; font-size: 0.98rem;
  background: linear-gradient(160deg, var(--accent-hi), var(--accent)); color: var(--on-accent);
  border: 0; border-radius: 999px; padding: 11px; cursor: pointer;
}

/* ---------- responsive ---------- */

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
  .side nav { display: flex; gap: 4px; }
  .side-foot { margin: 0 0 0 auto; }
  .main { padding: 20px 18px 50px; }
}

/* Line of business switch (010): All | Mainspring | DamagePort, under the brand. */
.line-switch { display: flex; gap: 2px; margin: 10px -4px 14px; padding: 3px; background: var(--ink-2); border-radius: 8px; }
.line-switch a { flex: 1 1 auto; min-width: 0; white-space: nowrap; text-align: center; padding: 4px 5px; border-radius: 6px; font-size: 0.78rem; color: var(--text-lo, inherit); }
.line-switch a:hover { text-decoration: none; color: var(--text-hi); }
.line-switch a.on { background: var(--brass-dim); color: var(--brass-hi); font-weight: 600; }
.chip-line-damageport { background: rgba(79, 143, 247, 0.18); color: #9cc0ff; }
.chip-line-mainspring { background: var(--brass-dim); color: var(--brass-hi); }

/* Pricing > Plans (011): an offering per row - name / tagline / description stacked, the small number boxes narrow. */
.plans-table .plan-cell { min-width: 16rem; }
.plans-table .plan-cell .ctl + .ctl { margin-top: 4px; }
.plans-table .plan-name { font-weight: 600; }
.plans-table .plan-tagline, .plans-table .plan-desc { font-size: 0.85rem; }
.plans-table .num-small { width: 4.5rem; text-align: right; }
