:root {
    --bg: #f2efe8;
    --bg-soft: #e4ede8;
    --surface: rgba(255, 253, 249, 0.9);
    --surface-strong: #fffdfa;
    --surface-dark: #10312f;
    --text: #16201d;
    --muted: #64706c;
    --line: rgba(16, 49, 47, 0.12);
    --primary: #14635f;
    --primary-strong: #0d3b3a;
    --accent: #de8b3b;
    --danger: #ab4337;
    --success: #2f7a5d;
    --radius: 26px;
    --shadow: 0 24px 60px rgba(16, 49, 47, 0.08);
}

:root[data-theme="dark"] {
    --bg: #0e1716;
    --bg-soft: #122120;
    --surface: rgba(18, 33, 32, 0.88);
    --surface-strong: #162524;
    --surface-dark: #091413;
    --text: #edf3ef;
    --muted: #9ba8a2;
    --line: rgba(237, 243, 239, 0.08);
    --primary: #67d4c3;
    --primary-strong: #f4fffd;
    --accent: #f3bc74;
    --danger: #ff8e81;
    --success: #56c08d;
    --shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { color-scheme: light; scrollbar-gutter: stable; }
html[data-theme="dark"] { color-scheme: dark; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(222, 139, 59, 0.14), transparent 25%),
        radial-gradient(circle at bottom right, rgba(20, 99, 95, 0.12), transparent 22%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
    color: var(--text);
    transition: background 0.25s ease, color 0.25s ease;
}
.dashboard-shell {
    background:
        radial-gradient(circle at top right, rgba(20, 99, 95, 0.08), transparent 22%),
        linear-gradient(180deg, #eef4ef 0%, #e4ede8 100%);
}
:root[data-theme="dark"] .dashboard-shell {
    background:
        radial-gradient(circle at top right, rgba(103, 212, 195, 0.08), transparent 20%),
        linear-gradient(180deg, #091413 0%, #0d1a19 100%);
}
a { color: inherit; text-decoration: none; }
main { padding-bottom: 48px; }
img { display: block; max-width: 100%; }

.container { width: min(1160px, calc(100% - 32px)); margin: 0 auto; }
.section { padding: 40px 0; }
.section-top { margin-top: 24px; }
.narrow { width: min(720px, calc(100% - 32px)); }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
    background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
    border-bottom: 1px solid var(--line);
}

.nav, .nav-links, .section-head, .action-bar, .inline-form, .stats {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.nav, .section-head { justify-content: space-between; }
.nav { padding: 18px 0; }
.brand { font-weight: 800; letter-spacing: -0.04em; font-size: 1.15rem; }
.brand-logo {
    display: inline-flex;
    align-items: center;
    min-height: 56px;
    flex: 0 0 auto;
}
.brand-logo img {
    display: block;
    width: auto;
}
.brand-logo-default {
    height: 44px;
    width: auto;
    max-width: none;
}
.theme-toggle, .sidebar-toggle {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: 14px;
    padding: 12px 14px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, color 0.18s ease;
}
.theme-toggle:hover, .sidebar-toggle:hover {
    transform: translateY(-1px);
}
.site-footer {
    padding: 18px 0 26px;
}
.site-footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    width: min(620px, calc(100% - 24px));
    margin: 0 auto;
    padding: 10px 16px;
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    text-align: center;
}
.site-footer-logo-shell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface-strong) 90%, transparent);
    border: 1px solid var(--line);
}
.site-footer-logo {
    height: 42px;
    width: auto;
    max-width: none;
    opacity: 0.96;
    mix-blend-mode: normal;
}
.site-footer p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.98rem;
}
.home-brand {
    display: inline-flex;
    align-items: center;
    min-height: 64px;
    margin-bottom: 20px;
    flex: 0 0 auto;
}
.home-brand img {
    width: auto;
}
.home-brand-default {
    height: 56px;
    width: auto;
    max-width: none;
}

.hero {
    padding: 48px 0 24px;
}
.hero-grid {
    align-items: start;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.85fr);
    gap: 28px;
}
.hero-grid > :first-child {
    max-width: 580px;
}
.hero-grid, .detail-grid, .dashboard-grid {
    display: grid;
    gap: 24px;
}
.entry-grid, .cards-grid, .stats-grid, .inventory-grid, .stack-panels {
    display: grid;
    gap: 18px;
}
.cards-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 24px; }
.inventory-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.home-inventory-panel {
    min-height: 220px;
    max-width: 440px;
    width: 100%;
    justify-self: end;
}
.home-manager-entry {
    display: flex;
    align-items: end;
    justify-content: flex-start;
    min-height: 48px;
}
.inventory-extra-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) 110px 150px minmax(220px, 1fr);
    gap: 12px;
    align-items: end;
}
.inventory-extra-search-field {
    position: relative;
}
.inventory-extra-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 20;
    display: grid;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
    padding: 8px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
    box-shadow: 0 18px 40px rgba(4, 16, 14, 0.18);
}
.inventory-extra-option {
    width: 100%;
    border: 0;
    border-radius: 14px;
    padding: 10px 12px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.inventory-extra-option:hover,
.inventory-extra-option:focus-visible {
    background: color-mix(in srgb, var(--accent) 14%, var(--surface-strong));
    outline: none;
}
.inventory-extra-empty {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 0.94rem;
}
.inventory-filter-panel {
    margin-bottom: 24px;
}
.inventory-load-more-wrap {
    justify-content: center;
}
.inventory-load-more-wrap.is-hidden {
    display: none !important;
}
.inventory-line-item {
    display: grid;
    gap: 14px;
    padding: 18px 20px;
}
.inventory-line-item.is-hidden {
    display: none !important;
}
.inventory-line-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.inventory-line-head h2 {
    margin-bottom: 6px;
}
.inventory-line-grid {
    display: grid;
    grid-template-columns: 72px 118px minmax(0, 1fr);
    gap: 14px;
    align-items: end;
}
.inventory-field {
    position: relative;
    display: grid;
    gap: 8px;
    padding: 10px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
    border: 1px solid var(--line);
}
.inventory-field-quantity,
.inventory-field-asset {
    justify-items: center;
}
.inventory-field-quantity input,
.inventory-field-asset input {
    text-align: center;
}
.inventory-field::before {
    display: none;
}
.inventory-line-item .field label {
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 24px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
}
.inventory-line-item .field input,
.inventory-line-item .field textarea {
    min-height: 40px;
    padding: 10px 12px;
}
.inventory-field textarea {
    min-height: 40px;
    height: 40px;
    max-height: 40px;
    padding-top: 10px;
    padding-bottom: 10px;
    line-height: 1.2;
    resize: none;
    overflow: hidden;
}

.panel, .list-card, .item-card, .stat-card {
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    background: var(--surface);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.panel-dark {
    background: linear-gradient(150deg, var(--surface-dark), color-mix(in srgb, var(--surface-dark) 55%, var(--primary) 45%));
    color: #f8fbfa;
}
.panel-light { background: var(--surface); }
.entry-grid .panel:hover,
.entry-grid .panel:focus-within,
.entry-grid .panel:active,
.list-card:hover,
.list-card:focus-within,
.list-card:active {
    transform: translateY(-6px);
    box-shadow: 0 30px 70px rgba(16, 49, 47, 0.15);
}

.panel-label, .eyebrow, .card-code, .tag {
    display: inline-flex;
    width: fit-content;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}
.panel-label, .eyebrow, .card-code { color: var(--accent); }
.tag {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(222, 139, 59, 0.14);
    color: var(--accent);
}
.badge-draft {
    background: rgba(243, 188, 116, 0.18);
    color: #8b5a16;
}
.badge-submitted {
    background: rgba(20, 99, 95, 0.16);
    color: #0f5b57;
}
.badge-approved {
    background: rgba(47, 122, 93, 0.18);
    color: #1e714e;
}
.badge-rejected {
    background: rgba(171, 67, 55, 0.16);
    color: #9d3328;
}
:root[data-theme="dark"] .badge-draft {
    background: rgba(243, 188, 116, 0.16);
    color: #ffd89e;
}
:root[data-theme="dark"] .badge-submitted {
    background: rgba(103, 212, 195, 0.16);
    color: #bff9ef;
}
:root[data-theme="dark"] .badge-approved {
    background: rgba(86, 192, 141, 0.18);
    color: #c5f6de;
}
:root[data-theme="dark"] .badge-rejected {
    background: rgba(255, 142, 129, 0.16);
    color: #ffd0ca;
}
:root[data-theme="dark"] .field-status-indicator {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
}
:root[data-theme="dark"] .field-status-indicator.is-valid {
    background: rgba(86, 192, 141, 0.18);
    color: #c5f6de;
}
:root[data-theme="dark"] .field-status-indicator.is-invalid {
    background: rgba(255, 142, 129, 0.16);
    color: #ffd0ca;
}

h1, h2, h3 { margin: 8px 0 12px; letter-spacing: -0.04em; }
h1 { font-size: clamp(2rem, 5vw, 3.8rem); line-height: 1; }
h2 { font-size: 1.3rem; }
p { color: var(--muted); line-height: 1.6; }

.button, .link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--primary);
    color: white;
    padding: 14px 18px;
    border-radius: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    box-shadow: 0 14px 32px rgba(20, 99, 95, 0.2);
}
.button:hover, .button:active { transform: translateY(-2px); }
.button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.button-light { background: #f2eee4; color: var(--primary-strong); }
.button-secondary {
    background: transparent;
    color: var(--primary-strong);
    border: 1px solid var(--line);
    box-shadow: none;
}
.button-danger { background: var(--danger); }
.link-button { padding: 0; background: transparent; color: var(--primary-strong); }

:root[data-theme="dark"] .button {
    background: linear-gradient(180deg, #7ae8d6 0%, #49bcae 100%);
    color: #06211f;
    box-shadow: 0 18px 40px rgba(73, 188, 174, 0.28);
}

:root[data-theme="dark"] .button:hover,
:root[data-theme="dark"] .button:focus-visible {
    background: linear-gradient(180deg, #8cf2e1 0%, #58c8ba 100%);
    box-shadow: 0 22px 44px rgba(88, 200, 186, 0.34);
}

:root[data-theme="dark"] .button-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: #e8f9f5;
    border: 1px solid rgba(122, 232, 214, 0.28);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

:root[data-theme="dark"] .button-secondary:hover,
:root[data-theme="dark"] .button-secondary:focus-visible {
    background: rgba(122, 232, 214, 0.12);
    border-color: rgba(122, 232, 214, 0.42);
    color: #ffffff;
}

:root[data-theme="dark"] .button-light {
    background: linear-gradient(180deg, #fff7ea 0%, #f1ddbd 100%);
    color: #2d2417;
    box-shadow: 0 18px 38px rgba(243, 188, 116, 0.18);
}

:root[data-theme="dark"] .button-danger {
    background: linear-gradient(180deg, #ff9f94 0%, #eb6f62 100%);
    color: #2f0f0a;
    box-shadow: 0 18px 38px rgba(235, 111, 98, 0.24);
}

:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .sidebar-toggle {
    background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%);
    border-color: rgba(122, 232, 214, 0.22);
    color: #ebfffb;
}

:root[data-theme="dark"] .theme-toggle:hover,
:root[data-theme="dark"] .sidebar-toggle:hover {
    background: rgba(122, 232, 214, 0.1);
    border-color: rgba(122, 232, 214, 0.36);
}

:root[data-theme="dark"] .link-button {
    color: #d9f8f2;
}

.stack-form, .field { display: grid; gap: 8px; }
.stack-form { gap: 18px; }
.field label { font-size: 0.9rem; font-weight: 700; }
.inline-form-stretch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
}
.field input, .field select, .field textarea, .inline-form select, .inline-form input {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text);
    border-radius: 14px;
    min-height: 48px;
    padding: 12px 14px;
    font: inherit;
}
.field textarea { min-height: 96px; }
.field-error { color: var(--danger); font-size: 0.88rem; }
.input-with-status {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}
.field-status-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(100, 112, 108, 0.12);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}
.field-status-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 1rem;
    line-height: 1;
    font-weight: 800;
}
.field-status-indicator.is-valid {
    background: rgba(47, 122, 93, 0.18);
    color: var(--success);
}
.field-status-indicator.is-invalid {
    background: rgba(171, 67, 55, 0.16);
    color: var(--danger);
}
.grow { flex: 1; }

.messages { padding-top: 16px; }
.message {
    padding: 14px 18px;
    border-radius: 16px;
    margin-bottom: 12px;
    background: rgba(47, 122, 93, 0.14);
    border: 1px solid rgba(47, 122, 93, 0.2);
}
.message.warning {
    background: rgba(222, 139, 59, 0.15);
    border-color: rgba(222, 139, 59, 0.22);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
.table-actions-col {
    width: 1%;
    white-space: nowrap;
}
.table-actions {
    white-space: nowrap;
}
.runs-table td:first-child,
.runs-table th:first-child {
    width: 1%;
    white-space: nowrap;
}
.runs-table td:nth-child(2),
.runs-table th:nth-child(2) {
    width: 1%;
    white-space: nowrap;
}
.runs-table td:last-child,
.runs-table th:last-child {
    width: 1%;
    white-space: nowrap;
}
.button-compact {
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 14px;
}
.dashboard-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}
.dashboard-chart-panel {
    display: grid;
    gap: 12px;
    align-self: start;
}
.chart-legend-box {
    display: grid;
    gap: 10px;
}
.chart-legend-title {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.chart-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.94rem;
}
.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
    border: 1px solid var(--line);
    color: var(--text);
    font-weight: 700;
}
.chart-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    display: inline-block;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55);
}
.chart-dot-executed { background: var(--primary); }
.chart-dot-approved { background: var(--success); }
.chart-dot-rejected { background: var(--danger); }
.dashboard-line-chart {
    position: relative;
    border-radius: 24px;
    padding: 10px;
    background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
    border: 1px solid var(--line);
}
.dashboard-line-chart canvas {
    width: 100%;
    height: 270px;
    display: block;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(244,248,245,0.92));
}
.chart-axis-label {
    fill: var(--muted);
    font-size: 11px;
    font-weight: 700;
}
.chart-axis-value {
    fill: var(--muted);
    font-size: 11px;
    font-weight: 700;
}
.chart-tooltip {
    position: absolute;
    z-index: 4;
    display: grid;
    gap: 3px;
    min-width: 110px;
    padding: 10px 12px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-dark) 94%, transparent);
    color: #f7fbf9;
    box-shadow: 0 18px 34px rgba(4, 16, 14, 0.24);
    pointer-events: none;
}
.chart-tooltip strong {
    font-size: 0.86rem;
}
.chart-tooltip span {
    color: rgba(247, 251, 249, 0.82);
    font-size: 0.82rem;
}
.chart-tooltip[data-tone="chart-point-executed"] {
    border-left: 4px solid #1c8c84;
}
.chart-tooltip[data-tone="chart-point-approved"] {
    border-left: 4px solid #2fa86d;
}
.chart-tooltip[data-tone="chart-point-rejected"] {
    border-left: 4px solid #d35a4f;
}
.chart-tooltip-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.status-bars {
    display: grid;
    gap: 14px;
}
.dashboard-chart-grid > :last-child {
    min-height: 0;
}
.status-bar-card {
    display: grid;
    gap: 8px;
}
.status-bar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.status-bar-track {
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: color-mix(in srgb, var(--surface-strong) 70%, var(--line));
}
.status-bar-fill {
    height: 100%;
    border-radius: inherit;
}
.status-bar-fill-rascunho { background: color-mix(in srgb, var(--accent) 70%, var(--surface-dark)); }
.status-bar-fill-enviado { background: var(--primary); }
.status-bar-fill-aprovado { background: var(--success); }
.status-bar-fill-reprovado { background: var(--danger); }
.users-table td:last-child,
.users-table th:last-child {
    width: 1%;
    white-space: nowrap;
}
.users-actions {
    gap: 10px;
}
.app-dialog {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: min(680px, calc(100vw - 24px));
    width: 100%;
}
.app-dialog::backdrop {
    background: rgba(4, 16, 14, 0.54);
    backdrop-filter: blur(6px);
}
.app-dialog-card {
    width: 100%;
    padding: 24px;
    border-radius: 28px;
    background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.app-dialog-card .section-head {
    align-items: flex-start;
    margin-bottom: 18px;
}
.app-dialog-card h2 {
    margin-bottom: 0;
}
.button.is-static {
    pointer-events: none;
    opacity: 0.45;
}
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}
.pagination-info {
    color: var(--muted);
    font-weight: 700;
}
.compact-list { margin: 0; padding-left: 18px; color: var(--muted); }
.sample-block pre {
    white-space: pre-wrap;
    overflow: auto;
    border-radius: 16px;
    padding: 16px;
    background: color-mix(in srgb, var(--surface-strong) 88%, var(--bg-soft));
    border: 1px solid var(--line);
}
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(8, 18, 17, 0.52);
    backdrop-filter: blur(8px);
}
.loading-overlay[hidden] {
    display: none;
}
.loading-overlay-card {
    width: min(420px, 100%);
    padding: 28px;
    border-radius: 28px;
    border: 1px solid color-mix(in srgb, var(--line) 80%, white 20%);
    background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.22);
    text-align: center;
}
.loading-overlay-card h2 {
    margin-bottom: 8px;
}
.progress-track {
    width: 100%;
    height: 14px;
    margin-top: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(20, 99, 95, 0.1);
}
.progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--accent) 30%, var(--primary)));
    transition: width 0.35s ease;
}
.progress-number {
    display: block;
    margin-top: 14px;
    font-size: 1.3rem;
    letter-spacing: -0.03em;
}
.progress-meta {
    margin-top: 8px;
    margin-bottom: 0;
}
.loading-spinner {
    display: inline-block;
    width: 54px;
    height: 54px;
    margin-bottom: 18px;
    border-radius: 50%;
    border: 4px solid rgba(20, 99, 95, 0.14);
    border-top-color: var(--primary);
    animation: spin 0.9s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
:root[data-theme="dark"] .loading-overlay {
    background: rgba(2, 8, 8, 0.68);
}
:root[data-theme="dark"] .loading-overlay-card {
    background: rgba(18, 33, 32, 0.96);
    border-color: rgba(103, 212, 195, 0.14);
}
:root[data-theme="dark"] .loading-spinner {
    border-color: rgba(103, 212, 195, 0.12);
    border-top-color: #7ae8d6;
}
:root[data-theme="dark"] .progress-track {
    background: rgba(103, 212, 195, 0.1);
}
:root[data-theme="dark"] .progress-bar {
    background: linear-gradient(90deg, #67d4c3, #f3bc74);
}
.inventory-search-panel,
.inventory-start-panel {
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 90%, transparent) 0%, var(--surface) 100%);
}
.inventory-search-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 14px;
}
.inventory-list-grid {
    margin-top: 24px;
}
.inventory-list-card {
    padding: 24px;
    gap: 12px;
}
.inventory-list-button {
    width: 100%;
    min-height: 52px;
}
.inventory-detail-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    align-items: start;
}
.inventory-detail-side {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 280px;
    max-width: 280px;
    min-width: 280px;
    align-self: start;
    position: sticky;
    top: 104px;
    height: fit-content;
    max-height: calc(100vh - 128px);
}
.inventory-side-card {
    width: 100%;
    min-height: 0;
    height: auto !important;
    flex: 0 0 auto;
    align-self: stretch;
    overflow: auto;
}
.inventory-side-card-status {
    height: 170px !important;
    min-height: 170px;
    max-height: 170px;
}
.inventory-side-card-form {
    height: 280px !important;
    min-height: 280px;
    max-height: 280px;
}
.inventory-side-card .stack-form {
    height: 100%;
    align-content: start;
}
.inventory-side-card textarea {
    max-height: 96px;
}
.inventory-detail-load-more-wrap {
    justify-content: center;
    margin-top: 18px;
}
.table-section-row td {
    padding-top: 22px;
    font-weight: 800;
    color: var(--accent);
    border-bottom: 1px solid var(--line);
}
.empty-item-row.is-hidden {
    display: none !important;
}
.run-card {
    border-radius: 24px;
    padding: 22px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: grid;
    gap: 14px;
}
.run-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.status-draft {
    background: linear-gradient(180deg, rgba(190, 160, 100, 0.12), var(--surface));
}
.status-submitted {
    background: linear-gradient(180deg, rgba(20, 99, 95, 0.16), var(--surface));
}
.status-approved {
    background: linear-gradient(180deg, rgba(47, 122, 93, 0.18), var(--surface));
}
.status-rejected {
    background: linear-gradient(180deg, rgba(171, 67, 55, 0.16), var(--surface));
}
:root[data-theme="dark"] .status-draft {
    background: linear-gradient(180deg, rgba(243, 188, 116, 0.12), rgba(18, 33, 32, 0.92));
}
:root[data-theme="dark"] .status-submitted {
    background: linear-gradient(180deg, rgba(103, 212, 195, 0.14), rgba(18, 33, 32, 0.92));
}
:root[data-theme="dark"] .status-approved {
    background: linear-gradient(180deg, rgba(86, 192, 141, 0.16), rgba(18, 33, 32, 0.92));
}
:root[data-theme="dark"] .status-rejected {
    background: linear-gradient(180deg, rgba(255, 142, 129, 0.14), rgba(18, 33, 32, 0.92));
}

.dashboard-shell .container { width: min(1180px, calc(100% - 32px)); }
.dashboard-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 0;
}
.dashboard-sidebar {
    position: sticky;
    top: 92px;
    align-self: start;
    border-radius: 28px;
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 90%, transparent) 0%, var(--surface) 100%);
    box-shadow: var(--shadow);
    padding: 20px;
}
.sidebar-top {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.sidebar-nav {
    display: grid;
    gap: 10px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    color: var(--muted);
    font-weight: 700;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.sidebar-label {
    white-space: nowrap;
}
.sidebar-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}
.sidebar-link .sidebar-icon {
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.sidebar-icon svg {
    width: 18px;
    height: 18px;
}
.hamburger-icon {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 18px;
    height: 18px;
}
.hamburger-icon span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}
.sidebar-link:hover, .sidebar-link.active {
    transform: translateX(4px);
    background: color-mix(in srgb, var(--primary) 13%, var(--surface-strong));
    border-color: color-mix(in srgb, var(--primary) 18%, transparent);
    color: var(--text);
}
.sidebar-link.active .sidebar-icon,
.sidebar-link:hover .sidebar-icon {
    background: color-mix(in srgb, var(--primary) 18%, var(--surface-strong));
}
.dashboard-content { min-width: 0; }
.dashboard-shell.sidebar-collapsed .dashboard-layout {
    grid-template-columns: 86px minmax(0, 1fr);
}
.dashboard-shell.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding-inline: 0;
    transform: none;
}
.dashboard-shell.sidebar-collapsed .sidebar-top h2,
.dashboard-shell.sidebar-collapsed .sidebar-top .panel-label,
.dashboard-shell.sidebar-collapsed .sidebar-label {
    display: none;
}
.dashboard-shell.sidebar-collapsed .sidebar-top {
    justify-content: center;
}
.dashboard-shell.sidebar-collapsed .sidebar-toggle {
    margin: 0 auto;
}

:root[data-theme="dark"] .dashboard-sidebar {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
}
:root[data-theme="dark"] .site-footer-logo-shell {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(103, 212, 195, 0.12);
}
:root[data-theme="dark"] .sidebar-link {
    background: rgba(255, 255, 255, 0.015);
}

:root[data-theme="dark"] .sidebar-link .sidebar-icon {
    background: rgba(103, 212, 195, 0.09);
}

:root[data-theme="dark"] .sidebar-link:hover,
:root[data-theme="dark"] .sidebar-link.active {
    background: rgba(103, 212, 195, 0.12);
    border-color: rgba(103, 212, 195, 0.16);
}

:root[data-theme="dark"] .sidebar-link:hover .sidebar-icon,
:root[data-theme="dark"] .sidebar-link.active .sidebar-icon {
    background: rgba(103, 212, 195, 0.18);
}

@media (max-width: 980px) {
    .hero-grid, .detail-grid, .dashboard-grid, .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .dashboard-chart-grid {
        grid-template-columns: 1fr;
    }
    .inventory-detail-layout {
        grid-template-columns: 1fr;
    }
    .inventory-detail-side {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: none;
        min-width: 0;
        position: static;
        top: auto;
        max-height: none;
    }
    .inventory-side-card-status,
    .inventory-side-card-form {
        height: auto !important;
        min-height: 0;
        max-height: none;
    }
    .inventory-search-grid {
        grid-template-columns: 1fr;
    }
    .inventory-extra-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-sidebar {
        position: static;
        top: auto;
    }
}

@media (max-width: 720px) {
    .container, .narrow { width: min(100% - 20px, 100%); }
    .panel, .list-card, .item-card, .stat-card { padding: 20px; border-radius: 20px; }
    .action-bar .button,
    .inline-form .button,
    .inline-form input,
    .inline-form select { width: 100%; }
    .nav { align-items: flex-start; }
    .brand-logo img {
        height: 32px;
    }
    .brand-logo-default {
        height: 32px;
    }
    .site-footer-logo-shell {
        padding: 8px 12px;
        border-radius: 14px;
    }
    .site-footer-logo {
        height: 34px;
    }
    .home-brand img {
        width: auto;
    }
    .home-brand-default {
        height: 40px;
    }
    .dashboard-layout { width: min(100% - 20px, 100%); margin-top: 20px; }
    .inventory-search-panel .action-bar .button,
    .inventory-start-panel .button,
    .inventory-list-button {
        width: 100%;
    }
    .inventory-list-card {
        padding: 22px;
    }
    .dashboard-line-chart {
        padding-inline: 6px;
    }
    .dashboard-line-chart canvas {
        height: 220px;
    }
    .inventory-line-item {
        padding: 16px;
        gap: 12px;
    }
    .inventory-line-grid {
        grid-template-columns: 72px 118px minmax(0, 1fr);
        gap: 14px;
    }
    .inventory-field {
        padding: 10px 8px;
        border-radius: 16px;
    }
    .inventory-field-quantity::after,
    .inventory-field-asset::after {
        content: "";
        position: absolute;
        right: -8px;
        top: 16px;
        bottom: 16px;
        width: 2px;
        border-radius: 999px;
        background: color-mix(in srgb, var(--accent) 38%, var(--line));
        opacity: 0.9;
    }
    .inventory-line-item .field label {
        font-size: 0.76rem;
        min-height: 32px;
        line-height: 1.15;
        padding: 0;
        text-align: center;
        width: 100%;
    }
    .inventory-line-item .field input,
    .inventory-line-item .field textarea {
        min-height: 38px;
        padding: 8px 10px;
    }
    .inventory-field-quantity {
        z-index: 3;
    }
    .inventory-field-asset {
        z-index: 2;
    }
    .inventory-field-notes {
        z-index: 1;
    }
    .inventory-field textarea {
        min-height: 38px;
        height: 38px;
        max-height: 38px;
        padding-top: 9px;
        padding-bottom: 9px;
    }
    .inline-form-stretch {
        grid-template-columns: 1fr;
    }
    .pagination {
        flex-direction: column;
        align-items: stretch;
    }
    .pagination .button {
        width: 100%;
    }
    .input-with-status {
        grid-template-columns: 1fr;
    }
    .field-status-indicator {
        width: 100%;
        justify-content: flex-start;
    }
}

.field-status-indicator .field-status-dot,
.field-status-indicator .field-status-text {
    color: inherit;
}

.field-status-indicator.is-valid {
    background: rgba(47, 122, 93, 0.18);
    color: var(--success);
}

.field-status-indicator.is-invalid {
    background: rgba(171, 67, 55, 0.16);
    color: var(--danger);
}

:root[data-theme="dark"] .field-status-indicator {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
}

:root[data-theme="dark"] .field-status-indicator.is-valid {
    background: rgba(86, 192, 141, 0.18);
    color: #c5f6de;
}

:root[data-theme="dark"] .field-status-indicator.is-invalid {
    background: rgba(255, 142, 129, 0.16);
    color: #ffd0ca;
}
