:root {
  --ink: #202723;
  --ink-soft: #38413c;
  --graphite: #27302c;
  --graphite-2: #1d2421;
  --cream: #f2efe6;
  --cream-deep: #e8e3d7;
  --paper: #fffdf8;
  --paper-pure: #ffffff;
  --line: #dedbd2;
  --line-soft: #ebe8e0;
  --muted: #777c77;
  --muted-light: #a3a7a2;
  --amber: #d69a2f;
  --amber-dark: #a96e0e;
  --amber-soft: #fbf0d5;
  --green: #33785a;
  --green-dark: #245c44;
  --green-soft: #e3f1e9;
  --red: #b84c42;
  --red-soft: #f8e8e5;
  --blue: #456f82;
  --blue-soft: #e6eff2;
  --shadow-sm: 0 1px 2px rgb(25 31 28 / 5%), 0 5px 18px rgb(25 31 28 / 4%);
  --shadow-md: 0 14px 42px rgb(25 31 28 / 13%);
  --sidebar-rail-width: 72px;
  --sidebar-expanded-width: 242px;
  --sidebar-width: var(--sidebar-rail-width);
  --topbar-height: 72px;
}

* { box-sizing: border-box; }
html { min-height: 100%; color: var(--ink); background: var(--cream); font: 15px/1.45 "Segoe UI", Inter, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; margin: 0; background: var(--cream); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled, input:disabled, textarea:disabled { cursor: not-allowed; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgb(214 154 47 / 30%); outline-offset: 2px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
.sr-only { width: 1px !important; height: 1px !important; padding: 0 !important; position: absolute !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* Application shell */
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: var(--sidebar-rail-width); padding: 25px 10px 20px; position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; flex-direction: column; overflow: hidden; color: #fff; background: linear-gradient(150deg, rgb(255 255 255 / 3%), transparent 26%), var(--graphite-2); border-right: 1px solid rgb(255 255 255 / 7%); transition: width .22s ease, box-shadow .22s ease; }
.sidebar:hover, .sidebar:focus-within { width: var(--sidebar-expanded-width); box-shadow: 18px 0 38px rgb(15 21 18 / 18%); }
.brand, .mobile-brand, .auth-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand { width: 100%; padding: 0 6px 25px; overflow: hidden; border-bottom: 1px solid rgb(255 255 255 / 9%); }
.brand-mark { width: 39px; height: 39px; position: relative; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; color: #1f2623; background: var(--amber); border-radius: 10px 10px 10px 3px; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 16%); }
.brand-mark::after { content: ""; width: 17px; height: 4px; position: absolute; right: -5px; top: 7px; rotate: -45deg; background: rgb(255 255 255 / 42%); }
.brand-mark span { font-size: 19px; font-weight: 900; }
.brand-copy { min-width: 160px; flex: 0 0 160px; }
.brand-copy strong, .brand-copy small, .auth-brand strong, .auth-brand small { display: block; }
.brand-copy strong { font-size: 18px; line-height: 1.1; letter-spacing: .01em; }
.brand-copy small { margin-top: 4px; color: #aeb7b2; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; }
.side-nav { padding-top: 24px; display: flex; flex-direction: column; gap: 5px; }
.nav-item { width: 100%; height: 46px; padding: 0 14px; display: flex; align-items: center; gap: 12px; overflow: hidden; color: #b8c0bb; border-radius: 9px; text-decoration: none; white-space: nowrap; transition: color .15s ease, background .15s ease; }
.nav-item:hover { color: #fff; background: rgb(255 255 255 / 6%); }
.nav-item.active { color: #fff; background: rgb(255 255 255 / 9%); box-shadow: inset 3px 0 0 var(--amber); }
.nav-icon { width: 24px; flex: 0 0 24px; display: grid; place-items: center; color: inherit; font-size: 19px; line-height: 1; }
.nav-item.active .nav-icon { color: var(--amber); }
.sidebar-status { width: 100%; margin-top: auto; padding: 15px 12px; display: flex; align-items: center; gap: 10px; overflow: hidden; color: #c3cbc6; background: rgb(255 255 255 / 4%); border: 1px solid rgb(255 255 255 / 7%); border-radius: 10px; }
.sidebar-status > span:last-child { min-width: 0; }
.sidebar-status strong, .sidebar-status small { display: block; }
.sidebar-status strong { font-size: 12px; }
.sidebar-status small { margin-top: 2px; color: #7f8a84; font-size: 9px; }
.online-dot { width: 8px; height: 8px; margin-left: 10px; flex: 0 0 auto; background: #5ab584; border-radius: 50%; box-shadow: 0 0 0 4px rgb(90 181 132 / 12%); }
.brand-copy, .nav-item > span:not(.nav-icon), .sidebar-status > span:last-child { opacity: 0; visibility: hidden; transform: translateX(-7px); transition: opacity .14s ease, visibility .14s ease, transform .18s ease; }
.sidebar:hover .brand-copy, .sidebar:focus-within .brand-copy, .sidebar:hover .nav-item > span:not(.nav-icon), .sidebar:focus-within .nav-item > span:not(.nav-icon), .sidebar:hover .sidebar-status > span:last-child, .sidebar:focus-within .sidebar-status > span:last-child { opacity: 1; visibility: visible; transform: translateX(0); transition-delay: .05s; }

.workspace { width: calc(100% - var(--sidebar-width)); min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { height: var(--topbar-height); padding: 0 clamp(22px, 3.3vw, 50px); position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: rgb(255 253 248 / 92%); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.breadcrumbs { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.breadcrumbs b { color: #c5c3bc; font-weight: 400; }
.breadcrumbs strong { color: var(--ink); font-weight: 650; }
.mobile-brand { display: none; }
.account-chip { margin-left: auto; padding: 5px 5px 5px 7px; display: flex; align-items: center; gap: 10px; border-radius: 10px; }
.avatar { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; color: #f8f5ec; background: var(--green); border-radius: 9px; font-size: 12px; font-weight: 800; }
.account-copy strong, .account-copy small { max-width: 190px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 13px; }
.account-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.inline-form { display: inline; margin: 0; }
.logout-button { width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 8px; font-size: 18px; transform: rotate(45deg); }
.logout-button:hover { color: var(--red); background: var(--red-soft); border-color: #efd0cc; }

.main-content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 39px clamp(22px, 3.3vw, 50px) 64px; }
.page-stack { display: flex; flex-direction: column; gap: 22px; animation: page-in .24s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.mobile-nav { display: none; }

/* Login */
.auth-body { background: radial-gradient(circle at 75% 10%, rgb(214 154 47 / 14%), transparent 27%), radial-gradient(circle at 15% 90%, rgb(51 120 90 / 10%), transparent 30%), var(--cream); }
.auth-shell { width: min(460px, calc(100% - 30px)); min-height: 100vh; margin: auto; padding: 52px 0; display: grid; align-content: center; gap: 22px; }
.auth-brand { justify-content: center; color: var(--ink); }
.auth-brand > span:last-child { min-width: 0; }
.auth-brand strong { font-size: 19px; letter-spacing: -.01em; }
.auth-brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.auth-content .page-stack { gap: 14px; }
.login-card { padding: 37px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-md); }
.login-card h1 { margin: 4px 0 8px; font-size: 29px; letter-spacing: -.035em; }
.login-card > .muted { margin: 0 0 24px; }

/* Shared content */
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-heading h1 { margin: 3px 0 7px; color: var(--ink); font-size: clamp(28px, 3vw, 37px); line-height: 1.08; letter-spacing: -.035em; }
.page-heading p:not(.eyebrow):not(.return-note) { max-width: 660px; margin: 0; color: var(--muted); font-size: 13px; }
.eyebrow { margin: 0; color: var(--amber-dark); font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
h2 { margin: 0 0 14px; color: var(--ink); font-size: 17px; line-height: 1.25; letter-spacing: -.015em; }
.card { padding: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.button-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.button { min-height: 43px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink); background: var(--paper-pure); border: 1px solid #d5d2ca; border-radius: 9px; box-shadow: 0 1px 2px rgb(31 38 34 / 4%); font-size: 13px; font-weight: 700; text-decoration: none; transition: translate .14s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease; }
.button:hover:not(:disabled) { translate: 0 -1px; background: #f8f6f0; border-color: #bdbab2; }
.button:disabled { opacity: .55; }
.button.primary { color: #1d241f; background: var(--amber); border-color: #c98c22; box-shadow: 0 6px 16px rgb(178 119 20 / 14%); }
.button.primary:hover:not(:disabled) { background: #dea43b; box-shadow: 0 8px 20px rgb(178 119 20 / 20%); }
.button.danger { color: #fff; background: var(--red); border-color: #a33e36; }
.button.danger:hover:not(:disabled) { background: #a94239; }
.button.full { width: 100%; }
.small-button { min-height: 34px; padding: 0 11px; font-size: 10px; }

.flash { padding: 13px 15px; display: flex; align-items: center; gap: 10px; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); font-size: 12px; }
.flash > span { width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 6px; font-weight: 900; }
.flash-success { border-color: #b8d9c6; }
.flash-success > span { color: var(--green); background: var(--green-soft); }
.flash-error { border-color: #e9beb9; }
.flash-error > span { color: var(--red); background: var(--red-soft); }
.flash-warning { border-color: #ead59e; }
.flash-warning > span { color: var(--amber-dark); background: var(--amber-soft); }

/* Forms */
.stacked-form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #626863; font-size: 11px; font-weight: 700; }
input, textarea, select { width: 100%; color: var(--ink); background: var(--paper-pure); border: 1px solid #d4d1c9; border-radius: 8px; transition: border-color .14s ease, box-shadow .14s ease; }
input, select { min-height: 42px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgb(214 154 47 / 11%); outline: none; }
input:disabled, textarea:disabled, select:disabled, input[readonly] { color: #6d726e; background: #f2f0ea; }
input::placeholder, textarea::placeholder { color: #a9aca8; }
input[type="file"] { padding: 9px 10px; }
code { padding: 2px 5px; color: var(--green-dark); background: var(--green-soft); border-radius: 5px; }

/* Dashboard */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { min-height: 126px; padding: 19px 20px 17px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.stat::before { content: ""; width: 29px; height: 29px; position: absolute; top: 16px; right: 16px; background: var(--amber-soft); border-radius: 8px; }
.stat::after { content: ""; width: 55px; height: 55px; position: absolute; right: -23px; bottom: -23px; border: 10px solid rgb(0 0 0 / 2.5%); border-radius: 50%; }
.stat:nth-child(2)::before { background: var(--green-soft); }
.stat:nth-child(3)::before { background: var(--red-soft); }
.stat:nth-child(4)::before { background: var(--blue-soft); }
.stat strong { display: block; font-size: 31px; line-height: 1; letter-spacing: -.04em; }
.stat span { margin-top: 8px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.dashboard-table-card { padding: 0; overflow: hidden; }
.panel-header { min-height: 69px; padding: 18px 22px 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line-soft); }
.panel-header h2 { margin: 0; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.card.dashboard-table-card > .table-wrap { width: 100%; margin: 0; }
.dashboard-table-card > .empty-state { margin: 0; }
.bulk-export-toolbar { margin-left: auto; display: flex; align-items: center; justify-content: flex-end; gap: 11px; }
.select-all-control { min-height: 34px; display: inline-flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 10px; white-space: nowrap; }
.select-all-control input, .select-cell input { width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--green); }
.selected-count { min-width: 73px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.bulk-download-button { color: #fff; background: var(--green); border-color: var(--green-dark); }
.bulk-download-button:hover:not(:disabled) { color: #fff; background: var(--green-dark); border-color: var(--green-dark); }
.bulk-download-button > span { font-size: 15px; line-height: 1; }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
.card > .table-wrap { margin: 0 -22px -22px; width: calc(100% + 44px); }
.card > .table-wrap:first-child { margin-top: -22px; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 14px; color: #90948f; background: #f8f6f0; border-bottom: 1px solid var(--line-soft); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 14px; color: var(--ink-soft); border-bottom: 1px solid var(--line-soft); font-size: 12px; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .13s ease; }
tbody tr:hover { background: #fbfaf6; }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
.select-cell { width: 48px; padding-right: 4px !important; text-align: center; vertical-align: middle; }
.select-cell + th, .select-cell + td { padding-left: 8px; }
.actions-cell { text-align: right; white-space: nowrap; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.inline-action-form { display: inline-flex; margin: 0; }
.repeat-button { color: var(--green-dark); border-color: #b9d2c5; }
.repeat-button:hover:not(:disabled) { color: var(--green-dark); background: var(--green-soft); border-color: #91bba5; }
.repeat-button > span { font-size: 16px; line-height: 1; }
.status { min-height: 25px; padding: 0 9px; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.status-draft { color: #6e746f; background: #eeece6; }
.status-submitted { color: #95640e; background: var(--amber-soft); }
.status-accepted { color: var(--green); background: var(--green-soft); }
.status-returned { color: #a23f37; background: var(--red-soft); }
.empty-state, .empty-hint { padding: 55px 25px; color: var(--muted); text-align: center; }
.empty-state::before { content: "▤"; width: 52px; height: 52px; margin: 0 auto 14px; display: grid; place-items: center; color: var(--amber-dark); background: var(--amber-soft); border-radius: 14px; font-size: 22px; }
.empty-state h2 { margin-bottom: 7px; }
.empty-state p { margin: 0; font-size: 12px; }

/* Report editor and catalog flow */
.report-header-card { display: grid; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr); gap: 20px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin: 0 0 14px; font-size: 11px; }
.manual-add-button { min-height: 38px; flex: 0 0 auto; color: var(--green-dark); background: var(--green-soft); border-color: #b9d2c5; box-shadow: none; }
.manual-add-button:hover:not(:disabled) { color: #fff; background: var(--green); border-color: var(--green-dark); }
.manual-add-button > span { font-size: 17px; line-height: 1; }
.catalog-cascade { margin: 3px -22px 0; padding: 16px 22px; display: grid; grid-template-columns: minmax(150px, .7fr) minmax(150px, .7fr) minmax(175px, .85fr) minmax(260px, 1.35fr); gap: 13px; background: #fbfaf6; border-block: 1px solid var(--line-soft); }
.catalog-step { min-width: 0; }
.catalog-step > span:first-child { min-height: 21px; display: flex; align-items: center; gap: 7px; color: #626863; font-size: 9px; font-weight: 750; }
.catalog-step > span:first-child b { width: 20px; height: 20px; display: grid; place-items: center; color: var(--amber-dark); background: var(--amber-soft); border-radius: 6px; font-size: 8px; }
.catalog-step > span:first-child small { margin-left: auto; color: #929690; font-size: 8px; font-weight: 600; }
.catalog-step select { height: 45px; padding-right: 34px; font-size: 11px; text-overflow: ellipsis; }
.catalog-search-control { height: 45px; display: flex; gap: 8px; }
.catalog-search-control input { min-width: 0; height: 45px; flex: 1; padding-left: 16px; box-shadow: inset 3px 0 0 var(--amber); font-size: 11px; }
.catalog-search-control input:disabled { box-shadow: none; }
.catalog-search-control .button { min-height: 45px; }
.catalog-picker-status { margin: 14px 0 0; padding: 10px 12px; color: var(--muted); background: #f4f2ec; border-radius: 8px; font-size: 10px; }
.catalog-picker-status strong { color: var(--ink); }
.catalog-results { max-height: 470px; margin: 14px -22px -22px; overflow-y: auto; background: var(--paper-pure); border-top: 1px solid var(--line-soft); }
.catalog-results > .muted, .catalog-results > .error-text { margin: 0; padding: 24px; text-align: center; }
.catalog-results-head, .catalog-result { display: grid; grid-template-columns: minmax(165px, .85fr) minmax(260px, 1.55fr) minmax(150px, .9fr) 36px; align-items: center; gap: 14px; }
.catalog-results-head { min-height: 38px; padding: 0 18px 0 22px; position: sticky; top: 0; z-index: 2; color: var(--muted); background: #faf9f5; border-bottom: 1px solid var(--line-soft); font-size: 9px; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.catalog-result { min-height: 76px; padding: 11px 18px 11px 22px; background: #fff; border-bottom: 1px solid var(--line-soft); }
.catalog-result:last-child { border-bottom: 0; }
.catalog-result:hover { background: #fbf9f3; }
.result-work-type, .result-material, .result-location { min-width: 0; }
.result-work-type { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.result-material strong, .result-material small { display: block; }
.result-material strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.result-material small { margin-top: 5px; color: var(--muted); font-size: 9px; }
.result-location { color: var(--muted); font-size: 10px; line-height: 1.35; }
.catalog-remaining { color: var(--green-dark); font-weight: 850; }
.catalog-remaining.is-negative { color: var(--red); }
.negative-balance { color: var(--red); font-weight: 850; }
.transfer-button { width: 34px; height: 34px; display: grid; place-items: center; color: #fff; background: var(--green); border: 1px solid var(--green-dark); border-radius: 8px; font-size: 19px; font-weight: 700; line-height: 1; }
.transfer-button:hover { background: var(--green-dark) !important; }

.report-lines-card { padding-bottom: 22px; }
.report-lines-card > .table-wrap { margin-top: 18px; border-top: 1px solid var(--line-soft); }
.wide-table { width: calc(100% + 44px) !important; }
.report-edit-table { min-width: 1280px; }
.report-edit-table td { padding: 8px; }
.report-edit-table th:first-child, .report-edit-table td:first-child { padding-left: 22px; }
.report-edit-table th:last-child, .report-edit-table td:last-child { padding-right: 18px; }
.report-edit-table input, .report-edit-table textarea { min-width: 110px; font-size: 11px; }
.report-edit-table input:required, .report-edit-table textarea:required { border-left: 3px solid var(--red); }
.catalog-summary { min-width: 300px; }
.catalog-summary strong, .catalog-summary span, .catalog-summary small { display: block; margin-bottom: 3px; }
.catalog-summary .line-work-type { margin-bottom: 5px; color: var(--ink); font-size: 12px; line-height: 1.35; }
.catalog-summary span { color: var(--ink); font-size: 11px; }
.catalog-summary small { color: var(--muted); font-size: 9px; }
.manual-summary { min-width: 390px; background: #fbfaf6; }
.manual-identity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.manual-identity-field { gap: 4px; color: var(--muted); font-size: 8px; }
.manual-identity-field input { min-width: 0; min-height: 36px; padding-inline: 9px; font-size: 10px; }
.manual-identity-field input:required { border-left: 3px solid var(--red); }
.manual-name-field { grid-column: 1 / -1; }
.catalog-summary .line-balance-preview { width: max-content; max-width: 100%; margin-top: 7px; padding: 4px 7px; color: var(--green-dark); background: var(--green-soft); border-radius: 6px; font-size: 10px; font-weight: 800; }
.catalog-summary .line-balance-preview.is-negative { color: var(--red); background: var(--red-soft); }
.icon-button { width: 31px; height: 31px; display: grid; place-items: center; color: var(--red); background: var(--red-soft); border: 1px solid transparent; border-radius: 8px; font-size: 18px; }
.icon-button:hover { border-color: #e7b7b2; }
.form-actions { padding: 13px 15px; position: sticky; bottom: 10px; z-index: 8; display: flex; align-items: center; justify-content: flex-end; gap: 11px; background: rgb(255 253 248 / 96%); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-md); backdrop-filter: blur(10px); }
.confirm-box { margin-right: auto; display: flex; grid-template-columns: auto 1fr; align-items: center; font-size: 10px; font-weight: 500; }
.confirm-box input { width: auto; min-height: 0; }

/* Report details */
.report-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.report-meta div { padding-left: 14px; display: grid; gap: 5px; border-left: 2px solid var(--amber); }
.report-meta span { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.report-meta strong { font-size: 13px; }
.print-table { min-width: 1200px; font-size: 11px; }
.print-title { display: none; }
.review-card { max-width: 820px; border-top: 3px solid var(--amber); }
.danger-zone { max-width: 820px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: var(--red-soft); border-color: #e3b5b0; }
.danger-zone h2 { margin: 3px 0 6px; color: var(--red); font-size: 18px; }
.danger-zone p:not(.eyebrow) { max-width: 570px; margin: 0; color: #765a56; font-size: 12px; line-height: 1.55; }
.danger-zone form { flex: 0 0 auto; }
.return-note { margin: 0; padding: 13px 15px; color: #7b5e27; background: var(--amber-soft); border: 1px solid #ead59e; border-left: 4px solid var(--amber); border-radius: 9px; font-size: 12px; }
.validation-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.validation { padding: 16px; border: 1px solid; border-radius: 11px; }
.validation h2 { margin-bottom: 9px; font-size: 13px; }
.validation ul { max-height: 230px; margin: 0; padding-left: 20px; overflow: auto; font-size: 11px; }
.validation li { margin-bottom: 5px; }
.validation.critical { background: var(--red-soft); border-color: #e5b5b0; }
.validation.warning { background: var(--amber-soft); border-color: #e5ca8b; }

/* Administration */
.two-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.details { margin: 0; display: grid; grid-template-columns: 135px minmax(0, 1fr); gap: 10px; }
.details dt { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.details dd { margin: 0; overflow-wrap: anywhere; font-size: 12px; }
.search-row { margin-bottom: 18px; display: flex; gap: 9px; }
.search-row input { flex: 1; }
.user-list { display: grid; gap: 10px; }
.user-row { padding: 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fbfaf6; border: 1px solid var(--line); border-radius: 10px; }
.user-row > div:first-child { min-width: 0; display: grid; gap: 3px; }
.user-row > div:first-child::before { content: ""; width: 8px; height: 8px; position: absolute; }
.user-row strong { font-size: 12px; }
.user-row span { color: var(--muted); font-size: 10px; }
.user-row.inactive { opacity: .58; }
.user-row details { position: relative; }
.user-row summary { list-style: none; }
.user-row summary::-webkit-details-marker { display: none; }
.reset-form { width: 350px; padding: 12px; position: absolute; right: 0; top: 42px; z-index: 12; display: flex; gap: 8px; background: var(--paper-pure); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-md); }
.audit-details { max-width: 360px; overflow-wrap: anywhere; font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.narrow-card { max-width: 610px; }
.error-text { color: var(--red) !important; }
.hidden { display: none !important; }

@media (max-width: 1120px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-cascade { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 850px) {
  :root { --topbar-height: 62px; }
  .sidebar { display: none; }
  .workspace { width: 100%; margin-left: 0; }
  .topbar { padding: 0 18px; }
  .mobile-brand { display: flex; font-size: 13px; }
  .mobile-brand .brand-mark { width: 32px; height: 32px; border-radius: 8px 8px 8px 3px; }
  .mobile-brand .brand-mark span { font-size: 15px; }
  .breadcrumbs { display: none; }
  .main-content { padding: 29px 18px 94px; }
  .account-copy { display: none; }
  .account-chip { gap: 4px; }
  .mobile-nav { height: 66px; padding: 5px max(7px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left)); position: fixed; z-index: 40; inset: auto 0 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: rgb(255 253 248 / 96%); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
  .mobile-nav a { padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); border-radius: 8px; text-decoration: none; }
  .mobile-nav a.active { color: var(--green); background: var(--green-soft); }
  .mobile-nav a > span { font-size: 17px; line-height: 1; }
  .mobile-nav small { font-size: 8px; }
  .two-column, .users-layout { grid-template-columns: 1fr; }
  .dashboard-table-card .panel-header { align-items: flex-start; flex-direction: column; }
  .bulk-export-toolbar { width: 100%; margin-left: 0; justify-content: flex-start; flex-wrap: wrap; }
  .catalog-cascade { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-search-step { grid-column: auto; }
  .form-actions { flex-wrap: wrap; }
  .confirm-box { width: 100%; order: -1; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .danger-zone .button { width: 100%; }
}

@media (max-width: 660px) {
  .main-content { padding-inline: 13px; }
  .page-stack { gap: 14px; }
  .page-heading { align-items: stretch; flex-direction: column; gap: 15px; }
  .page-heading .button { align-self: flex-start; }
  .page-heading h1 { font-size: 27px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat { min-height: 112px; padding: 15px; }
  .stat strong { font-size: 27px; }
  .card { padding: 17px 14px; }
  .bulk-export-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; }
  .selected-count { justify-self: end; }
  .bulk-download-button { width: 100%; grid-column: 1 / -1; }
  .card > .table-wrap { margin: 0 -14px -17px; width: calc(100% + 28px); }
  .card > .table-wrap:first-child { margin-top: -17px; }
  .report-lines-card > .table-wrap { margin-top: 15px; }
  .wide-table { width: calc(100% + 28px) !important; }
  .report-header-card, .report-meta { grid-template-columns: 1fr; }
  .catalog-cascade { margin-inline: -14px; padding-inline: 14px; grid-template-columns: 1fr; }
  .catalog-search-step { grid-column: auto; }
  .catalog-search-control { height: auto; display: grid; }
  .catalog-search-control .button { width: 100%; }
  .section-heading { flex-wrap: wrap; }
  .manual-add-button { width: 100%; }
  .catalog-results { margin-inline: -14px; margin-bottom: -17px; }
  .catalog-results-head, .catalog-result { grid-template-columns: minmax(95px, .75fr) minmax(150px, 1.4fr) 36px; gap: 9px; }
  .catalog-results-head { padding-inline: 14px; }
  .catalog-results-head > span:nth-child(3) { display: none; }
  .catalog-result { padding-inline: 14px; align-items: start; }
  .result-work-type { grid-column: 1; grid-row: 1 / span 2; }
  .result-material { grid-column: 2; grid-row: 1; }
  .result-material strong { white-space: normal; }
  .result-location { grid-column: 2; grid-row: 2; margin-top: 3px; }
  .transfer-button { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
  .manual-summary { min-width: 285px; }
  .manual-identity-grid { grid-template-columns: 1fr; }
  .manual-name-field { grid-column: auto; }
  .search-row, .user-row { align-items: stretch; display: grid; }
  .reset-form { width: 90vw; position: fixed; left: 5vw; right: 5vw; top: 25vh; }
  .form-actions { bottom: 74px; }
  .form-actions .button { flex: 1; }
  .button-row { align-items: stretch; }
}

@media (max-width: 410px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat { min-height: 100px; }
  .auth-shell { padding-block: 25px; }
  .login-card { padding: 27px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  @page { size: A4 landscape; margin: 9mm; }
  html, body { background: #fff; font-size: 9pt; }
  .no-print, .flash, .mobile-nav { display: none !important; }
  .app-shell, .workspace { width: 100%; display: block; margin: 0; }
  .main-content { width: 100%; max-width: none; margin: 0; padding: 0; }
  .page-stack { display: block; animation: none; }
  .print-title { display: block; }
  .card { padding: 0; margin: 0; background: #fff; border: 0; box-shadow: none; }
  .table-wrap, .card > .table-wrap, .wide-table { width: 100% !important; margin: 0 !important; overflow: visible; }
  .print-table { min-width: 0; font-size: 7pt; }
  .print-table th, .print-table td { padding: 4px; border: 1px solid #777; overflow-wrap: anywhere; }
  .report-meta { margin-bottom: 10px; padding-bottom: 8px; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid #777 !important; }
  .return-note { margin-bottom: 10px; background: #fff; border: 1px solid #777; }
  .print-table tr { break-inside: avoid; }
}
