:root {
    color-scheme: light;
    --bg: #f5f6f8;
    --surface: #fff;
    --text: #4b5563;
    --head: #202939;
    --muted: #697586;
    --line: #e4e7ec;
    --brand: #087f70;
    --brand-dark: #066658;
    --brand-soft: #e9f6f2;
    --side: #fff;
    --side-text: #526071;
    --side-active: #e9f6f2;
    --side-dark: #f4f6f8;
    --ok: #087f70;
    --warn: #a6670b;
    --bad: #c43245;
    --radius: 6px;
    --shadow: 0 1px 3px #10182806;
}
html, body { min-height: 100%; font-size: 13px; letter-spacing: 0; }
body { background: var(--bg); }
button, input, select, textarea { letter-spacing: 0; }
button, .btn { min-height: 38px; gap: 7px; padding: 8px 14px; border-radius: 5px; font-size: 12px; font-weight: 500; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #49b9a7; outline-offset: 3px; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.7; flex-shrink: 0; }
.skip-link { position: fixed; top: -60px; left: 20px; background: var(--head); color: white; padding: 10px 18px; z-index: 100; }
.skip-link:focus { top: 10px; }
.app { grid-template-columns: 238px minmax(0, 1fr); }
.app-anon { grid-template-columns: 1fr; }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 0; scrollbar-color: #d2d8df transparent; z-index: 15; }
.logo { min-height: 80px; color: var(--head); font-size: 20px; padding: 18px 22px; gap: 11px; }
.logo-mark { width: 36px; height: 36px; background: var(--brand); border-radius: 8px; }
.logo-mark svg { width: 23px; height: 23px; }
.logo small { display: block; margin-top: 2px; font-size: 9px; font-weight: 500; color: var(--muted); }
.workspace-label { display: flex; align-items: center; gap: 9px; margin: 0 17px 12px; padding: 10px; border: 1px solid var(--line); border-radius: 5px; font-size: 11px; color: var(--text); }
.workspace-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }
.side-nav { flex: 1; padding: 0 12px 18px; }
.nav-group { color: #6b7685; font-size: 10px; font-weight: 500; letter-spacing: 0; padding: 18px 12px 7px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border: 0; border-radius: 5px; margin: 2px 0; font-size: 12px; }
.side-nav a:hover { color: var(--head); }
.side-nav a.active { color: var(--brand-dark); font-weight: 600; border: 0; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 17px; }
.sidebar-footer > div { min-width: 0; flex: 1; }
.sidebar-footer strong, .sidebar-footer small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer strong { color: var(--head); font-size: 11px; font-weight: 500; }
.sidebar-footer small { color: var(--muted); font-size: 10px; }
.sidebar-footer > a { color: var(--muted); padding: 5px; }
.avatar { width: 32px; height: 32px; flex-shrink: 0; background: #e8eeff; color: #4e5ab3; font-size: 12px; }
.topbar { min-height: 67px; padding: 10px 28px; border-bottom: 1px solid var(--line); box-shadow: none; gap: 16px; }
.breadcrumb { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; font-size: 11px; color: var(--muted); }
.breadcrumb svg { width: 13px; height: 13px; }
.page-title { font-size: 12px; color: var(--head); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 20px; }
.top-actions form { border-left: 1px solid var(--line); padding-left: 18px; }
.user-name { font-size: 11px; max-width: 140px; }
.icon-button, .menu-btn, .signout { display: inline-flex; width: 36px; height: 36px; min-height: 36px; padding: 8px !important; background: transparent !important; border: 1px solid transparent !important; color: var(--muted) !important; }
.icon-button:hover { background: var(--bg) !important; }
.page-shell { padding: 28px 30px 40px; max-width: 1800px; flex: 1; }
.page-shell:focus { outline: none; }
.app-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; padding: 18px 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.app-footer a { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.footer-divider { margin: 0 8px; color: #b6bdc7; }
.card, .hero-copy, .hero-panel, .error-shell { border: 1px solid var(--line); padding: 22px; border-radius: 6px; box-shadow: var(--shadow); }
.card > h1 { font-size: 21px; margin-bottom: 6px; }
.card > h2:first-child { margin-top: 0; }
.muted-copy, .lead { font-size: 12px; line-height: 1.7; }
.hero-copy h1 { font-size: 25px; }
.eyebrow, .nav-group { letter-spacing: 0; }
label { font-size: 11px; gap: 6px; }
input:not([type=checkbox]):not([type=radio]), select, textarea { border-color: #d9dee5; font-size: 12px; border-radius: 5px; padding: 8px 11px; min-width: 0; }
input:not([type=checkbox]):not([type=radio]), select { height: 38px; }
input[type=hidden] { display: none; }
input::placeholder, textarea::placeholder { color: #7b8797; opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: #239e8c; box-shadow: 0 0 0 3px #0f9d8517; }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: #f5f6f8; color: var(--muted); }
input.input-validation-error, select.input-validation-error, textarea.input-validation-error { border-color: var(--bad); }
.validation-summary-errors { color: var(--bad); background: #fff2f3; border: 1px solid #f5d0d6; padding: 12px 16px; border-radius: 5px; grid-column: 1 / -1; }
.validation-summary-errors ul { margin: 0; padding-left: 16px; }
.field-validation-valid, .validation-summary-valid { display: none; }
main form[method=get] { align-items: end; gap: 10px; padding: 16px; background: #f8f9fb; border: 1px solid var(--line); border-radius: 5px; margin: 18px 0; }
main form[method=get] > button { align-self: end; }
main form[method=post] { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
main form[method=post] > div:has(> table), main form[method=post] > .table-region { grid-column: 1 / -1; }
fieldset { background: #fafbfc; max-height: 340px; }
fieldset > legend { font-size: 12px; }
fieldset > label { font-size: 11px; }
.options { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
table { font-size: 12px; font-variant-numeric: tabular-nums; }
th { color: #5d6979; background: #f8f9fb; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 10px; padding: 12px 15px; }
td { padding: 13px 15px; vertical-align: middle; color: #485566; }
tbody tr:nth-child(even) { background: #fcfcfd; }
tbody tr:hover { background: #f3faf7; }
td a:not(.btn) { font-weight: 500; }
td button, td .btn { min-height: 30px; padding: 4px 10px; font-size: 11px; }
.table-region { width: 100%; min-width: 0; margin-top: 16px; }
.table-scroll { overflow-x: auto; width: 100%; border: 1px solid var(--line); border-radius: 5px; }
.table-scroll table { margin: 0; }
.table-scroll th { border-top: 0; }
.table-scroll tbody tr:last-child td { border-bottom: 0; }
.table-scroll:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.table-toolbar, .table-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 0 0 14px; }
.table-toolbar h2 { margin: 0; font-size: 13px; }
.table-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.table-search { position: relative; }
.table-search > svg { position: absolute; top: 11px; left: 10px; width: 16px; height: 16px; color: var(--muted); }
.table-search input { max-width: 230px; padding-left: 33px !important; }
.table-footer { padding: 14px 0 0; color: var(--muted); font-size: 11px; }
.table-footer label { flex-direction: row; align-items: center; font-weight: 400; color: var(--muted); }
.table-footer select { width: 65px; height: 32px; padding: 4px 7px; font-size: 11px; }
.pagination { display: flex; align-items: center; gap: 6px; }
.pagination button, .pagination a.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; height: 30px; width: 30px; padding: 5px; }
.pagination span { min-width: 92px; text-align: center; white-space: nowrap; }
/* Server-paged lists (the _Pager partial) share the automatic table pager's footer. */
.erp-pager { margin: 0; }
.erp-pager .erp-subtle { margin-left: 4px; }
.sort-button { background: transparent; color: inherit; padding: 0; border: 0; min-height: 20px; width: 100%; justify-content: space-between; text-align: left; font-size: inherit; font-weight: 600; }
.sort-button:hover { background: transparent; color: var(--brand); border: 0; }
.sort-button svg { width: 12px; height: 12px; opacity: .6; }
.table-empty { text-align: center; padding: 35px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 4px; font-size: 10px; font-weight: 500; background: var(--brand-soft); color: var(--brand); }
.page-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page-heading h1 { font-size: 25px; margin: 0 0 5px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 28px; }
.overview-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 15px; padding: 20px; border: 1px solid var(--line); background: white; border-radius: 6px; color: var(--head); }
.overview-tile:hover { border-color: #a6cfc5; box-shadow: 0 3px 10px #10182808; }
.tile-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 7px; background: var(--brand-soft); color: var(--brand); }
.tile-icon.blue { color: #4268b8; background: #edf2ff; }
.tile-icon.amber { color: #a56c10; background: #fff5de; }
.tile-icon.rose { color: #b14c74; background: #fceff4; }
.overview-tile > div { width: 100%; }
.overview-tile strong { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 600; }
.overview-tile small { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 15px; }
.section-heading > span { font-size: 11px; color: var(--muted); }
.operations-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; }
.workflow-list { border-top: 1px solid var(--line); }
.workflow-row { display: flex; align-items: center; gap: 14px; padding: 17px 0; border-bottom: 1px solid var(--line); color: var(--head); }
.workflow-row > div { flex: 1; min-width: 0; }
.workflow-row strong { display: block; font-size: 12px; font-weight: 500; }
.workflow-row small { color: var(--muted); font-size: 11px; }
.workflow-row > svg { color: var(--muted); width: 16px; }
.workflow-row:hover strong { color: var(--brand); }
.quick-link-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.quick-link-list a { display: flex; align-items: center; gap: 9px; padding: 15px 8px 15px 0; border-bottom: 1px solid var(--line); color: var(--text); font-size: 11px; }
.quick-link-list a:hover { color: var(--brand); }
.quick-link-list svg { width: 16px; height: 16px; color: var(--muted); }
.archive-section { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 20px; }
.archive-section summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.archive-section .dashboard-links { margin-top: 16px; }
.dashboard-links a { background: white; font-size: 11px; }
nav.dashboard-links { display: flex; flex-wrap: wrap; gap: 0; margin: 18px 0 22px; border-bottom: 1px solid var(--line); }
nav.dashboard-links a { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 10px 15px; }
nav.dashboard-links a:hover { border-color: #b0d8cf; background: #f7fbf9; }
nav.dashboard-links a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
form[action*="handler=Delete"] button { color: var(--bad); background: #fff3f4; border-color: #f4d1d6; }
form[action*="handler=Delete"] button:hover { background: #fde6e9; }
.secondary-heading { margin-top: 26px; }
.login-shell { max-width: 420px; margin: 8vh auto; }
.login-logo { justify-content: center; padding-bottom: 30px; }
.login-form { padding: 32px; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 30px #10182806; }
.login-form h1 { font-size: 25px; }
main .login-form form[method=post] { display: flex; flex-direction: column; gap: 20px; }
.login-form label { width: 100%; }
.login-form button { width: 100%; margin-top: 4px; }
.login-error, .success-banner { padding: 12px 15px; border-radius: 5px; font-size: 12px; }
.login-error { color: var(--bad); background: #fff2f3; border: 1px solid #f5d0d6; }
.success-banner { color: var(--brand-dark); background: var(--brand-soft); border: 1px solid #bfdfd5; margin-bottom: 18px; }
.item-shell { margin-top: 24px; }
.item-shell-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 24px; }
.item-shell-grid > *, .field { min-width: 0; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 15px; }
.item-card { border: 1px solid var(--line); border-radius: 6px; padding: 18px; }
.item-card-header { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.item-card-header h2, .item-card-header h3 { margin: 4px 0 12px; font-size: 14px; }
.item-code { color: var(--muted); font-size: 10px; }
.item-badge { background: var(--brand-soft); color: var(--brand); padding: 3px 7px; border-radius: 4px; font-size: 10px; }
.item-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; font-size: 11px; }
.item-details dt { color: var(--muted); }
.item-details dd { margin: 2px 0 0; color: var(--head); overflow-wrap: anywhere; }
.item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 15px; }
.item-form-card { padding-left: 24px; border-left: 1px solid var(--line); }
.item-form-card h2 { margin-top: 0; }
main .item-form { display: block !important; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field-full { grid-column: 1 / -1; }
.field label { margin-bottom: 6px; }
.preview-card { padding: 15px 0; margin-top: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric strong { font-size: 20px; overflow-wrap: anywhere; }
.hero-copy, .hero-panel { box-shadow: none; }
.hero-panel .metric, .hero-panel .status-card { border-radius: 0; background: transparent; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hero-copy .lead { margin-bottom: 0; }
.app.nav-collapsed { grid-template-columns: 1fr; }
.app.nav-collapsed .sidebar { display: none; }
@media (min-width: 901px) { .scrim { display: none !important; } }
@media (max-width: 1200px) { .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .operations-grid, .item-shell-grid { grid-template-columns: 1fr; } .top-create { display: none; } .item-form-card { padding: 24px 0 0; border-left: 0; border-top: 1px solid var(--line); } }
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .app.nav-collapsed .sidebar { display: flex; }
    .sidebar { position: fixed; width: 250px; height: 100dvh; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .scrim.show { display: block; position: fixed; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: #10182866; z-index: 20; padding: 0; }
    body.nav-open { overflow: hidden; }
    .topbar { padding: 10px 16px; gap: 9px; }
    .top-actions { gap: 8px; }
    .top-actions form { padding-left: 10px; }
    .page-shell { padding: 22px 16px 32px; }
    .user-name { display: none; }
    .app-footer { padding: 16px; }
    .card { padding: 16px; }
    .hero-shell { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
    .breadcrumb > span:first-child, .breadcrumb > svg { display: none; }
    .page-heading h1 { font-size: 22px; }
    .overview-grid { gap: 10px; }
    .overview-tile { padding: 15px; gap: 12px; }
    .overview-tile strong { font-size: 13px; }
    .overview-tile strong svg { display: none; }
    .overview-tile small { font-size: 10px; }
    .table-toolbar, .table-controls { align-items: stretch; }
    .table-controls { width: 100%; }
    .table-search { flex: 1; min-width: 130px; }
    .table-search input { max-width: none; }
    .table-footer { align-items: flex-start; }
    .table-footer > span { flex-basis: 100%; }
    main form[method=get] > input:not([type=checkbox]), main form[method=get] > select { width: 100%; flex-basis: 100%; }
    main form[method=get] > .dashboard-links, .dashboard-links { grid-template-columns: 1fr; }
    .dashboard-sections { grid-template-columns: minmax(0, 1fr); }
    .app-footer { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media print {
    .sidebar, .topbar, .app-footer, .table-controls, .pagination, .skip-link { display: none !important; }
    .app { display: block; }
    .page-shell { padding: 0; }
    .table-scroll, .card { overflow: visible; box-shadow: none; }
}