:root {
  --text: #f4f7fc;
  --muted: #b8c4dc;
  --accent: #6b9bff;
  --accent-2: #8b7dff;
  --danger: #ff6b88;
  --ok: #4de0a8;
  --radius: 16px;
  --glass-bg: rgba(12, 18, 36, 0.42);
  --glass-bg-strong: rgba(10, 16, 32, 0.58);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  --blur: blur(22px) saturate(165%);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background: #060a14;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    url("assets/wallpaper/desktop.png") center / cover no-repeat,
    linear-gradient(160deg, #0a1020 0%, #121a30 45%, #060a14 100%);
}

.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 75% 10%, rgba(107, 155, 255, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 50% at 10% 90%, rgba(139, 125, 255, 0.12), transparent 50%),
    linear-gradient(180deg, rgba(6, 10, 20, 0.15), rgba(6, 10, 20, 0.72));
}

@media (max-width: 768px) {
  .bg-layer {
    background:
      url("assets/wallpaper/mobile.png") center / cover no-repeat,
      linear-gradient(160deg, #0a1020 0%, #121a30 45%, #060a14 100%);
  }
}

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.brand img.brand-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.brand-text small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  margin-top: 2px;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 60px);
}

nav.side {
  border-right: 1px solid var(--glass-border);
  padding: 18px 12px;
  background: rgba(8, 12, 24, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

nav.side button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

nav.side button.active,
nav.side button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

main { padding: 28px; }

.card {
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

input, select, textarea {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder { color: rgba(184, 196, 220, 0.65); }

textarea.glass-input {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(107, 155, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(107, 155, 255, 0.15);
}

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 18px;
  border: 1px solid transparent;
  transition: transform 0.14s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.btn:disabled,
button.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary,
button.btn:not(.btn-secondary):not(.btn-ghost):not(.danger) {
  background: linear-gradient(145deg, rgba(107, 155, 255, 0.95), rgba(139, 125, 255, 0.92));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 28px rgba(88, 120, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-primary:hover:not(:disabled),
button.btn:not(.btn-secondary):not(.btn-ghost):not(.danger):hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(88, 120, 255, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-color: rgba(107, 155, 255, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(107, 155, 255, 0.14);
  border-color: rgba(107, 155, 255, 0.65);
}

.btn-ghost,
button.btn.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: var(--glass-border);
  box-shadow: none;
}

.btn-ghost:hover:not(:disabled),
button.btn.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

button.btn.danger,
.btn-danger {
  background: linear-gradient(145deg, rgba(255, 107, 136, 0.95), rgba(255, 77, 109, 0.92));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 26px rgba(255, 107, 136, 0.28);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

th { color: var(--muted); font-weight: 600; }

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
}

.pill.ok { color: var(--ok); border-color: rgba(77, 224, 168, 0.45); }
.pill.warn { color: var(--danger); border-color: rgba(255, 107, 136, 0.45); }

.login-shell,
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 16px;
  gap: 20px;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px 26px 24px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.login-brand img {
  width: min(220px, 72vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.35));
}

.login-brand h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  max-width: 420px;
}

.site-footer p { margin: 0 0 4px; }

.site-footer a {
  color: #9ec0ff;
  text-decoration: none;
}

.site-footer a:hover { text-decoration: underline; }

.site-footer .sep { margin: 0 6px; opacity: 0.5; }

.btn-block { width: 100%; }

.err { display: block; min-height: 1.2em; color: #ff8fa3; }

.login-step { animation: fadeIn 0.28s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.turnstile-wrap {
  display: flex;
  justify-content: center;
  min-height: 65px;
  margin: 6px 0 4px;
}

.verify-panel {
  text-align: center;
  padding: 8px 4px 4px;
}

.verify-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: linear-gradient(145deg, rgba(107, 155, 255, 0.22), rgba(139, 125, 255, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.verify-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.verify-desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.verify-desc strong {
  color: var(--text);
  font-weight: 600;
}

.otp-wrap {
  position: relative;
  margin: 0 auto 14px;
  max-width: 320px;
}

#otpInput {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.otp-cells {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.otp-cell {
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.otp-cell.filled {
  background: rgba(107, 155, 255, 0.12);
  border-color: rgba(107, 155, 255, 0.45);
}

.otp-cell.active {
  border-color: rgba(139, 125, 255, 0.75);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(88, 120, 255, 0.18);
}

#stepVerify.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.login-form input { width: 100%; }

#turnstileSlot { display: flex; justify-content: center; min-height: 65px; margin: 4px 0; }

.muted { color: var(--muted); font-size: 13px; }
.tiny { font-size: 12px; line-height: 1.5; }
.link { color: #9ec0ff; text-decoration: none; }
.link:hover { text-decoration: underline; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 16px;
  border-radius: 12px;
  z-index: 50;
}

.hidden { display: none !important; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.stat { font-size: 28px; font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  nav.side {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--glass-border);
  }
  nav.side button { width: auto; white-space: nowrap; }
  .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr; }
}
