:root {
  color-scheme: dark;
  --bg: #060914;
  --panel: #0c1120;
  --panel-soft: #10172a;
  --line: #202a43;
  --text: #f3f6ff;
  --muted: #97a2ba;
  --blue: #5795ff;
  --blue-bright: #72a8ff;
  --violet: #9875ff;
  --danger: #ff6b78;
  --success: #59d7a2;
  --shadow: 0 28px 80px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 25% 20%, rgba(57, 111, 220, .13), transparent 30rem),
    radial-gradient(circle at 88% 75%, rgba(132, 80, 220, .1), transparent 32rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

a { color: inherit; }

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

.login-shell {
  width: min(430px, 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-weight: 720;
  letter-spacing: -.025em;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(114, 168, 255, .5);
  border-radius: 11px;
  color: var(--blue-bright);
  background: rgba(87, 149, 255, .08);
  box-shadow: 0 0 34px rgba(87, 149, 255, .15);
  font: 700 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.login-brand { margin: 0 0 28px; justify-content: center; }

.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(12, 17, 32, .91);
  box-shadow: var(--shadow);
}

.login-panel { padding: 34px; }

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -.055em;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.42rem;
  letter-spacing: -.035em;
}

.muted { color: var(--muted); line-height: 1.6; }

.form-stack { display: grid; gap: 19px; margin-top: 28px; }

.field { display: grid; gap: 8px; }

.field label {
  color: #c9d1e3;
  font-size: .88rem;
  font-weight: 650;
}

.field input, .field select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: #090e1b;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.field input:focus, .field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(87, 149, 255, .14);
}

.button {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(120deg, #367ff1, #7359e9);
  box-shadow: 0 12px 28px rgba(54, 127, 241, .2);
  font-weight: 720;
  transition: transform .18s ease, filter .18s ease;
}

.button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .65; transform: none; }

.button-danger {
  background: linear-gradient(120deg, #d94859, #ad3f75);
  box-shadow: 0 12px 28px rgba(217, 72, 89, .18);
}

.alert {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 107, 120, .35);
  border-radius: 10px;
  color: #ffc7cc;
  background: rgba(255, 107, 120, .08);
  font-size: .9rem;
  line-height: 1.5;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 25px 20px;
  border-right: 1px solid var(--line);
  background: rgba(7, 11, 22, .86);
  backdrop-filter: blur(18px);
}

.sidebar .brand { padding: 4px 6px 28px; }

.nav { display: grid; gap: 8px; }

.nav a, .logout {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
  font-weight: 630;
  transition: .18s ease;
}

.nav a:hover, .nav a.active {
  border-color: var(--line);
  color: var(--text);
  background: var(--panel-soft);
}

.sidebar-bottom { margin-top: auto; }

.logout {
  width: 100%;
  cursor: pointer;
  font: inherit;
}

.logout:hover { color: #ffc7cc; background: rgba(255, 107, 120, .07); }

.main {
  width: min(100%, 1120px);
  padding: 54px clamp(24px, 6vw, 80px);
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.page-head p { max-width: 630px; margin-bottom: 0; }

.status {
  color: var(--success);
  white-space: nowrap;
  font-size: .88rem;
}

.status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px var(--success);
}

.operation-panel { padding: clamp(24px, 5vw, 42px); }

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, .48fr);
  gap: 20px;
  margin-top: 30px;
}

.form-grid .wide { grid-column: 1 / -1; }

.security-note {
  margin: 28px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.6;
}

.result-panel { padding: 28px; }

.result-frame {
  width: 100%;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.back-link {
  display: inline-block;
  margin-bottom: 22px;
  color: var(--blue-bright);
  text-decoration: none;
  font-weight: 650;
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { padding-bottom: 18px; }
  .nav { grid-template-columns: 1fr 1fr; }
  .sidebar-bottom { margin-top: 12px; }
  .main { padding: 34px 18px; }
  .page-head { display: block; }
  .status { display: block; margin-top: 18px; }
}

@media (max-width: 580px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .login-panel { padding: 26px 22px; }
}
