:root {
  --ink: #24221f;
  --muted: #625e57;
  --line: #e7e1d8;
  --canvas: #f7f5f1;
  --paper: #fff;
  --accent: #914521;
  --accent-hover: #713318;
  --accent-soft: #f8ebe0;
  --sidebar: #26231f;
  --sidebar-ink: #e8dfd3;
  --bs-primary: #914521;
  --bs-primary-rgb: 145, 69, 33;
  --bs-body-color: var(--ink);
  --bs-secondary-color: var(--muted);
  --bs-body-font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bs-border-color: var(--line);
}

body { background: var(--canvas); color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid #b75a2d; outline-offset: 3px; }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 20; padding: .6rem 1rem; background: var(--paper); transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.workspace { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100dvh; }
.content { min-width: 0; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; min-width: 0; height: 100dvh; padding: 1.65rem .95rem 1rem; background: var(--sidebar); color: var(--sidebar-ink); overflow: auto; }
.brand { display: flex; align-items: center; gap: .65rem; margin: 0 .45rem 2rem; color: #fff7ed; }
.brand:hover { color: white; text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; flex: 0 0 2rem; background: #d98b59; color: #2a1b13; border-radius: 8px; font-size: .95rem; font-weight: 850; }
.brand-word { font-size: 1.25rem; font-weight: 760; letter-spacing: -.045em; }
.navigation, .navigation-secondary { display: grid; gap: 5px; }
.navigation-mobile { display: none; }
.nav-item { display: flex; align-items: center; gap: .65rem; padding: .66rem .65rem; color: var(--sidebar-ink); border-radius: 8px; font-size: .88rem; font-weight: 550; white-space: nowrap; }
.nav-item:hover { background: #38332d; color: white; text-decoration: none; }
.nav-item.is-current { color: #fff6ea; background: #4a382c; box-shadow: inset 3px 0 #e2a076; font-weight: 700; }
.nav-glyph { display: inline-flex; align-items: center; justify-content: center; width: 1.12rem; font-size: 1.12rem; color: #deab89; line-height: 1; }
.nav-divider { border-top: 1px solid #50473e; margin: .5rem .3rem; }
.sidebar-account { margin-top: auto; padding-top: 1rem; }
.sign-out { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; padding: .63rem; background: transparent; color: var(--sidebar-ink); border: 1px solid #65584b; border-radius: 8px; font-size: .85rem; }
.sign-out:hover { background: #38332d; color: white; }

.topbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; padding: .65rem clamp(1rem, 3.5vw, 3rem); background: var(--paper); border-bottom: 1px solid var(--line); gap: .75rem; }
.topbar-label { font-weight: 680; font-size: .86rem; color: var(--muted); }
.profile { display: flex; align-items: center; gap: .55rem; min-width: 0; font-size: .84rem; font-weight: 650; }
.profile-mark { display: grid; place-items: center; width: 1.85rem; height: 1.85rem; flex: 0 0 1.85rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent-hover); }
.profile-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 15rem; }

.page-content { width: 100%; max-width: 1470px; margin-inline: auto; padding: clamp(1.25rem, 3.4vw, 3rem); }
.page-heading { margin: 0 0 1.65rem; }
.heading-row { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: .8rem 1.2rem; }
.page-description { color: var(--muted); margin: .4rem 0 0; }
.page-footnote { color: var(--muted); font-size: .88rem; margin-top: 1.25rem; }
.breadcrumb-link { display: inline-block; font-size: .88rem; font-weight: 650; margin-bottom: 1rem; }
.eyebrow { color: var(--muted); font-size: .78rem; font-weight: 650; margin-bottom: .45rem; }
h1 { margin: 0; font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 760; letter-spacing: -.045em; line-height: 1.05; overflow-wrap: anywhere; }
h2 { font-weight: 710; letter-spacing: -.027em; }
.surface, .metric { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 2px 6px #30201306; }
.surface { padding: clamp(.9rem, 2.3vw, 1.55rem); min-width: 0; }
.form-surface { max-width: 760px; }
.surface > h2:first-child { margin-bottom: 1rem; }
.table-card { padding: 0; overflow: hidden; }
.table-heading { padding: .95rem 1.2rem; border-bottom: 1px solid var(--line); }
.table-heading h2 { font-size: 1.06rem; margin: 0; }
.table-title { color: var(--ink); font-weight: 700; }
.table-meta { display: block; color: var(--muted); font-size: .79rem; margin-top: .13rem; }
.text-action { font-size: .86rem; font-weight: 700; }
.warehouse-heading { margin-bottom: 1.25rem; }
.warehouse-primary { min-height: 46px; display: inline-flex; align-items: center; }
.warehouse-catalog .table-heading { background: #fff; }
.warehouse-table-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .55rem; padding: .65rem 1.2rem; border-bottom: 1px solid var(--line); }
.warehouse-table { table-layout: fixed; }
.warehouse-table th:first-child { width: 52%; }
.warehouse-table th:nth-child(2) { width: 17%; }
.warehouse-table td { overflow-wrap: anywhere; }
.warehouse-row-actions > * + * { margin-top: .35rem; }
.warehouse-row-actions > a { display: inline-block; }
.warehouse-management { color: var(--muted); font-size: .9rem; }
.goods-form { display: grid; gap: 1rem; max-width: 760px; }
.goods-section h2 { font-size: 1.08rem; margin-bottom: .85rem; }
.goods-section-head { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: .65rem; margin-bottom: .9rem; }
.goods-section-head h2 { margin: 0; }
.goods-section-head > div { display: flex; flex-wrap: wrap; gap: .6rem; }
.goods-section-head label { display: inline-flex; align-items: center; gap: .38rem; padding: .42rem .68rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: .9rem; }
.goods-section-head label:has(input:checked) { background: var(--accent-soft); border-color: #dfc3ad; }
.goods-section-head .form-control { accent-color: var(--accent); min-height: 0; padding: 0; box-shadow: none; }
.goods-form fieldset { min-width: 0; }
.goods-total { color: var(--accent-hover); font-weight: 700; }
.stock-parts summary { color: var(--accent-hover); font-weight: 650; }
.stock-parts ul { padding: .5rem 0 0; margin: 0; list-style: none; }
.stock-parts li + li { margin-top: .6rem; }
.product-create { display: grid; gap: 1rem; max-width: 57rem; }
.product-create fieldset { min-width: 0; }
.product-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.product-fields.component-fields { grid-template-columns: minmax(0, 1fr) minmax(7rem, 9rem); }
.product-row { border-top: 1px solid var(--line); padding-block: .9rem; }
.product-row > button { margin-bottom: .15rem; }
.table { --bs-table-color: var(--ink); }
.table th { color: #615950; background: #faf8f4; font-size: .77rem; font-weight: 700; }
.table td, .table th { padding: .8rem 1.05rem; vertical-align: middle; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr:hover > * { background: #fcfaf7; }
.table-responsive { position: relative; }
.table-narrow { min-width: 600px; }
.filter-tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.filter-tabs a { border-radius: 6px; padding: .35rem .65rem; color: var(--muted); font-size: .86rem; }
.filter-tabs .is-selected { color: var(--accent-hover); background: var(--accent-soft); font-weight: 700; }

.work-highlight { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem 2rem; padding: clamp(1.15rem, 3vw, 2rem); background: linear-gradient(115deg, #f8ebe1, #fbf5ed 68%); border: 1px solid #e8d5c6; border-left: 4px solid #ba6a42; border-radius: 13px; }
.work-highlight h2 { font-size: clamp(1.35rem, 2.6vw, 1.9rem); margin: .18rem 0 .35rem; }
.work-highlight p { margin: 0; color: #604936; font-size: .9rem; }
.work-highlight .highlight-label { color: #7e452b; font-size: .79rem; font-weight: 720; }
.work-highlight .btn [aria-hidden=true] { margin-left: .3rem; }
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.metric { display: block; color: var(--ink); padding: 1rem 1.18rem; }
.metric span { display: block; color: var(--muted); font-size: .82rem; }
.metric strong { display: block; font-size: 1.85rem; letter-spacing: -.045em; margin-top: .14rem; font-variant-numeric: tabular-nums; }
.metric-link:hover { border-color: #d6aa8f; text-decoration: none; color: var(--accent-hover); }
.status-pill { display: inline-block; padding: .22rem .58rem; border-radius: 99px; background: #f0eeea; color: #574e43; font-size: .77rem; font-weight: 650; white-space: nowrap; }
.status-open { background: #eaf0fb; color: #304981; }
.status-done { background: #e7f2e9; color: #295f3d; }
.review-badge { background: #fbedd2; color: #6d481c; }
.notice { background: #f7eee3; padding: .85rem 1rem; border-radius: 8px; color: #5f4938; border: 1px solid #ebdecf; }
.empty-state { text-align: center; color: var(--muted) !important; padding: 2.4rem 1rem !important; }
.voided { opacity: .7; }
.audit-data { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; max-height: 22rem; overflow: auto; }
.btn { border-radius: 8px; min-height: 40px; font-weight: 650; padding-inline: .92rem; }
.btn-sm { min-height: 33px; padding-inline: .62rem; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover); --bs-btn-active-bg: var(--accent-hover); --bs-btn-active-border-color: var(--accent-hover); --bs-btn-disabled-bg: #a78674; --bs-btn-disabled-border-color: #a78674; --bs-btn-focus-shadow-rgb: 145,69,33; }
.btn-outline-primary { --bs-btn-color: var(--accent-hover); --bs-btn-border-color: #d7bead; --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover); --bs-btn-active-bg: var(--accent-hover); }
.btn-outline-secondary { --bs-btn-border-color: #cfc5b9; --bs-btn-color: #534b43; }
.form-label, .form-check-label { font-weight: 600; }
.form-label { margin-bottom: .35rem; }
.form-control, .form-select { border-color: #cfc5b9; min-height: 42px; border-radius: 8px; color: var(--ink); }
.form-control:focus, .form-select:focus { border-color: #bb7349; box-shadow: 0 0 0 .18rem #a9582f2c; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.errorlist { color: #983d30; margin: .35rem 0 .7rem; padding-left: 1.1rem; }
.required-mark { color: #983d30; }
.form-text { color: var(--muted); }
.filter-form { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; }
.filter-search { flex: 1 1 17rem; min-width: 0; }
.filter-form > div { max-width: 100%; }
summary { cursor: pointer; font-weight: 650; }
summary:hover { color: var(--accent-hover); }
[hidden] { display: none !important; }

.entry-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(230px, 1fr); gap: 1rem; align-items: start; }
.entry-section + .entry-section { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.entry-section h2 { font-size: 1.08rem; margin: 0 0 .8rem; }
.entry-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.input-group-row { display: flex; gap: .5rem; align-items: stretch; }
.input-group-row input { min-width: 0; }
.product-matches { display: grid; gap: .35rem; margin-top: .45rem; max-height: 17rem; overflow-y: auto; padding: 3px; }
.product-option { display: grid; gap: .1rem; padding: .48rem .7rem; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); text-align: left; }
.product-option:hover { border-color: #d1a588; background: #fdf7f1; }
.product-option small { color: var(--muted); }
.selected-product { display: grid; gap: .18rem; padding: .7rem .85rem; background: #f8f3ec; border: 1px solid #eddfd3; border-radius: 8px; margin-bottom: .7rem; }
.selected-product small { color: var(--muted); }
.inline-disclosure { margin-top: .7rem; font-size: .9rem; }
.entry-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.25rem; }
.recent-entry { padding: .7rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.recent-entry:first-child { border-top: 0; padding-top: 0; }
.recent-entry p { margin: .18rem 0; }
.recent-entry small { color: var(--muted); }
.recent-entry:last-child { padding-bottom: .9rem; }

.guest-content { min-height: 100dvh; display: grid; place-content: center; padding: 1rem; }
.login-layout { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); background: var(--paper); border: 1px solid var(--line); width: min(760px, calc(100vw - 2rem)); overflow: hidden; border-radius: 17px; box-shadow: 0 12px 40px #36231518; }
.login-brand { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: .75rem; padding: 2rem; background: var(--sidebar); color: #fff7ed; }
.login-brand .brand-word { font-size: 2rem; }
.login-brand p { color: #e1ccbd; margin: 0; }
.login-panel { padding: clamp(1.15rem, 4vw, 2.5rem); max-width: 460px; }
.login-panel h1 { font-size: 1.9rem; margin-bottom: 1.6rem; }
.auth-form input:not([type=hidden]) { display: block; width: 100%; padding: .55rem .7rem; border: 1px solid #cfc5b9; border-radius: 8px; min-height: 44px; }

@media (max-width: 920px) {
  .workspace { grid-template-columns: 176px minmax(0, 1fr); }
  .sidebar { padding-inline: .55rem; }
  .entry-layout { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .workspace { display: block; }
  .sidebar { position: relative; z-index: 2; height: auto; overflow: visible; padding: .65rem .85rem; }
  .brand { margin: 0 0 .55rem; }
  .navigation { display: flex; align-items: center; justify-content: space-between; gap: 0; }
  .nav-item, .navigation-mobile summary { padding: .5rem .4rem; font-size: .82rem; }
  .navigation > .nav-item .nav-glyph, .navigation-secondary { display: none; }
  .navigation-mobile { display: block; position: relative; }
  .navigation-mobile summary { cursor: pointer; border-radius: 8px; white-space: nowrap; }
  .navigation-mobile[open] summary, .navigation-mobile:has(.is-current) summary { background: #4a382c; color: #fff6ea; }
  .navigation-mobile-links { position: absolute; top: calc(100% + .35rem); right: 0; min-width: 10rem; padding: .3rem; border: 1px solid #65584b; border-radius: 9px; background: var(--sidebar); box-shadow: 0 .4rem 1rem #26231f30; }
  .navigation-mobile-links .nav-item { min-height: 42px; }
  .nav-divider { display: none; }
  .sidebar-account { position: absolute; right: .85rem; top: .65rem; display: flex; gap: .3rem; padding: 0; }
  .sidebar-account .nav-item { display: none; }
  .sign-out { padding: .35rem .48rem; }
  .topbar { min-height: 44px; padding-block: .35rem; }
  .profile-name { max-width: 10rem; }
  .table td, .table th { padding: .65rem .72rem; }
  .table-heading { padding: .7rem .75rem; }
  .sheet-table, .sheet-table tbody { display: block; min-width: 0; }
  .sheet-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sheet-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: .45rem .75rem; padding: .8rem .85rem; border-bottom: 1px solid var(--line); }
  .sheet-table tbody tr:last-child { border-bottom: 0; }
  .sheet-table tbody td { padding: 0; border: 0; overflow-wrap: anywhere; }
  .sheet-table td:first-child, .sheet-table td:last-child { grid-column: 1 / -1; }
  .sheet-table td:last-child { display: flex; flex-wrap: wrap; gap: .6rem 1rem; }
  .sheet-table td.empty-state { display: block; }
  .overview-grid { gap: .45rem; }
  .metric { padding: .63rem .62rem; }
  .metric span { font-size: .73rem; }
  .metric strong { font-size: 1.5rem; }
  .entry-actions .btn-primary { flex: 1 1 100%; min-height: 46px; }
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { padding: 1rem 1.2rem; gap: .2rem .65rem; flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; }
  .login-brand p { flex: 1 1 100%; font-size: .85rem; }
  .login-brand .brand-word { font-size: 1.35rem; }
}
@media (max-width: 485px) {
  .warehouse-table td, .warehouse-table th { padding-inline: .5rem; }
  .warehouse-table th:first-child { width: 47%; }
  .warehouse-table th:nth-child(2) { width: 24%; }
  .goods-form .entry-fields { grid-template-columns: 1fr; gap: 0; }
  .stock-overview td, .stock-overview th { padding-inline: .4rem; overflow-wrap: anywhere; }
  .product-fields, .product-fields.component-fields { grid-template-columns: 1fr; }
  .filter-form > div { flex: 1 1 100%; }
  .overview-grid { grid-template-columns: 1fr; }
  .metric { display: flex; align-items: center; justify-content: space-between; padding: .35rem .85rem; }
}
