:root {
  color-scheme: light;
  --ink: #172139;
  --navy: #132d55;
  --navy-soft: #eaf0f8;
  --green: #0b3d2e;
  --green-2: #1d6b50;
  --green-soft: #e9f4ef;
  --gold: #b68c3c;
  --gold-soft: #f4ead0;
  --red: #cf202e;
  --cream: #f8f5ee;
  --white: #fff;
  --muted: #667286;
  --line: #dfe5eb;
  --shadow: 0 20px 55px rgba(20, 45, 82, 0.11);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--cream);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 100% 0%, rgba(70, 154, 117, 0.16), transparent 32rem),
    var(--cream);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(31, 106, 80, 0.25);
  outline-offset: 2px;
}
h1, h2, h3, h4 { font-family: Georgia, "Times New Roman", serif; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(290px, 370px) 1fr auto;
  align-items: center;
  gap: 26px;
  padding: 14px clamp(18px, 4vw, 64px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(182, 140, 60, 0.36);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 17px; min-width: 0; }
.brand img { width: 74px; height: 88px; object-fit: contain; flex: 0 0 auto; }
.brand h1 { margin: 0; color: var(--navy); font-size: clamp(25px, 3vw, 39px); line-height: 0.98; }
.brand small { display: block; margin-top: 7px; color: var(--muted); }
.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.topbar nav {
  justify-self: center;
  display: flex;
  gap: 5px;
  padding: 5px;
  border-radius: 999px;
  background: #eef2f3;
}
.role {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  text-transform: capitalize;
  white-space: nowrap;
}
.role.active { background: var(--green); color: white; box-shadow: 0 7px 18px rgba(11, 61, 46, 0.23); }
.post {
  border: 0;
  border-radius: 13px;
  padding: 12px 17px;
  background: var(--red);
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 25px rgba(207, 32, 46, 0.2);
}

main { width: min(1500px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 70px; }
.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 30px;
  padding: clamp(25px, 4vw, 54px);
  border-radius: 30px;
  color: white;
  background: linear-gradient(132deg, rgba(11, 61, 46, 0.98), rgba(19, 45, 85, 0.98));
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  right: -175px;
  bottom: -240px;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  box-shadow: 0 0 0 54px rgba(255, 255, 255, 0.045), 0 0 0 108px rgba(255, 255, 255, 0.025);
}
.hero > div { position: relative; z-index: 1; }
.hero h2 { max-width: 880px; margin: 0 0 18px; font-size: clamp(38px, 5vw, 72px); line-height: 0.98; }
.hero > div > p:not(.eyebrow) { max-width: 820px; margin: 0; color: rgba(255, 255, 255, 0.83); font-size: clamp(16px, 2vw, 20px); line-height: 1.55; }
.hero .eyebrow { color: #ffdb83; }
.badges { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 25px; }
.badges span { padding: 9px 12px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 13px; font-weight: 760; }
.model { align-self: center; position: relative; z-index: 1; padding: 23px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 22px; background: rgba(255, 255, 255, 0.1); }
.model h3 { margin: 0 0 8px; font-size: 24px; }
.model p { display: grid; grid-template-columns: 1fr auto; gap: 14px; margin: 0; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.86); }
.model p:last-child { border-bottom: 0; }
.model b { color: #ffdc89; text-align: right; }

.flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(145px, 1fr));
  gap: 10px;
  margin: 24px 0;
  overflow-x: auto;
  padding-bottom: 6px;
}
.flow article { position: relative; min-width: 145px; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.flow article:not(:last-child)::after { content: "→"; position: absolute; z-index: 2; right: -10px; top: 43%; color: var(--gold); font-size: 20px; font-weight: 900; }
.flow i { display: grid; place-items: center; width: 31px; height: 31px; margin-bottom: 12px; border-radius: 50%; background: var(--navy); color: white; font-style: normal; font-weight: 900; }
.flow b { display: block; color: var(--navy); font-size: 13px; letter-spacing: 0.07em; text-transform: uppercase; }
.flow small { display: block; margin-top: 7px; color: var(--muted); line-height: 1.4; }

.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin: 22px 0; }
.metrics article { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.metrics span { color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.metrics b { display: block; margin-top: 7px; color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: 31px; }
.metrics small { display: block; margin-top: 5px; color: var(--green-2); }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, 0.72fr); gap: 22px; }
.panel { padding: clamp(18px, 2.4vw, 28px); border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 10px 30px rgba(19, 45, 85, 0.05); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-head h3 { margin: 0; color: var(--navy); font-size: 28px; }
.panel-head p { margin: 5px 0 0; color: var(--muted); }
.primary, .secondary { border-radius: 12px; padding: 11px 14px; font-weight: 850; }
.primary { border: 0; background: var(--green); color: white; }
.secondary { border: 1px solid var(--line); background: white; color: var(--navy); }

.list { display: grid; gap: 12px; }
.card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
  color: inherit;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.card:hover, .card.selected { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 12px 24px rgba(19, 45, 85, 0.08); }
.card small, .detail-title small { color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }
.card h4 { margin: 6px 0; color: var(--navy); font-family: inherit; font-size: 18px; }
.card p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.status { align-self: start; padding: 7px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.status.available { background: #fff2d7; color: #7d5908; }
.status.receipt_issued { background: var(--navy-soft); color: var(--navy); }
.status.rejected, .status.cancelled, .status.recalled { background: #ffe8ea; color: #9f1823; }

.detail { min-height: 560px; }
.empty { min-height: 450px; display: grid; place-items: center; color: var(--muted); text-align: center; }
.detail-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.detail-title h3 { margin: 6px 0 0; color: var(--navy); font-size: 31px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; }
.facts > div { padding: 13px; border-radius: 14px; background: var(--cream); }
.facts span { display: block; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: 0.07em; text-transform: uppercase; }
.facts b { display: block; margin-top: 6px; line-height: 1.35; }
.detail table { width: 100%; margin: 18px 0; border-collapse: collapse; }
.detail th, .detail td { padding: 11px 6px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
.detail th { color: var(--muted); font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; }
.detail > aside { margin: 17px 0; padding: 14px 16px; border: 1px solid #e2d2ab; border-radius: 14px; background: #fff9ea; color: #67562e; font-size: 13px; line-height: 1.5; }
.detail > h4 { margin: 25px 0 5px; color: var(--navy); font-size: 22px; }
.ledger { max-height: 360px; overflow: auto; padding-right: 4px; }
.ledger article { display: grid; grid-template-columns: 28px 1fr; gap: 11px; min-height: 78px; }
.ledger article > i { position: relative; width: 13px; height: 13px; margin: 5px auto 0; border-radius: 50%; background: var(--green); }
.ledger article:not(:last-child) > i::after { content: ""; position: absolute; left: 6px; top: 13px; width: 1px; height: 66px; background: var(--line); }
.ledger b { color: var(--navy); font-size: 12px; text-transform: capitalize; }
.ledger p { margin: 4px 0 2px; font-size: 13px; }
.ledger small { color: var(--muted); }
.ledger code { display: block; max-width: 440px; overflow: hidden; margin-top: 4px; color: #7a8494; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.categories { margin-top: 22px; }
.categories > div:last-child { display: grid; grid-template-columns: repeat(10, 1fr); gap: 9px; }
.categories > div:last-child > span { padding: 12px 8px; border: 1px solid var(--line); border-radius: 14px; color: var(--navy); font-size: 11px; font-weight: 800; text-align: center; }
.categories i { display: block; margin-bottom: 6px; font-size: 22px; font-style: normal; }
.notice { display: block; margin-top: 22px; padding: 18px 22px; border: 1px solid #d9ceb3; border-radius: 17px; background: #fffaf0; color: #67562e; font-size: 13px; line-height: 1.5; }
.page-footer { padding: 30px 20px 50px; color: var(--muted); font-size: 12px; text-align: center; }
.toast { position: fixed; z-index: 60; right: 20px; bottom: 20px; max-width: min(420px, calc(100% - 40px)); padding: 14px 17px; border-radius: 13px; background: var(--navy); color: white; box-shadow: var(--shadow); }

#donation-dialog {
  width: min(920px, calc(100% - 30px));
  max-height: min(920px, calc(100vh - 28px));
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  box-shadow: 0 32px 90px rgba(8, 28, 48, 0.36);
}
#donation-dialog::backdrop { background: rgba(7, 25, 39, 0.64); backdrop-filter: blur(6px); }
#donation-dialog form { background: white; }
#donation-dialog header { display: flex; justify-content: space-between; gap: 24px; padding: 26px 30px 21px; border-bottom: 1px solid var(--line); background: linear-gradient(140deg, white, var(--cream)); }
#donation-dialog h2 { margin: 0; color: var(--navy); font-size: 35px; }
#donation-dialog header p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); line-height: 1.45; }
.close { flex: 0 0 auto; width: 39px; height: 39px; border: 0; border-radius: 50%; background: #edf1f3; color: var(--navy); font-size: 25px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; padding: 26px 30px; }
.form-grid label { display: grid; align-content: start; gap: 7px; color: var(--navy); font-size: 11px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.form-grid label.wide { grid-column: span 2; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid #cfd7df; border-radius: 11px; outline: 0; background: white; color: var(--ink); letter-spacing: 0; text-transform: none; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(31, 106, 80, 0.12); }
.form-grid textarea { resize: vertical; }
.form-grid label.check { grid-column: span 3; display: grid; grid-template-columns: auto 1fr; gap: 11px; align-items: start; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--cream); letter-spacing: 0; text-transform: none; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--green); }
.check b { display: block; color: var(--navy); font-size: 13px; }
.check small { display: block; margin-top: 3px; color: var(--muted); font-weight: 500; line-height: 1.4; }
#donation-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 30px 25px; border-top: 1px solid var(--line); background: #fbfcfc; }
#donation-dialog footer > span { max-width: 500px; color: var(--muted); font-size: 12px; line-height: 1.45; }
#donation-dialog footer > div { display: flex; gap: 10px; }

@media (max-width: 1120px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar nav { grid-column: 1 / -1; order: 3; justify-self: stretch; overflow-x: auto; }
  .hero { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .categories > div:last-child { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 720px) {
  .topbar { gap: 11px; padding: 11px 14px; }
  .brand { gap: 10px; }
  .brand img { width: 54px; height: 65px; }
  .brand h1 { font-size: 24px; }
  .brand small, .brand .eyebrow { display: none; }
  .post { padding: 10px 11px; font-size: 12px; }
  .role { padding: 9px 12px; font-size: 12px; }
  main { width: calc(100% - 20px); padding-top: 12px; }
  .hero { padding: 25px 20px; border-radius: 22px; }
  .hero h2 { font-size: 40px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics article:last-child { grid-column: 1 / -1; }
  .panel { padding: 16px; border-radius: 18px; }
  .panel-head { align-items: flex-start; }
  .card { grid-template-columns: 1fr; }
  .status { justify-self: start; }
  .facts { grid-template-columns: 1fr; }
  .detail table { display: block; overflow-x: auto; }
  .categories > div:last-child { grid-template-columns: repeat(3, 1fr); }
  #donation-dialog { width: calc(100% - 14px); max-height: calc(100vh - 14px); border-radius: 18px; }
  #donation-dialog header { padding: 20px 18px 17px; }
  #donation-dialog h2 { font-size: 28px; }
  .form-grid { grid-template-columns: 1fr; padding: 20px 18px; }
  .form-grid label.wide, .form-grid label.check { grid-column: auto; }
  #donation-dialog footer { align-items: stretch; flex-direction: column; padding: 17px 18px 20px; }
  #donation-dialog footer > div { display: grid; grid-template-columns: 1fr 1fr; }
}
