:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-soft: #f8fbfc;
  --ink: #18222d;
  --muted: #677485;
  --line: #dce5ec;
  --brand: #c9283f;
  --brand-dark: #971d30;
  --brand-soft: #fff0f2;
  --teal: #006f78;
  --teal-soft: #e5f5f6;
  --green: #147244;
  --amber: #9a5a00;
  --shadow: 0 18px 45px rgba(24, 34, 45, 0.1);
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  min-width: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(201, 40, 63, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(0, 111, 120, 0.08), transparent 32%),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

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

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
  height: 100vh;
  padding: 24px;
  color: #ffffff;
  background: #17212b;
}

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

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

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

.brand small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.68);
}

.main-nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.main-nav a {
  min-height: 44px;
  padding: 13px 14px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.main-nav a:hover,
.main-nav a.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar__note {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar__note strong {
  font-size: 2rem;
}

.sidebar__note span {
  color: rgba(255, 255, 255, 0.72);
}

.main-content {
  min-width: 0;
  padding: clamp(16px, 3vw, 28px);
}

.topbar {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto 22px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 4vw, 2rem);
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.view {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.primary-link,
.secondary-link,
.primary-button,
.ghost-button,
.action-button,
.danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.primary-link,
.primary-button {
  padding: 0 16px;
  color: #ffffff;
  background: var(--brand);
}

.primary-link:hover,
.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-link,
.ghost-button,
.action-button {
  padding: 0 14px;
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.danger-button {
  padding: 0 12px;
  color: #8c1822;
  background: #fdecee;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 240px);
  gap: 22px;
  align-items: center;
  margin-bottom: 22px;
  padding: clamp(22px, 4vw, 34px);
  overflow: hidden;
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: #ffffff;
  background:
    linear-gradient(115deg, rgba(91, 10, 24, 0.95), rgba(201, 40, 63, 0.86)),
    url("https://images.unsplash.com/photo-1615461066841-6116e61058f4?auto=format&fit=crop&w=1400&q=80")
      center / cover;
}

.hero-panel .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.hero-panel h2 {
  max-width: 720px;
  margin-bottom: 12px;
  font-size: clamp(1.85rem, 5vw, 2.45rem);
}

.hero-panel p {
  max-width: 650px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.6;
}

.hero-panel__metric {
  display: grid;
  gap: 4px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
}

.hero-panel__metric strong {
  font-size: clamp(2.15rem, 7vw, 3rem);
}

.stats-grid,
.content-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.content-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.75fr);
}

.panel,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(24, 34, 45, 0.06);
}

.panel {
  padding: 22px;
}

.stat-card {
  display: grid;
  gap: 8px;
  padding: 20px;
}

.stat-card span {
  color: var(--muted);
  font-weight: 700;
}

.stat-card strong {
  font-size: 2.1rem;
}

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

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.section-heading a {
  color: var(--teal);
  font-weight: 800;
}

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

.blood-item {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.blood-item strong {
  color: var(--brand-dark);
  font-size: 1.35rem;
}

.blood-item span,
.recent-item span,
.empty-state span {
  color: var(--muted);
}

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

.recent-item {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.blood-badge,
.status-pill {
  display: inline-flex;
  min-width: 48px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 800;
}

.blood-badge {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.status-pill {
  min-width: 104px;
  color: var(--green);
  background: #e9f8ef;
  font-size: 0.82rem;
}

.status-pill.is-unavailable {
  color: var(--amber);
  background: #fff4dd;
}

.donor-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: #2e3b49;
  font-size: 0.9rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #fbfdfe;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 111, 120, 0.14);
}

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

.form-grid--wide {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(72px, 0.35fr);
}

.form-grid--wide:first-of-type {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.75fr);
}

.toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.tools {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 160px;
  gap: 10px;
  min-width: min(100%, 540px);
}

.section-heading--stack {
  align-items: flex-start;
}

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

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

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td span {
  display: block;
}

.donor-email {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .sidebar {
    padding: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

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

.empty-state {
  display: grid;
  min-height: 190px;
  place-items: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.is-hidden {
  display: none;
}

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

  .sidebar {
    position: static;
    grid-template-columns: minmax(210px, auto) minmax(0, 1fr);
    align-items: center;
    height: auto;
    gap: 18px;
  }

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

  .main-nav a {
    text-align: center;
  }

  .sidebar__note {
    display: none;
  }

  .hero-panel,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel__metric {
    max-width: 280px;
  }

  .form-grid,
  .form-grid--wide,
  .form-grid--wide:first-of-type {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .main-content,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .section-heading,
  .section-heading--stack {
    display: grid;
    align-items: start;
  }

  .topbar {
    gap: 14px;
  }

  .primary-link,
  .primary-button,
  .secondary-link,
  .ghost-button {
    width: 100%;
  }

  .hero-panel {
    padding: 24px;
  }

  .hero-panel__metric {
    max-width: none;
  }

  .stats-grid,
  .form-grid,
  .form-grid--wide,
  .form-grid--wide:first-of-type,
  .tools,
  .blood-grid {
    grid-template-columns: 1fr;
  }

  .main-nav {
    grid-template-columns: 1fr;
  }

  .brand {
    justify-content: center;
  }

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

  thead {
    display: none;
  }

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

  td {
    display: grid;
    grid-template-columns: minmax(82px, 0.35fr) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: stretch;
  }

  .row-actions::before {
    content: "";
  }

  .action-button,
  .danger-button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  body {
    background: var(--bg);
  }

  .sidebar {
    padding: 14px;
  }

  .brand {
    justify-content: flex-start;
  }

  .brand__mark {
    width: 40px;
    height: 40px;
  }

  .main-content {
    padding: 14px;
  }

  .panel,
  .stat-card {
    box-shadow: none;
  }

  .panel {
    padding: 16px;
  }

  .hero-panel {
    margin-right: -14px;
    margin-left: -14px;
    border-radius: 0;
  }

  .stats-grid {
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-card strong {
    font-size: 1.75rem;
  }

  .recent-item {
    display: grid;
    align-items: start;
  }

  .blood-badge,
  .status-pill {
    justify-self: start;
  }

  .form-actions {
    display: grid;
  }

  td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  td::before {
    font-size: 0.78rem;
    text-transform: uppercase;
  }

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

  .row-actions::before {
    display: none;
  }
}

@media (max-width: 380px) {
  .main-content,
  .sidebar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .hero-panel {
    margin-right: -10px;
    margin-left: -10px;
    padding: 18px;
  }

  .panel {
    padding: 14px;
  }

  .main-nav a,
  .primary-link,
  .secondary-link,
  .primary-button,
  .ghost-button,
  .action-button,
  .danger-button {
    min-height: 40px;
  }
}
