:root {
  color-scheme: dark;
  --bg: #08111f;
  --ink: #edf6ff;
  --muted: #8aa0bd;
  --line: rgba(159, 183, 213, .18);
  --card: rgba(13, 26, 46, .74);
  --card-strong: #102039;
  --cyan: #47d8ff;
  --lime: #6ee7a8;
  --amber: #f7c86a;
  --red: #ff718b;
  --blue: #4f8cff;
  --shadow: 0 26px 90px rgba(0, 0, 0, .38);
  font-family: "Trebuchet MS", "Avenir Next", Verdana, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 12%, rgba(71, 216, 255, .20), transparent 24rem),
    radial-gradient(circle at 82% 8%, rgba(110, 231, 168, .18), transparent 28rem),
    linear-gradient(135deg, #07101d 0%, #0d1b2d 48%, #071522 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.026) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, #000, transparent 86%);
}
.hidden { display: none !important; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  padding: 34px;
  border: 1px solid rgba(71, 216, 255, .24);
  border-radius: 32px;
  background: linear-gradient(160deg, rgba(16, 32, 57, .94), rgba(8, 17, 31, .88));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.08);
}
.login-kicker, .eyebrow { color: var(--cyan); font-size: 11px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.login-card h1 { margin: 0; font-size: clamp(34px, 7vw, 54px); line-height: .95; }
.login-card p { margin: 0; color: var(--muted); line-height: 1.65; }
.login-error { color: var(--red); border: 1px solid rgba(255,113,139,.32); background: rgba(255,113,139,.1); border-radius: 14px; padding: 11px 13px; }

.shell { width: min(1440px, 100%); min-height: 100vh; margin: 0 auto; display: grid; grid-template-columns: 292px minmax(0, 1fr); gap: 22px; padding: 22px; }
.sidebar {
  position: sticky;
  top: 22px;
  height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 34px;
  background: rgba(7, 16, 29, .78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  padding: 22px;
}
.brand-block { display: flex; gap: 14px; align-items: center; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 18px; color: #06202a; font-weight: 950; background: linear-gradient(135deg, var(--cyan), var(--lime)); }
.brand-block p { margin: 0 0 5px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.brand-block h1 { margin: 0; font-size: 20px; line-height: 1.1; }
.tab-menu { display: grid; gap: 10px; margin-top: 22px; }
.tab-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
}
.tab-btn span { color: rgba(138,160,189,.62); font-size: 12px; }
.tab-btn:hover, .tab-btn.active { color: var(--ink); border-color: rgba(71,216,255,.22); background: linear-gradient(135deg, rgba(71,216,255,.14), rgba(110,231,168,.08)); }
.side-footer { margin-top: auto; display: grid; gap: 12px; }
.status-pill { border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--muted); border-radius: 999px; padding: 10px 13px; text-align: center; }
.status-pill.ok { color: var(--lime); border-color: rgba(110,231,168,.35); }
.status-pill.bad { color: var(--red); border-color: rgba(255,113,139,.35); }

.workspace { min-width: 0; display: grid; align-content: start; gap: 18px; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 34px;
  padding: 24px;
  background: rgba(13, 26, 46, .62);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}
.eyebrow { margin: 0 0 8px; }
.topbar h2 { margin: 0; font-size: clamp(30px, 5vw, 54px); letter-spacing: -.04em; line-height: .95; }
.quick-stats { display: flex; gap: 12px; }
.quick-stats div { min-width: 112px; border: 1px solid var(--line); border-radius: 22px; padding: 14px 16px; background: rgba(2, 8, 18, .34); }
.quick-stats strong { display: block; color: var(--lime); font-size: 28px; line-height: 1; }
.quick-stats span { color: var(--muted); font-size: 12px; }

.tab-panel { display: none; animation: rise .28s ease both; }
.tab-panel.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.panel-grid.two { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 18px; }
.card, .brief-card, .proxy-studio {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  padding: 24px;
}
.brief-card { min-height: 420px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; background: radial-gradient(circle at 70% 18%, rgba(71,216,255,.22), transparent 18rem), linear-gradient(150deg, rgba(15, 46, 64, .82), rgba(9, 19, 35, .86)); }
.security-brief { background: radial-gradient(circle at 70% 18%, rgba(247,200,106,.24), transparent 18rem), linear-gradient(150deg, rgba(53, 36, 18, .82), rgba(9, 19, 35, .9)); }
.brief-card span { color: var(--cyan); font-size: 12px; font-weight: 950; letter-spacing: .14em; text-transform: uppercase; }
.brief-card h3 { margin: 14px 0; font-size: clamp(28px, 4vw, 48px); line-height: .98; }
.brief-card p { color: var(--muted); line-height: 1.7; }
.section-title { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.section-title h3 { margin: 0 0 6px; font-size: 24px; }
.section-title span { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }

form { display: grid; gap: 15px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(3, 10, 22, .72);
  color: var(--ink);
  padding: 14px 15px;
  outline: none;
  font-size: 15px;
}
input:focus, textarea:focus { border-color: rgba(71,216,255,.72); box-shadow: 0 0 0 4px rgba(71,216,255,.11); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.check-row { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.check-row input { width: 16px; height: 16px; }
.check-row.small { font-size: 12px; }
button { border: 0; border-radius: 15px; padding: 12px 16px; color: var(--ink); cursor: pointer; font-weight: 950; transition: transform .15s ease, opacity .15s ease, border-color .15s ease; }
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.primary { background: linear-gradient(135deg, #20c7f7, #6ee7a8); color: #06131d; }
.ghost { background: rgba(255,255,255,.055); border: 1px solid var(--line); }
.wide { width: 100%; }
.mini { padding: 10px 12px; font-size: 13px; }

.jobs-list { display: grid; gap: 10px; max-height: 620px; overflow: auto; padding-right: 4px; }
.job-item { display: grid; gap: 6px; padding: 15px; border: 1px solid var(--line); background: rgba(255,255,255,.04); border-radius: 18px; cursor: pointer; }
.job-item.active { border-color: rgba(71,216,255,.8); background: rgba(71,216,255,.10); }
.job-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.job-id { font-weight: 950; }
.badge { border-radius: 999px; padding: 4px 9px; background: rgba(255,255,255,.08); color: var(--muted); font-size: 12px; }
.badge.running { color: var(--cyan); }
.badge.awaiting_otp { color: var(--amber); }
.badge.completed { color: var(--lime); }
.badge.failed { color: var(--red); }
.job-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty, .empty-state { color: var(--muted); border: 1px dashed var(--line); border-radius: 18px; padding: 28px; text-align: center; }
.current-body { display: grid; gap: 18px; }
.progress-line { display: flex; justify-content: space-between; align-items: center; padding: 18px; background: rgba(3,10,22,.5); border: 1px solid var(--line); border-radius: 20px; }
.job-status { text-transform: uppercase; letter-spacing: .1em; color: var(--cyan); font-weight: 950; font-size: 12px; }
.job-stage { margin-top: 5px; font-size: 18px; }
.duration { color: var(--muted); font-variant-numeric: tabular-nums; }
.otp-panel { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; align-items: center; border: 1px solid rgba(247,200,106,.4); background: rgba(247,200,106,.1); border-radius: 20px; padding: 18px; }
.otp-panel h3, .details-grid h3, .logs-head h3 { margin: 0 0 8px; }
.otp-panel p { margin: 0; color: var(--muted); line-height: 1.5; }
.otp-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.json-box, .logs-box { margin: 0; border: 1px solid var(--line); background: rgba(2, 6, 16, .75); border-radius: 18px; padding: 14px; overflow: auto; font-family: Consolas, "Liberation Mono", monospace; font-size: 12px; line-height: 1.55; }
.json-box { height: 270px; }
.logs-head { display: flex; align-items: center; justify-content: space-between; }
.logs-box { height: 380px; white-space: pre-wrap; }

.proxy-studio { padding: 0; overflow: hidden; background: linear-gradient(140deg, rgba(9,18,38,.94), rgba(10,37,41,.82) 48%, rgba(5,10,22,.94)); }
.proxy-hero-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 28px; }
.proxy-kicker { color: var(--cyan); font-size: 11px; font-weight: 950; letter-spacing: .16em; text-transform: uppercase; }
.proxy-copy h3 { margin: 8px 0; font-size: clamp(28px, 4vw, 42px); }
.proxy-copy p { margin: 0; color: var(--muted); line-height: 1.65; }
.proxy-meter { width: 118px; height: 118px; display: grid; place-items: center; align-content: center; border-radius: 30px; border: 1px solid rgba(71,216,255,.25); background: rgba(255,255,255,.06); }
.proxy-count { font-size: 34px; font-weight: 950; color: var(--lime); line-height: 1; }
.proxy-meter small { color: var(--muted); font-size: 12px; }
.proxy-workbench { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 16px; padding: 0 18px 18px; }
.proxy-editor-panel, .proxy-inspector { border: 1px solid rgba(148,163,184,.16); background: rgba(2,6,16,.48); border-radius: 24px; }
.proxy-editor-panel { padding: 18px; }
.proxy-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.field-label { color: var(--ink); font-size: 15px; font-weight: 950; }
.proxy-editor-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.proxy-save { display: inline-flex; align-items: center; gap: 10px; border: 1px solid rgba(110,231,168,.38); background: linear-gradient(135deg, #18b981, #2dd4bf 54%, #60a5fa); color: #03121a; min-width: 132px; justify-content: center; }
.save-dot { width: 8px; height: 8px; border-radius: 999px; background: #03121a; }
.proxy-save.saving .save-dot { animation: pulseSave 1s infinite; }
.proxy-save.saved { background: linear-gradient(135deg, #48d597, #a7f3d0); }
.proxy-save.error { background: linear-gradient(135deg, #ff718b, #fbbf24); }
@keyframes pulseSave { 0%,100% { transform: scale(1); opacity: .55; } 50% { transform: scale(1.7); opacity: 1; } }
.proxy-input-shell { display: grid; grid-template-columns: 48px 1fr; border: 1px solid rgba(148,163,184,.18); border-radius: 20px; overflow: hidden; background: rgba(0,0,0,.22); }
.line-gutter { padding: 16px 12px; color: rgba(138,160,189,.45); text-align: right; line-height: 1.7; border-right: 1px solid rgba(148,163,184,.12); font-family: Consolas, monospace; }
.proxy-textarea { min-height: 310px; border: 0; border-radius: 0; resize: vertical; font-family: Consolas, monospace; line-height: 1.7; }
.proxy-inspector { padding: 18px; display: grid; gap: 14px; align-content: start; }
.proxy-status-card { border: 1px solid var(--line); border-radius: 18px; padding: 16px; color: var(--muted); background: rgba(255,255,255,.04); line-height: 1.6; }
.proxy-status-card.success { color: var(--lime); border-color: rgba(110,231,168,.28); }
.proxy-status-card.error { color: var(--red); border-color: rgba(255,113,139,.32); }
.proxy-status-card.dirty, .proxy-status-card.loading { color: var(--amber); border-color: rgba(247,200,106,.3); }
.proxy-rules { display: grid; gap: 12px; }
.rule-item { border: 1px solid rgba(148,163,184,.14); border-radius: 16px; padding: 14px; background: rgba(255,255,255,.035); }
.rule-item span { display: block; color: var(--ink); font-weight: 950; margin-bottom: 8px; }
.rule-item p { margin: 0; color: var(--muted); line-height: 1.55; }
.rule-item code { color: var(--cyan); word-break: break-all; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #102039; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 12px 18px; box-shadow: var(--shadow); z-index: 20; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; padding: 14px; }
  .sidebar { position: static; height: auto; border-radius: 26px; }
  .tab-menu { grid-template-columns: 1fr 1fr; }
  .topbar, .panel-grid.two, .details-grid, .otp-panel, .proxy-workbench, .proxy-hero-panel { grid-template-columns: 1fr; }
  .quick-stats { width: 100%; }
  .quick-stats div { flex: 1; min-width: 0; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { align-items: stretch; flex-direction: column; }
  .tab-menu { grid-template-columns: 1fr; }
  .otp-form { grid-template-columns: 1fr; }
  .proxy-editor-head, .section-title { flex-direction: column; align-items: stretch; }
}
