:root {
  color: #202720;
  background: #efede4;
  font-family: 'Avenir Next', 'Segoe UI', sans-serif;
  font-synthesis: none;
  --paper: #f8f6ee;
  --canvas: #efede4;
  --ink: #202720;
  --forest: #173c32;
  --forest-dark: #112d26;
  --moss: #dce6d8;
  --lime: #e4f190;
  --muted: #566158;
  --line: #d9dbcf;
  --white: #fffdf6;
  --error: #8a302a;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .61; }
a { color: inherit; }
:focus-visible { outline: 3px solid #567c55; outline-offset: 3px; }
h1, h2, p, dl, dd { margin: 0; }
h1, h2 { overflow-wrap: anywhere; }
h1 { font: 600 clamp(2.9rem, 5.6vw, 5.15rem)/.98 Georgia, 'Times New Roman', serif; letter-spacing: -.07em; }
h2 { font: 600 clamp(1.42rem, 2.2vw, 1.95rem)/1.06 Georgia, 'Times New Roman', serif; letter-spacing: -.035em; }
.muted { color: var(--muted); }
.eyebrow { color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .13em; line-height: 1.4; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.brand { display: inline-flex; align-items: center; gap: .75rem; width: fit-content; color: inherit; text-decoration: none; font-weight: 750; font-size: 1.28rem; letter-spacing: -.055em; }
.brand-mark { width: 1.7rem; height: 1.7rem; background: var(--forest); color: var(--lime); border-radius: .42rem; display: grid; place-content: center; }
.brand-mark::after { content: ''; width: .68rem; height: .68rem; border: solid currentColor; border-width: 0 0 2px 2px; transform: skewY(-20deg); box-shadow: 3.5px -3.5px 0 -1px var(--forest), 4.5px -4.5px currentColor; }

.sign-in { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; min-height: 100svh; }
.sign-poster { display: grid; place-items: center; position: relative; overflow: hidden; min-height: 28rem; background: var(--forest-dark); }
.sign-poster::before { content: ''; position: absolute; inset: 0; opacity: .36; background: repeating-linear-gradient(0deg, transparent 0 41px, #517868 41px 42px), repeating-linear-gradient(90deg, transparent 0 41px, #517868 41px 42px); mask-image: linear-gradient(128deg, #000, #0002); }
.poster-mark { width: min(52%, 23rem); aspect-ratio: 1; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); gap: .42rem; transform: rotate(-15deg) skew(-5deg); animation: reveal .45s ease both; }
.poster-mark i { display: block; background: var(--lime); border: 1px solid #edf6a9; border-radius: 6px; }
.poster-mark i:nth-child(1) { grid-area: 2 / 1 / 4 / 2; background: #a1b66b; }
.poster-mark i:nth-child(2) { grid-area: 1 / 2 / 3 / 3; background: #c9da80; }
.poster-mark i:nth-child(3) { grid-area: 3 / 2 / 4 / 3; background: #b4c877; }
.poster-mark i:nth-child(4) { grid-area: 1 / 3 / 4 / 4; }
.sign-content { display: grid; grid-template-rows: auto 1fr; gap: 2rem; align-items: center; justify-items: start; padding: clamp(1.3rem, 6vw, 6rem); background: var(--paper); }
.sign-card { max-width: 29rem; padding-bottom: clamp(0rem, 6vh, 5rem); display: grid; gap: 1.18rem; }
.sign-card h1 { font-size: clamp(2.8rem, 5vw, 4.65rem); }
.sign-card > p:not(.eyebrow) { max-width: 34ch; line-height: 1.55; }
.sign-card form { margin-top: .8rem; }
.sign-card button { justify-self: start; min-width: 8rem; }

.app { display: grid; grid-template-columns: 14rem minmax(0, 1fr); min-height: 100vh; min-height: 100svh; }
.rail { align-self: start; position: sticky; top: 0; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; padding: 2.35rem 1.25rem 1.35rem; background: var(--forest-dark); color: var(--paper); }
.rail .brand { margin-left: .62rem; }
.rail .brand-mark { background: var(--lime); color: var(--forest); }
.rail .brand-mark::after { box-shadow: 3.5px -3.5px 0 -1px var(--lime), 4.5px -4.5px currentColor; }
.rail :focus-visible { outline-color: var(--lime); }
.rail nav { display: grid; gap: .27rem; margin-top: 3.15rem; }
.nav-link { display: flex; align-items: center; gap: .65rem; padding: .75rem .7rem; min-height: 2.7rem; border-radius: .48rem; color: #d4e1d8; font-size: .91rem; text-decoration: none; font-weight: 610; }
.nav-link::before { content: ''; width: .46rem; height: .46rem; border: 1px solid #95ac9e; border-radius: 50%; }
.nav-link:hover { background: #21463a; }
.nav-link[aria-current='page'] { background: var(--lime); color: var(--forest-dark); }
.nav-link[aria-current='page']::before { border-color: var(--forest-dark); background: var(--forest-dark); }
.button.exit { align-self: flex-start; margin-top: auto; background: transparent; color: #e0e9df; border-color: #587467; }
.button.exit:hover { background: #21463a; }
.workspace { max-width: 105rem; width: 100%; justify-self: center; min-width: 0; padding: clamp(1.25rem, 4.3vw, 5rem); }
.view { display: grid; gap: 1.25rem; animation: reveal .2s ease both; }
@keyframes reveal { from { opacity: 0; } to { opacity: 1; } }
.page-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; padding-bottom: clamp(.55rem, 2.6vw, 2.3rem); }
.page-heading div { display: grid; gap: .82rem; }
.page-heading .button { margin-bottom: .25rem; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: .37em; padding: .58rem .91rem; min-height: 2.65rem; border: 1px solid transparent; border-radius: .5rem; text-decoration: none; font-size: .88rem; line-height: 1.23; font-weight: 710; transition: background .14s, color .14s, border-color .14s; }
.button.primary { background: var(--forest); color: var(--white); }
.button.primary:hover { background: #25584a; }
.button.secondary { background: var(--paper); border-color: var(--line); color: var(--forest); }
.button.secondary:hover { background: var(--moss); border-color: #bac9ba; }
.button.small { min-height: 2.25rem; padding: .37rem .63rem; font-size: .81rem; }
.icon-button { background: transparent; color: var(--ink); font: inherit; font-size: 1.45rem; line-height: 1; min-height: 2.3rem; min-width: 2.3rem; padding: .24rem; }
.icon-button:hover { background: var(--moss); }

.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.field { display: grid; min-width: 0; gap: .32rem; color: #344137; font-size: .79rem; font-weight: 700; }
.field input:not([type='checkbox']), .field select { width: 100%; min-height: 2.65rem; min-width: 0; border: 1px solid #cdd3c7; border-radius: .5rem; padding: .5rem .61rem; background: var(--white); color: var(--ink); font-weight: 550; font-size: .91rem; }
.field select { padding-right: 1.25rem; }
.field input::placeholder { color: #637367; opacity: 1; }
.field input[type='file'] { padding: .3rem; }
.field input[type='file']::file-selector-button { margin-right: .45rem; border: 0; padding: .4rem; border-radius: .25rem; background: var(--moss); color: var(--ink); font: inherit; cursor: pointer; }
.field :disabled { opacity: .65; }
.filter-org { flex: 1 1 10rem; max-width: 16rem; }
.grow { flex: 1 1 12rem; }
.check { display: inline-flex; align-items: center; gap: .5rem; width: fit-content; color: var(--muted); font-weight: 650; font-size: .82rem; }
.check input { margin: 0; accent-color: var(--forest); width: 1.1rem; height: 1.1rem; }
.toolbar-check { min-height: 2.65rem; }
.field-help { margin-top: -.55rem; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.message { padding: .75rem .9rem; border-radius: .55rem; background: var(--moss); color: var(--ink); font-size: .87rem; line-height: 1.42; }
.message.error { color: var(--error); background: #f7e5df; }
#global-status { margin-bottom: .9rem; }

.report-data, .form-stack { display: grid; gap: 1.12rem; }
.metrics { display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); gap: .55rem; }
.metric { min-width: 0; min-height: 7rem; display: grid; gap: .75rem; align-content: space-between; padding: clamp(.75rem, 1.5vw, 1.25rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.metric dt { color: var(--muted); font-size: .82rem; font-weight: 650; }
.metric dd { font: 600 clamp(1.32rem, 2.6vw, 2.65rem)/1.04 Georgia, 'Times New Roman', serif; overflow-wrap: anywhere; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.metric-feature { background: var(--forest); border-color: var(--forest); color: var(--lime); }
.metric-feature dt { color: #e1eadb; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; padding: 1.18rem 1rem; }
.order-filter select { min-height: 2.15rem; }
.table-wrap { position: relative; overflow-x: auto; }
.table-wrap:focus-visible { outline-offset: -3px; }
table { width: 100%; border-spacing: 0; font-size: .87rem; line-height: 1.35; }
th, td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { background: #e6e9dd; color: #465348; font-size: .72rem; font-weight: 725; letter-spacing: .045em; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover { background: #f0f1e7; }
tbody th { min-width: 9rem; font-weight: 680; overflow-wrap: anywhere; }
tbody td { overflow-wrap: anywhere; }
.number { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.row-action { text-align: right; }
.empty { padding: 1.7rem 1rem; color: var(--muted); }
.badge { width: fit-content; display: inline-block; border-radius: .35rem; padding: .25rem .42rem; color: #434d43; background: #e5e7dd; font-size: .76rem; font-weight: 710; white-space: nowrap; }
.badge.paid_manual, .badge.active { color: #25472c; background: #dfebd9; }
.badge.pending { color: #59460c; background: #f0e8bc; }
.badge.cancelled { color: #743e39; background: #f0e1db; }

.org-list { display: grid; gap: .7rem; }
.org-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(9rem, .4fr) auto; align-items: center; gap: 1rem; padding: 1.14rem 1.05rem; border: 1px solid var(--line); border-left: 4px solid #829f76; border-radius: var(--radius); background: var(--paper); }
.org-card.archived { border-left-color: #aeafa3; }
.org-title { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.org-card dl, .order-meta { display: grid; gap: .3rem; }
.org-card dl div, .order-meta div { display: grid; grid-template-columns: minmax(5rem, 1fr) minmax(4rem, 1fr); gap: .6rem; }
.org-card dt, .order-meta dt { color: var(--muted); font-size: .82rem; }
.org-card dd, .order-meta dd { font-weight: 700; font-size: .82rem; overflow-wrap: anywhere; }

dialog { width: min(100% - 1.75rem, 33rem); max-height: calc(100% - 1.75rem); padding: 1.3rem; border: 1px solid var(--line); border-radius: calc(var(--radius) + 3px); background: var(--paper); color: var(--ink); box-shadow: 0 1rem 4rem #16291d30; }
dialog::backdrop { background: #152b23a3; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: .7rem; margin-bottom: 1.05rem; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .55rem; margin-top: .2rem; }
.payment-options { min-inline-size: 0; margin: 0; padding: .7rem .7rem .9rem; border: 1px solid var(--line); border-radius: .6rem; }
.payment-options legend { padding: 0 .26rem; color: var(--muted); font-size: .83rem; font-weight: 700; }
.qr-preview { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.qr-preview img { width: 6rem; height: 6rem; object-fit: contain; background: white; border: 1px solid var(--line); border-radius: .35rem; }
#order-dialog { width: min(100% - 1.75rem, 42rem); }
#order-dialog .table-wrap { margin-block: .85rem; border: 1px solid var(--line); border-radius: .5rem; }

@media (max-width: 860px) {
  .app { grid-template-columns: 10.5rem minmax(0, 1fr); }
  .rail { padding-inline: .8rem; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .app { display: block; }
  .rail { position: static; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .8rem; padding: .72rem 1rem; }
  .rail .brand { margin: 0; }
  .rail nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; margin: 0; }
  .rail .exit { grid-column: 2; grid-row: 1; margin: 0; }
  .nav-link { min-height: 2.25rem; padding: .4rem .56rem; }
  .workspace { padding: 1rem .85rem 2rem; }
  .sign-in { grid-template-columns: 1fr; grid-template-rows: minmax(8rem, 24vh) 1fr; }
  .sign-poster { min-height: 0; }
  .poster-mark { width: min(28vw, 9rem); }
  .sign-content { padding: 1.35rem; align-content: start; }
  .sign-card { padding-bottom: 0; }
  .toolbar .filter-org { max-width: none; }
  #report-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #report-filters .filter-org, #report-submit { grid-column: 1 / -1; }
  #report-submit { justify-self: start; }
  .org-card { grid-template-columns: minmax(0, 1fr) auto; }
  .org-card dl { grid-row: 2; grid-column: 1 / -1; }
  .org-card .button { grid-row: 1; grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
