:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #152033;
  --muted: #64748b;
  --line: #dbe3ee;
  --blue: #1c4f91;
  --navy: #102a4c;
  --gold: #f4c542;
  --red: #b42318;
  --green: #1d7a46;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 55%, var(--bg) 55%);
}

.login-card,
.panel,
.stat,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 42, 76, 0.08);
}

.login-card {
  width: min(440px, 100%);
  padding: 32px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
}

.btn.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.btn.danger {
  border-color: var(--red);
  color: var(--red);
}

.btn.warning {
  border-color: #d97706;
  background: #f59e0b;
  color: #111827;
}

.btn.warning:hover:not(:disabled) {
  background: #d97706;
  color: #fff;
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 16px;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.icon-btn.edit {
  border-color: #bfd0e6;
  color: var(--blue);
}

.icon-btn.edit:hover {
  background: #eaf2fb;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  border-radius: 6px;
  color: #334155;
  padding: 10px 12px;
  font-weight: 700;
}

.nav a:hover {
  background: #eef3f9;
  color: var(--navy);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.content {
  padding: 28px;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
  padding: 18px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 30px;
}

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

.page-intro h1 {
  margin-bottom: 6px;
}

.intro-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(12, 1fr);
}

.span-3-cols {
  grid-column: span 3;
}

.span-4-cols {
  grid-column: span 4;
}

.span-6-cols {
  grid-column: span 6;
}

.span-8-cols {
  grid-column: span 8;
}

.span-12-cols {
  grid-column: span 12;
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 28px;
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.quick-actions a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font-weight: 800;
}

.quick-actions a:hover {
  border-color: var(--blue);
  background: #eaf2fb;
}

.panel {
  padding: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  text-align: left;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.badge.danger-soft {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--red);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

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

.compact-form {
  align-items: end;
  grid-template-columns: minmax(180px, 1fr) 170px minmax(260px, 2fr) auto;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.action-cell {
  display: flex;
  gap: 8px;
}

.effect-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.effect-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 9px 11px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.effect-option input {
  width: 16px;
  height: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.compact-form textarea {
  min-height: 42px;
}

input[type="color"] {
  min-height: 42px;
  padding: 4px;
  cursor: pointer;
}

.color-field {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  align-items: center;
}

.color-field input[type="color"] {
  min-width: 54px;
}

.color-value {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.span-2 {
  grid-column: 1 / -1;
}

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

.card {
  padding: 16px;
}

tr.clickable {
  cursor: pointer;
  transition: background-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

tr.clickable:hover,
tr.clickable:focus,
tr.clickable.row-active {
  background: #eaf2fb;
  box-shadow: inset 4px 0 0 var(--blue);
  outline: none;
}

tr.clickable:hover td,
tr.clickable:focus td,
tr.clickable.row-active td {
  border-bottom-color: #bfd0e6;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  background: rgba(15, 23, 42, 0.36);
}

.drawer-backdrop.open {
  display: block;
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 21;
  width: min(720px, 100%);
  transform: translateX(100%);
  transition: transform 180ms ease;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -20px 0 40px rgba(15, 23, 42, 0.18);
  overflow-y: auto;
}

.drawer.open {
  transform: translateX(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-backdrop.open {
  display: grid;
}

.modal {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.modal-body {
  padding: 18px;
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 18px;
}

.drawer-body {
  padding: 18px;
}

.drawer-issue-form {
  margin-bottom: 14px;
}

.drawer-issue-form h2 {
  margin-bottom: 0;
}

.disciplinary-history {
  display: grid;
  gap: 8px;
}

.compact-heading {
  margin: 4px 0 6px;
}

.disciplinary-record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px 12px;
}

.disciplinary-record-row.revoked {
  background: #f8fafc;
}

.disciplinary-record-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.disciplinary-record-main p {
  margin: 0 0 5px;
}

.disciplinary-record-side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 800;
}

.tab.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

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

.detail-list div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.swatch {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  vertical-align: middle;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer {
  font-size: 48px;
  font-weight: 900;
  color: var(--navy);
}

.notice {
  border: 1px solid #bfd0e6;
  border-radius: 6px;
  background: #eaf2fb;
  color: var(--navy);
  padding: 10px 12px;
}

.notice.error {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--red);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .stats,
  .form-grid,
  .compact-form {
    grid-template-columns: 1fr;
  }

  .page-intro,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .page-intro {
    display: grid;
  }

  .span-3-cols,
  .span-4-cols,
  .span-6-cols,
  .span-8-cols,
  .span-12-cols {
    grid-column: span 1;
  }

  .disciplinary-record-row {
    grid-template-columns: 1fr;
  }

  .disciplinary-record-side {
    justify-items: start;
  }
}
