:root {
    color-scheme: dark;
    --bg: #030712;
    --panel: rgba(10, 21, 38, .88);
    --line: rgba(65, 199, 255, .25);
    --pink: #ff2ba6;
    --blue: #25bdff;
    --text: #f7f8ff;
    --muted: #aeb8cc;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font-family: Inter, system-ui, sans-serif; color: var(--text); background: radial-gradient(circle at 15% 15%, #271044 0, transparent 35%), radial-gradient(circle at 85% 20%, #092b56 0, transparent 30%), var(--bg); }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; }
.auth-page { display: grid; place-items: center; padding: 1rem; }
.auth-shell { width: min(64rem, 100%); display: grid; grid-template-columns: 1.15fr .85fr; gap: 1.25rem; align-items: stretch; }
.brand-panel, .auth-card, .welcome-card { border: 1px solid var(--line); border-radius: 1.25rem; background: var(--panel); box-shadow: 0 0 32px rgba(37, 189, 255, .08); }
.brand-panel { min-height: 30rem; padding: clamp(2rem, 6vw, 5rem); display: flex; flex-direction: column; justify-content: center; }
.brand-panel h1 { margin: .5rem 0; font-size: clamp(2.5rem, 6vw, 5rem); color: var(--pink); text-shadow: 0 0 18px rgba(255, 43, 166, .38); }
.brand-panel h1 span { display: block; color: var(--blue); font-size: .58em; }
.auth-card { padding: clamp(1.5rem, 4vw, 3rem); align-self: center; }
.eyebrow { color: var(--blue); letter-spacing: .08em; text-transform: uppercase; font-size: .75rem; font-weight: 800; }
.muted { color: var(--muted); }
label { display: grid; gap: .45rem; margin: 1rem 0; font-weight: 650; }
input, select, textarea { width: 100%; padding: .9rem 1rem; color: var(--text); background: #101b2d; border: 1px solid #30425c; border-radius: .75rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
button { min-height: 3rem; padding: .75rem 1.1rem; border: 0; border-radius: .75rem; color: white; font-weight: 800; background: linear-gradient(90deg, var(--pink), #d519e8); cursor: pointer; }
button.secondary { background: transparent; border: 1px solid var(--line); }
.alert { margin: 1rem 0; padding: .85rem 1rem; border: 1px solid #ff5b85; border-radius: .75rem; background: rgba(121, 12, 50, .5); }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--line); background: rgba(3, 7, 18, .94); }
.app-header > div:first-of-type { min-width: 0; flex: 1; }
.app-header h1 { margin: .15rem 0; font-size: 1.25rem; }
.dashboard-shell { width: min(75rem, calc(100% - 2rem)); margin: 2rem auto; }
.welcome-card { padding: clamp(1.5rem, 4vw, 3rem); }
.button-link { display: inline-flex; min-height: 2.75rem; align-items: center; justify-content: center; padding: .65rem 1rem; border-radius: .75rem; color: white; text-decoration: none; font-weight: 800; background: linear-gradient(90deg, var(--pink), #d519e8); }
.secondary-link { background: transparent; border: 1px solid var(--line); }
.toolbar { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.search-form { display: flex; gap: .65rem; width: min(34rem, 100%); }
.filter-form { display: grid; grid-template-columns: minmax(12rem, 2fr) repeat(3, minmax(8rem, auto)); gap: .65rem; flex: 1; }
.filter-form select, .filter-form input { margin: 0; }
.data-card { padding: 1.25rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); }
.table-wrap { overflow-x: auto; } table { width: 100%; border-collapse: collapse; } th, td { padding: .8rem; border-bottom: 1px solid rgba(255,255,255,.08); text-align: left; } td a { color: var(--blue); font-weight: 800; } td small { display: block; color: var(--muted); }
.status { display: inline-flex; padding: .25rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 800; }
.status-active { color: #9bffd1; background: rgba(0, 110, 68, .45); } .status-inactive { color: #e1e6ef; background: rgba(90, 100, 120, .45); }
.form-shell { width: min(50rem, calc(100% - 2rem)); margin: 2rem auto; } .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; } .full { grid-column: 1 / -1; } .field-error { color: #ff8cab; }
.wide-form-shell { width: min(75rem, calc(100% - 2rem)); margin: 2rem auto; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; } .full-detail { grid-column: 1 / -1; } .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; } dl { display: grid; grid-template-columns: 9rem 1fr; gap: .7rem 1rem; } dt { color: var(--muted); } dd { margin: 0; }
.quick-links { display: flex; flex-wrap: wrap; gap: .75rem; }
.guidance { padding: .85rem 1rem; border-left: 3px solid var(--blue); color: var(--muted); background: rgba(37, 189, 255, .07); }
.variant-list { list-style: none; padding: 0; margin: 0; } .variant-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.product-photo { display: block; width: 100%; max-height: 22rem; margin: 1rem 0; object-fit: cover; border-radius: .8rem; border: 1px solid var(--line); }
.order-filter { grid-template-columns: minmax(14rem, 2fr) minmax(10rem, 1fr) auto; }
.order-lines { margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; }
.order-lines legend { color: var(--blue); font-weight: 800; }
.order-line { display: grid; grid-template-columns: 2rem minmax(14rem, 2fr) minmax(7rem, .6fr) minmax(9rem, .8fr); gap: .75rem; align-items: end; border-bottom: 1px solid rgba(255,255,255,.08); }
.line-number { align-self: center; color: var(--muted); font-weight: 800; }
.inline-form { display: flex; gap: .75rem; align-items: center; } .inline-form select { max-width: 18rem; }
.status-new, .status-confirmed { color: #bcecff; background: rgba(0, 89, 130, .5); } .status-preparing, .status-partial { color: #ffe499; background: rgba(130, 83, 0, .5); } .status-ready, .status-collected, .status-completed, .status-paid { color: #9bffd1; background: rgba(0, 110, 68, .45); } .status-cancelled, .status-unpaid { color: #ffabc3; background: rgba(121, 12, 50, .5); }
.allocation-line { display: grid; grid-template-columns: 2rem minmax(8rem, .7fr) minmax(16rem, 2fr) minmax(10rem, 1fr) minmax(8rem, .7fr); gap: .75rem; align-items: end; border-bottom: 1px solid rgba(255,255,255,.08); }
.status-posted, .status-valid { color: #9bffd1; background: rgba(0, 110, 68, .45); } .status-voided { color: #ffabc3; background: rgba(121, 12, 50, .5); text-decoration: line-through; }
.status-overdue { color: #fff; background: #981542; box-shadow: 0 0 0 1px #ff8cab; } .account-filter { grid-template-columns: minmax(13rem, 2fr) minmax(9rem, 1fr) minmax(9rem, 1fr) auto; }
.danger-zone { border-color: rgba(255, 91, 133, .45); } button.danger-button { background: #8f1739; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mobile-nav { display: none; }
@media (max-width: 720px) {
    .auth-shell { grid-template-columns: 1fr; }
    .brand-panel { min-height: 12rem; padding: 1.5rem; }
    .brand-panel h1 { font-size: 2.5rem; }
    body:not(.auth-page) { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
    .app-header { position: sticky; top: 0; z-index: 20; min-height: 4.25rem; align-items: center; padding: .65rem .8rem; backdrop-filter: blur(14px); }
    .app-header::before { content: ""; flex: 0 0 5.5rem; width: 5.5rem; height: 2.5rem; background: url("../brand-logo") left center / contain no-repeat; }
    .app-header .eyebrow { display: none; }
    .app-header h1 { overflow: hidden; margin: 0; font-size: 1rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
    .app-header .button-link, .app-header button { min-height: 2.75rem; padding: .55rem .7rem; font-size: .8rem; }
    .app-header form { margin: 0; }
    .dashboard-shell, .form-shell, .wide-form-shell { width: min(100% - 1rem, 75rem); margin: .75rem auto; }
    .welcome-card, .data-card { padding: 1rem; border-radius: .9rem; }
    .section-heading { align-items: flex-start; }
    .toolbar, .search-form { flex-direction: column; }
    .toolbar { position: relative; gap: .65rem; }
    .toolbar > .button-link, .toolbar > button { width: 100%; }
    .filter-form { grid-template-columns: 1fr; width: 100%; }
    .order-line { grid-template-columns: 2rem 1fr; } .order-line label { grid-column: 2; margin: .25rem 0; }
    .allocation-line { grid-template-columns: 2rem 1fr; } .allocation-line label { grid-column: 2; margin: .25rem 0; }
    .inline-form { align-items: stretch; flex-direction: column; } .inline-form select { max-width: none; }
    .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .full, .full-detail { grid-column: auto; }
    input, select, textarea { min-height: 3rem; font-size: 16px; }
    button, .button-link { min-height: 3rem; }
    .quick-links { display: grid; grid-template-columns: 1fr 1fr; }
    .quick-links .button-link { width: 100%; text-align: center; }
    table, thead, tbody, tr, th, td { display: block; }
    thead { position: absolute; width: 1px; height: 1px; overflow: hidden; }
    tbody { display: grid; gap: .65rem; }
    tr { padding: .75rem; border: 1px solid rgba(65,199,255,.16); border-radius: .75rem; background: rgba(5,13,27,.55); }
    td { display: grid; grid-template-columns: minmax(6.5rem, 38%) 1fr; gap: .75rem; border: 0; padding: .35rem 0; overflow-wrap: anywhere; }
    td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
    dl { grid-template-columns: 1fr; }
    .mobile-nav { position: fixed; z-index: 50; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); border-top: 1px solid rgba(65,199,255,.35); background: rgba(3,7,18,.97); box-shadow: 0 -8px 28px rgba(0,0,0,.35); backdrop-filter: blur(16px); }
    .mobile-nav a { display: grid; min-width: 0; min-height: 3.8rem; place-content: center; gap: .15rem; border-radius: .65rem; color: var(--muted); text-align: center; text-decoration: none; }
    .mobile-nav a span { font-size: 1.25rem; font-weight: 900; line-height: 1; }
    .mobile-nav a small { overflow: hidden; font-size: .67rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
    .mobile-nav a[aria-current="page"] { color: white; background: linear-gradient(180deg, rgba(255,43,166,.28), rgba(37,189,255,.12)); box-shadow: inset 0 0 0 1px rgba(255,43,166,.35); }
}

.recipe-lines { display: grid; gap: .65rem; }
.recipe-line { display: grid; grid-template-columns: minmax(12rem, 2fr) minmax(7rem, 1fr) minmax(6rem, .6fr); gap: .65rem; align-items: end; }
.recipe-line-heading { color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.metric-card { display: grid; gap: .35rem; align-content: center; }
.metric-card strong { color: var(--blue); font-size: clamp(1.35rem, 4vw, 2rem); }
.metric-card small { color: var(--muted); }
.cost-summary { display: grid; gap: .35rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.dashboard-grid, .report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.activity-list, .module-links { list-style: none; padding: 0; margin: 0; }
.activity-list li { display: flex; justify-content: space-between; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.activity-list a { width: 100%; display: flex; justify-content: space-between; gap: .75rem; text-decoration: none; }
.activity-list span { color: var(--muted); }
.module-links { display: flex; flex-wrap: wrap; gap: .75rem; padding: 1rem 0 5rem; }
.print-only { display: none; }
.statement-document { max-width: 70rem; }
.statement-head, .statement-parties { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.statement-logo { width: min(24rem, 55vw); max-height: 8rem; object-fit: contain; object-position: left center; }
.statement-parties > div:last-child { min-width: 18rem; }
.statement-summary article { display: grid; gap: .35rem; padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--panel); }
.statement-summary span { color: var(--muted); }
.statement-summary strong { font-size: 1.25rem; color: var(--blue); }
.statement-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); text-align: center; }
.copy-source { width: 100%; min-height: 12rem; margin-top: 1rem; }
@media (max-width: 620px) { .recipe-line { grid-template-columns: 1fr 1fr; } .recipe-line select:first-child { grid-column: 1 / -1; } .recipe-line-heading { display: none; } }
@media (max-width: 820px) { .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dashboard-grid, .report-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .summary-grid { grid-template-columns: 1fr; } .activity-list a, .activity-list li { align-items: flex-start; flex-direction: column; } .quick-links { grid-template-columns: 1fr; } .mobile-nav a small { font-size: .62rem; } }
@media (max-width: 620px) { .statement-head, .statement-parties { align-items: flex-start; flex-direction: column; } .statement-parties > div:last-child { min-width: 0; } .statement-logo { width: 100%; } }
@media print {
    :root { color-scheme: light; }
    body { color: #111; background: #fff; font-size: 10pt; }
    .app-header { color: #111; background: #fff; border-bottom: 2px solid #111; }
    .no-print, .app-header a { display: none !important; }
    .print-only { display: block; }
    .data-card { color: #111; background: #fff; border-color: #bbb; box-shadow: none; break-inside: avoid; }
    .metric-card strong, a { color: #111; }
    .summary-grid { grid-template-columns: repeat(3, 1fr); }
    .dashboard-shell { width: 100%; max-width: none; padding: 0; }
    .statement-head, .statement-parties, .statement-footer { border-color: #bbb; }
    .statement-summary article { color: #111; background: #fff; border-color: #bbb; }
    .statement-summary strong, .statement-summary span { color: #111; }
    .statement-document table a { color: #111; text-decoration: none; }
}
