:root {
  color-scheme: light;
  --sta-bg: #F4F9FD;
  --sta-surface: #FFFFFF;
  --sta-blue-soft: #EAF6FF;
  --sta-primary: #1677C8;
  --sta-deep: #123A5A;
  --sta-cyan: #19A7CE;
  --sta-text: #17324D;
  --sta-muted: #63788A;
  --sta-border: #DDEAF2;
  --sta-success: #1E9B63;
  --sta-warning: #E5A11A;
  --sta-danger: #D84A4A;
  --sta-shadow: 0 18px 45px rgba(18, 58, 90, 0.10);
  font-family: Inter, Manrope, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--sta-bg); }
body { margin: 0; min-width: 320px; color: var(--sta-text); background: var(--sta-bg); }
button, input { font: inherit; }
button { cursor: pointer; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px;
  background: linear-gradient(180deg, #103B5D 0%, #0D2D48 100%);
  color: white;
  overflow: hidden;
  transition: width .2s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand img { width: 48px; height: 48px; object-fit: contain; }
.brand strong { display: block; font-size: 18px; letter-spacing: -.3px; }
.brand span { display: block; margin-top: 3px; font-size: 12px; color: #B9DAEE; }

.nav { display: grid; gap: 7px; margin-top: 24px; }
.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #D9EDF8;
  text-align: left;
}
.nav button:hover, .nav button.active { background: rgba(25,167,206,.18); color: white; }
.nav-icon { width: 24px; text-align: center; font-size: 17px; }

.sidebar-footer {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 22px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  font-size: 12px;
  color: #C8E0ED;
}

.content { min-width: 0; }
.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 30px;
  border-bottom: 1px solid var(--sta-border);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 4;
}
.topbar h1 { margin: 0; font-size: 20px; }
.topbar p { margin: 3px 0 0; color: var(--sta-muted); font-size: 13px; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-button {
  border: 1px solid var(--sta-border);
  border-radius: 11px;
  background: white;
  color: var(--sta-deep);
  padding: 10px 12px;
}
.avatar {
  width: 39px; height: 39px; display: grid; place-items: center;
  border-radius: 50%; background: var(--sta-blue-soft);
  color: var(--sta-primary); font-weight: 800;
}

main { padding: 30px; }
.hero {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: 22px;
  margin-bottom: 22px;
}
.hero-card, .card {
  border: 1px solid var(--sta-border);
  border-radius: 20px;
  background: var(--sta-surface);
  box-shadow: var(--sta-shadow);
}
.hero-card { padding: 26px; position: relative; overflow: hidden; }
.hero-card::after {
  content: "";
  position: absolute;
  width: 240px; height: 240px;
  right: -80px; top: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(25,167,206,.22), rgba(25,167,206,0));
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--sta-blue-soft);
  color: var(--sta-primary);
  font-weight: 800; font-size: 12px;
}
.hero h2 { margin: 17px 0 9px; font-size: 30px; letter-spacing: -.8px; }
.hero p { margin: 0; max-width: 650px; color: var(--sta-muted); line-height: 1.6; }
.hero-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.primary, .secondary {
  border-radius: 11px; padding: 11px 15px; font-weight: 800;
}
.primary { border: 1px solid var(--sta-primary); background: var(--sta-primary); color: white; }
.secondary { border: 1px solid var(--sta-border); background: white; color: var(--sta-deep); }

.status-panel { padding: 22px; }
.status-panel h3 { margin: 0 0 16px; font-size: 16px; }
.status-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--sta-border);
}
.status-row:last-child { border-bottom: 0; }
.status-label strong { display: block; font-size: 13px; }
.status-label span { color: var(--sta-muted); font-size: 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 999px; padding: 6px 9px; font-size: 11px; font-weight: 900;
}
.badge.off { background: #FFF4DF; color: #9A6500; }
.badge.ok { background: #E8F8F0; color: #147348; }
.badge.info { background: #EAF6FF; color: #0F67A9; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 16px;
}
.metric { padding: 19px; }
.metric-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.metric-icon {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px; background: var(--sta-blue-soft); color: var(--sta-primary);
}
.metric span { color: var(--sta-muted); font-size: 12px; }
.metric strong { display: block; margin-top: 8px; font-size: 27px; letter-spacing: -.7px; }
.metric small { display: block; margin-top: 7px; color: var(--sta-muted); }

.section-grid {
  margin-top: 18px;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px;
}
.section-card { padding: 22px; }
.section-card h3 { margin: 0; font-size: 16px; }
.section-card > p { margin: 6px 0 18px; color: var(--sta-muted); font-size: 13px; }

.progress-item { margin: 15px 0; }
.progress-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.progress-track { height: 8px; border-radius: 999px; background: #EAF1F6; margin-top: 8px; overflow: hidden; }
.progress-value { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sta-primary), var(--sta-cyan)); }

.event {
  display: grid; grid-template-columns: 35px 1fr; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--sta-border);
}
.event:last-child { border-bottom: 0; }
.event-icon { width: 35px; height: 35px; border-radius: 11px; display: grid; place-items: center; background: var(--sta-blue-soft); }
.event strong { display: block; font-size: 13px; }
.event span { display: block; margin-top: 3px; color: var(--sta-muted); font-size: 12px; }

.notice {
  margin-top: 18px; padding: 15px 17px; border-radius: 14px;
  border: 1px solid #F1D79D; background: #FFF9EA; color: #72520E;
  font-size: 13px; line-height: 1.5;
}

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero, .section-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 14px 18px; }
  main { padding: 18px; }
  .grid { grid-template-columns: 1fr; }
  .hero h2 { font-size: 25px; }
}

.monitor-banner {
  padding: 13px 16px;
  border-radius: 14px;
  background: #153D5D;
  color: #E9F6FE;
  font-size: 13px;
}
.risk-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.risk-table th, .risk-table td { padding: 12px; border-bottom: 1px solid var(--sta-border); text-align: left; font-size: 13px; }
.risk-table th { color: var(--sta-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(25,167,206,.18), transparent 32%),
    radial-gradient(circle at 85% 80%, rgba(22,119,200,.15), transparent 30%),
    var(--sta-bg);
}
.login-card {
  width: min(460px, 100%);
  padding: 34px;
  border: 1px solid var(--sta-border);
  border-radius: 24px;
  background: white;
  box-shadow: var(--sta-shadow);
}
.login-card img { width: 190px; max-height: 64px; object-fit: contain; object-position: left center; }
.login-card h1 { margin: 22px 0 8px; font-size: 28px; }
.login-card p { margin: 0 0 20px; color: var(--sta-muted); line-height: 1.55; }
.login-card small { display: block; margin-top: 18px; color: var(--sta-muted); line-height: 1.45; }
.security-label {
  display: inline-flex;
  margin-top: 24px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #E8F8F0;
  color: #147348;
  font-size: 11px;
  font-weight: 900;
}
.security-label.warning { background: #FFF4DF; color: #946100; }
.form-stack { display: grid; gap: 14px; }
.form-stack label { display: grid; gap: 7px; color: var(--sta-deep); font-size: 13px; font-weight: 800; }
.form-stack input, .form-stack select, .form-stack textarea {
  width: 100%;
  border: 1px solid var(--sta-border);
  border-radius: 11px;
  padding: 12px 13px;
  background: white;
  color: var(--sta-text);
  outline: none;
}
.form-stack textarea { min-height: 120px; resize: vertical; }
.form-stack input:focus, .form-stack select:focus, .form-stack textarea:focus {
  border-color: var(--sta-primary);
  box-shadow: 0 0 0 3px rgba(22,119,200,.12);
}
.alert { margin: 0 0 18px; padding: 13px 15px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.alert.danger { border: 1px solid #F2BABA; background: #FFF0F0; color: #9B2929; }
.alert.success { border: 1px solid #A9DEC4; background: #ECFAF3; color: #176E49; }
.alert.warning-box { border: 1px solid #F1D79D; background: #FFF9EA; color: #72520E; }
.result-card { margin-top: 18px; padding: 22px; }
.result-card h3 { margin: 0 0 12px; }
.result-card pre { margin: 0; max-height: 340px; overflow: auto; padding: 15px; border-radius: 12px; background: #0F2D46; color: #EAF6FF; font-size: 12px; line-height: 1.5; }
.nav button:disabled { opacity: .55; cursor: not-allowed; }
.top-actions > span:not(.badge) { color: var(--sta-muted); font-size: 12px; }
code { padding: 2px 5px; border-radius: 6px; background: var(--sta-blue-soft); color: var(--sta-deep); }

.wide-card { width: min(560px, 100%); }
.mfa-setup { display: grid; gap: 16px; }
.login-card .mfa-qr {
  width: 260px;
  height: 260px;
  max-width: 100%;
  max-height: none;
  aspect-ratio: 1 / 1;
  justify-self: center;
  padding: 14px;
  border: 1px solid var(--sta-border);
  border-radius: 18px;
  background: #fff;
  object-fit: contain;
  object-position: center;
  box-shadow: 0 10px 26px rgba(18, 58, 90, .08);
}
.secret-box {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--sta-border);
  border-radius: 14px;
  background: var(--sta-blue-soft);
}
.secret-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.secret-box-header > span { color: var(--sta-muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.secret-box code {
  display: block;
  padding: 10px 12px;
  border: 1px solid rgba(22,119,200,.14);
  border-radius: 10px;
  background: rgba(255,255,255,.76);
  overflow-wrap: anywhere;
  user-select: all;
  font-size: 14px;
  line-height: 1.55;
}
.copy-secret-button {
  min-width: 88px;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--sta-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  transition: transform .15s ease, filter .15s ease, background .15s ease;
}
.copy-secret-button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(.97); }
.copy-secret-button:disabled { cursor: default; opacity: .86; }
.copy-secret-button.copied { background: var(--sta-success); }
.copy-status {
  min-height: 16px;
  color: var(--sta-success);
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
}
.mfa-instruction { margin: 0 !important; font-size: 13px; }
.code-input { text-align: center; letter-spacing: 8px; font-size: 22px; font-weight: 800; }
.actions-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }


@media (max-width: 520px) {
  .login-card .mfa-qr {
    width: 220px;
    height: 220px;
    padding: 12px;
  }
  .secret-box-header {
    align-items: stretch;
    flex-direction: column;
  }
  .copy-secret-button { width: 100%; }
}
