:root {
  --bg: #080b12;
  --panel: rgba(18, 24, 38, 0.82);
  --panel-strong: #121827;
  --panel-soft: #171e30;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f7ff;
  --muted: #929db2;
  --accent: #ff7a1a;
  --accent-2: #ffb05f;
  --green: #2bd67b;
  --red: #ff5f6d;
  --yellow: #ffcc66;
  --blue: #69a7ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --radius: 20px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 122, 26, 0.12), transparent 30%),
    radial-gradient(circle at 90% 90%, rgba(74, 121, 255, 0.10), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
.ambient { position: fixed; width: 420px; height: 420px; filter: blur(120px); opacity: .16; pointer-events: none; z-index: -1; }
.ambient-a { background: var(--accent); top: -220px; left: 20%; }
.ambient-b { background: #4b72ff; bottom: -250px; right: -120px; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 260px; padding: 24px 18px;
  background: rgba(8, 11, 18, .78); backdrop-filter: blur(24px); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 20;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 26px; }
.brand-mark, .auth-logo {
  display: grid; place-items: center; background: linear-gradient(145deg, var(--accent), #ff9e50);
  color: #160900; font-weight: 900; box-shadow: 0 10px 35px rgba(255, 122, 26, .28);
}
.brand-mark { width: 40px; height: 40px; border-radius: 13px; }
.brand strong { display: block; font-size: 17px; }
.brand small { display: block; color: var(--muted); margin-top: 2px; font-size: 11px; }
nav { display: grid; gap: 8px; }
.nav-link { padding: 12px 14px; color: var(--muted); border-radius: 12px; transition: .18s ease; }
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(255,122,26,.18), rgba(255,122,26,.05)); border: 1px solid rgba(255,122,26,.22); }
.sidebar-footer { margin-top: auto; display: grid; gap: 14px; }
.user-chip { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.avatar { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: rgba(255,122,26,.14); color: var(--accent-2); font-weight: 800; }
.user-chip strong, .user-chip small { display: block; }
.user-chip small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.main-shell { margin-left: 260px; padding: 34px; min-height: 100vh; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 26px; }
.compact-header { align-items: center; }
h1 { margin: 3px 0 7px; font-size: clamp(30px, 4vw, 46px); line-height: 1.02; }
h2 { margin: 2px 0 0; font-size: 22px; }
h3 { margin: 18px 0 6px; font-size: 17px; }
.eyebrow { margin: 0; color: var(--accent-2); font-size: 11px; letter-spacing: .16em; font-weight: 800; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }
.label-caption { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; margin: 0 0 7px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.primary-button, .ghost-button, .action-button {
  border: 0; border-radius: 12px; transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.primary-button { background: linear-gradient(135deg, var(--accent), #ff9346); color: #1c0a00; font-weight: 800; padding: 12px 17px; box-shadow: 0 10px 28px rgba(255,122,26,.22); }
.primary-button:hover { transform: translateY(-1px); }
.ghost-button { background: rgba(255,255,255,.045); color: var(--text); border: 1px solid var(--line); padding: 11px 15px; }
.ghost-button:hover { border-color: rgba(255,122,26,.35); background: rgba(255,122,26,.08); }
.ghost-button.small { padding: 8px 11px; font-size: 12px; }
.ghost-button.full { width: 100%; }
.link-button { display: inline-flex; align-items: center; justify-content: center; }
.card, .hero-status, .auth-card {
  border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(18px); box-shadow: var(--shadow); border-radius: var(--radius);
}
.hero-status { padding: 20px 22px; margin-bottom: 18px; display: flex; justify-content: space-between; align-items: center; }
.hero-status > div { display: flex; gap: 14px; align-items: center; }
.status-dot { width: 15px; height: 15px; border-radius: 50%; box-shadow: 0 0 0 7px rgba(255,255,255,.04); }
.status-dot.ok { background: var(--green); box-shadow: 0 0 0 7px rgba(43,214,123,.12), 0 0 24px rgba(43,214,123,.35); }
.status-dot.bad { background: var(--red); box-shadow: 0 0 0 7px rgba(255,95,109,.12), 0 0 24px rgba(255,95,109,.35); }
.status-dot.warn { background: var(--yellow); }
.status-dot.unknown { background: #6f7890; }
.last-update { color: var(--muted); font-size: 12px; }
.card-grid { display: grid; gap: 16px; }
.services-grid { grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom: 16px; }
.card { padding: 20px; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.status-pill { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status-pill.ok { background: rgba(43,214,123,.12); color: #79f0ae; }
.status-pill.bad { background: rgba(255,95,109,.12); color: #ff9da7; }
.status-pill.unknown { background: rgba(255,255,255,.06); color: var(--muted); }
.service-symbol { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.04); color: var(--muted); font-size: 12px; }
.split-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; margin-bottom: 16px; }
.lower-grid { grid-template-columns: 1fr 1fr; }
.large-card { min-height: 235px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.automation-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.metric-box { border: 1px solid var(--line); border-radius: 14px; padding: 15px; background: rgba(255,255,255,.025); }
.metric-box span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.metric-box strong { font-size: 16px; }
.inline-alert { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255,95,109,.11); border: 1px solid rgba(255,95,109,.2); color: #ffb2ba; font-size: 13px; }
.hidden { display: none !important; }
.resource-row { display: grid; grid-template-columns: 70px 1fr 72px; gap: 12px; align-items: center; margin: 18px 0; }
.resource-row span { color: var(--muted); font-size: 12px; }
.resource-row strong { text-align: right; font-size: 12px; }
.meter { height: 8px; background: rgba(255,255,255,.055); border-radius: 99px; overflow: hidden; }
.meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #ffb35f); transition: width .35s ease; }
.event-list { display: grid; gap: 9px; max-height: 280px; overflow: auto; }
.event-item { display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.event-item:last-child { border-bottom: 0; }
.event-marker { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; background: var(--blue); }
.event-marker.error { background: var(--red); }
.event-marker.success { background: var(--green); }
.event-marker.warning { background: var(--yellow); }
.event-item p { margin: 0; font-size: 13px; }
.event-item time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-button { text-align: left; padding: 14px; color: var(--text); background: rgba(255,255,255,.035); border: 1px solid var(--line); }
.action-button:hover { transform: translateY(-1px); border-color: rgba(255,122,26,.3); }
.action-button strong, .action-button span { display: block; }
.action-button strong { font-size: 13px; margin-bottom: 5px; }
.action-button span { color: var(--muted); font-size: 11px; line-height: 1.35; }
.action-button.danger-lite:hover { border-color: rgba(255,95,109,.35); background: rgba(255,95,109,.06); }
.log-card { margin-bottom: 24px; }
.terminal { min-height: 260px; max-height: 420px; overflow: auto; padding: 16px; border-radius: 14px; background: #070a10; border: 1px solid rgba(255,255,255,.055); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; line-height: 1.65; color: #c8d2e7; white-space: pre-wrap; }
.log-line { display: grid; grid-template-columns: 170px 1fr; gap: 12px; }
.log-time { color: #6f7d98; }
.auth-card { width: min(450px, 100%); padding: 34px; text-align: center; }
.wide-auth { width: min(720px, 100%); }
.auth-logo { width: 58px; height: 58px; border-radius: 18px; margin: 0 auto 20px; font-size: 24px; }
.form-stack { display: grid; gap: 14px; margin-top: 24px; text-align: left; }
.form-stack.compact { margin-top: 16px; }
label { display: grid; gap: 7px; color: #cbd3e3; font-size: 12px; font-weight: 700; }
input {
  width: 100%; border-radius: 11px; border: 1px solid var(--line); background: rgba(0,0,0,.2); color: var(--text); padding: 12px 13px; outline: 0;
}
input:focus { border-color: rgba(255,122,26,.55); box-shadow: 0 0 0 3px rgba(255,122,26,.1); }
.fineprint { color: #69758b; font-size: 11px; margin-top: 18px; }
.alert { border-radius: 12px; padding: 12px 14px; margin: 18px 0; text-align: left; font-size: 13px; }
.alert-error { background: rgba(255,95,109,.1); border: 1px solid rgba(255,95,109,.23); color: #ffb0b8; }
.twofa-grid { display: grid; grid-template-columns: 230px 1fr; gap: 28px; align-items: center; text-align: left; margin-top: 24px; }
.qr-code { width: 230px; border-radius: 18px; background: #fff; padding: 10px; }
.secret-code { display: block; word-break: break-all; border-radius: 10px; background: #070a10; border: 1px solid var(--line); padding: 11px; color: var(--accent-2); margin-bottom: 12px; }
.settings-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-card { display: grid; gap: 14px; }
.settings-submit { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.form-two { display: grid; grid-template-columns: 1fr 120px; gap: 12px; }
.check-row { display: flex; align-items: center; gap: 9px; }
.check-row input { width: auto; }
.switch { display: inline-flex; }
.switch input { display: none; }
.switch span { width: 44px; height: 24px; border-radius: 999px; background: #343c4d; position: relative; transition: .2s; }
.switch span::after { content: ""; width: 18px; height: 18px; border-radius: 50%; background: #fff; position: absolute; left: 3px; top: 3px; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.remote-shell { height: calc(100vh - 170px); min-height: 560px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.remote-shell iframe { width: 100%; height: 100%; border: 0; display: block; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 15px; border-radius: 13px; background: #1a2233; border: 1px solid var(--line); box-shadow: var(--shadow); transform: translateY(30px); opacity: 0; pointer-events: none; transition: .22s; z-index: 100; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: rgba(255,95,109,.35); }
@media (max-width: 1100px) {
  .services-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split-grid, .lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; min-height: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { display: flex; overflow-x: auto; }
  .sidebar-footer { display: none; }
  .brand { padding-bottom: 14px; }
  .main-shell { margin-left: 0; padding: 20px 14px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .services-grid { grid-template-columns: 1fr; }
  .automation-grid, .action-grid, .settings-layout, .twofa-grid { grid-template-columns: 1fr; }
  .settings-submit { grid-column: auto; }
  .qr-code { width: min(230px,100%); justify-self: center; }
  .hero-status { align-items: flex-start; gap: 14px; }
  .last-update { display: none; }
  .remote-shell { height: calc(100vh - 230px); min-height: 470px; }
}

/* Case control */
select {
  width: 100%; border-radius: 11px; border: 1px solid var(--line); background: rgba(0,0,0,.2);
  color: var(--text); padding: 12px 13px; outline: 0; font: inherit;
}
select:focus { border-color: rgba(255,122,26,.55); box-shadow: 0 0 0 3px rgba(255,122,26,.1); }
button:disabled { opacity: .52; cursor: wait; transform: none !important; }
.case-control-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 16px; margin-bottom: 16px; }
.case-control-card { min-height: 360px; }
.case-status-strip { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.case-status-strip > div { padding: 12px; border-radius: 13px; background: rgba(255,255,255,.027); border: 1px solid var(--line); }
.case-status-strip span, .trade-preview span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.case-status-strip strong { font-size: 13px; overflow-wrap: anywhere; }
.control-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.control-form-grid .span-2 { grid-column: 1 / -1; }
.field-with-button { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.locked-choice { min-height: 44px; display: flex; gap: 9px; align-items: center; padding: 10px 12px; border-radius: 11px; border: 1px solid rgba(255,122,26,.25); background: rgba(255,122,26,.08); }
.locked-choice small { margin-left: auto; color: var(--muted); font-weight: 500; }
.choice-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(255,122,26,.55); }
.currency-input { position: relative; }
.currency-input span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--accent-2); font-weight: 800; }
.currency-input input { padding-left: 30px; }
.auto-resume-row { margin: 16px 0 13px; color: var(--muted); font-weight: 600; }
.case-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.danger-border { border-color: rgba(255,95,109,.28); }
.danger-border:hover { background: rgba(255,95,109,.08); border-color: rgba(255,95,109,.5); }
.action-feedback { margin-top: 14px; min-height: 18px; }
.case-trade-copy { line-height: 1.55; margin-bottom: 18px; }
.trade-preview { padding: 16px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(135deg,rgba(255,122,26,.08),rgba(255,255,255,.02)); }
.trade-preview strong { display: block; font-size: 17px; overflow-wrap: anywhere; }
.trade-preview small { display: block; color: var(--accent-2); margin-top: 5px; }
.trade-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.trade-button { border-radius: 13px; padding: 14px; text-align: left; color: var(--text); background: rgba(255,255,255,.035); border: 1px solid var(--line); }
.trade-button strong, .trade-button span { display: block; }
.trade-button strong { margin-bottom: 4px; }
.trade-button span { color: var(--muted); font-size: 11px; }
.trade-button.buy:hover { border-color: rgba(43,214,123,.45); background: rgba(43,214,123,.07); }
.trade-button.sell:hover { border-color: rgba(255,95,109,.45); background: rgba(255,95,109,.07); }
.trade-warning { line-height: 1.45; }
@media (max-width: 1180px) {
  .case-control-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .case-status-strip, .control-form-grid { grid-template-columns: 1fr; }
  .control-form-grid .span-2 { grid-column: auto; }
  .field-with-button { grid-template-columns: 1fr; }
  .trade-actions { grid-template-columns: 1fr; }
}
