:root {
    --green: #1a6b4a;
    --green-dark: #105239;
    --green-soft: #e8f3ee;
    --background: #f6f6f4;
    --surface: #ffffff;
    --text: #22262a;
    --muted: #626a70;
    --border: #d8ddd9;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --warning: #8a5a00;
    --shadow: 0 12px 34px rgba(28, 45, 36, .09);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top right, #e4eee8 0, transparent 32rem), var(--background);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--green); text-underline-offset: 3px; }
a:hover { color: var(--green-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(26, 107, 74, .3); outline-offset: 2px; }
.site-header { min-height: 68px; display: flex; align-items: center; padding: 0 5vw; border-bottom: 1px solid rgba(26,107,74,.12); background: rgba(255,255,255,.82); }
.brand { color: var(--green-dark); font-weight: 800; letter-spacing: -.02em; text-decoration: none; }
.container { width: min(calc(100% - 32px), 1040px); margin: 0 auto; padding: 56px 0; min-height: calc(100vh - 132px); }
.site-footer { padding: 22px; text-align: center; color: var(--muted); font-size: .875rem; }
.card { background: var(--surface); border: 1px solid rgba(26,107,74,.12); border-radius: 16px; box-shadow: var(--shadow); }
.form-card { width: 100%; max-width: 560px; margin: 0 auto; padding: clamp(24px, 5vw, 42px); overflow-wrap: anywhere; }
.form-card form { display: grid; gap: 22px; }
h1, h2 { line-height: 1.15; letter-spacing: -.025em; margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(1.8rem, 5vw, 2.5rem); }
h2 { font-size: 1.25rem; }
.eyebrow { color: var(--green); font-size: .78rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; margin: 0 0 10px; }
.lead { color: var(--muted); margin: 0 0 28px; }
.field { min-width: 0; margin: 0; }
.field label { display: block; margin-bottom: 7px; font-weight: 700; }
.field input, .field select { display: block; width: 100%; min-width: 0; min-height: 46px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: white; color: var(--text); font: inherit; }
.field input:hover, .field select:hover { border-color: #9ba8a0; }
.field small { display: block; margin-top: 6px; color: var(--muted); font-size: .8125rem; line-height: 1.4; }
.field-error { color: var(--danger); margin: 7px 0 0; font-size: .875rem; font-weight: 650; line-height: 1.4; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.label-row a { font-size: .875rem; }
.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; border: 1px solid var(--green); border-radius: 8px; padding: 10px 20px; background: var(--green); color: white; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; transition: background .15s, transform .15s; }
.button:hover { background: var(--green-dark); color: white; }
.button:active { transform: translateY(1px); }
.button-secondary { background: white; color: var(--green); }
.button-secondary:hover { background: var(--green-soft); color: var(--green-dark); }
.button-full { width: 100%; }
.card-footer { margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--border); text-align: center; color: var(--muted); }
.alert { width: min(100%, 760px); margin: 0 auto 22px; border: 1px solid transparent; border-radius: 9px; padding: 13px 15px; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert-error { background: var(--danger-soft); border-color: #fecdca; color: var(--danger); }
.alert-success { background: var(--green-soft); border-color: #b8d9c9; color: var(--green-dark); }
.alert-info { background: #eef5f8; border-color: #c9dfe8; color: #28566a; }
.state-card { width: min(100%, 640px); margin: 0 auto; padding: clamp(28px, 6vw, 52px); text-align: center; }
.state-card > p:not(.eyebrow) { color: var(--muted); max-width: 490px; margin: 0 auto 26px; }
.state-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 20px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 1.6rem; font-weight: 900; }
.state-icon-error { background: var(--danger-soft); color: var(--danger); }
.state-icon-warning { background: #fff7e8; color: var(--warning); }
.actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.strength { min-height: 30px; margin-top: 10px; position: relative; background: transparent; }
.strength::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; border-radius: 10px; background: #e8ebe9; }
.strength span { position: relative; z-index: 1; display: block; width: 0; height: 5px; border-radius: 10px; background: var(--danger); transition: width .2s, background .2s; }
.strength span[data-score="3"] { background: #b7791f; }
.strength span[data-score="4"], .strength span[data-score="5"] { background: var(--green); }
.strength small { margin-top: 6px; padding: 0; }
.dashboard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.dashboard-head p { margin-bottom: 0; color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 24px; }
.detail-card, .placeholder-card { padding: 28px; }
.detail-card dl { margin: 0; }
.detail-card dl div { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.detail-card dl div:last-child { border-bottom: 0; }
.detail-card dt { color: var(--muted); }
.detail-card dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.placeholder-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: #f0f5f2; border-style: dashed; box-shadow: none; }
.placeholder-card p { margin: 0; color: var(--muted); }
.placeholder-icon { color: var(--green); font-size: 2rem; margin-bottom: 12px; }
.debug-box { overflow: auto; text-align: left; padding: 12px; border-radius: 6px; background: #f1f1f1; color: var(--danger); white-space: pre-wrap; }

.wide-card { max-width: 980px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.section-head p { margin: 4px 0 0; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 24px; }
.filters .field { min-width: 150px; margin: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; white-space: nowrap; }
.table th { background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfa; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); }
.badge { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px; font-size: .75rem; font-weight: 750; letter-spacing: .01em; }
.badge-1 { background: #fff7e8; color: var(--warning); }
.badge-2 { background: var(--green-soft); color: var(--green-dark); }
.badge-3 { background: var(--danger-soft); color: var(--danger); }
.badge-4 { background: #eef0ef; color: var(--muted); }
.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 22px; flex-wrap: wrap; }
.pagination span { color: var(--muted); font-size: .875rem; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 24px; margin: 22px 0; }
.detail-grid div { padding: 10px 0; border-bottom: 1px solid var(--border); }
.detail-grid dt { color: var(--muted); font-size: .8125rem; margin-bottom: 3px; }
.detail-grid dd { margin: 0; font-weight: 700; }
.resolution-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin-top: 18px; }
.action-box { border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.action-box h3 { margin: 0 0 6px; font-size: 1.05rem; }
.action-box > p { margin: 0 0 18px; color: var(--muted); font-size: .875rem; }
.action-box form { display: grid; gap: 14px; }
.action-box-approve { background: var(--green-soft); border-color: rgba(26, 107, 74, .22); }
.action-box-reject { background: var(--danger-soft); border-color: rgba(180, 35, 24, .18); }
.row-actions { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.row-actions form { display: contents; }
.link-button { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: var(--danger); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-button:hover { color: #8f1c12; }
.receipt-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.total-card { text-align: center; padding: clamp(24px, 5vw, 40px) 20px; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.total-card .eyebrow { margin-bottom: 10px; }
.total-amount { margin: 0; font-size: clamp(2rem, 5vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; color: var(--green-dark); }

@media (max-width: 900px) {
    .receipt-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .container { width: calc(100% - 24px); padding: 28px 0; }
    .form-card, .state-card { border-radius: 12px; padding: 26px 24px; }
    .form-card form { gap: 20px; }
    .dashboard-head { flex-direction: column; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .detail-card dl div { grid-template-columns: 1fr; gap: 2px; }
    .dashboard-head form, .dashboard-head .button { width: 100%; }
}
