:root {
  --bg: #070b14;
  --panel: #0f1728;
  --panel-2: #111c31;
  --line: #24314d;
  --text: #e6edf8;
  --muted: #9aa8c4;
  --primary: #4f8cff;
  --danger: #ef4444;
  --ok: #22c55e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
:root { color-scheme: dark; }
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 15% -20%, #1b2a4d 0%, transparent 55%),
              radial-gradient(1000px 700px at 100% 0%, #3d1130 0%, transparent 40%),
              var(--bg);
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 20%);
}

.container { max-width: 1200px; margin: 22px auto 36px; padding: 0 18px; }

.shell {
  margin: 16px auto 0;
  width: calc(100% - 32px);
  max-width: 1240px;
  border: 1px solid var(--line);
  background: rgba(12, 19, 34, 0.85);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(8px);
}

.brand-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: #4cc9f0; box-shadow: 0 0 12px #4cc9f0; }
.brand { font-weight: 700; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.nav { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-link {
  text-decoration: none;
  color: #c9d4ea;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,0.06); }
.profile-link {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  flex: 0 0 auto;
}
.nav-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #22d3ee;
}
.nav-badge {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.panel {
  background: linear-gradient(180deg, rgba(20,29,51,.9), rgba(13,20,36,.9));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.section-title { margin: 2px 0 14px; font-size: 26px; font-weight: 700; }

.upload-form { display: grid; gap: 10px; }
input:not([type]), input[type='file'], input[type='text'], input[type='password'], input[type='email'], input[type='number'], select {
  width: 100%;
  display: block;
  height: 42px;
  line-height: 20px;
  background: #0a1222 !important;
  background-color: #0a1222 !important;
  border: 1px solid #2a3a59 !important;
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text) !important;
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
  appearance: none;
}

/* hard override for legacy/admin forms */
body input,
body select,
body textarea {
  background-color: #0a1222 !important;
  color: var(--text) !important;
  border-color: #2a3a59 !important;
}
input::placeholder { color: #7f93ba; }
input:focus, select:focus {
  border-color: #4f8cff;
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
}
/* keep dark style when browser autofills username/password */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0px 1000px #0a1222 inset !important;
  box-shadow: 0 0 0px 1000px #0a1222 inset !important;
  caret-color: var(--text) !important;
  transition: background-color 9999s ease-in-out 0s;
}
input:-moz-autofill,
input:-moz-autofill:focus,
input:-moz-autofill:hover {
  box-shadow: 0 0 0px 1000px #0a1222 inset !important;
  -moz-text-fill-color: var(--text) !important;
  color: var(--text) !important;
}
label { color: #c5d4ef; font-size: 13px; }

.btn {
  border: 1px solid #355391;
  background: #173367;
  color: #e8f2ff;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover { filter: brightness(1.08); }
.btn.primary { background: linear-gradient(180deg, #3b82f6, #285ec7); border-color: #467ef0; }
.btn.danger { background: linear-gradient(180deg, #ef4444, #c62828); border-color: #ef6b6b; }
.btn.ghost, .btn.secondary { background: transparent; border-color: #3d527f; }
.btn.sm { padding: 7px 10px; font-size: 12px; border-radius: 8px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 14px; }
.kpi-card {
  border: 1px solid var(--line);
  background: rgba(7, 11, 22, 0.65);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.kpi-label { color: #c1cee7; font-size: 13px; text-align: center; }

.ring {
  --p: 0;
  --ring: #4f8cff;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--p) * 1%), #1f2b45 0);
  display: grid;
  place-items: center;
  position: relative;
}
.ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #0e1527;
  border: 1px solid #2d3c5e;
}
.ring span { position: relative; z-index: 1; font-size: 24px; font-weight: 800; }

.table-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.check-all { font-size: 14px; color: #d0dcf3; }

.table-wrap table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #243451; font-size: 13px; text-align: left; }
th { background: #111a2f; color: #d6e2fb; position: sticky; top: 0; z-index: 1; }
tr:hover td { background: rgba(125, 157, 214, 0.07); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.pill { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: lowercase; }
.pill.done { background: rgba(34,197,94,.2); color: #7CFFB0; border: 1px solid rgba(34,197,94,.35); }
.pill.running { background: rgba(245,158,11,.18); color: #ffd08a; border: 1px solid rgba(245,158,11,.35); }
.pill.compliance { background: rgba(59,130,246,.18); color: #9cc4ff; border: 1px solid rgba(59,130,246,.38); box-shadow: 0 0 0 1px rgba(59,130,246,.12) inset; }
.pill.merge { background: rgba(20,184,166,.18); color: #8ff3e5; border: 1px solid rgba(20,184,166,.38); }
.pill.burp {
  background: rgba(236,72,153,.18);
  color: #f9a8d4;
  border: 1px solid rgba(236,72,153,.42);
  box-shadow: 0 0 0 1px rgba(236,72,153,.12) inset, 0 0 14px rgba(236,72,153,.10);
}
.pill.failed { background: rgba(239,68,68,.18); color: #ff9a9a; border: 1px solid rgba(239,68,68,.35); }

.flash-wrap { margin-bottom: 12px; display: grid; gap: 8px; }
.flash { padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; }
.flash.success { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.35); }
.flash.error { background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.35); }

.auth-panel { max-width: 520px; margin: 36px auto 0; }
.auth-header h1 { margin: 0 0 6px; font-size: 24px; }
.auth-header p { margin: 0 0 14px; color: var(--muted); }
.form-grid { display: grid; gap: 10px; }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-create-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.field { display: grid; gap: 6px; }
.field-inline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}
.check-inline { display: inline-flex; align-items: center; gap: 8px; color: #d4def2; }

.admin-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.action-form {
  border: 1px solid #243451;
  border-radius: 10px;
  padding: 8px;
  background: rgba(10,16,31,0.55);
}
.action-form label { display: block; margin-bottom: 6px; font-size: 12px; color: #9fb1d3; }
.action-row { display: flex; gap: 8px; align-items: center; }
.action-row .btn { white-space: nowrap; }
.admin-danger-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-table th:nth-child(1), .audit-table td:nth-child(1) { width: 72px; }
.audit-table th:nth-child(2), .audit-table td:nth-child(2) { min-width: 190px; }
.audit-table th:nth-child(3), .audit-table td:nth-child(3) { min-width: 120px; }
.audit-table th:nth-child(4), .audit-table td:nth-child(4) { min-width: 150px; }
.audit-table th:nth-child(5), .audit-table td:nth-child(5) { min-width: 130px; }
.detail-cell { max-width: 520px; white-space: normal; word-break: break-word; color: #d6e1f6; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }

/* Audit event color coding */
.pill.ev-success { background: rgba(34,197,94,.18); color: #7CFFB0; border: 1px solid rgba(34,197,94,.38); }
.pill.ev-danger { background: rgba(239,68,68,.18); color: #ff9a9a; border: 1px solid rgba(239,68,68,.4); }
.pill.ev-info { background: rgba(59,130,246,.20); color: #9cc4ff; border: 1px solid rgba(59,130,246,.42); }
.pill.ev-neutral { background: rgba(148,163,184,.16); color: #d1d9e6; border: 1px solid rgba(148,163,184,.35); }
.pill.ev-default { background: rgba(245,158,11,.18); color: #ffd08a; border: 1px solid rgba(245,158,11,.35); }

@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .admin-action-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .shell {
    margin: 10px;
    width: calc(100% - 20px);
    max-width: none;
    padding: 12px;
    border-radius: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .brand-wrap { width: 100%; }
  .brand-wrap > div { min-width: 0; }
  .brand {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }
  .brand-sub { font-size: 11px; }
  .container { padding: 0 10px; margin-top: 12px; }
  .nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    align-items: center;
  }
  .nav-link {
    min-width: 0;
    padding: 9px 8px;
    text-align: center;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .profile-link { justify-content: center; }
  .nav-avatar { width: 36px; height: 36px; border-width: 1px; }
  .nav-badge {
    bottom: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 1px 5px;
    font-size: 10px;
  }
  .nav .btn {
    width: 100%;
    min-height: 36px;
    padding: 8px 9px;
    font-size: 12px;
    border-radius: 8px;
  }
  .kpi-grid { grid-template-columns: 1fr; }
  .admin-create-grid { grid-template-columns: 1fr; }
  .field-inline { align-items: center; }
}

@media (max-width: 420px) {
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-link { font-size: 11px; }
}


/* TAC input tidy sizing */
.tac-input {
  max-width: 220px;
  margin: 0 auto;
  text-align: center;
  font-size: 24px;
  letter-spacing: 0.35em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}


/* Polished login card */
.auth-panel-pro {
  max-width: 520px;
  margin: 42px auto 0;
  padding: 20px;
  border: 1px solid #2a3a59;
  box-shadow: 0 12px 38px rgba(6, 13, 30, .55);
}
.auth-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.auth-badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(180deg, #1f3d75, #15305d);
  border: 1px solid #3c5c96;
  font-size: 12px;
  font-weight: 800;
  color:#dbe7ff;
}
.auth-hero h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: .2px;
}
.auth-hero p {
  margin: 4px 0 0;
  color: var(--muted);
}
.auth-panel-pro .form-grid {
  margin-top: 10px;
}
.auth-panel-pro label {
  font-weight: 600;
  color: #dbe6fb;
}
.auth-panel-pro input {
  height: 44px;
}
.auth-submit {
  margin-top: 4px;
  height: 44px;
  font-size: 15px;
}
