:root {
  --black: #0a0b0d;
  --night-blue: #14161a;
  --blue: #353a40;
  --blue-soft: #6b7280;
  --gold: #b8902f;
  --off-white: #eee9df;
  --muted: #aba59b;
  --danger: #b91c1c;
  --success: #15803d;
  --card: rgba(20, 22, 26, 0.88);
  --card-strong: rgba(13, 14, 17, 0.96);
  --card-soft: rgba(22, 24, 28, 0.76);
  --border: rgba(255, 255, 255, 0.07);
  --border-gold: rgba(184, 144, 47, 0.34);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 18px 45px rgba(0, 0, 0, 0.42);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Bahnschrift", "DejaVu Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 16% 18%, rgba(184, 144, 47, 0.08), transparent 22%),
    linear-gradient(135deg, #090a0b 0%, #111316 48%, #0d0f11 100%);
  color: var(--off-white);
}

body {
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 85%);
  opacity: 0.28;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(184, 144, 47, 0.05), transparent 32%),
    linear-gradient(180deg, rgba(9, 10, 12, 0.92), rgba(9, 10, 12, 0.97)),
    url("/api/file?path=%2Fhome%2Fpolcram%2FBureau%2FUSSS.png") center center / min(58vw, 760px) no-repeat;
  opacity: 0.18;
  filter: grayscale(0.65) blur(1px);
  mix-blend-mode: soft-light;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.page-shell {
  display: grid;
  grid-template-columns: 308px 1fr;
  min-height: 100vh;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(15, 16, 18, 0.98), rgba(12, 13, 15, 0.94)),
    radial-gradient(circle at top, rgba(184, 144, 47, 0.08), transparent 30%);
  border-right: 1px solid var(--border);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: relative;
}

.sidebar::after {
  content: "";
  position: absolute;
  top: 24px;
  right: 0;
  width: 3px;
  height: calc(100% - 48px);
  background: linear-gradient(180deg, rgba(184, 144, 47, 0), rgba(184, 144, 47, 0.75), rgba(184, 144, 47, 0));
  box-shadow: 0 0 18px rgba(184, 144, 47, 0.24);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-logo {
  width: 62px;
  height: 62px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border-gold);
  background: linear-gradient(135deg, #1b1d21, #2d3137);
  box-shadow: 0 0 0 1px rgba(200, 155, 44, 0.12), 0 12px 25px rgba(0, 0, 0, 0.35);
}

.brand-copy h1,
.brand-copy h2,
.brand-copy p {
  margin: 0;
}

.brand-copy h1,
.brand-copy h2 {
  font-size: 1.08rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-copy p {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.user-panel,
.status-panel {
  background: linear-gradient(180deg, rgba(20, 22, 26, 0.96), rgba(15, 17, 20, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--glow);
  position: relative;
  overflow: hidden;
}

.user-panel::before,
.status-panel::before,
.panel::before,
.feature-card::before,
.login-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(184, 144, 47, 0), rgba(184, 144, 47, 0.62), rgba(184, 144, 47, 0));
}

.user-panel strong,
.status-panel strong {
  display: block;
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-button,
.action-button,
.secondary-button,
.danger-button {
  border-radius: 12px;
  padding: 12px 14px;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.nav-button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.015));
  color: var(--off-white);
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.88rem;
}

.nav-button:hover,
.nav-button.active {
  background: linear-gradient(180deg, rgba(184, 144, 47, 0.18), rgba(184, 144, 47, 0.08));
  border-color: rgba(184, 144, 47, 0.24);
  box-shadow: inset 0 0 0 1px rgba(184, 144, 47, 0.08), 0 10px 22px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.sidebar-spacer {
  flex: 1;
}

.logout-button {
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.42), rgba(88, 28, 28, 0.22));
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.24);
  border-radius: 12px;
  padding: 12px 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.content {
  padding: 30px;
  position: relative;
}

.topbar {
  margin-bottom: 26px;
  padding: 0 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  top: -20px;
  right: 0;
  width: 120px;
  height: 120px;
  background: url("assets/images/logo_dhs.png") center center / contain no-repeat;
  opacity: 0.12;
  filter: saturate(0) brightness(1.5);
}

.topbar h2,
.topbar p {
  margin: 0;
}

.topbar h2 {
  font-size: 2rem;
  margin-bottom: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.card,
.feature-card {
  background: linear-gradient(180deg, rgba(21, 23, 27, 0.92), rgba(16, 18, 21, 0.86));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  box-shadow: var(--glow);
  position: relative;
  overflow: hidden;
}

.feature-card {
  padding: 22px;
}

.feature-card h3 {
  position: relative;
  padding-left: 28px;
}

.feature-card h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 18px;
  height: 18px;
  background: url("assets/images/logo_dhs.png") center center / contain no-repeat;
  opacity: 0.7;
}

.feature-card h3,
.feature-card p {
  margin-top: 0;
}

.feature-card p {
  color: var(--muted);
  min-height: 52px;
}

.feature-card button,
.action-button {
  background: linear-gradient(180deg, #32363c, #24272c 70%, #1a1c20);
  color: white;
  border: 1px solid rgba(184, 144, 47, 0.18);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.secondary-button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  color: var(--off-white);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.danger-button {
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.46), rgba(88, 28, 28, 0.24));
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.24);
}

.action-button:hover,
.secondary-button:hover,
.danger-button:hover,
.logout-button:hover {
  transform: translateY(-1px);
}

.panel {
  background: linear-gradient(180deg, rgba(21, 23, 27, 0.94), rgba(16, 18, 21, 0.86));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  box-shadow: var(--glow);
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.panel-heading h3 {
  position: relative;
  padding-left: 28px;
}

.panel-heading h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 18px;
  height: 18px;
  background: url("assets/images/logo_dhs.png") center center / contain no-repeat;
  opacity: 0.7;
}

.page-grid {
  display: grid;
  gap: 18px;
}

.page-grid.two-columns {
  grid-template-columns: 1.15fr 0.85fr;
}

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

.form-grid.single {
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(12, 13, 15, 0.92), rgba(18, 20, 24, 0.78));
  color: var(--off-white);
  padding: 12px 14px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.field select {
  color-scheme: dark;
}

.field select option,
.field select optgroup {
  background: #121316;
  color: var(--off-white);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(184, 144, 47, 0.4);
  box-shadow: 0 0 0 3px rgba(184, 144, 47, 0.12);
}

.field textarea {
  resize: vertical;
  min-height: 110px;
}

.actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-layout {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(380px, 1fr);
  gap: 24px;
  align-items: start;
}

.login-card {
  width: min(460px, 100%);
  background:
    linear-gradient(180deg, rgba(16, 18, 21, 0.98), rgba(12, 13, 15, 0.92)),
    radial-gradient(circle at top, rgba(184, 144, 47, 0.05), transparent 35%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 28px 65px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

.login-header {
  text-align: center;
  margin-bottom: 26px;
}

.login-header img {
  width: 92px;
  height: 92px;
  border-radius: 18px;
  border: 1px solid var(--border-gold);
  margin-bottom: 14px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(200, 155, 44, 0.08), 0 14px 28px rgba(0, 0, 0, 0.32);
}

.login-header h1,
.login-header p {
  margin: 0;
}

.login-header h1 {
  margin-bottom: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.84rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge.on-duty::before,
.badge.off-duty::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.badge.on-duty::before {
  background: #22c55e;
}

.badge.off-duty::before {
  background: #ef4444;
}

.badge.paused-duty::before {
  background: #f59e0b;
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.list-item {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(17, 18, 21, 0.78), rgba(22, 24, 28, 0.54));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.list-item h4,
.list-item p {
  margin: 0;
}

.list-item h4 {
  margin-bottom: 6px;
}

.inline-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 8px 0;
}

.result-box {
  white-space: pre-wrap;
  line-height: 1.5;
  background:
    linear-gradient(180deg, rgba(12, 13, 15, 0.92), rgba(18, 20, 24, 0.72)),
    radial-gradient(circle at top right, rgba(184, 144, 47, 0.05), transparent 35%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  min-height: 180px;
}

.compact-result {
  min-height: 132px;
}

.miranda-panel {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.miranda-panel h3 {
  margin: 0;
}

.miranda-box {
  min-height: 240px;
  font-size: 1rem;
  line-height: 1.8;
  border-color: rgba(184, 144, 47, 0.22);
  background:
    linear-gradient(180deg, rgba(18, 16, 12, 0.92), rgba(24, 20, 16, 0.76)),
    radial-gradient(circle at top right, rgba(184, 144, 47, 0.08), transparent 35%);
}

.detention-layout {
  grid-template-columns: 1.25fr 0.9fr;
  align-items: start;
}

.sanction-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(15, 16, 19, 0.58), rgba(20, 22, 26, 0.36));
}

.sanction-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 14px;
}

.detention-selection-grid {
  display: grid;
  grid-template-columns: 1fr 0.95fr;
  gap: 16px;
}

.sanction-column {
  display: grid;
  gap: 12px;
}

.sanction-column h3 {
  margin: 0;
}

.selectable-list {
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.selectable-item {
  width: 100%;
  text-align: left;
  color: var(--off-white);
  cursor: pointer;
}

.selectable-item.selected {
  border-color: rgba(184, 144, 47, 0.34);
  background: linear-gradient(180deg, rgba(184, 144, 47, 0.16), rgba(184, 144, 47, 0.08));
  box-shadow: 0 0 0 1px rgba(184, 144, 47, 0.08);
}

.selectable-item:hover {
  border-color: rgba(184, 144, 47, 0.22);
  background: rgba(255, 255, 255, 0.05);
}

.search-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.search-row .field {
  flex: 1;
}

.message {
  margin-top: 14px;
  color: #dfd0a7;
}

.danger-text {
  color: #fca5a5;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 18px;
  margin-top: 18px;
}

.admin-tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tab-button {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  color: var(--off-white);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tab-button.active,
.tab-button:hover {
  background: linear-gradient(180deg, rgba(184, 144, 47, 0.18), rgba(184, 144, 47, 0.08));
  border-color: rgba(184, 144, 47, 0.26);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading h3,
.metric-card strong {
  margin: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(17, 18, 21, 0.86), rgba(20, 22, 26, 0.64));
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-agent-card {
  display: grid;
  gap: 14px;
}

.admin-agent-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.collapsible-card {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.collapse-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: transparent;
  color: var(--off-white);
  text-align: left;
}

.collapse-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}

.collapse-toggle-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.collapse-indicator {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.collapse-toggle.expanded .collapse-indicator {
  color: var(--off-white);
}

.collapsible-body {
  padding: 0 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 920px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .auth-layout,
  .dashboard-grid,
  .page-grid.two-columns,
  .detention-layout,
  .detention-selection-grid,
  .sanction-toolbar,
  .stat-grid,
  .admin-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 20px;
  }
}
