/* ─── CSS Custom Properties ────────────────────────────────────────── */
:root {
  --id-primary:      #1a4f8a;
  --id-secondary:    #e8a020;
  --id-bg:           #f5f6fa;
  --id-text:         #1c1c1c;
  --id-font:         Inter, system-ui, sans-serif;
  --id-radius:       0.5rem;
  --id-shadow:       0 1px 4px rgba(0,0,0,.08), 0 2px 12px rgba(0,0,0,.06);
  --id-shadow-sm:    0 1px 3px rgba(0,0,0,.07);
  --id-navbar-h:     56px;
  --id-footer-h:     44px;
}

/* ─── Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
}

body {
  font-family: var(--id-font);
  background: var(--id-bg);
  color: var(--id-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Navbar ───────────────────────────────────────────────────────── */
.id-navbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  height: var(--id-navbar-h);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--id-shadow-sm);
}

.id-navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1.25rem;
  gap: 1rem;
}

.id-navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--id-text);
  font-weight: 600;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.id-navbar-logo {
  height: 30px;
  width: auto;
  object-fit: contain;
}

.id-navbar-title {
  letter-spacing: -0.01em;
}

.id-navbar-auth {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.id-navbar-user-btn {
  font-size: 0.82rem;
  gap: 0.3rem;
  display: flex;
  align-items: center;
}

.id-navbar-rolebadge {
  display: inline-block;
  background: var(--id-secondary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1em 0.45em;
  border-radius: 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-left: 0.2rem;
}

/* ─── Layout wrapper (sidebar + main) ─────────────────────────────── */
.id-body-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ─── Sidebar ─────────────────────────────────────────────────────── */
.id-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  padding: 1rem 0;
  overflow-y: auto;
}

.id-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.id-sidebar-section {
  padding: 0.25rem 0;
}

.id-sidebar-section + .id-sidebar-section {
  border-top: 1px solid #f1f3f5;
  margin-top: 0.25rem;
  padding-top: 0.5rem;
}

.id-sidebar-heading {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  padding: 0.35rem 1.1rem 0.2rem;
}

.id-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 1.1rem;
  font-size: 0.84rem;
  font-weight: 450;
  color: #4b5563;
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
}

.id-sidebar-link:hover {
  background: #f5f6fa;
  color: var(--id-primary);
  text-decoration: none;
}

.id-sidebar-link.active {
  background: color-mix(in srgb, var(--id-primary) 8%, #fff);
  color: var(--id-primary);
  font-weight: 550;
  border-right: 3px solid var(--id-primary);
}

.id-sidebar-link i {
  font-size: 1rem;
  width: 1.2rem;
  text-align: center;
  flex-shrink: 0;
}

/* ─── Main column (sidebar peer) ──────────────────────────────────── */
.id-main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ─── Main content ─────────────────────────────────────────────────── */
.id-main {
  flex: 1;
  min-width: 0;
  padding-bottom: 2rem;
}

/* ─── Footer ───────────────────────────────────────────────────────── */
.id-footer {
  background: #fff;
  border-top: 1px solid #e2e8f0;
  height: var(--id-footer-h);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* ─── Card ─────────────────────────────────────────────────────────── */
.id-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--id-radius);
  padding: 1.5rem;
  box-shadow: var(--id-shadow);
}

/* ─── Buttons ──────────────────────────────────────────────────────── */
.btn.id-btn-primary,
.id-btn-primary {
  background: var(--id-primary);
  border-color: var(--id-primary);
  color: #fff;
  font-weight: 500;
}
.btn.id-btn-primary:hover,
.id-btn-primary:hover {
  background: color-mix(in srgb, var(--id-primary) 85%, #000);
  border-color: color-mix(in srgb, var(--id-primary) 85%, #000);
  color: #fff;
}

.btn.id-btn-outline,
.id-btn-outline {
  border-color: var(--id-primary);
  color: var(--id-primary);
}
.btn.id-btn-outline:hover,
.id-btn-outline:hover {
  background: var(--id-primary);
  color: #fff;
}

/* ─── Login page ───────────────────────────────────────────────────── */
.id-login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--id-navbar-h) - var(--id-footer-h));
  padding: 2rem 1rem;
}

.id-login-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--id-radius);
  box-shadow: var(--id-shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.id-login-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
}

.id-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #9ca3af;
  font-size: 0.8rem;
  margin: 1rem 0;
}
.id-divider::before,
.id-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
}
.id-divider span { padding: 0 0.6rem; }

/* ─── Setup wizard ─────────────────────────────────────────────────── */
.id-setup-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: calc(100vh - var(--id-navbar-h) - var(--id-footer-h));
  padding: 3rem 1rem;
}

.id-setup-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--id-radius);
  box-shadow: var(--id-shadow);
  padding: 2rem;
  width: 100%;
  max-width: 540px;
}

.id-setup-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.id-setup-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.id-setup-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #9ca3af;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.id-setup-step.active .id-setup-step-dot {
  background: var(--id-primary);
  color: #fff;
}

.id-setup-step.done .id-setup-step-dot {
  background: #22c55e;
  color: #fff;
}

.id-setup-step-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: #9ca3af;
  white-space: nowrap;
}

.id-setup-step.active .id-setup-step-label { color: var(--id-primary); }
.id-setup-step.done  .id-setup-step-label  { color: #22c55e; }

.id-setup-step-line {
  flex: 1;
  height: 2px;
  background: #e5e7eb;
  margin: 0 0.35rem;
  margin-bottom: 1.25rem;
  min-width: 24px;
}

/* ─── Error page ───────────────────────────────────────────────────── */
.id-error-card {
  max-width: 420px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--id-radius);
  box-shadow: var(--id-shadow);
  padding: 3rem 2rem;
}

/* ─── Tables ───────────────────────────────────────────────────────── */
.id-card .table {
  margin-bottom: 0;
}

.id-card .table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  border-bottom-width: 1px;
  background: #f9fafb;
}

/* ─── Badges ───────────────────────────────────────────────────────── */
.id-badge-role {
  background: color-mix(in srgb, var(--id-primary) 15%, #fff);
  color: var(--id-primary);
  font-weight: 500;
  font-size: 0.7rem;
  border: 1px solid color-mix(in srgb, var(--id-primary) 30%, #fff);
}

/* ─── Settings logo ────────────────────────────────────────────────── */
.id-settings-logo {
  max-height: 80px;
  max-width: 200px;
  object-fit: contain;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.5rem;
  background: #f9fafb;
}

/* ─── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .id-login-card  { padding: 1.5rem 1rem; }
  .id-setup-card  { padding: 1.25rem 1rem; }
  .id-navbar-inner { padding: 0 0.75rem; }

  .id-setup-step-label { display: none; }
  .id-setup-step-line  { min-width: 12px; }

  .id-sidebar {
    display: none;
  }

  .id-sidebar.open {
    display: block;
    position: fixed;
    top: var(--id-navbar-h);
    left: 0;
    bottom: 0;
    z-index: 999;
    box-shadow: 2px 0 8px rgba(0,0,0,.15);
  }
}

/* ─── Policy Editor ─────────────��─────────────────────────────────── */

.id-op-badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.id-op-read   { background-color: #198754; color: #fff; }
.id-op-create { background-color: #0d6efd; color: #fff; }
.id-op-update { background-color: #fd7e14; color: #fff; }
.id-op-delete { background-color: #dc3545; color: #fff; }

.btn-xs {
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  line-height: 1.4;
}
