/* ============================================================
   AuthCentral — design system
   Fond graphite, accent ambre, typo Space Grotesk / JetBrains Mono
   ============================================================ */

:root {
  --bg: #0B0D10;
  --surface: #14171C;
  --surface-2: #1B1F26;
  --border: #262B33;
  --border-strong: #333A45;
  --text: #E7E9EC;
  --text-dim: #8A94A6;
  --text-faint: #545C6B;
  --accent: #E8A93D;
  --accent-ink: #1A1300;
  --positive: #33C481;
  --negative: #FF5C5C;
  --font-ui: 'Space Grotesk', -apple-system, Segoe UI, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --radius: 0px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  font-family: var(--font-ui);
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px 0;
}

h1 { font-size: 1.5rem; margin-bottom: 24px; }
h2 { font-size: 1.05rem; color: var(--text); margin-top: 0; }
h3 { font-size: 0.9rem; color: var(--text-dim); font-weight: 500; margin-top: 24px; }

code, .mono { font-family: var(--font-mono); font-size: 0.9em; }

/* ---------- Layout ---------- */

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

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  flex-direction: column;
  width: fit-content;
  padding: 0 8px;
  margin-bottom: 20px;
}
.brand-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  object-fit: contain;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.sidebar nav a {
  position: relative;
  color: var(--text-dim);
  text-decoration: none;
  padding: 9px 10px 9px 22px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar nav a::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}
.sidebar nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.sidebar nav a.nav-active {
  color: var(--text);
  background: var(--surface-2);
}
.sidebar nav a.nav-active::before {
  background: #4C9EFF;
  box-shadow: 0 0 6px #4C9EFF, 0 0 2px #4C9EFF;
}

.logout-link {
  color: var(--text-faint);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 9px 10px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 16px;
  display: block;
}
.logout-link:hover { color: var(--negative); }

main {
  flex: 1;
  padding: 40px 48px;
  min-width: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

section { margin-bottom: 40px; }

/* ---------- Dashboard cards ---------- */

.cards { display: flex; gap: 14px; margin-top: 20px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  min-width: 150px;
}
.card-value {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 500;
  color: var(--accent);
  line-height: 1;
}
.card-label {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 8px;
}

/* ---------- Tables ---------- */

table.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 4px;
}
table.grid thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
table.grid thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }
table.grid tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
table.grid tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius); }
table.grid th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
table.grid td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text);
}
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: var(--surface-2); }
table.grid td code { color: var(--text-dim); }

.grid-nowrap {
  table-layout: fixed;
}
.grid-nowrap td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid-nowrap col.col-date { width: 13%; }
.grid-nowrap col.col-email { width: 20%; }
.grid-nowrap col.col-action { width: 15%; }
.grid-nowrap col.col-details { width: 27%; }
.grid-nowrap col.col-ip { width: 25%; }

.row-warning td { background: rgba(255, 92, 92, 0.06); }

/* ---------- Status dot ---------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}
.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
}
.status.on::before { background: var(--positive); box-shadow: 0 0 5px var(--positive); }
.status.off::before { background: var(--negative); }

/* ---------- Forms ---------- */

label {
  display: block;
  margin-top: 18px;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text);
}

input, select {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  outline: none;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 169, 61, 0.15);
}
input[type="checkbox"] { width: auto; accent-color: var(--accent); }

button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid #8A6220;
  padding: 0 16px;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: filter 0.12s ease;
}
button:hover { filter: brightness(1.1); }
button:active { filter: brightness(0.95); }
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: none !important;
}

.btn-danger {
  background: transparent;
  color: var(--negative);
  border: 1px solid rgba(255, 92, 92, 0.4);
}
.btn-danger:hover {
  background: rgba(255, 92, 92, 0.1);
  filter: none;
}

.danger-zone {
  border: 1px solid rgba(255, 92, 92, 0.3);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 16px;
}

.form-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.error {
  color: var(--negative);
  background: rgba(255, 92, 92, 0.1);
  border: 1px solid rgba(255, 92, 92, 0.3);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-top: 14px;
  font-size: 0.85rem;
}
.success { color: var(--positive); font-size: 0.85rem; }
.hint { color: var(--text-faint); font-size: 0.8rem; line-height: 1.5; }

.totp-uri {
  display: block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 10px;
  word-break: break-all;
  margin: 8px 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  border-radius: var(--radius);
}

/* ---------- Login screen ---------- */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(circle at 50% 0%, rgba(232, 169, 61, 0.08), transparent 60%);
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 40px;
  border-radius: var(--radius);
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.login-box h1 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  display: flex;
  flex-direction: column;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}
.login-box h1 .brand-icon {
  width: 20px;
  height: 20px;
}
.login-box .subtitle {
  color: var(--text-faint);
  margin-top: 2px;
  margin-bottom: 14px;
  font-size: 0.85rem;
}
.login-box button { margin-top: 14px; padding: 10px; }

/* ---------- Brand text (title + subtitle) ---------- */

.brand-row {
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-title {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text);
}
.brand-subtitle {
  display: block;
  align-self: flex-end;
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: 0.68rem;
  color: var(--text-faint);
  letter-spacing: 0.03em;
  margin-top: 2px;
}
.login-box h1 .brand-subtitle {
  font-size: 0.72rem;
}

/* ---------- Empty state ---------- */

.empty-state-text {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.9rem;
  margin-top: 24px;
}

.logs-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 40px;
}

.settings-saved-footer {
  margin-top: 32px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.settings-saved-footer.visible {
  opacity: 1;
}
