/* ---------------------------------------------------------------------------
   Invlogix -- operator console
   Palette: ink navy ground, hairline rules, amber for money, green for verdict.
   Type: Georgia for headings (audit-ledger register), system sans for UI,
   monospace for anything a number or a hash. Zero external assets.
--------------------------------------------------------------------------- */
:root {
    --ink:        #0b1220;
    --panel:      #121b2c;
    --panel-2:    #17223a;
    --rule:       #22304a;
    --text:       #e6edf7;
    --muted:      #8a9bb8;
    --amber:      #f0b429;
    --green:      #3fbf8f;
    --red:        #e5646e;
    --blue:       #6aa9f0;
    --radius:     3px;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --serif: Georgia, "Times New Roman", serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--ink);
    color: var(--text);
    font: 15px/1.55 var(--sans);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .5rem; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

.eyebrow {
    font: 600 11px/1 var(--sans);
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: .6rem;
}

/* ---- shell ---- */
.shell { display: flex; min-height: 100vh; }

.rail {
    width: 232px;
    flex: 0 0 232px;
    background: var(--panel);
    border-right: 1px solid var(--rule);
    padding: 1.1rem .8rem;
    display: flex;
    flex-direction: column;
}

.rail .mark {
    font-family: var(--serif);
    font-size: 1.05rem;
    padding: 0 .4rem .9rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: .9rem;
}
.rail .mark small { display: block; font: 400 11px/1.4 var(--sans); color: var(--muted); margin-top: .25rem; }

.rail nav a {
    display: block;
    padding: .45rem .5rem;
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
}
.rail nav a:hover { background: var(--panel-2); text-decoration: none; }
.rail nav a.on { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--amber); }
.rail nav .group { margin: 1rem 0 .3rem; padding: 0 .5rem; font: 600 10px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.rail .foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; padding: 1.6rem 1.9rem 3rem; max-width: 1180px; }

/* ---- panels ---- */
.panel {
    background: var(--panel);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    margin-bottom: 1.1rem;
}
.panel > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 1.1rem; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.split { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font: 600 11px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); font-size: 13px; }

/* ---- forms ---- */
label { display: block; font-size: 12px; color: var(--muted); margin: .7rem 0 .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
    width: 100%;
    background: var(--ink);
    border: 1px solid var(--rule);
    color: var(--text);
    padding: .5rem .55rem;
    border-radius: var(--radius);
    font: 14px/1.4 var(--sans);
}
textarea { font-family: var(--mono); font-size: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }

.check { display: flex; align-items: flex-start; gap: .45rem; margin: .3rem 0; font-size: 13px; color: var(--text); }
.check input { width: auto; margin-top: .2rem; }

.btn {
    display: inline-block;
    background: var(--panel-2);
    border: 1px solid var(--rule);
    color: var(--text);
    padding: .45rem .85rem;
    border-radius: var(--radius);
    font: 600 13px/1.4 var(--sans);
    cursor: pointer;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #221a05; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: .25rem .55rem; font-size: 12px; }

.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* ---- chips ---- */
.chip {
    display: inline-block;
    font: 600 11px/1 var(--sans);
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: .28rem .45rem;
    border-radius: var(--radius);
    border: 1px solid var(--rule);
    color: var(--muted);
    white-space: nowrap;
}
.chip.ok      { color: var(--green); border-color: #23543f; }
.chip.warn    { color: var(--amber); border-color: #5a4413; }
.chip.bad     { color: var(--red);   border-color: #5c2830; }
.chip.info    { color: var(--blue);  border-color: #24405f; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }
.right { text-align: right; }

/* ---- notices ---- */
.notice { border-left: 2px solid var(--green); background: var(--panel-2); padding: .6rem .8rem; border-radius: var(--radius); margin-bottom: 1.1rem; font-size: 14px; }
.notice.bad { border-left-color: var(--red); }
.notice ul { margin: .3rem 0 0; padding-left: 1.1rem; }

.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty strong { display: block; font-family: var(--serif); font-size: 1.05rem; color: var(--text); margin-bottom: .3rem; }

/* ---- the trace rail: the signature element -----------------------------
   A run is a numbered sequence of steps, so the numbering carries real
   information. Each line is a ledger entry: what ran, how long, what it cost.
------------------------------------------------------------------------- */
.trace { font-size: 13px; }
.trace .entry {
    display: grid;
    grid-template-columns: 2.1rem 1fr auto;
    gap: .55rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--rule);
}
.trace .entry:last-child { border-bottom: 0; }
.trace .seq { font-family: var(--mono); color: var(--muted); font-size: 12px; padding-top: .1rem; }
.trace .what { min-width: 0; }
.trace .what .kind { font: 600 11px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.trace .what .body { margin-top: .25rem; word-break: break-word; }
.trace .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.trace .meta .cost { color: var(--amber); }

.ledger-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: .9rem;
    padding-top: .7rem;
    border-top: 2px solid var(--rule);
    font-family: var(--mono);
}
.ledger-total .amount { font-size: 1.15rem; color: var(--amber); }

/* ---- transcript ---- */
.thread { display: flex; flex-direction: column; gap: .7rem; max-height: 52vh; overflow-y: auto; padding-right: .3rem; }
.msg { border: 1px solid var(--rule); border-radius: var(--radius); padding: .6rem .7rem; background: var(--ink); }
.msg .who { font: 600 10px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .35rem; }
.msg.user { background: var(--panel-2); }
.msg .text { white-space: pre-wrap; word-break: break-word; }

pre.dump {
    background: var(--ink);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: .6rem .7rem;
    overflow-x: auto;
    font: 12px/1.5 var(--mono);
    color: var(--muted);
    margin: .4rem 0 0;
}

/* ---- landing ---- */
.lander { max-width: 780px; margin: 0 auto; padding: 5rem 1.5rem; }
.lander h1 { font-size: 2.4rem; line-height: 1.15; margin-bottom: .8rem; }
.lander .lede { font-size: 1.05rem; color: var(--muted); max-width: 56ch; }
.lander .plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2.4rem; }
.lander .price { font-family: var(--mono); font-size: 1.2rem; color: var(--amber); }

.auth { max-width: 380px; margin: 0 auto; padding: 4.5rem 1.5rem; }

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .rail { width: auto; flex: none; }
    .rail nav { display: flex; flex-wrap: wrap; gap: .2rem; }
    .main { padding: 1.1rem; }
    .grid.two, .grid.split { grid-template-columns: 1fr; }
    .lander .plans { grid-template-columns: 1fr; }
}

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