/*
 * SentinelTrade dashboard - "Review Workspace Black" (UI-206 to UI-209, R67).
 *
 * Derived from design-vorschlaege/assets/app.css, selector block `body.review.review-dark`.
 * The tokens below are the whole palette; every derivation (hover, focus, shadow, backdrop)
 * is expressed through a token with color-mix instead of a new literal (UI-207); the only
 * exception is the pure black card shadow, which is a shadow and not a surface colour.
 * No imported sheet, no web font, no external origin - the policy blocks it anyway (SEC-72).
 * Status is never colour alone: each state carries its text as well (UI-70).
 */

:root {
  --bg: #080a0d;
  --panel: #11151a;
  --text: #edf2f7;
  --muted: #98a5b5;
  --line: #27303a;
  --accent: #00c8ff;
  --accent-text: #04151e;
  --accent-hover: #55dcff;
  --soft: #092a38;
  --good: #73dbb0;
  --bad: #ff94a3;
  --warn: #efc078;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
a.theme-link { white-space: nowrap; color: var(--accent); }

button, select, input, textarea { font: inherit; }
button, select, a { touch-action: manipulation; }
button, select { cursor: pointer; }

/* UI-189: the focus ring is the same everywhere and never removed. */
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

button {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
}
button:hover { border-color: var(--accent); }
button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 650;
  box-shadow: 0 3px 14px color-mix(in srgb, var(--accent) 8%, transparent);
}
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { opacity: .45; cursor: default; }
button.danger, .danger { color: var(--bad); }

input[type="text"], input[type="password"], input[type="email"], input[type="search"],
input[type="date"], input[type="number"], select, textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  width: 100%;
}

/*
 * ---------------------------------------------------------------- frame
 *
 * The landmark selectors below stay scoped to .shell, and with the child combinator rather
 * than a descendant one. A page template may nest its own <nav> (pagination), <header>
 * (card head) or <aside> inside the content; `.shell nav a` would have specificity 0,1,1 and
 * would still beat `.pagination a`, so the pager would come out as a second sidebar menu.
 */

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.shell > aside {
  background: #090c10;
  border-right: 1px solid var(--line);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand {
  display: flex;
  justify-content: center;
  padding: 0 4px 14px;
  border-bottom: 1px solid var(--line);
}
.brand-logo { display: block; width: 176px; height: auto; max-width: 100%; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  margin: 0;
}
.shell > aside > .eyebrow { padding-left: 12px; font-size: 9px; letter-spacing: 1.8px; }

.shell > aside > nav { display: grid; gap: 6px; }
.shell > aside > nav a { border: 1px solid transparent; padding: 12px; border-radius: 8px; color: var(--muted); }
.shell > aside > nav a:hover { background: var(--soft); color: var(--text); }
.shell > aside > nav a.active {
  border-color: #12506a;
  background: linear-gradient(90deg, #073348, #0e1c25);
  box-shadow: inset 2px 0 var(--accent);
  color: var(--accent);
  font-weight: 650;
}

.aside-bottom { margin-top: auto; display: grid; gap: 10px; }
.aside-bottom > a { font-size: 12px; color: var(--muted); }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid #164459;
  border-radius: 10px;
  background: var(--soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.workspace { min-width: 0; display: flex; flex-direction: column; }
.shell > .workspace > header {
  background: #0c1015;
  border-bottom: 1px solid var(--line);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
}
.shell > .workspace > main { padding: 32px 28px; max-width: 1700px; width: 100%; flex: 1; }
.shell > .workspace > footer.footnote {
  border-top: 1px solid var(--line);
  padding: 14px 28px;
  color: var(--muted);
  font-size: 11px;
}

/* ---------------------------------------------------------------- type */

h1, h2, h3 { font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; }
h1 { font-size: 34px; line-height: 1.2; letter-spacing: -1.2px; font-weight: 700; margin: 8px 0; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 14px; margin: 0 0 8px; }
p { margin: 6px 0 18px; }
.muted, small { color: var(--muted); }
small { font-size: 11px; }
b, strong { font-weight: 650; }

.page-title { margin-bottom: 26px; }
.page-title .eyebrow { color: var(--accent); }
.page-title p { margin-top: 12px; }

/* ---------------------------------------------------------------- status */

.pill {
  display: inline-block;
  border: 1px solid var(--line);
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
}
.good { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.mode { color: var(--accent); background: var(--soft); border-color: #12506a; }

.notice {
  background: #1c1914;
  border: 1px solid #453824;
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  padding: 13px 17px;
  margin-bottom: 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- cards */

/*
 * R67 allows 10px here instead of the 12px the token table names for cards: the reference
 * tightens the radius inside the dark block, and .metric below keeps the full 12px.
 */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 21px;
  box-shadow: 0 10px 30px rgb(0 0 0 / .13);
}
.card + .card { margin-top: 18px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric {
  position: relative;
  background: linear-gradient(135deg, #151c24, #101419);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
}
.metric:first-child { border-color: #17607a; }
.metric:first-child::before {
  content: "";
  position: absolute;
  top: 22px;
  right: 22px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 40%, transparent);
}
.metric .value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
  margin: 10px 0 7px;
  font-variant-numeric: tabular-nums;
}
.metric:first-child .value { color: var(--accent); }
.metric .value span { font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.metric-label { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- master detail */

.master-detail { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; align-items: start; }
.master { align-self: start; padding: 0; overflow: hidden; }
.master-head { background: #151b22; padding: 20px; border-bottom: 1px solid var(--line); }
.master-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 21px 18px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
}
.master-item:last-child { border-bottom: 0; }
.master-item:hover { background: #14212c; }
.master-item.active { background: linear-gradient(100deg, #0a2d3c, #101d27); box-shadow: inset 3px 0 var(--accent); }
.master-item.active b { color: var(--accent); }
.master-item p { font-size: 12px; line-height: 1.7; margin: 12px 0; color: var(--muted); }
.master-item small { font-size: 10px; }

.detail { display: grid; gap: 18px; }
.detail > .card:first-child { border-top: 2px solid #1580a2; padding: 24px; }
.detail-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }

.quote {
  margin: 18px 0 24px;
  padding: 22px;
  background: #090f15;
  border: 1px solid #20323e;
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  font-size: 19px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.field { display: flex; justify-content: space-between; gap: 15px; margin: 13px 0; font-size: 12px; }
.field b { text-align: right; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.validation { padding: 10px 0; font-size: 12px; border-bottom: 1px solid var(--line); }
.validation:last-child { border-bottom: 0; }

.timeline { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 11px; }
.timeline b { display: block; margin-bottom: 5px; }

/* ---------------------------------------------------------------- tables */

/* UI-159: a wide table scrolls inside its own container, the page never does. */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th {
  background: #0c1015;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  font-weight: 500;
  padding: 13px 12px;
}
td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
td small { display: block; }
td button { padding: 4px 9px; }
tbody tr:hover { background: #151e27; }
tr:last-child td { border-bottom: 0; }

/* ---------------------------------------------------------------- controls */

.actions, .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.filters label { display: grid; gap: 5px; font-size: 11px; color: var(--muted); }
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 14px; }

details { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
summary { cursor: pointer; color: var(--muted); }
pre { overflow-x: auto; font-size: 11px; margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
code, pre, .secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.secret { font-size: 16px; letter-spacing: 2px; overflow-wrap: anywhere; }

.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { display: block; width: 148px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.thumb img { display: block; width: 100%; height: 100px; object-fit: cover; }
.thumb small { display: block; padding: 6px 8px; }

.diff-ins { color: var(--good); text-decoration: underline; }
.diff-del { color: var(--bad); text-decoration: line-through; }
.error-text { color: var(--bad); }
.hidden { display: none !important; }

dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px;
  max-width: 540px;
  width: calc(100% - 32px);
}
dialog::backdrop { background: color-mix(in srgb, var(--bg) 82%, transparent); }
dialog h2 { font-size: 22px; margin-bottom: 17px; }

/* ---------------------------------------------------------------- login frame */

body.auth { display: grid; place-items: center; min-height: 100vh; }
.auth-shell { padding: 24px; width: 100%; max-width: 460px; }
.auth-card { display: grid; gap: 14px; }
.auth-card .brand { border-bottom: 0; padding-bottom: 0; }
.auth-card .brand-logo { width: 140px; }
.auth-card label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }

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

@media (max-width: 1200px) {
  .shell { grid-template-columns: 200px minmax(0, 1fr); }
  .brand-logo { width: 154px; }
  .master-detail { grid-template-columns: 240px minmax(0, 1fr); }
  .detail-columns { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .shell { display: block; }
  .shell > aside { padding: 12px 16px; }
  .brand { justify-content: flex-start; border: 0; padding: 0; }
  .brand-logo { width: 100px; }
  .shell > aside > nav { display: flex; overflow-x: auto; gap: 6px; margin-top: 12px; white-space: nowrap; }
  .shell > aside > .eyebrow, .aside-bottom { display: none; }
  .shell > .workspace > header { padding: 14px 16px; }
  .shell > .workspace > main { padding: 24px 16px; }
  .shell > .workspace > footer.footnote { padding: 14px 16px; }
  h1 { font-size: 29px; }
  .master-detail { grid-template-columns: 1fr; }
  .metric { padding: 18px; }
  .detail > .card:first-child { padding: 18px; }
  .card { padding: 17px; }
  .card-head { flex-wrap: wrap; }
  .actions { gap: 7px; }
}

@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .metric .value { font-size: 26px; }
  .quote { font-size: 17px; padding: 16px; }
  .master-item { padding: 16px; }
  .timeline { flex-wrap: wrap; }
}
