:root {
  color-scheme: dark;
  --bg: #101112;
  --panel: #181a1c;
  --panel-2: #202326;
  --text: #f3efe6;
  --muted: #a9a297;
  --line: #35312a;
  --gold: #d6aa48;
  --amber: #f0c96a;
  --green: #72c58a;
  --red: #df6b62;
  --blue: #6ea3c7;
  --shadow: 0 18px 60px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(115deg, rgba(214,170,72,.12), transparent 34%),
    radial-gradient(circle at 80% 12%, rgba(110,163,199,.12), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  letter-spacing: 0;
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 24px; }
.ok { color: var(--green); }
.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(920px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 40px;
  align-items: center;
  background: linear-gradient(145deg, rgba(24,26,28,.96), rgba(32,35,38,.92));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(28px, 6vw, 72px);
  box-shadow: var(--shadow);
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  font-size: clamp(42px, 7vw, 82px);
  line-height: .95;
  margin-bottom: 18px;
}
h2 { font-size: 28px; margin-bottom: 0; }

.stack { display: grid; gap: 16px; }
label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
input, select, textarea {
  width: 100%;
  color: var(--text);
  background: #111315;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
}
textarea { min-height: 94px; resize: vertical; }

.primary {
  color: #14110a;
  background: linear-gradient(180deg, var(--amber), var(--gold));
  border-radius: 6px;
  padding: 12px 16px;
  font-weight: 700;
}
.ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
}
.compact { padding: 7px 10px; }
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--text);
  background: var(--panel-2);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: rgba(16, 17, 18, .92);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: var(--gold);
  font-weight: 800;
}
.brand small { display: block; color: var(--muted); margin-top: 2px; }
nav { display: grid; gap: 8px; }
nav button {
  color: var(--muted);
  background: transparent;
  text-align: left;
  padding: 13px 14px;
  border-radius: 6px;
}
nav button.active {
  color: var(--text);
  background: var(--panel-2);
}

.workspace { padding: 26px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}
.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.status-strip span {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
}

.view { display: none; }
.active-view { display: block; }
.decision-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, .7fr);
  gap: 18px;
}
.signal-board, .price-card, .checklist-panel, .panel {
  background: rgba(24,26,28,.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--muted);
}
.section-title strong { color: var(--amber); }
.flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(104px, 1fr));
  gap: 14px;
  align-items: center;
}
.flow-line { display: none; }
.flow-node {
  min-height: 104px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #111315;
}
.flow-node.on {
  color: #101112;
  background: var(--gold);
  border-color: var(--amber);
}
.decision-state {
  margin-top: 18px;
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  font-size: 28px;
  font-weight: 800;
}
.decision-state.wait { background: rgba(240,201,106,.12); color: var(--amber); }
.decision-state.ready { background: rgba(114,197,138,.14); color: var(--green); }
.decision-state.block { background: rgba(223,107,98,.14); color: var(--red); }
.price { font-size: clamp(40px, 7vw, 74px); color: var(--amber); font-weight: 800; }
.checklist-panel { margin-top: 18px; }
.checks {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}
.check {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111315;
}
.check input { width: auto; margin-right: 8px; }
.check span { color: var(--text); }
.check small { display: block; color: var(--muted); margin-top: 8px; line-height: 1.45; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
  background: rgba(24,26,28,.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}
.wide { grid-column: 1 / -1; }
.records, .rules-list, .notes-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}
.record, .rule {
  background: rgba(24,26,28,.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.record strong, .rule strong { color: var(--amber); }
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.switch {
  grid-template-columns: auto 1fr;
  align-items: center;
}
.switch input { width: auto; }
.twofa-box { display: grid; gap: 16px; }
.qr {
  width: 220px;
  height: 220px;
  background: #fff;
  border-radius: 8px;
  padding: 10px;
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  nav {
    grid-auto-flow: column;
    overflow-x: auto;
  }
  .decision-grid, .admin-grid, .login-panel { grid-template-columns: 1fr; }
  .checks, .form-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .workspace { padding: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .flow, .checks, .form-grid { grid-template-columns: 1fr; }
  h1 { font-size: 42px; }
}
