:root {
  --ink: #102033;
  --muted: #64748b;
  --line: #d7e2ee;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --primary: #0f4c81;
  --primary-2: #1c7ab6;
  --accent: #16a34a;
  --danger: #dc2626;
  --shadow: 0 16px 40px rgba(15, 76, 129, .14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

body.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(15, 76, 129, .12), rgba(22, 132, 191, .08)),
    var(--bg);
}

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

button,
input {
  font: inherit;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  color: #fff;
  background: linear-gradient(180deg, #0f4c81 0%, #1684bf 100%);
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: 8px 0 26px rgba(15, 76, 129, .18);
  z-index: 20;
}

.brand {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: rgba(255, 255, 255, .16);
  border-radius: 8px;
  padding: 4px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand small {
  opacity: .82;
  font-size: 12px;
}

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

.side-nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255, 255, 255, .9);
  font-weight: 700;
}

.side-nav a:hover,
.side-nav a.active {
  background: rgba(255, 255, 255, .17);
  color: #fff;
}

.side-nav svg,
.module-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: 0 0 auto;
}

.side-footer {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  font-weight: 700;
  color: rgba(255, 255, 255, .86);
}

.main-area {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.icon-btn span {
  width: 18px;
  height: 2px;
  background: var(--ink);
}

.top-title {
  display: grid;
  gap: 2px;
}

.top-title span,
.top-user a,
.detail-list dt,
.stat-card small,
.module-card small {
  color: var(--muted);
}

.top-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.top-user strong,
.top-user a {
  display: block;
  font-size: 13px;
}

.top-user a {
  text-decoration: underline;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #d9ecff;
  color: var(--primary);
  font-weight: 800;
  border: 2px solid #b6d8f5;
}

.avatar.small {
  width: 38px;
  height: 38px;
  font-size: 14px;
}

.content {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 24px 42px;
  display: grid;
  gap: 22px;
}

.hero-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-left: 5px solid var(--primary-2);
}

.hero-panel.compact {
  align-items: flex-start;
}

.hero-panel h1,
.panel h2,
.module-card h3,
.event-row h3 {
  margin: 0;
}

.hero-panel h1 {
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.05;
}

.hero-panel p,
.panel-copy,
.module-card p,
.event-row p {
  margin: 8px 0 0;
  color: var(--muted);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero-actions,
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

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

.btn-soft {
  background: #eef6ff;
  color: var(--primary);
  border-color: #c7dff4;
}

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

.stat-card {
  min-height: 130px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-card span,
.stat-card small,
.stat-card strong {
  display: block;
}

.stat-card span {
  font-weight: 800;
}

.stat-card strong {
  margin: 10px 0 4px;
  font-size: 34px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr);
  gap: 22px;
}

.panel {
  padding: 24px;
}

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

.link-action {
  color: var(--primary);
  font-weight: 800;
  text-decoration: underline;
}

.event-list {
  display: grid;
  gap: 10px;
}

.event-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.date-pill {
  padding: 10px;
  border-radius: 8px;
  background: #eef6ff;
  color: var(--primary);
  text-align: center;
}

.date-pill strong,
.date-pill span {
  display: block;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #166534;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.empty-state,
.table-empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.profile-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.profile-card strong,
.profile-card span {
  display: block;
}

.profile-card span {
  color: var(--muted);
}

.detail-list {
  margin: 18px 0 0;
  display: grid;
  gap: 12px;
}

.detail-list div {
  display: grid;
  gap: 4px;
}

.detail-list dt,
.detail-list dd {
  margin: 0;
}

.detail-list dd {
  font-weight: 800;
  overflow-wrap: anywhere;
}

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

.module-card {
  min-height: 170px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.module-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef6ff;
  color: var(--primary);
  margin-bottom: 14px;
}

.module-card small {
  display: block;
  margin-top: 14px;
  font-family: Consolas, Monaco, monospace;
}

.report-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.report-strip div {
  padding: 16px;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.toolbar {
  align-items: end;
  margin-bottom: 18px;
}

.search-box {
  flex: 1 1 320px;
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.search-box input {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 3px;
  color: var(--muted);
}

.backdrop {
  display: none;
}

.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-brand {
  min-height: 520px;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(160deg, #0f4c81 0%, #1684bf 100%);
  color: #fff;
}

.login-brand img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  background: rgba(255, 255, 255, .15);
  border-radius: 8px;
  padding: 6px;
  margin-bottom: 24px;
}

.login-brand span {
  font-weight: 800;
  opacity: .84;
}

.login-brand h1 {
  margin: 8px 0 0;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1;
}

.login-brand p {
  max-width: 360px;
  margin: 16px 0 0;
  color: rgba(255, 255, 255, .82);
  font-weight: 700;
}

.login-card-admin {
  padding: 42px 34px;
  align-self: center;
}

.login-card-admin h2 {
  margin: 0 0 22px;
  font-size: 28px;
}

.login-card-admin form,
.form-field {
  display: grid;
  gap: 14px;
}

.form-field {
  gap: 6px;
  font-weight: 800;
}

.form-field input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.login-card-admin .btn {
  width: 100%;
  margin-top: 6px;
}

.alert-error {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-weight: 800;
}

@media (max-width: 980px) {
  .admin-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    transform: translateX(-105%);
    transition: transform .18s ease;
  }

  .admin-shell.menu-open .sidebar {
    transform: translateX(0);
  }

  .admin-shell.menu-open + .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 32, 51, .46);
    z-index: 15;
  }

  .icon-btn {
    display: inline-flex;
  }

  .stat-grid,
  .content-grid,
  .module-grid,
  .report-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    height: 64px;
    padding: 0 14px;
  }

  .top-title span,
  .top-user div {
    display: none;
  }

  .content {
    padding: 18px 12px 28px;
  }

  .hero-panel {
    display: grid;
    padding: 20px;
  }

  .hero-actions,
  .hero-actions .btn,
  .toolbar .btn {
    width: 100%;
  }

  .stat-grid,
  .content-grid,
  .module-grid,
  .report-strip {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 18px;
  }

  .event-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .date-pill {
    text-align: left;
  }

  .responsive-table {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tr {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fff;
  }

  td {
    border: 0;
    padding: 8px 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: auto;
    padding: 28px 24px;
  }

  .login-brand img {
    width: 58px;
    height: 58px;
    margin-bottom: 16px;
  }

  .login-card-admin {
    padding: 28px 22px;
  }
}
