/* ==========================================================================
   SQ AUDIT MANAGER — SOVEREIGN WHITE, ROYAL GOLD & SAUDI EMERALD (.NET BLAZOR)
   Domain: audit.sqsons.com
   ========================================================================== */

:root {
  --bg-white: #ffffff;
  --bg-pearl: #fdfbf7;
  --bg-ivory: #faf6ec;
  --bg-champagne: #f4ecda;

  --gold-50: #fbf7ec;
  --gold-100: #f6ecd2;
  --gold-300: #dfc06c;
  --gold-400: #c9a038;
  --gold-500: #b28720;
  --gold-600: #8f6912;

  --emerald: #0f6b4f;
  --emerald-bg: #ebf7f2;
  --emerald-border: rgba(15, 107, 79, 0.25);

  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --info: #1d4ed8;
  --info-bg: #eff6ff;

  --text-primary: #1d1912;
  --text-secondary: #534c40;
  --text-muted: #776f61;

  --border-subtle: rgba(178, 135, 32, 0.17);
  --border-gold: rgba(201, 160, 56, 0.4);
  --shadow-soft: 0 10px 28px rgba(143, 105, 18, 0.06), 0 2px 8px rgba(29, 25, 18, 0.03);
  --shadow-hover: 0 18px 42px rgba(143, 105, 18, 0.12);

  --font-display: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-body);
  background: linear-gradient(180deg, #ffffff 0%, #fcf9f2 100%);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 276px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #ffffff 0%, #faf6ec 100%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-svg {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  line-height: 1.15;
}

.brand-sub {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--gold-600);
  margin-top: 2px;
}

.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin: 22px 10px 10px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: 13px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.22s ease;
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(178, 135, 32, 0.35);
  transition: all 0.22s ease;
}

.nav-item:hover {
  background: rgba(201, 160, 56, 0.1);
  color: var(--gold-600);
}

.nav-item.active {
  background: linear-gradient(135deg, #fbf7ec 0%, #f4e6c0 100%);
  border: 1px solid var(--border-gold);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(143, 105, 18, 0.08);
}

.nav-item.active .nav-dot {
  background: var(--emerald);
  box-shadow: 0 0 8px rgba(15, 107, 79, 0.5);
}

.sidebar-footer {
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.compliance-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--emerald);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.back-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gold-600);
  padding: 4px 2px;
}

.back-link:hover { text-decoration: underline; }

.sidebar-powered {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Main Area & Topbar */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 74px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  color: var(--gold-600);
}

.topbar-domain {
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.env-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gold-50);
  border: 1px solid var(--border-gold);
  color: var(--gold-600);
}

.workspace-content {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px;
}

/* Page Header */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.page-head h1 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.page-head p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 5px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-sm { padding: 8px 16px; font-size: 0.82rem; }

.btn-gold {
  background: linear-gradient(135deg, #d7b24d 0%, #be9227 55%, #9c7416 100%);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(178, 135, 32, 0.24);
}

.btn-emerald {
  background: linear-gradient(135deg, #137859 0%, #0b523c 100%);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 107, 79, 0.22);
}

.btn-outline {
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-gold);
}

.btn-outline:hover { background: var(--gold-50); color: var(--gold-600); }

/* Cards & Grids */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.kpi-card {
  background: linear-gradient(160deg, #ffffff 0%, #fcf8ef 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 22px 24px;
  box-shadow: var(--shadow-soft);
}

.kpi-label {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-value.gold { color: var(--gold-600); }
.kpi-value.emerald { color: var(--emerald); }
.kpi-value.danger { color: var(--danger); }

.kpi-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.95fr);
  gap: 22px;
}

.card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-pearl);
}

td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(178, 135, 32, 0.1);
  color: var(--text-primary);
  vertical-align: middle;
}

tr:hover td { background: rgba(251, 247, 236, 0.55); }

.mono-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold-600);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.69rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-gold { background: var(--gold-50); color: var(--gold-600); border: 1px solid var(--border-gold); }
.badge-emerald { background: var(--emerald-bg); color: var(--emerald); border: 1px solid var(--emerald-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.25); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(180, 83, 9, 0.25); }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(29, 78, 216, 0.22); }

/* Progress Bar */
.progress-track {
  width: 110px;
  height: 7px;
  border-radius: 999px;
  background: var(--gold-100);
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d7b24d, #0f6b4f);
}

/* Filters & Forms */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.input, .select {
  background: #ffffff;
  border: 1px solid rgba(178, 135, 32, 0.28);
  border-radius: 11px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--text-primary);
}

.input:focus, .select:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(201, 160, 56, 0.16);
}

.filter-pill {
  padding: 7px 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--gold-50);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-pill.active {
  background: linear-gradient(135deg, #d7b24d, #b28720);
  color: #ffffff;
  border-color: transparent;
}

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29, 25, 18, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  background: #ffffff;
  border: 1px solid var(--border-gold);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 28px 64px rgba(29, 25, 18, 0.22);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }

/* Compliance Checklist Cards */
.compliance-list { display: flex; flex-direction: column; gap: 12px; }

.compliance-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.compliance-row.verified {
  background: #f6fcf9;
  border-color: var(--emerald-border);
}

/* Audit Trail Feed */
.trail-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(178, 135, 32, 0.11);
}

.trail-item:last-child { border-bottom: none; }

.trail-bullet {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--gold-400);
  flex-shrink: 0;
}

.mobile-menu-btn, .mobile-close-btn {
  display: none;
  background: var(--gold-50);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-primary);
}

@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: -300px;
    transition: left 0.28s ease;
  }
  .sidebar.open { left: 0; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2); }
  .mobile-menu-btn, .mobile-close-btn { display: inline-flex; align-items: center; justify-content: center; }
  .topbar { padding: 0 18px; }
  .workspace-content { padding: 20px 16px; }
  .env-badge { display: none; }
}

@media (max-width: 560px) {
  .kpi-grid, .form-grid { grid-template-columns: 1fr; }
}
