:root {
  --sidebar-w: 260px;
  --topbar-h: 56px;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1c1c28;
  --muted: #8a8aa3;
  --border: #e2e4e9;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #e02424;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

body {
  font-family: 'Segoe UI', Roboto, Helvetica Neue, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── LOGIN ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  padding: 20px;
}

.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .muted { margin-bottom: 28px; font-size: 14px; }

.form-group {
  text-align: left;
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 5px;
}
.form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #f8fafc;
  transition: border-color .15s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.btn {
  border: none; cursor: pointer;
  font-size: 14px; font-weight: 600;
  border-radius: 10px; padding: 11px 20px;
  transition: all .15s ease; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.error-text { color: var(--danger); font-size: 13px; margin-top: 12px; }

.login-hint {
  margin-top: 20px;
  font-size: 12px;
  padding: 8px;
  background: #f1f5f9;
  border-radius: 8px;
}

/* ─── DASHBOARD ─── */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo { font-size: 28px; }
.sidebar-brand strong { display: block; font-size: 15px; color: #fff; line-height: 1.2; }
.sidebar-brand small { opacity: .55; font-size: 11px; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  margin: 2px 10px;
  border-radius: 10px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .12s ease;
  cursor: pointer;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}
.nav-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-text { white-space: nowrap; }

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--sidebar-active);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.user-name { font-size: 13px; color: #94a3b8; }

.btn-sidebar-ghost {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.btn-sidebar-ghost:hover {
  background: rgba(255,255,255,.08);
  color: #f87171;
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-head h3 { font-size: 17px; }

.modal-close {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--danger); }

/* ─── MAIN ─── */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: none;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  flex-shrink: 0;
}

.btn-burger {
  display: none;
  background: none; border: none;
  color: var(--text); cursor: pointer;
  padding: 4px;
}

.main-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.topbar-spacer { flex: 1; }

.btn-outline-sm {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.btn-outline-sm:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.content-area {
  flex: 1;
  position: relative;
}

.content-area iframe {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
  border: none;
  min-height: calc(100vh - var(--topbar-h));
}

/* ─── MOBILE ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 40;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  .main-area {
    margin-left: 0;
  }
  .btn-burger {
    display: flex;
  }
  .btn-outline-sm span {
    display: none;
  }
}
