:root {
  --bg: #070d12;
  --panel: #101922;
  --panel-2: #13202b;
  --line: #263848;
  --line-strong: #395267;
  --text: #eef6fb;
  --muted: #93a9b8;
  --accent: #2fd0ff;
  --green: #48d597;
  --yellow: #f2c94c;
  --red: #ff5e5b;
  --orange: #ff9f43;
  --nav: #0b131b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

button,
select,
input,
textarea {
  color: var(--text);
  background: #0c151d;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

button {
  min-height: 40px;
  padding: 0 12px;
  color: #031018;
  background: var(--accent);
  border: 0;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  color: var(--text);
  background: #172734;
  border: 1px solid var(--line-strong);
}

input,
select,
textarea {
  width: 100%;
  padding: 10px;
}

textarea {
  resize: vertical;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
  grid-template-rows: auto 1fr;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 10px 16px;
  background: #0a1118;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #06121a;
  background: var(--accent);
  border-radius: 6px;
  font-weight: 900;
}

.brand p,
.screen-head p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 21px;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.top-actions span {
  padding: 7px 9px;
  background: #101a23;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.sidebar {
  grid-row: 2;
  padding: 14px;
  background: var(--nav);
  border-right: 1px solid var(--line);
}

.agency-card {
  display: grid;
  gap: 3px;
  margin-bottom: 14px;
  padding: 12px;
  background: #101b24;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agency-card span,
.role-panel label,
.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.agency-card strong {
  font-size: 16px;
}

.sidebar button,
.mobile-tabs button {
  width: 100%;
  margin-bottom: 8px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
}

.sidebar button.active,
.mobile-tabs button.active {
  color: #06121a;
  background: var(--accent);
}

.role-panel {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.mobile-tabs {
  display: none;
}

.workspace {
  grid-column: 2;
  grid-row: 2;
  overflow: auto;
  padding: 18px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

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

.screen-head input {
  max-width: 360px;
}

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

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

.metric {
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.metric small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.dashboard-grid,
.schedule-layout,
.notify-layout,
.audit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  min-width: 0;
  padding: 14px;
}

.panel.wide {
  min-width: 0;
}

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

.shift-list,
.alert-list,
.notification-list,
.audit-log,
.assignment-grid,
.request-grid,
.staff-grid {
  display: grid;
  gap: 10px;
}

.shift-card,
.person-card,
.alert-card,
.request-card,
.notification-card,
.audit-row {
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.shift-card {
  display: grid;
  grid-template-columns: minmax(150px, .9fr) minmax(0, 1.1fr) auto;
  gap: 12px;
  align-items: center;
}

.shift-title strong,
.person-card strong,
.alert-card strong,
.request-card strong,
.notification-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

.shift-title span,
.person-card span,
.alert-card span,
.request-card span,
.notification-card span,
.audit-row span {
  color: var(--muted);
  font-size: 12px;
}

.staff-pills,
.certs,
.channels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill,
.flag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.pill {
  color: var(--text);
  background: #182a38;
  border: 1px solid var(--line-strong);
}

.flag.ok {
  color: #062015;
  background: var(--green);
}

.flag.warn {
  color: #201700;
  background: var(--yellow);
}

.flag.danger {
  color: #270504;
  background: var(--red);
}

.flag.info {
  color: #06121a;
  background: var(--accent);
}

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

.form-grid label,
.channel-set {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.form-grid span,
.channel-set legend {
  color: var(--muted);
  font-size: 12px;
}

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

.assignment-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #0d1720;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.request-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

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

.person-card {
  display: grid;
  gap: 10px;
}

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

.profile-meta div {
  padding: 8px;
  background: #0c151d;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.channel-set {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.channel-set label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.channel-set input {
  width: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
}

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

  .sidebar {
    display: none;
  }

  .mobile-tabs {
    grid-column: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px;
    background: var(--nav);
    border-bottom: 1px solid var(--line);
  }

  .mobile-tabs button {
    min-height: 36px;
    margin: 0;
    padding: 0 8px;
    text-align: center;
    font-size: 12px;
  }

  .workspace {
    grid-column: 1;
    grid-row: 3;
    padding: 12px;
  }

  .status-grid,
  .dashboard-grid,
  .schedule-layout,
  .notify-layout,
  .audit-grid,
  .staff-grid {
    grid-template-columns: 1fr;
  }

  .shift-card,
  .assignment-row,
  .request-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 13px;
  }

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

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  h1 {
    font-size: 19px;
  }

  h2 {
    font-size: 22px;
  }

  .form-grid,
  .profile-meta {
    grid-template-columns: 1fr;
  }

  .screen-head input {
    max-width: none;
  }
}
