/* CETATE Links — Mechanical Heart family (graphite + amber). Palette matches the other CETATE standalone tools. */
:root {
  color-scheme: dark;
  --bg: #111213;
  --panel: #191b1d;
  --raised: #202225;
  --line: #343638;
  --text: #f6f3ec;
  --muted: #aaa9a5;
  --accent: #f1bd72;
  --olive: #a8c6a1;
  --red: #e39a92;
  --blue: #9cc3d1;
  font: 15px/1.55 "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: .2em; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.08; letter-spacing: -.055em; text-wrap: balance; }
h2 { font-size: 1.12rem; letter-spacing: -.02em; }
h3 { font-size: 1rem; }
p, small { color: var(--muted); }
code { font: .85em Consolas, monospace; color: #e7dccb; }

.topbar { height: 60px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 0 clamp(16px, 3.5vw, 49px); border-bottom: 1px solid var(--line); background: #151617; }
.top-controls, .actions, .row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 9px; border: 1px solid var(--line); background: #202123; border-radius: 5px; color: #ddd9d1; font-size: .74rem; white-space: nowrap; }
.chip.amber { color: var(--accent); border-color: #624d35; background: #272019; }
.chip.live { color: #c7ddc2; border-color: #43543e; background: #20291e; }
.chip.red { color: var(--red); border-color: #5e3a36; background: #2a1d1b; }
.chip.blue { color: var(--blue); border-color: #3a5058; background: #1b2427; }
.chip.dim { color: var(--muted); }
i.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 60px); max-width: 1660px; margin: auto; }
.rail { display: flex; flex-direction: column; justify-content: space-between; gap: 24px; padding: 36px 15px 29px; background: #151617; border-right: 1px solid var(--line); }
.rail nav { display: grid; gap: 4px; }
.rail button { border: 1px solid transparent; border-radius: 7px; padding: 9px 8px; text-align: left; color: #c2c1bc; background: transparent; display: flex; gap: 8px; align-items: center; font-size: .84rem; white-space: nowrap; }
.rail button:hover { background: var(--raised); }
.rail button[aria-current="page"] { background: #29221a; border-color: #59462f; color: var(--accent); }
.rail button span.ico { width: 21px; text-align: center; font-size: 1.1rem; }
.rail button .count { margin-left: auto; font-size: .72rem; color: var(--muted); }
.rail-footer { border-top: 1px solid var(--line); margin: 0 5px; padding: 17px 1px 0; font-size: .82rem; }
.rail-footer span { color: var(--olive); }
.rail-footer small { display: block; margin-top: 6px; }

main { width: 100%; max-width: 1160px; margin: 0 auto; padding: 35px clamp(16px, 4.4vw, 70px) 40px; min-width: 0; }
.intro { padding: 14px 0 29px; }
.intro h1 { font-size: clamp(2.3rem, 5vw, 4.1rem); }
.intro p { max-width: 62ch; margin-top: 13px; }
.eyebrow { font: 650 .71rem/1.4 Consolas, monospace; letter-spacing: .15em; color: var(--accent); margin-bottom: 13px; text-transform: uppercase; }
.panel { border: 1px solid var(--line); background: var(--panel); border-radius: 11px; padding: clamp(15px, 2.6vw, 24px); min-width: 0; }
.panel + .panel, .stack > * + * { margin-top: 16px; }
.panel-head, .view-head, .section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head { padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.panel-head p { margin-top: 3px; font-size: .88rem; max-width: 70ch; }
.view-head { margin: 4px 0 22px; }
.view-head p { margin-top: 8px; max-width: 70ch; }
.grid-two, .grid-four, .stats { display: grid; gap: 13px; }
.grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-four, .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: grid; align-content: start; gap: 5px; min-width: 0; }
.field label, .label { font-size: .79rem; font-weight: 650; color: #dedbd3; }
.field small { font-size: .78rem; }
input[type=text], input[type=url], input[type=search], select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: #141516; color: var(--text); padding: 8px 10px; font-size: .88rem; }
textarea { min-height: 86px; resize: vertical; }
.btn, button.primary, button.secondary, button.ghost { border-radius: 7px; padding: 7px 13px; font-size: .84rem; border: 1px solid var(--line); background: var(--raised); color: var(--text); }
button.primary { background: #3a2c1a; border-color: #8a6a40; color: #ffd9a3; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #4a381f; }
button.secondary:hover:not(:disabled), button.ghost:hover:not(:disabled) { border-color: #59462f; }
button.ghost { background: transparent; color: var(--muted); }
button.good { border-color: #4f6a49; color: #c7ddc2; }
button.bad { border-color: #6a443f; color: var(--red); }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 7px 13px; font-size: .84rem; }
.segmented button[aria-pressed="true"] { background: #29221a; color: var(--accent); }

.drop { border: 1px dashed #5a4b38; border-radius: 10px; padding: 22px; text-align: center; background: #16171a; }
.drop.over { background: #211c15; border-color: var(--accent); }
.filelist { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.filelist li { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: .84rem; border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; background: #16171a; }
.notice { border-left: 3px solid var(--accent); background: #1d1a15; padding: 10px 13px; border-radius: 0 7px 7px 0; font-size: .86rem; color: #e6dccb; }
.notice.red { border-color: var(--red); background: #211816; color: #f0d2cd; }
.notice.olive { border-color: var(--olive); background: #182016; color: #d7e6d2; }
.notice ul { margin: 4px 0 0; padding-left: 18px; }
.stat { border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; background: #16171a; }
.stat b { display: block; font-size: 1.35rem; letter-spacing: -.03em; }
.stat small { font-size: .76rem; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.filters select, .filters input { width: auto; min-width: 150px; }
.filters input[type=search] { min-width: 220px; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; background: transparent; color: var(--muted); font-size: .8rem; }
.pill[aria-pressed="true"] { border-color: #8a6a40; color: var(--accent); background: #29221a; }

.card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 14px 16px; }
.card + .card { margin-top: 10px; }
.card .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.card .pair { margin: 9px 0 4px; font-size: .9rem; overflow-wrap: anywhere; }
.card .pair .arrow { color: var(--accent); margin: 0 6px; }
.card .reason { font-size: .86rem; color: #d7d3ca; }
.card .detail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .84rem; }
.card .detail .wide { grid-column: 1 / -1; }
.card .detail ul { margin: 2px 0 0; padding-left: 17px; color: var(--muted); }
.card .detail .v { color: #d7d3ca; overflow-wrap: anywhere; }
.k { font: 650 .66rem/1.4 Consolas, monospace; letter-spacing: .12em; color: #8f8c86; text-transform: uppercase; }
.card .actions { margin-top: 12px; }
.editor { margin-top: 12px; padding: 12px; border: 1px solid #59462f; border-radius: 8px; background: #1a1712; display: grid; gap: 10px; }
.ai-box { margin-top: 12px; padding: 11px 13px; border: 1px solid #3a5058; border-radius: 8px; background: #161d20; font-size: .87rem; }
.ai-box.prerecorded { border-color: #5a4b38; background: #1b1814; }
.group-title { margin: 22px 0 8px; font-size: .86rem; color: var(--accent); overflow-wrap: anywhere; }

table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { text-align: left; padding: 8px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 650 .68rem/1.4 Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; color: #8f8c86; position: sticky; top: 0; background: var(--panel); cursor: pointer; }
td.url { overflow-wrap: anywhere; max-width: 320px; }
.table-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
pre.brief { white-space: pre-wrap; font: .8rem/1.5 Consolas, monospace; background: #141516; border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 360px; overflow: auto; color: #ddd6c9; }
.toast { position: fixed; right: 18px; bottom: 18px; max-width: 420px; padding: 11px 14px; border-radius: 9px; background: #262019; border: 1px solid #8a6a40; color: #ffe4bd; font-size: .86rem; box-shadow: 0 10px 30px #0008; z-index: 10; }
.toast.error { background: #2a1a18; border-color: #7a4741; color: #f6d4ce; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.settings .provider-help { font-size: .84rem; }
.settings .provider-help li + li { margin-top: 4px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .rail { padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); min-width: 0; }
  .filters select, .filters input, .filters input[type=search] { min-width: 0; flex: 1 1 140px; }
  main { padding-inline: 14px; }
  .rail nav { grid-auto-flow: column; overflow-x: auto; }
  .rail-footer { display: none; }
  .grid-two, .card .detail { grid-template-columns: 1fr; }
  .grid-four, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { height: auto; min-height: 56px; flex-wrap: wrap; padding-block: 10px; justify-content: flex-start; }
}

.u-small { font-size: .82rem; margin-top: 8px; }
.account-list { list-style: none; padding: 0; margin: 8px 0 10px; display: grid; gap: 8px; font-size: .82rem; color: var(--muted); }
.account-list li { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.settings { margin-bottom: 22px; }

/* layout helpers (no inline styles: the Content-Security-Policy forbids them) */
.u2 { margin-top: 16px; } .u3 { margin-top: 12px; } .u4 { margin-top: 20px; } .u5 { margin-bottom: 10px; } .u6 { margin-bottom: 6px; } .u7 { margin-top: 4px; } .u8 { margin: 8px 0 14px; }
.hidden-input { display: none; }
.plain-list { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: .88rem; }
.plain-list li + li { margin-top: 3px; }
.step { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; background: #16171a; }
.step > p { font-size: .88rem; margin-top: 6px; }
.step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.guide { margin-top: 10px; }
.guide summary { cursor: pointer; color: var(--accent); font-size: .86rem; }
.guide-body { margin-top: 10px; font-size: .86rem; color: #d7d3ca; }
.guide-body h4 { margin: 12px 0 4px; font-size: .86rem; color: var(--text); }
.guide-body p { color: #d7d3ca; margin: 4px 0; }
.steps { margin: 4px 0; padding-left: 20px; }
.steps li + li { margin-top: 4px; }
.flags { margin: 4px 0 0; padding-left: 16px; color: var(--muted); font-size: .76rem; }
td.src { font-size: .74rem; color: var(--muted); }
.reason-input { max-width: 280px; }
.ai-text { color: #e6e1d6; margin-top: 4px; }
.export-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.export-row b { font-size: 1rem; }
.chip[title] { cursor: help; }
.step .grid-two { margin-top: 10px; }
