/* Good Oil donation portal. Hand-written, no build step.
   Palette from the Good Oil brand sheet: Night Blue, Sky Blue, Victory Red, Chalk White. */

:root {
    --night-blue: #233261;
    --night-blue-dark: #1a2549;
    --sky-blue: #4698cb;
    --victory-red: #ed1b24;
    --red-text: #b3121a;
    --chalk: #f7f6f3;
    --white: #ffffff;
    --ink: #1d2433;
    --muted: #5d6578;
    --line: #dcdde3;
    --ok-bg: #e6f2f9;
    --err-bg: #fdeced;
    --radius: 6px;
    --font: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--chalk); }
img { max-width: 100%; }
a { color: var(--night-blue); }
a:hover { color: var(--sky-blue); }
:focus-visible { outline: 3px solid var(--sky-blue); outline-offset: 2px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 1rem; color: var(--night-blue); }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; color: var(--night-blue); }

/* Top bar */
.topbar { background: var(--white); border-bottom: 4px solid var(--night-blue); }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.brand img { display: block; height: 46px; width: auto; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a { padding: .45rem .8rem; border-radius: var(--radius); text-decoration: none; font-weight: 500; color: var(--night-blue); }
.nav a:hover { background: var(--chalk); }
.nav a.active { background: var(--night-blue); color: var(--white); }
.account { display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: var(--muted); }
.account form { margin: 0; }

/* Page */
.page { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.muted { color: var(--muted); }

/* Guest pages (login, reset) */
.guest { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.guest-card { width: 100%; max-width: 420px; }
.guest-card .brand { margin-bottom: 1.25rem; padding-inline: 2rem; }
.guest-card .brand img { display: block; width: 100%; height: auto; }
.guest-card .card { border-top: 4px solid var(--night-blue); }

/* Forms */
.field { margin-bottom: 1rem; }
label { display: block; font-weight: 500; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=number], input[type=search], select, textarea {
    width: 100%; padding: .6rem .7rem; font: inherit; color: var(--ink); background: var(--white);
    border: 1px solid #b9bcc8; border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus { border-color: var(--sky-blue); }
.check { display: flex; align-items: center; gap: .5rem; }
.check input { width: 1.1rem; height: 1.1rem; }
.check label { margin: 0; font-weight: 400; }
.hint { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
.error { color: var(--red-text); font-size: .9rem; margin-top: .25rem; }

/* Buttons */
.btn { display: inline-block; padding: .6rem 1.1rem; font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
    border: 2px solid var(--night-blue); border-radius: var(--radius); background: var(--night-blue); color: var(--white); }
.btn:hover { background: var(--night-blue-dark); color: var(--white); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-quiet { background: transparent; color: var(--night-blue); }
.btn-quiet:hover { background: var(--chalk); color: var(--night-blue); }
.btn-danger { background: var(--red-text); border-color: var(--red-text); }
.btn-danger:hover { background: #8f0e14; color: var(--white); }
.btn-small { padding: .3rem .7rem; font-size: .9rem; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--night-blue); text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--sky-blue); }

/* Messages */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border-left: 4px solid var(--sky-blue); background: var(--ok-bg); }
.alert-error { border-left-color: var(--victory-red); background: var(--err-bg); }
.text-error { color: var(--victory-red); font-weight: 700; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td.actions { white-space: nowrap; text-align: right; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 500; background: var(--ok-bg); color: var(--night-blue); }
.badge-off { background: #ececf0; color: var(--muted); }

/* Modal (replaces native confirm dialogs) */
.modal { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(29, 36, 51, .55); align-items: center; justify-content: center; padding: 1rem; }
.modal.open { display: flex; }
.modal-inner { background: var(--white); border-radius: var(--radius); max-width: 440px; width: 100%; padding: 1.5rem; border-top: 4px solid var(--victory-red); }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }

@media (max-width: 600px) {
    .topbar-inner { gap: .75rem; }
    .account { width: 100%; justify-content: space-between; }
    td.actions { white-space: normal; }
}

/* ---------- Public request form ---------- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.public-wrap { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.public-head { text-align: center; margin-bottom: 1.5rem; }
.public-head img { display: block; width: 100%; max-width: 280px; height: auto; margin: 0 auto 1rem; }
.public-head h1 { margin-bottom: .25rem; }
.form-section { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.form-section > h2 { padding-bottom: .5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.req-mark { color: var(--red-text); }
.notice { background: var(--ok-bg); border-left: 4px solid var(--sky-blue); padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .95rem; }
.notice p { margin: 0 0 .5rem; }
.notice p:last-child { margin-bottom: 0; }
.notice-privacy { background: var(--chalk); border-left-color: var(--night-blue); }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix > span { display: flex; align-items: center; padding: 0 .75rem; background: var(--chalk); border: 1px solid #b9bcc8; border-right: 0; border-radius: var(--radius) 0 0 var(--radius); color: var(--muted); }
.input-prefix > input { border-radius: 0 var(--radius) var(--radius) 0; }
.file-input { display: block; width: 100%; padding: .9rem; background: var(--chalk); border: 2px dashed #b9bcc8; border-radius: var(--radius); font: inherit; }
.field.has-error input, .field.has-error select, .field.has-error textarea, .field.has-error .file-input { border-color: var(--victory-red); }
.field-error { color: var(--red-text); font-size: .9rem; margin-top: .25rem; }
.small-print { font-size: .8rem; color: var(--muted); }
.btn-lg { padding: .8rem 1.8rem; font-size: 1.05rem; }
.ref-code { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.6rem; font-weight: 700; letter-spacing: .08em; color: var(--night-blue); background: var(--chalk); border: 2px dashed var(--night-blue); border-radius: var(--radius); padding: .4rem 1rem; }
.ref-small { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; color: var(--muted); letter-spacing: .04em; }

/* ---------- Staff: review board ---------- */
.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar input[type=search] { width: 260px; max-width: 100%; }
.toolbar select { width: auto; }
.board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 1rem; align-items: start; overflow-x: auto; padding-bottom: .5rem; }
.board-col { background: #eceef4; border-radius: var(--radius); padding: .75rem; min-width: 0; }
.board-col > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; font-weight: 700; color: var(--night-blue); }
.board-col .count { background: var(--white); border-radius: 999px; padding: 0 .55rem; font-size: .85rem; font-weight: 500; }
.board-empty { font-size: .9rem; color: var(--muted); padding: .5rem; }
.req-card { display: block; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--sky-blue); border-radius: var(--radius); padding: .7rem .8rem; margin-bottom: .7rem; text-decoration: none; color: var(--ink); }
.req-card:hover { box-shadow: 0 2px 8px rgba(35, 50, 97, .18); color: var(--ink); }
.req-card.is-new { border-left-color: var(--victory-red); }
.req-card h3 { font-size: 1rem; margin: 0 0 .3rem; color: var(--night-blue); }
.meta-row { display: flex; flex-wrap: wrap; gap: .25rem .6rem; font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.badge-new { background: var(--victory-red); color: var(--white); }
.badge-warn { background: #fff1d6; color: #7a4b00; }
.badge-approved { background: #e1f2e7; color: #17602f; }
.badge-denied { background: var(--err-bg); color: var(--red-text); }

/* ---------- Staff: request detail ---------- */
.crumb { margin-bottom: .75rem; font-size: .9rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.stack > * + * { margin-top: 1rem; }
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .4rem 1.25rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.status-line { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.action-box { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.btn-approve { background: #1c6b3a; border-color: #1c6b3a; }
.btn-approve:hover { background: #14502b; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 3px solid var(--line); margin-left: .3rem; padding: 0 0 .9rem .9rem; font-size: .92rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline small { display: block; color: var(--muted); }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.suggest { background: var(--chalk); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; margin-bottom: .75rem; }

/* ---------- Staff: history and trends ---------- */
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .4rem .9rem; border-radius: var(--radius); text-decoration: none; border: 1px solid var(--line); background: var(--white); color: var(--night-blue); font-weight: 500; }
.tabs a.active { background: var(--night-blue); color: var(--white); border-color: var(--night-blue); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile { background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--night-blue); border-radius: var(--radius); padding: 1rem; }
.tile .figure { font-size: 1.75rem; font-weight: 700; color: var(--night-blue); font-variant-numeric: tabular-nums; }
.tile .label { color: var(--muted); font-size: .9rem; }
.pager { display: flex; gap: .4rem; align-items: center; justify-content: flex-end; margin-top: 1rem; font-size: .9rem; color: var(--muted); }
.pager a { padding: .25rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); text-decoration: none; }

/* ---------- Design preview only ---------- */
.preview-bar { background: var(--night-blue-dark); color: var(--white); font-size: .85rem; padding: .4rem 1rem; text-align: center; }
.preview-bar a { color: var(--white); }
.email-frame { max-width: 640px; margin: 1.5rem auto; background: var(--white); border: 1px solid var(--line); }
.email-meta { background: var(--chalk); border-bottom: 1px solid var(--line); padding: .75rem 1rem; font-size: .9rem; }
.email-meta div + div { margin-top: .15rem; }
.email-body { padding: 1.25rem 1.5rem 1.5rem; }

@media (max-width: 860px) {
    .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .board { grid-template-columns: minmax(0, 1fr); overflow-x: visible; }
    dl.facts { grid-template-columns: minmax(0, 1fr); }
    dl.facts dt { margin-top: .5rem; }
}
