:root {
  --bg: #f3f6fb;
  --bg-soft: #e8eef8;
  --card: #ffffff;
  --card-2: #f8fbff;
  --text: #13203a;
  --muted: #5d6f90;
  --line: #d5dfef;
  --brand: #1d4ed8;
  --brand-strong: #0f3fb9;
  --ok: #0f9f61;
  --danger: #d14343;
  --sidebar: #0a1a35;
  --sidebar-2: #0f2d5f;
  --sidebar-text: #d8e6ff;
  --shadow: 0 18px 45px rgba(10, 26, 53, 0.14);
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 7% 3%, #d3e3ff 0%, transparent 35%),
    radial-gradient(circle at 90% 12%, #dff0ff 0%, transparent 30%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 50%, #edf3fd 100%);
  animation: fadeInPage 420ms ease-out;
}

.audit-bg {
  min-height: 100vh;
}

.audit-card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  animation: riseIn 420ms ease-out both;
}

.login-card {
  max-width: 560px;
  padding: 34px;
}

.login-kicker,
.sidebar-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
}

.login-kicker {
  color: var(--brand);
  background: rgba(29, 78, 216, 0.1);
  border: 1px solid rgba(29, 78, 216, 0.2);
  padding: 7px 11px;
  border-radius: 999px;
  margin: 0 auto 18px;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 295px 1fr;
}

.sidebar {
  padding: 24px 20px;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(216, 230, 255, 0.2);
  animation: slideInLeft 480ms ease-out both;
}

.sidebar-kicker {
  color: #9ec0ff;
  margin-bottom: 12px;
}

.sidebar h2 {
  color: #f3f8ff;
}

.sidebar .text-secondary {
  color: #a4bbdf !important;
}

.sidebar .btn {
  text-align: left;
  border-radius: 12px;
  border-color: rgba(216, 230, 255, 0.35);
  color: #dbe8ff;
  font-weight: 600;
}

.sidebar .btn:hover,
.sidebar .btn:focus {
  color: #ffffff;
  border-color: #9ec0ff;
  background: rgba(158, 192, 255, 0.14);
}

.main-area {
  padding: 22px;
}

.topbar {
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(213, 223, 239, 0.9);
  border-radius: 16px;
  padding: 14px 16px;
  backdrop-filter: blur(6px);
  animation: riseIn 480ms ease-out both;
}

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

.stat-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: #aec6ee;
  box-shadow: 0 14px 26px rgba(14, 34, 70, 0.12);
}

.live-row-down {
  background: rgba(209, 67, 67, 0.08);
  border-left: 3px solid rgba(209, 67, 67, 0.75);
}

.live-row-up {
  background: rgba(15, 159, 97, 0.08);
  border-left: 3px solid rgba(15, 159, 97, 0.72);
}

.btn-primary {
  background-color: var(--brand);
  border-color: var(--brand);
  font-weight: 700;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--brand-strong);
  border-color: var(--brand-strong);
}

.btn {
  transition: transform 140ms ease, box-shadow 180ms ease;
}

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

.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-primary {
  font-weight: 700;
}

.form-control,
.form-select {
  border-radius: 12px;
  border-color: #c9d7ee;
  padding: 0.62rem 0.8rem;
}

.form-control:focus,
.form-select:focus {
  border-color: #88a9f0;
  box-shadow: 0 0 0 0.22rem rgba(29, 78, 216, 0.15);
}

.form-control,
.form-select {
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.table-responsive {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: auto;
  background: #ffffff;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background: #eef4ff;
  color: #1f335e;
  border-bottom: 1px solid #d3e0f4;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table td,
.table th {
  padding: 0.7rem 0.72rem;
}

.table tbody tr {
  transition: background-color 160ms ease;
}

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

.tool-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
  padding: 12px;
}

.alerts-panel {
  display: grid;
  gap: 8px;
}

.accordion-list {
  display: grid;
  gap: 8px;
}

.accordion-item-lite {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
}

.accordion-head-lite {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--text);
}

.accordion-body-lite {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
}

.accordion-body-lite pre {
  max-height: 260px;
  overflow: auto;
  margin: 0 0 10px 0;
  font-size: 0.8rem;
  background: rgba(12, 27, 51, 0.04);
  border-radius: 10px;
  padding: 10px;
}

.modal-lite {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: grid;
  place-items: center;
}

.modal-lite-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 20, 0.58);
}

.modal-lite-dialog {
  position: relative;
  width: min(920px, 92vw);
  max-height: 84vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
  padding: 14px;
}

.modal-lite-full {
  width: min(1400px, 97vw);
  height: 92vh;
  max-height: 92vh;
}

.live-log-box {
  height: calc(92vh - 260px);
  overflow: auto;
  font-family: "Courier New", monospace;
  font-size: 0.82rem;
  background: rgba(12, 27, 51, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
}

.human-alert {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 0.93rem;
}

.alert-info {
  background: rgba(15, 159, 97, 0.1);
  border-color: rgba(15, 159, 97, 0.35);
}

.alert-warn {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.4);
}

.alert-critical {
  background: rgba(209, 67, 67, 0.1);
  border-color: rgba(209, 67, 67, 0.4);
}

body.dark {
  --bg: #081120;
  --bg-soft: #0e1b31;
  --card: #0f1d35;
  --card-2: #112746;
  --text: #e5eeff;
  --muted: #a9bddf;
  --line: #22395e;
  --brand: #4d8cff;
  --brand-strong: #3f7bee;
  --sidebar: #060e1c;
  --sidebar-2: #0a1630;
  --sidebar-text: #dce9ff;
  --shadow: 0 20px 55px rgba(3, 8, 18, 0.45);
}

body.dark .topbar {
  background: rgba(13, 25, 46, 0.75);
  border-color: rgba(44, 67, 108, 0.9);
}

body.dark .table,
body.dark .table th,
body.dark .table td,
body.dark .form-control,
body.dark .form-select {
  color: var(--text);
  background-color: transparent;
}

body.dark .table thead th {
  background: rgba(77, 140, 255, 0.11);
  color: #dce8ff;
  border-bottom: 1px solid #314b79;
}

body.dark .table-responsive {
  background: #0c1b33;
}

body.dark .tool-card {
  background: linear-gradient(180deg, #122746 0%, #10233f 100%);
}

body.dark .accordion-item-lite {
  background: linear-gradient(180deg, #122746 0%, #10233f 100%);
}

body.dark .accordion-body-lite pre {
  background: rgba(163, 190, 235, 0.08);
}

body.dark .modal-lite-dialog {
  background: linear-gradient(180deg, #122746 0%, #10233f 100%);
}

body.dark .live-log-box {
  background: rgba(163, 190, 235, 0.08);
}

@media (max-width: 991px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-right: 0;
    border-bottom: 1px solid rgba(216, 230, 255, 0.2);
  }

  .main-area {
    padding: 14px;
  }
}

@keyframes fadeInPage {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
