:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef3f5;
  --ink: #1d2528;
  --muted: #627177;
  --line: #dbe3e6;
  --brand: #0f766e;
  --brand-strong: #0b5f59;
  --amber: #b36b00;
  --blue: #2563a8;
  --green: #138a46;
  --red: #b42318;
  --shadow: 0 12px 32px rgba(30, 45, 52, 0.10);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #182326;
  color: #f7fbfb;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--brand);
  border-radius: 8px;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel p {
  margin: 0;
}

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

.brand p,
.side-title {
  color: #a9b9be;
}

.primary-action,
.secondary-action,
.solid-btn {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  padding: 11px 14px;
  font-weight: 700;
}

.primary-action:hover,
.solid-btn:hover {
  background: var(--brand-strong);
}

.secondary-action {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.secondary-action:hover {
  background: rgba(255, 255, 255, 0.16);
}

.ghost-btn,
.danger-btn,
.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 13px;
  font-weight: 700;
}

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

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.event-list-wrap {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.event-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #f7fbfb;
  border-radius: 8px;
  padding: 10px;
}

.event-item.active {
  border-color: #64d3c9;
  background: rgba(15, 118, 110, 0.38);
}

.event-select {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 2px;
}

.event-item strong,
.event-item span,
.event-select strong,
.event-select span {
  display: block;
}

.event-item span,
.event-select span {
  color: #bfd0d4;
  margin-top: 4px;
  font-size: 12px;
}

.event-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.event-actions button {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #f7fbfb;
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 800;
}

.event-actions .delete-event {
  border-color: rgba(248, 113, 113, 0.42);
  color: #fecaca;
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--brand);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
}

.topbar h2 {
  font-size: 28px;
}

.sync-status {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sync-status.online {
  color: var(--green);
}

.sync-status.offline {
  color: var(--red);
}

.top-actions,
.table-tools,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(30, 45, 52, 0.04);
}

.metric span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric strong {
  font-size: 26px;
}

.metric.warn {
  border-left-color: var(--amber);
}

.metric.info {
  border-left-color: var(--blue);
}

.metric.success {
  border-left-color: var(--green);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(30, 45, 52, 0.04);
}

.panel-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.panel h3 {
  font-size: 16px;
}

.panel p {
  color: var(--muted);
  margin-top: 4px;
  font-size: 12px;
}

.stack-list {
  padding: 8px;
  display: grid;
  gap: 8px;
  min-height: 126px;
}

.stack-row {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: #fbfcfc;
}

.stack-row strong,
.stack-row span {
  display: block;
}

.stack-row span {
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
}

.pill {
  white-space: nowrap;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.pill.Done {
  background: #dcfce7;
  color: #166534;
}

.pill.Rejected,
.pill.Refund {
  background: #fee2e2;
  color: #991b1b;
}

.pill.Submitted,
.pill.Under {
  background: #dbeafe;
  color: #1e40af;
}

.pill.Awaiting {
  background: #fef3c7;
  color: #92400e;
}

.empty-state,
.empty-table {
  color: var(--muted);
  align-content: center;
  text-align: center;
}

.workspace {
  min-width: 0;
}

.wide {
  width: 100%;
}

.table-head {
  align-items: flex-end;
}

.table-tools input,
.table-tools select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.table-tools input {
  width: 280px;
}

.table-scroll {
  overflow: auto;
}

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

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

th {
  background: #f8fafb;
  font-size: 12px;
  color: #425056;
  text-transform: uppercase;
  letter-spacing: 0;
}

td {
  color: #243034;
}

.row-action {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 7px 10px;
  font-weight: 700;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

dialog {
  border: 0;
  padding: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: min(940px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(18, 30, 34, 0.48);
}

.modal {
  padding: 18px;
  width: 620px;
  max-height: 88vh;
  overflow: auto;
}

.applicant-modal {
  width: 920px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

.modal-head h3 {
  margin: 0;
  font-size: 20px;
}

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

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

label {
  display: grid;
  gap: 6px;
  color: #425056;
  font-weight: 700;
}

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

textarea {
  resize: vertical;
}

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

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

.document-checklist {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin: 2px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.document-checklist legend {
  padding: 0 6px;
  color: var(--ink);
  font-weight: 800;
}

.record-uploads {
  align-items: end;
}

.uploaded-record-links {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.uploaded-record-links a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--brand);
  background: #fff;
  font-weight: 800;
  text-decoration: none;
}

.modal-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

.upload-template {
  margin-top: 12px;
}

.modal-spacer {
  flex: 1;
}

.reminder-modal {
  width: 620px;
}

.share-modal {
  width: 700px;
}

.reminder-content {
  display: grid;
  gap: 10px;
}

.reminder-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.reminder-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.status-view {
  min-height: 100vh;
  background: var(--bg);
  padding: 28px;
}

.status-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.status-header {
  margin-bottom: 18px;
}

.status-header h1 {
  margin: 4px 0 0;
  font-size: 30px;
}

.status-panel table {
  min-width: 920px;
}

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

  .sidebar {
    min-height: auto;
  }

  .event-list {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  }

  .topbar,
  .panel-head,
  .table-head {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .dashboard-grid,
  .form-grid,
  .applicant-grid {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .table-tools {
    flex-wrap: wrap;
  }

  .table-tools input,
  .table-tools select {
    width: 100%;
  }

  .span-2,
  .span-all {
    grid-column: auto;
  }

  .document-checklist {
    grid-template-columns: 1fr;
  }
}
