:root {
  --bg: #170f1e;
  --panel: #21172c;
  --panel-2: #2a1e38;
  --text: #f0e9f5;
  --muted: #b09bc4;
  /* Light magenta brand accent (was blue #4f8cff) */
  --accent: #e85fd6;
  --accent-dark: #a21caf;
  --accent-2: #33c17a;
  --warn: #e7b93f;
  --danger: #e0546a;
  --border: #3a2a4a;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  margin: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.sidebar-nav { flex: 1; }

.sidebar h1 {
  font-size: 16px;
  color: var(--text);
  margin: 0 0 4px 4px;
}
.sidebar .sub { color: var(--muted); font-size: 11px; margin: 0 0 20px 4px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 14px;
}
.nav-link:hover { background: var(--panel-2); text-decoration: none; }
.nav-link.active { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.main-content { flex: 1; padding: 24px 32px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.topbar .title { font-size: 22px; font-weight: 600; }
.topbar .user { color: var(--muted); font-size: 13px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.kpi .num { font-size: 28px; font-weight: 700; }
.kpi .label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.kpi.warn .num { color: var(--warn); }
.kpi.danger .num { color: var(--danger); }
.kpi.good .num { color: var(--accent-2); }

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
tr:hover td { background: rgba(255,255,255,0.02); }

.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { opacity: 0.9; text-decoration: none; color: #fff; }
.btn.secondary { background: var(--panel-2); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 12px; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge.active { background: rgba(51,193,122,.15); color: var(--accent-2); }
.badge.expiring { background: rgba(231,185,63,.15); color: var(--warn); }
.badge.expired, .badge.revoked { background: rgba(224,84,106,.15); color: var(--danger); }
.badge.suspended { background: rgba(147,160,184,.15); color: var(--muted); }

form.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
}
textarea { min-height: 80px; }
.checklist { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.checklist label { display: flex; align-items: center; gap: 8px; font-size: 14px; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert.success { background: rgba(51,193,122,.15); color: var(--accent-2); }
.alert.error { background: rgba(224,84,106,.15); color: var(--danger); }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 360px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 32px; }
.text-muted { color: var(--muted); }
.mt-2 { margin-top: 10px; }
.mb-2 { margin-bottom: 10px; }


/* ── Brand badge (sidebar + login) ─────────────────────────────── */
.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(232, 95, 214, 0.35);
  flex-shrink: 0;
}
.brand-badge img { display: block; width: 100%; height: 100%; }

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.brand-row .brand-badge { width: 32px; height: 32px; }
.brand-row h1 { margin: 0; }

.login-card { text-align: center; }
.login-card .brand-badge { width: 56px; height: 56px; margin: 0 auto 14px; }
.login-card h2 { margin: 0 0 4px; }
.login-card .tagline { color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 18px; }
.login-card form { text-align: left; }

input[type=text]:focus, input[type=email]:focus, input[type=password]:focus,
input[type=number]:focus, input[type=date]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 95, 214, 0.18);
}


/* ── Sidebar footer: signed-in user card ───────────────────────── */
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10px; color: var(--muted); }
.logout-btn {
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 6px; border-radius: 6px; font-size: 14px;
}
.logout-btn:hover { color: var(--danger); background: rgba(224,84,106,.12); }

/* ── Topbar profile menu ────────────────────────────────────────── */
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--muted); font-size: 14px; text-decoration: none;
}
.topbar-btn:hover { background: var(--border); color: var(--text); }
.profile-menu { position: relative; }
.profile-menu-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 230px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,.35); z-index: 200; overflow: hidden; padding: 6px;
}
.profile-menu-header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
}
.profile-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 6px; border: none; background: none;
  font-size: 13px; color: var(--text); text-decoration: none; cursor: pointer;
  text-align: left; font-family: inherit;
}
.profile-menu-item:hover { background: var(--panel-2); text-decoration: none; }
.profile-menu-item i { width: 16px; color: var(--muted); font-size: 13px; }
.profile-menu-divider { height: 1px; background: var(--border); margin: 6px 4px; }

/* ── Bottom app bar ─────────────────────────────────────────────── */
.app-footer {
  height: 38px; flex-shrink: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; font-size: 11px; color: var(--muted); gap: 8px; flex-wrap: wrap;
}
.app-footer strong { color: var(--text); font-weight: 600; }
.app-footer a { color: var(--accent); }
.app-footer a:hover { text-decoration: underline; }

/* Breadcrumb (2026-10-11) */
.breadcrumb { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 6px; opacity: .6; }
