:root {
    --ink: #24282b;
    --muted: #5f6668;
    --paper: #f6f5f1;
    --line: #e6e4dd;
    --surface: #fff;
    --sidebar: #202829;
    --sidebar-text: #b9c3c0;
    --accent: #f6ab77;
    --accent-strong: #8c411d;
    --radius: 16px;
}

body { margin: 0; color: var(--ink); background: var(--paper); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: #85401f; text-decoration-thickness: .08em; text-underline-offset: .16em; }
a:hover { color: #622b11; }
:focus-visible { outline: 3px solid #9e4d23; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 720; letter-spacing: -.033em; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.08; }
h2 { font-size: 1.23rem; }
h3 { font-size: 1.05rem; }
p { overflow-wrap: anywhere; }
small { font-size: .81rem; }
.shell { display: grid; grid-template-columns: 246px minmax(0, 1fr); min-height: 100vh; }
.skip { position: fixed; z-index: 5; top: 5px; left: 5px; background: white; padding: 8px; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 26px 17px 16px; background: var(--sidebar); color: var(--sidebar-text); }
.brand { display: inline-flex; align-items: center; gap: 12px; margin: 0 0 34px 6px; color: #fff; font-size: 1.32rem; font-weight: 780; line-height: 1.16; text-decoration: none; letter-spacing: -.04em; }
.brand:hover { color: #fff; }
.brand-logo { display: block; width: 132px; max-width: 100%; height: auto; }
.login-brand .brand-logo { width: 154px; }
.brand small { display: block; margin-top: 5px; font-size: .61rem; color: var(--sidebar-text); font-weight: 680; letter-spacing: .13em; }
.nav-caption { margin: 0 0 8px 12px; font-size: .65rem; font-weight: 750; letter-spacing: .15em; }
.nav-link { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; padding: 11px 12px; border-radius: 9px; color: var(--sidebar-text); font-size: .91rem; font-weight: 550; white-space: nowrap; }
.nav-link:hover, .nav-link:focus { background: #303b3b; color: #fff; }
.nav-link.current { color: #ffd2af; background: #41403a; font-weight: 700; }
.nav-link svg { flex: 0 0 19px; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 10px; border-top: 1px solid #434c4a; padding: 15px 2px 0; }
.avatar { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 50%; background: #3d4947; color: #fff; font-weight: 700; }
.identity { flex: 1; min-width: 0; font-size: .85rem; overflow-wrap: anywhere; }
.identity strong, .identity small { display: block; }
.identity strong { color: #fff; }
.logout { background: transparent; color: var(--sidebar-text); border: 0; border-radius: 8px; padding: 8px; }
.logout:hover { color: #fff; background: #364140; }
.topline { display: flex; align-items: center; justify-content: space-between; padding: 18px clamp(16px, 4vw, 50px); background: #fff; border-bottom: 1px solid var(--line); font-size: .68rem; letter-spacing: .15em; font-weight: 750; color: var(--muted); }
.topline-date { display: inline-flex; align-items: center; gap: 7px; font-size: .83rem; letter-spacing: 0; }
.topline-date svg { width: 15px; height: 15px; }
.page { max-width: 1530px; margin: 0 auto; padding: clamp(20px, 3vw, 44px) clamp(14px, 4vw, 50px) 48px; }
.page-heading { display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between; align-items: end; margin-bottom: 24px; }
.page-heading .muted { margin: 8px 0 0; }
.eyebrow { margin: 0 0 7px; font-size: .69rem; line-height: 1.25; font-weight: 780; letter-spacing: .125em; color: var(--accent-strong); }
.muted, .field-help, .app-table small, .payment-row small, .timeline small { color: var(--muted); }
.surface { padding: clamp(15px, 2.3vw, 25px); min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 8px #322a1c07; }
.section-head, .split { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.section-head { margin-bottom: 15px; }
.section-head .eyebrow { margin-bottom: 4px; }
.total-chip { border-radius: 20px; padding: 4px 10px; color: #4c5552; background: #f0f1ed; font-size: .76rem; font-weight: 700; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 670; font-size: .89rem; border-radius: 9px; min-height: 40px; padding: .54rem .86rem; }
.btn-accent { --bs-btn-color: #332118; --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-color: #25150c; --bs-btn-hover-bg: #f49a5e; --bs-btn-hover-border-color: #f49a5e; --bs-btn-active-bg: #ee9356; --bs-btn-active-border-color: #ee9356; }
.btn-soft { --bs-btn-color: #313635; --bs-btn-bg: #f7f7f3; --bs-btn-border-color: #dddfd8; --bs-btn-hover-bg: #ebeee8; --bs-btn-hover-border-color: #c6cbc2; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button-row form { margin: 0; }
.text-link { display: inline-flex; align-items: center; gap: 5px; font-size: .87rem; font-weight: 700; }
.breadcrumb-link { display: inline-block; margin-bottom: 17px; font-size: .88rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.metric { display: grid; align-content: start; justify-items: start; gap: 4px; }
.metric-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; margin-bottom: 6px; }
.metric-icon.violet, .pill.production { color: #5c4494; background: #eee8fb; }
.metric-icon.green, .pill.ready, .pill.delivered { color: #22644d; background: #e2f4eb; }
.metric-icon.amber, .pill.awaiting { color: #755000; background: #fff0cc; }
.metric-icon.red, .pill.cancelled { color: #9d3d31; background: #fae7e3; }
.metric-label { font-size: .86rem; font-weight: 690; }
.metric strong { font-size: 2.04rem; line-height: 1; letter-spacing: -.06em; }
.metric small { color: var(--muted); }
.dashboard-grid, .detail-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dashboard-side, .stack { display: grid; gap: 16px; min-width: 0; }
.status-chart { display: grid; gap: 11px; margin: 18px 0; }
.chart-row > div:first-child { display: flex; justify-content: space-between; font-size: .84rem; }
.bar-track { height: 6px; margin-top: 5px; border-radius: 7px; background: #f0efeb; overflow: hidden; }
.bar-fill { height: 100%; background: #7b8b85; border-radius: inherit; }
.bar-fill.awaiting { background: #df9e48; }
.bar-fill.production { background: #9175c3; }
.bar-fill.ready, .bar-fill.delivered { background: #57917b; }
.bar-fill.cancelled { background: #c98279; }
.balance-card { color: white; background: #293634; border-radius: var(--radius); padding: 22px; }
.balance-card .metric-icon { background: #43534f; color: #ffcb9f; }
.balance-card p { margin: 9px 0 4px; font-weight: 650; }
.balance-card strong { display: block; font-size: clamp(1.45rem, 3vw, 2rem); letter-spacing: -.04em; overflow-wrap: anywhere; }
.balance-card small { color: #d1dad5; }
.deadline-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 10px 0; }
.deadline-row small { display: block; color: var(--muted); }
.pill { display: inline-block; border-radius: 40px; padding: 4px 9px; background: #f0efec; color: #535653; font-size: .75rem; font-weight: 690; vertical-align: middle; }
.pill.confirmed, .pill.shipped { background: #e5effa; color: #294f79; }
.form-grid, .filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.form-stack { display: grid; gap: 12px; align-items: start; justify-items: stretch; }
.form-stack:not(.form-grid) > .btn { justify-self: start; }
.form-grid .wide, .filters .wide { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; min-width: 0; font-size: .87rem; font-weight: 640; }
.form-control, .form-select { margin-top: 5px; min-height: 41px; border-color: #d7d9d1; border-radius: 8px; font-size: .93rem; }
.form-control:focus, .form-select:focus { border-color: #bc754d; box-shadow: 0 0 0 .19rem #efb78d55; }
.field-help { display: block; margin-top: 5px; font-weight: 400; }
.field-error { display: block; margin-top: 4px; font-weight: 650; color: #962d22; }
.filter-actions { display: flex; flex-wrap: wrap; align-items: center; align-self: end; gap: 10px; }
.filters { padding-bottom: 10px; }
.app-table { --bs-table-bg: transparent; --bs-table-border-color: var(--line); font-size: .88rem; margin-bottom: 0; }
.app-table th { background: #f6f6f2; padding: 10px 9px; font-size: .74rem; }
.app-table td { padding: 11px 9px; }
.app-table td small { display: block; margin-top: 2px; }
.app-table a { font-weight: 720; }
.table-caption { margin: 9px 0; font-size: .83rem; font-weight: 670; }
.table-responsive { margin-top: 10px; }
.empty { padding: 23px 10px; text-align: center; margin: 0; }
.empty h2 { margin-bottom: 7px; }
.pagination-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; font-size: .86rem; }
.nowrap { white-space: nowrap; }
.item-fieldset, .new-customer { padding: 12px 15px 15px; margin: 0; border: 1px solid var(--line); border-radius: 12px; min-width: 0; background: #fafaf7; }
.item-fieldset legend, .new-customer legend { float: none; width: auto; margin: 0; padding: 0 5px; font-size: .9rem; font-weight: 730; }
.technical-fields { margin: 12px 0 6px; padding-top: 11px; border-top: 1px solid var(--line); }
summary { cursor: pointer; font-size: .9rem; font-weight: 710; }
.technical-fields p { margin: 8px 0; font-size: .84rem; }
.save-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; }
.save-bar strong { display: block; font-size: 1.43rem; }
.notice { padding: 12px 14px; margin: 0 0 14px; border: 1px solid #e7c48a; border-radius: 10px; color: #633d17; background: #fff4e0; }
.notice.error { color: #831f18; border-color: #edb4a7; background: #fff0eb; }
.notice.success { color: #225e42; border-color: #b1d6bf; background: #eaf8ee; }
.item-summary, .payment-row { border-top: 1px solid var(--line); padding: 15px 0; }
.item-summary:last-child, .payment-row:last-child { padding-bottom: 0; }
.item-summary .muted { margin: 3px 0 7px; }
.item-price { text-align: right; }
.item-price small, .payment-row small, .timeline small { display: block; }
.spec-list { margin: 12px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.spec-list div { background: #f6f6f2; padding: 8px 9px; border-radius: 7px; overflow-wrap: anywhere; }
.spec-list dt, .data-list dt { font-size: .73rem; color: var(--muted); }
.spec-list dd, .data-list dd { margin: 2px 0 0; font-size: .86rem; }
.file-list { margin: 10px 0 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; font-size: .83rem; }
.file-list a { overflow-wrap: anywhere; }
.subpanel { margin-top: 12px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; }
.subpanel .form-stack { margin-top: 12px; }
.subpanel.danger summary { color: #922c24; }
.data-list, .totals { display: grid; gap: 9px; margin: 0; }
.data-list div { border-bottom: 1px solid var(--line); padding-bottom: 8px; overflow-wrap: anywhere; }
.totals div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.totals dt, .totals dd { margin: 0; font-size: .9rem; }
.totals .grand { border-top: 1px solid var(--line); padding-top: 9px; margin-top: 2px; }
.totals .grand dd { font-weight: 780; font-size: 1.1rem; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 2px solid #edc6a9; }
.timeline li { padding: 0 0 13px; overflow-wrap: anywhere; }
.timeline p { margin: 6px 0; }
.history-details { margin-top: 6px; }
.history-details pre { padding: 7px; border-radius: 7px; background: #f4f4ef; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 190px; }
.preserve { white-space: pre-wrap; }
.production-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.work-card h2 { margin: 10px 0 6px; }
.print-controls { margin-bottom: 16px; }
.print-sheet { max-width: 850px; }
.print-sheet .totals { margin: 20px 0; max-width: 320px; margin-left: auto; }
.copy-source { width: min(100%, 850px); min-height: 160px; margin-bottom: 12px; }
.inline-record { display: grid; grid-template-columns: minmax(0, 1fr) minmax(95px, 150px) auto; align-items: end; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.login-wrap { min-height: 100dvh; display: grid; align-content: center; justify-items: center; padding: 24px; background: radial-gradient(ellipse at 0 0, #efd2ba, #f5f3ee 56%); }
.login-card, .login-wrap .notice { width: min(100%, 430px); }
.login-card { padding: clamp(20px, 5vw, 37px); background: #fff; border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 12px 40px #44322415; }
.login-card h1 { font-size: 2rem; }
.login-card .muted { margin: 10px 0 20px; }
.login-card .btn { justify-self: stretch; }
.login-brand { margin: 0 0 24px; color: var(--ink); }
.login-brand small { color: var(--muted); }

@media (max-width: 1050px) {
    .shell { grid-template-columns: 198px minmax(0, 1fr); }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .shell { display: block; }
    .sidebar { display: grid; grid-template-columns: 1fr auto; gap: 10px; position: static; height: auto; padding: 12px 13px 6px; }
    .brand { margin: 0; font-size: 1.12rem; }
    .nav-caption, .sidebar-user .avatar, .sidebar-user .identity { display: none; }
    .sidebar-user { grid-row: 1; grid-column: 2; margin: 0; padding: 0; border: 0; align-self: center; }
    .sidebar nav { display: flex; grid-column: 1 / -1; overflow-x: auto; gap: 3px; }
    .nav-link { font-size: .78rem; padding: 8px; }
    .nav-link svg { width: 15px; height: 15px; flex-basis: 15px; }
    .topline { padding-top: 10px; padding-bottom: 10px; }
    .dashboard-grid, .production-grid { grid-template-columns: 1fr; }
    .form-grid, .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
    .form-grid, .filters { grid-template-columns: 1fr; }
    .form-grid .wide, .filters .wide { grid-column: auto; }
    .page-heading { align-items: start; gap: 12px; }
    .inline-record { grid-template-columns: minmax(0, 1fr) 100px; }
    .inline-record button { grid-column: 1 / -1; justify-self: start; }
}
@media print {
    body { background: white; }
    .sidebar, .topline, .no-print, .notice, .skip { display: none !important; }
    .shell { display: block; }
    .page, .print-sheet { padding: 0; max-width: none; box-shadow: none; border: 0; }
    .table-responsive { overflow: visible; }
    .spec-list div, tr { break-inside: avoid; }
}


