:root {
  --ink: #17211c;
  --muted: #69766f;
  --line: #dce4df;
  --paper: #fff;
  --wash: #f3f6f4;
  --green: #125f3d;
  --green-dark: #0a432a;
  --green-soft: #e5f3eb;
  --red: #ae2d35;
  --red-soft: #fae9e9;
  --amber: #8a5a0a;
  --amber-soft: #fff3d5;
  --shadow: 0 18px 60px rgba(24, 45, 34, .12);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.topbar {
  min-height: 72px;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand b { display: block; font-size: .98rem; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: .72rem; }
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  letter-spacing: -.05em;
  box-shadow: 0 10px 24px rgba(18, 95, 61, .22);
}
.brand-mark-small { width: 42px; height: 42px; border-radius: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; font-size: .82rem; }
.user-chip { color: var(--muted); }
.text-link { color: var(--green); font-weight: 700; }

.status-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.status-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 700;
}
.status-tab span {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 99px;
  background: #e9eeeb;
  text-align: center;
  font-size: .72rem;
}
.status-tab.active { background: var(--green); color: #fff; }
.status-tab.active span { background: rgba(255,255,255,.17); }

.toast {
  position: fixed;
  z-index: 40;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  padding: 11px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: .83rem;
  font-weight: 700;
}
.toast-success { color: var(--green-dark); background: #dff4e8; border: 1px solid #b9e2ca; }
.toast-error { color: #842027; background: #ffe8e9; border: 1px solid #f2c2c5; }

.review-layout {
  min-height: calc(100vh - 129px);
  display: grid;
  grid-template-columns: minmax(440px, 46%) minmax(0, 54%);
}
.details-panel {
  padding: clamp(28px, 4vw, 58px);
  background: #fff;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.review-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: clamp(2rem, 3vw, 3.2rem); line-height: 1; letter-spacing: -.05em; }
.reference-number { margin: 12px 0 0; color: var(--muted); font: 700 .82rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.status-badge { padding: 7px 11px; border-radius: 999px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.status-pending { color: var(--amber); background: var(--amber-soft); }
.status-approved { color: var(--green); background: var(--green-soft); }
.status-rejected { color: var(--red); background: var(--red-soft); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 38px 0 30px;
  border-top: 1px solid var(--line);
}
.detail-grid > div { padding: 18px 18px 18px 0; border-bottom: 1px solid var(--line); }
.detail-grid > div:nth-child(even) { padding-left: 18px; border-left: 1px solid var(--line); }
.detail-grid .detail-wide { grid-column: 1 / -1; padding-left: 0; border-left: 0; }
.detail-grid dt { margin-bottom: 7px; color: var(--muted); font-size: .69rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.detail-grid dd { margin: 0; font-size: .96rem; line-height: 1.4; font-weight: 650; overflow-wrap: anywhere; }
.detail-grid .amount { color: var(--green); font-size: 1.2rem; }

.decision-card, .decision-summary {
  padding: 22px;
  border: 1px solid #cddbd3;
  border-radius: 18px;
  background: #f8fbf9;
}
.pin-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.pin-row label { font-weight: 800; font-size: .92rem; }
.pin-row p { margin: 5px 0 0; color: var(--muted); font-size: .75rem; }
.pin-form input {
  width: 92px;
  padding: 11px;
  border: 1px solid #b8c9bf;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  outline: none;
}
.pin-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18,95,61,.12); }
.decision-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.button {
  min-height: 44px;
  padding: 11px 18px;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .86rem;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.button:hover { transform: translateY(-1px); }
.button-primary, .button-approve { color: #fff; background: var(--green); box-shadow: 0 8px 20px rgba(18,95,61,.18); }
.button-primary:hover, .button-approve:hover { background: var(--green-dark); }
.button-reject { color: var(--red); background: #fff; border: 1px solid #e6bfc2; }
.button-reject-solid { color: #fff; background: var(--red); }
.button-quiet { color: var(--muted); background: #e8eeea; }
.button-block { width: 100%; }
.reject-form { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.reject-form label { display: block; margin-bottom: 8px; font-size: .78rem; font-weight: 800; }
.reject-form textarea {
  width: 100%;
  padding: 12px;
  resize: vertical;
  border: 1px solid #d5b3b6;
  border-radius: 10px;
  outline: none;
  background: #fff;
}
.reject-form textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(174,45,53,.1); }
.reject-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 10px; }
.decision-summary h2 { margin: 0 0 8px; font-size: 1.35rem; }
.decision-summary > p:not(.eyebrow) { color: #4e5c54; line-height: 1.55; }
.decision-summary small { color: var(--muted); }

.record-navigation { display: flex; justify-content: space-between; margin-top: 20px; }
.nav-button { color: var(--green); font-size: .82rem; font-weight: 800; }

.receipt-panel { min-width: 0; padding: clamp(18px, 2vw, 30px); background: #e7ece9; display: flex; flex-direction: column; }
.receipt-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; color: #526159; font-size: .76rem; font-weight: 800; }
.receipt-toolbar a { color: var(--green); }
.receipt-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #35a56c; box-shadow: 0 0 0 4px rgba(53,165,108,.12); }
.receipt-stage {
  min-height: 500px;
  flex: 1;
  overflow: auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #cfd7d2;
  background-image: radial-gradient(rgba(26,49,37,.13) .65px, transparent .65px);
  background-size: 7px 7px;
  box-shadow: inset 0 1px 6px rgba(24,45,34,.08);
}
.receipt-stage img { display: block; max-width: calc(100% - 44px); max-height: calc(100vh - 215px); margin: 22px; object-fit: contain; background: #fff; box-shadow: 0 20px 55px rgba(17,38,27,.22); }
.receipt-stage iframe { width: 100%; height: 100%; min-height: 680px; border: 0; border-radius: 18px; background: #fff; }
.unsupported-preview { max-width: 360px; padding: 32px; border-radius: 16px; background: #fff; text-align: center; box-shadow: var(--shadow); }
.unsupported-preview p { color: var(--muted); line-height: 1.5; }

.empty-state { min-height: calc(100vh - 150px); display: grid; place-content: center; text-align: center; padding: 40px; }
.empty-state h1 { font-size: 2.4rem; }
.empty-state > p:last-child { color: var(--muted); }
.empty-icon { width: 70px; height: 70px; margin: 0 auto 24px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 1.7rem; font-weight: 900; }

.login-page { min-height: 100vh; background: radial-gradient(circle at 20% 15%, #e1efe7, transparent 34%), #eff4f1; }
.login-shell { min-height: 100vh; padding: 24px; display: grid; place-items: center; }
.login-card { width: min(430px, 100%); padding: 38px; border: 1px solid rgba(205,219,211,.9); border-radius: 24px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.login-card h1 { margin-top: 4px; font-size: 2.5rem; }
.login-card .brand-mark { margin-bottom: 28px; }
.login-intro { margin: 14px 0 28px; color: var(--muted); line-height: 1.55; }
.login-form { display: grid; gap: 15px; }
.login-form label span { display: block; margin-bottom: 7px; font-size: .75rem; font-weight: 800; }
.login-form input { width: 100%; padding: 12px 13px; border: 1px solid #cbd7d0; border-radius: 10px; outline: none; }
.login-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18,95,61,.1); }
.alert { margin-bottom: 18px; padding: 11px 13px; border-radius: 9px; font-size: .8rem; }
.alert-error { color: #842027; background: var(--red-soft); }

[hidden] { display: none !important; }

@media (max-width: 980px) {
  .review-layout { grid-template-columns: 1fr; }
  .details-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .receipt-panel { min-height: 70vh; }
  .receipt-stage img { max-height: none; }
}

@media (max-width: 600px) {
  .topbar { padding: 10px 16px; }
  .user-chip { display: none; }
  .status-tabs { padding: 12px 14px; overflow-x: auto; }
  .details-panel { padding: 28px 18px; }
  .review-heading { align-items: flex-start; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid > div:nth-child(even) { padding-left: 0; border-left: 0; }
  .detail-grid .detail-wide { grid-column: auto; }
  .pin-row { align-items: flex-start; }
  .decision-actions { grid-template-columns: 1fr; }
  .receipt-panel { padding: 14px; }
  .receipt-toolbar { padding: 0 4px; }
  .login-card { padding: 28px 22px; }
}

