/* Panel Profit Guard — ops-room UI.
   Palette: ink navy field, bone text, amber signal, loss red, profit green. */
:root {
    --bg: #10141c;
    --bg-raise: #171d28;
    --line: #232c3b;
    --text: #e7e4da;
    --muted: #8b94a3;
    --signal: #e8a13c;   /* amber: attention, primary actions */
    --loss: #e05252;
    --profit: #4cae74;
    --watch: #5d8fd1;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 "Segoe UI", system-ui, -apple-system, sans-serif;
}
.mono, pre, .code, .price-input {
    font-family: "Cascadia Mono", "JetBrains Mono", Consolas, Menlo, monospace;
    font-variant-numeric: tabular-nums;
}

a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ---------- Shell ---------- */
header.top {
    display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center;
    padding: 12px 22px;
    background: var(--bg-raise);
    border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .04em; color: var(--signal); }
header.top nav { display: flex; flex-wrap: wrap; gap: 4px; }
header.top nav a {
    color: var(--muted); padding: 6px 10px; border-radius: 6px;
}
header.top nav a.on { color: var(--text); background: var(--bg); }
header.top nav a:hover { color: var(--text); text-decoration: none; }

main { max-width: 1080px; margin: 0 auto; padding: 22px 18px 60px; }
main.narrow { max-width: 560px; padding-top: 8vh; }
footer {
    max-width: 1080px; margin: 0 auto; padding: 14px 18px 30px;
    color: var(--muted); font-size: 13px; border-top: 1px solid var(--line);
}

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 4px 0 8px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.danger-text { color: var(--loss); }

/* ---------- Cards & forms ---------- */
.card {
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 16px;
}
.card.empty { color: var(--muted); }
label { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
input, select, textarea {
    display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--line); border-radius: 7px; font-size: 14px;
}
textarea { resize: vertical; }
label.check input { display: inline; width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--signal); outline: none; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }

button {
    margin-top: 10px; padding: 9px 16px; border: 0; border-radius: 7px;
    background: var(--signal); color: #181206; font-weight: 700; font-size: 14px;
    cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--line); }
button.mini { margin: 0; padding: 5px 10px; font-size: 12.5px; }
button.danger { background: var(--loss); color: #fff; }
.mini-link { font-size: 13px; align-self: center; }

pre {
    background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
    padding: 10px 12px; overflow-x: auto; font-size: 13px;
}

/* ---------- Flash ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-ok { background: rgba(76,174,116,.12); border: 1px solid var(--profit); }
.flash-error { background: rgba(224,82,82,.12); border: 1px solid var(--loss); }
.flash ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------- Tables ---------- */
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th {
    text-align: left; color: var(--muted); font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: .06em;
    padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid .num, .grid th.num { text-align: right; }
.code { color: var(--muted); font-size: 12.5px; }

/* The signature: status bleeds in from the left edge of each row. */
tr.row-bad td:first-child { box-shadow: inset 3px 0 0 var(--loss); }
tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--signal); }
tr.row-ok td:first-child { box-shadow: inset 3px 0 0 var(--profit); }
tr.row-watched td:first-child { box-shadow: inset 3px 0 0 var(--watch); }
tr.row-bad { background: rgba(224,82,82,.06); }
tr.row-dim { color: var(--muted); }

.text-bad { color: var(--loss); }
.text-ok { color: var(--profit); }

.badge {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .03em; white-space: nowrap;
}
.badge-bad { background: rgba(224,82,82,.18); color: #ff9f9f; }
.badge-warn { background: rgba(232,161,60,.18); color: var(--signal); }
.badge-ok { background: rgba(76,174,116,.18); color: #8fd9ad; }
.badge-dim { background: var(--bg); color: var(--muted); }
.badge-watch { background: rgba(93,143,209,.18); color: #a9c6ec; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; margin-left: 6px; }

/* ---------- Inline price form ---------- */
.inline-price { display: flex; gap: 6px; align-items: center; }
.inline-price input.price-input { width: 110px; margin: 0; padding: 5px 8px; font-size: 13px; }

/* ---------- Filters / tabs / pager ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 160px; margin: 0; }
.filters button { margin: 0; }
.tabs { display: flex; gap: 4px; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--text); border-bottom-color: var(--signal); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs .right { margin-left: auto; font-size: 13px; }
.pager { display: flex; gap: 14px; justify-content: center; padding: 14px 0; }

/* ---------- Providers ---------- */
.provider.paused { opacity: .65; }
.provider-head { margin-bottom: 8px; }
.provider-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13px; margin: 4px 0; }
.provider-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
details { margin-top: 8px; font-size: 14px; }
details summary { cursor: pointer; color: var(--muted); }
.row-form { display: flex; gap: 8px; margin-top: 8px; }
.row-form input { margin: 0; max-width: 340px; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
    main { padding: 16px 10px 50px; }
    .grid { font-size: 13px; }
    .grid th, .grid td { padding: 7px 6px; }
    table.grid { display: block; overflow-x: auto; white-space: nowrap; }
    .page-head { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
