:root {
    color-scheme: light;
    --ink: #253026;
    --muted: #737b70;
    --line: #e2e6dc;
    --paper: #f5f6ef;
    --white: #fff;
    --green: #496437;
    --green-soft: #edf4e5;
    --red: #985246;
    --red-soft: #f8ece8;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Arial, sans-serif; font-size: 14px; }
a { color: var(--green); }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(calc((100vw - 1200px) / 2), 28px); border-bottom: 1px solid var(--line); background: var(--white); }
.brand { color: var(--ink); font-size: 21px; font-weight: 800; letter-spacing: -.8px; text-decoration: none; }
.brand span { color: #78866b; font-weight: 400; }
.page { width: min(1240px, calc(100% - 56px)); margin: 0 auto; padding: 42px 0 70px; }
.page-heading, .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-heading { margin-bottom: 26px; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: 1.4px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(29px, 4vw, 40px); letter-spacing: -1.5px; }
h1 span { color: #81916f; }
h2 { margin: 0; font-size: 21px; letter-spacing: -.5px; }
h3 { margin-bottom: 12px; font-size: 14px; }
.muted, .help-text { color: var(--muted); }
.muted { margin-bottom: 0; }
.stats { display: flex; gap: 12px; }
.stats div { min-width: 112px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
.stats strong, .stats span { display: block; }
.stats strong { margin-bottom: 4px; font-size: 20px; }
.stats span { color: var(--muted); font-size: 11px; }
.panel { margin-bottom: 20px; padding: 23px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); }
.section-heading { align-items: center; margin-bottom: 20px; }
.section-heading .eyebrow { margin-bottom: 6px; }
.batch-status-summary { display: grid; justify-items: end; gap: 7px; }
.order-filter { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.order-filter label { min-width: min(320px, 100%); }
.order-filter select { width: 100%; }
.batch-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.batch-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
label { display: grid; gap: 7px; color: #51594f; font-size: 12px; font-weight: 700; }
input, select { min-width: 120px; height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font: inherit; }
.button { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; padding: 0 14px; border: 0; border-radius: 6px; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.button-primary { background: var(--green); color: white; }
.button-danger { background: var(--red-soft); color: var(--red); }
.button-quiet { min-height: 34px; background: transparent; color: var(--green); }
.button-small { min-height: 32px; padding: 0 10px; font-size: 11px; }
.help-text { margin: 13px 0 0; font-size: 11px; line-height: 1.6; }
.batch-list { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.batch-history-toggle { width: fit-content; min-height: 34px; padding: 0 11px; border: 1px solid var(--line); list-style: none; }
.batch-history-toggle::-webkit-details-marker { display: none; }
.batch-history-toggle::after { margin-left: 8px; content: "+"; font-size: 15px; }
.batch-list[open] .batch-history-toggle::after { content: "−"; }
.batch-history-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.batch-history-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.batch-history-column { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fcfcf9; }
.batch-history-column h3 { margin-bottom: 11px; }
.batch-list .batch-history-column ul { display: grid; gap: 8px; }
.batch-list .batch-history-column li { align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.batch-history-column .muted { font-size: 12px; line-height: 1.5; }
.batch-list ul { display: flex; flex-wrap: wrap; gap: 9px; margin: 0; padding: 0; list-style: none; }
.batch-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; }
.badge { display: inline-block; padding: 5px 8px; border-radius: 5px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge-open, .badge-status { background: var(--green-soft); color: var(--green); }
.badge-ready { background: #f2f1e7; color: #6e6a3d; }
.badge-closed { background: #f2f2ef; color: #737b70; }
.badge-closed, .badge-open { font-size: 11px; }
.alert { margin-bottom: 15px; padding: 12px 14px; border-radius: 6px; font-size: 12px; }
.alert-success { background: var(--green-soft); color: var(--green); }
.alert-error { background: var(--red-soft); color: var(--red); }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 1100px; border-collapse: collapse; text-align: left; }
th { padding: 12px 10px; color: var(--muted); font-size: 10px; letter-spacing: .5px; text-transform: uppercase; }
td { padding: 13px 10px; border-top: 1px solid var(--line); color: #50584f; font-size: 11px; line-height: 1.55; vertical-align: top; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
.primary-cell { color: var(--ink); font-weight: 700; }
.primary-cell span, .primary-cell small { display: block; color: var(--muted); font-size: 10px; font-weight: 400; }
.primary-cell small { max-width: 190px; margin-top: 4px; overflow-wrap: anywhere; }
.photo-link { font-weight: 700; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding-top: 17px; color: var(--muted); font-size: 11px; }
.pagination a { font-weight: 700; text-decoration: none; }
.empty-state { margin: 0; padding: 24px 0; color: var(--muted); }
.login-page { display: grid; min-height: 100vh; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); box-shadow: 0 18px 55px #25302612; }
.login-card .brand { display: inline-block; margin-bottom: 34px; }
.login-card h1 { font-size: 32px; }
.login-card .muted { margin-bottom: 24px; font-size: 12px; }
.login-form { display: grid; gap: 10px; }
.login-form input { width: 100%; margin-bottom: 7px; }
.login-form .button { margin-top: 8px; }

@media (max-width: 700px) {
    .topbar { height: 64px; padding: 0 18px; }
    .page { width: calc(100% - 32px); padding-top: 30px; }
    .page-heading, .section-heading { align-items: flex-start; flex-direction: column; }
    .stats { width: 100%; }
    .stats div { flex: 1; }
    .panel { padding: 18px 14px; }
    .batch-actions, .batch-form { align-items: stretch; flex-direction: column; }
    .batch-form label, .batch-form input, .batch-form select, .batch-form .button, .close-form, .close-form .button, .reset-form, .reset-form .button { width: 100%; }
    .order-filter { align-items: stretch; flex-direction: column; }
    .order-filter label, .order-filter select, .order-filter .button { width: 100%; }
    .badge-open, .badge-closed { white-space: normal; }
    .batch-status-summary { justify-items: start; }
    .batch-history-grid { grid-template-columns: 1fr; }
    .batch-history-toggle { width: 100%; }
    .login-card { padding: 25px 20px; }
}
