:root {
    color-scheme: light;
    --bg: #f4efe6;
    --bg-soft: #faf7ef;
    --panel: #fffdf7;
    --panel-muted: #fbf6ea;
    --ink: #26312a;
    --ink-strong: #152119;
    --muted: #687569;
    --line: #e1d8c8;
    --line-strong: #cfc2ad;
    --sidebar: #22372b;
    --sidebar-soft: #2f4737;
    --green: #2f7d51;
    --green-soft: #e8f3ea;
    --honey: #d69a27;
    --honey-hover: #c48618;
    --honey-soft: #fff1cf;
    --red: #a83b32;
    --red-soft: #f8e4df;
    --blue: #2f648b;
    --focus: #6b8f45;
    --shadow: 0 10px 26px rgba(48, 39, 27, .08);
    --shadow-soft: 0 4px 14px rgba(48, 39, 27, .06);
    --radius: 8px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --font-base: 16px;
    --line-height: 1.55;
    --border: #e1d8c8;
}

* {
    box-sizing: border-box;
}

html {
    font-size: var(--font-base);
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top right, rgba(214, 154, 39, .10), transparent 34rem),
        linear-gradient(180deg, var(--bg-soft), var(--bg));
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: var(--line-height);
    text-rendering: optimizeLegibility;
}

a {
    color: #7a5514;
}

a:hover {
    color: #5e400c;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
    background: linear-gradient(180deg, var(--sidebar), #1b2c22);
    color: #fff;
    padding: var(--space-6) 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, .08);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: #fff;
    text-decoration: none;
    margin-bottom: var(--space-7);
    padding: 0 6px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #f1bd51, var(--honey));
    font-weight: 800;
    color: #241804;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .16);
}

.brand strong {
    display: block;
    font-size: 1.08rem;
}

.brand small,
.topbar-label,
.muted {
    color: var(--muted);
}

.brand small {
    display: block;
    color: #d9e4d9;
}

.nav-menu {
    display: grid;
    gap: var(--space-2);
}

.nav-menu a {
    color: #eef5ef;
    text-decoration: none;
    padding: 11px 13px;
    border-radius: var(--radius);
    font-weight: 650;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-menu a.active,
.nav-menu a:hover {
    background: rgba(255, 255, 255, .13);
}

.nav-menu a.active {
    box-shadow: inset 3px 0 0 var(--honey);
}

.main-panel {
    min-width: 0;
}

.topbar {
    min-height: 76px;
    background: rgba(255, 253, 247, .92);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 2;
    backdrop-filter: blur(10px);
}

.topbar strong {
    display: block;
    color: var(--ink-strong);
}

.content {
    padding: 30px;
    max-width: 1680px;
    width: 100%;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.page-header > div:first-child {
    max-width: 760px;
}

h1,
h2,
h3 {
    margin: 0;
    letter-spacing: 0;
    color: var(--ink-strong);
}

h1 {
    font-size: clamp(1.65rem, 2vw, 2rem);
    line-height: 1.2;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: var(--space-3);
}

h3 {
    font-size: 1.02rem;
    margin-top: var(--space-5);
    margin-bottom: var(--space-2);
}

p {
    margin-top: var(--space-2);
}

.grid {
    display: grid;
    gap: var(--space-5);
}

.grid > * {
    min-width: 0;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.split-layout {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
    align-items: start;
}

.split-layout.form-left {
    grid-template-columns: minmax(400px, 470px) minmax(0, 1fr);
}

.dashboard-main-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
    margin-top: var(--space-5);
    align-items: start;
}

.card,
.table-panel,
.form-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.card {
    padding: var(--space-5);
    min-width: 0;
}

.stats-grid .card {
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-top: 4px solid rgba(214, 154, 39, .48);
}

.stat-value {
    font-size: clamp(2rem, 3vw, 2.55rem);
    line-height: 1;
    font-weight: 800;
    margin-top: var(--space-3);
    color: var(--sidebar);
}

.toolbar,
.quick-actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
}

.toolbar {
    margin-bottom: var(--space-5);
}

.quick-actions {
    justify-content: flex-end;
}

.table-panel {
    overflow-x: auto;
    overflow-y: visible;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 720px;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    font-size: .86rem;
    color: #4f5e52;
    background: #f7f0e3;
    font-weight: 800;
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody tr:nth-child(even) {
    background: rgba(247, 240, 227, .38);
}

tbody tr:hover {
    background: #fff4d9;
}

td:has(> button),
td:has(> .btn) {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
}

.form-panel {
    padding: var(--space-6);
    position: sticky;
    top: 96px;
}

.form-panel h2 {
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--line);
    margin-bottom: var(--space-5);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

.field {
    display: grid;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

label {
    font-weight: 750;
    font-size: .95rem;
    color: #354239;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 11px 12px;
    font: inherit;
    color: var(--ink);
    background: #fffefb;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

textarea {
    min-height: 104px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #8b948c;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
.btn:focus-visible,
.nav-menu a:focus-visible {
    outline: 3px solid rgba(107, 143, 69, .26);
    outline-offset: 2px;
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(107, 143, 69, .14);
}

.btn,
button {
    border: 1px solid transparent;
    border-radius: var(--radius);
    min-height: 44px;
    padding: 10px 16px;
    font-weight: 800;
    cursor: pointer;
    background: var(--honey);
    color: #251803;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    line-height: 1.25;
    box-shadow: 0 2px 0 rgba(86, 56, 7, .15);
    transition: background-color .15s ease, transform .12s ease, box-shadow .12s ease;
}

.btn:hover,
button:hover {
    background: var(--honey-hover);
}

.btn:active,
button:active {
    transform: translateY(1px);
    box-shadow: none;
}

.btn.secondary,
button.secondary {
    background: #ebe4d7;
    color: var(--ink);
    border-color: #d7cab7;
    box-shadow: none;
}

.btn.secondary:hover,
button.secondary:hover {
    background: #e0d6c6;
}

.btn.danger,
button.danger {
    background: var(--red-soft);
    color: #8e2d26;
    border-color: #e4b4ad;
    box-shadow: none;
}

.btn.danger:hover,
button.danger:hover {
    background: #f1d1ca;
}

button:disabled,
.btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .62;
}

.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--green-soft);
    color: #265a3b;
    border: 1px solid #cfe2d1;
    font-weight: 800;
    font-size: .84rem;
    line-height: 1.2;
}

.alert,
.error,
.success {
    padding: 13px 15px;
    border-radius: var(--radius);
    margin: var(--space-3) 0 var(--space-5);
    line-height: 1.45;
}

.alert {
    background: var(--honey-soft);
    border: 1px solid #efd08c;
    color: #6b4709;
}

.error {
    background: #fff1ee;
    border: 1px solid #e8b9b2;
    color: var(--red);
}

.success {
    background: #edf7ee;
    border: 1px solid #c7dec8;
    color: #2f6b48;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--space-6);
    background:
        radial-gradient(circle at 30% 20%, rgba(214, 154, 39, .18), transparent 24rem),
        linear-gradient(135deg, #21352a, #49612f);
}

.login-card {
    width: min(440px, 100%);
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

.login-card form {
    margin-top: var(--space-5);
}

.trace-report {
    gap: var(--space-6);
}

.trace-card {
    padding: var(--space-6);
}

.trace-path {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    padding: var(--space-4);
    background: var(--panel-muted);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
}

.trace-node {
    background: #fffefb;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 9px 12px;
    font-weight: 800;
    color: var(--sidebar);
    box-shadow: var(--shadow-soft);
}

.trace-arrow {
    color: #8a7354;
    font-weight: 800;
}

.trace-meta {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: var(--space-4);
}

.shipment-lines {
    display: grid;
    gap: var(--space-2);
    margin: var(--space-4) 0;
    padding: var(--space-3);
    background: var(--panel-muted);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.shipment-line {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--green);
    padding: 0;
    min-height: auto;
    font-size: .78rem;
    text-decoration: underline;
    box-shadow: none;
}

.link-button:hover {
    color: var(--green-dark);
    background: transparent;
}

.empty-state {
    padding: var(--space-5);
    background: var(--panel-muted);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--muted);
}

.page-loading {
    padding: var(--space-6);
}

#blazor-error-ui {
    display: none;
}

@media (max-width: 1160px) {
    .stats-grid,
    .dashboard-main-grid,
    .split-layout,
    .split-layout.form-left,
    .grid[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .form-panel {
        position: static;
    }

    .quick-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .nav-menu {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .content,
    .topbar {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    .content {
        padding-top: var(--space-5);
    }

    .page-header {
        display: grid;
    }

    .nav-menu {
        grid-template-columns: 1fr;
    }

    .toolbar,
    .quick-actions {
        align-items: stretch;
    }

    .toolbar > *,
    .quick-actions > * {
        width: 100%;
    }

    .card,
    .form-panel {
        padding: var(--space-4);
    }

    table {
        min-width: 640px;
    }
}

/* Responsive shell and touch-friendly refinements */
body {
    overflow-x: hidden;
}

.menu-toggle,
.sidebar-close,
.mobile-menu-overlay {
    display: none;
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.sidebar-header .brand {
    margin-bottom: 0;
}

.topbar-user {
    min-width: 0;
}

.topbar-user strong {
    display: block;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-button {
    flex-shrink: 0;
}

.table-panel,
.card {
    max-width: 100%;
}

@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .content {
        padding: 24px;
    }

    .dashboard-main-grid,
    .split-layout,
    .split-layout.form-left,
    .grid[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .form-panel {
        position: static;
    }
}

@media (max-width: 1024px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .menu-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        width: 44px;
        min-width: 44px;
        height: 44px;
        padding: 8px;
        background: #ebe4d7;
        color: var(--sidebar);
        border-color: #d7cab7;
        box-shadow: none;
    }

    .menu-toggle span {
        display: block;
        width: 21px;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(86vw, 320px);
        height: 100dvh;
        z-index: 30;
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform .18s ease;
        box-shadow: 20px 0 48px rgba(19, 31, 24, .28);
    }

    .app-shell.menu-open .sidebar {
        transform: translateX(0);
    }

    .mobile-menu-overlay {
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgba(23, 37, 28, .42);
        opacity: 0;
        pointer-events: none;
        transition: opacity .18s ease;
    }

    .app-shell.menu-open .mobile-menu-overlay {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        min-width: 42px;
        height: 42px;
        padding: 0;
        background: rgba(255, 255, 255, .12);
        color: #fff8e8;
        border-color: rgba(255, 255, 255, .18);
        box-shadow: none;
        font-size: 1.15rem;
    }

    .nav-menu {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .nav-menu a {
        min-height: 48px;
    }

    .topbar {
        min-height: 64px;
        padding: 0 18px;
        gap: 12px;
    }

    .topbar-label {
        font-size: .78rem;
    }

    .content {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 18px 14px 24px;
    }

    .page-header {
        display: grid;
        gap: 14px;
        margin-bottom: 18px;
    }

    .page-header > div,
    .page-header .toolbar,
    .page-header .quick-actions {
        min-width: 0;
    }

    .stats-grid,
    .dashboard-main-grid,
    .split-layout,
    .split-layout.form-left,
    .grid[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .split-layout > .form-panel,
    .split-layout.form-left > .form-panel,
    .grid[style*="grid-template-columns"] > .form-panel {
        order: -1;
    }

    .form-panel {
        position: static;
        width: 100%;
        padding: 18px;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
    }

    .toolbar,
    .quick-actions {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 12px;
        width: 100%;
    }

    .toolbar > *,
    .quick-actions > * {
        width: 100%;
    }

    input,
    select,
    textarea {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }

    button,
    .btn {
        min-height: 44px;
    }

    .table-panel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }

    .card:has(table) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 620px;
    }

    th,
    td {
        padding: 12px;
    }

    td:has(> button),
    td:has(> .btn) {
        min-width: 150px;
    }

    td:has(> button) button,
    td:has(> .btn) .btn {
        width: 100%;
        justify-content: center;
    }

    .trace-report {
        gap: var(--space-4);
    }

    .trace-card {
        padding: 16px;
    }

    .trace-path {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px;
    }

    .trace-node {
        width: 100%;
        text-align: center;
    }

    .trace-arrow {
        text-align: center;
        transform: rotate(90deg);
    }

    .trace-card table {
        min-width: 560px;
    }

    .shipment-lines {
        gap: 10px;
        padding: 12px;
    }

    .shipment-line {
        width: 100%;
        justify-content: flex-start;
    }

    .empty-state {
        padding: 18px;
    }

    .login-card {
        padding: 22px;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 0 12px;
        gap: 8px;
    }

    .topbar-user strong {
        max-width: 34vw;
        font-size: .92rem;
    }

    .logout-button {
        min-height: 42px;
        padding: 8px 11px;
    }

    h1 {
        font-size: 1.45rem;
    }

    h2 {
        font-size: 1.15rem;
    }

    .card,
    .form-panel {
        padding: 14px;
    }

    .content {
        padding-left: 12px;
        padding-right: 12px;
    }

    table {
        min-width: 560px;
    }

    .status {
        max-width: 100%;
        white-space: normal;
    }
}

/* Pas 12 - layout operațional compact pentru ecrane late */
.compact-page-header {
    margin-bottom: 1.15rem;
}

.operation-grid {
    grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
    align-items: start;
    gap: 1rem;
}

.operation-grid.table-first .form-panel {
    order: -1;
}

.operation-grid .form-panel,
.operation-grid .table-panel,
.info-panel {
    min-height: 0;
}

.compact-form {
    padding: 1.05rem 1.15rem;
}

.compact-form h2 {
    margin-bottom: .55rem;
}

.compact-form .field {
    margin-bottom: .72rem;
}

.compact-form input,
.compact-form select,
.compact-form textarea {
    padding: .62rem .72rem;
}

.compact-form textarea {
    min-height: 72px;
}

.form-divider {
    border-top: 1px solid var(--border);
    margin: .55rem 0 .95rem;
}

.form-grid.two-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem .85rem;
}

.button-row {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: .75rem;
}

.section-subtitle {
    font-size: 1.05rem;
    margin-top: 1rem;
}

.toolbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .75rem;
    margin-bottom: 1rem;
}

.loss-preview {
    border-radius: 16px;
    padding: .8rem .9rem;
    margin: .35rem 0 .75rem;
    display: grid;
    gap: .25rem;
    border: 1px solid var(--border);
}

.loss-preview span,
.loss-preview em,
.form-hint {
    color: var(--muted);
    font-size: .9rem;
}

.success-inline {
    background: #eef8f0;
    border-color: #cfe8d4;
}

.warning-inline {
    background: #fff1cf;
    border-color: #e7b352;
}

.badge.status-warning {
    background: #fff1cf;
    border-color: #e7b352;
    color: #7a4a00;
}

.badge.status-ok {
    background: #e8f5ed;
    border-color: #c7e3d1;
    color: #1e5d3a;
}

.info-steps {
    display: grid;
    gap: .9rem;
    margin-top: 1rem;
}

.info-steps div {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: .75rem;
    align-items: center;
    padding: .85rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, .55);
}

.info-steps strong {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: var(--green);
    color: white;
}

@media (min-width: 1500px) {
    .content-shell {
        padding-top: 1.35rem;
    }

    .page-header h1 {
        font-size: 2.05rem;
    }

    .operation-grid {
        grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    }
}

@media (max-width: 1100px) {
    .operation-grid,
    .form-grid.two-columns,
    .toolbar-row {
        grid-template-columns: 1fr;
    }

    .operation-grid.table-first .form-panel {
        order: 0;
    }
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .32rem .62rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #f2ecdf;
    font-size: .86rem;
    font-weight: 700;
}
.brand-signature {
    font-style: italic;
    font-weight: 500;
    opacity: .82;
}


/* Pas 15 - rafinare layout și dashboard */
.nav-menu {
    gap: 18px;
}

.nav-group {
    display: grid;
    gap: 8px;
}

.nav-group-title {
    padding: 0 8px;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 800;
    color: rgba(236, 244, 236, .78);
}

.content {
    padding: 26px 34px 34px;
}

.content > * + * {
    margin-top: 20px;
}

.page-header-balanced {
    align-items: center;
}

.section-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.flow-hub-card,
.demo-mode-card,
.dashboard-overview-card,
.activity-card,
.alerts-card,
.report-summary-card,
.header-highlight-card {
    background: rgba(255, 253, 247, .92);
}

.demo-mode-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    border-color: rgba(47, 125, 81, .28);
    background: linear-gradient(180deg, #f7fbf4, #fffaf0);
}

.maintenance-section {
    margin-top: 20px;
}

.maintenance-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.maintenance-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-muted);
}

.danger-zone-card {
    border-color: #e4b4ad;
    background: #fff4f1;
}

.danger-badge {
    background: var(--red-soft);
    border-color: #e4b4ad;
    color: #8e2d26;
}

.danger-note {
    color: #8e2d26;
    font-weight: 750;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(21, 33, 25, .56);
}

.modal-card {
    width: min(560px, 100%);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

@media (max-width: 900px) {
    .maintenance-grid,
    .maintenance-card,
    .demo-mode-card {
        grid-template-columns: 1fr;
        display: grid;
    }
}

.flow-hub-card {
    padding: 22px;
}

.flow-hub-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.flow-hub-header h2 {
    margin-top: 10px;
    margin-bottom: 8px;
    max-width: 820px;
}

.flow-step-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.flow-step-card {
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(251,246,234,.98));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.flow-step-card h3 {
    margin-top: 8px;
    margin-bottom: 8px;
    font-size: 1.06rem;
}

.flow-step-card p {
    min-height: 48px;
    margin-bottom: 14px;
}

.flow-step-number {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: var(--sidebar);
    color: #fff;
    font-weight: 800;
}

.quick-link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid #dccdb8;
    background: #fffaf0;
    color: var(--ink-strong);
    text-decoration: none;
    font-weight: 700;
    font-size: .9rem;
}

.quick-link:hover {
    background: #f5ead5;
    color: var(--ink-strong);
}

.quick-link-admin {
    border-color: #d9c281;
    background: #fff3d8;
}

.dashboard-overview-card {
    padding: 20px 22px 22px;
}

.stats-grid-tight {
    gap: 16px;
}

.stat-card {
    padding: 18px;
    border-top-width: 3px;
}

.dashboard-main-grid-spaced {
    gap: 20px;
}

.dashboard-table-panel {
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.alert-list {
    display: grid;
    gap: 12px;
}

.header-highlight-card {
    min-width: 220px;
    max-width: 260px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: var(--shadow-soft);
}

.header-highlight-card strong {
    display: block;
    margin-top: 6px;
    font-size: 1.6rem;
    line-height: 1;
}

.header-highlight-card small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.toolbar-row-wide {
    grid-template-columns: minmax(0, 1fr) auto;
}

.operation-grid-wide {
    grid-template-columns: minmax(430px, 500px) minmax(0, 1fr);
    gap: 18px;
}

.production-form-panel {
    padding: 18px 18px 20px;
}

.production-form-panel textarea {
    min-height: 82px;
}

.field-span-2 {
    grid-column: 1 / -1;
}

.production-loss-preview {
    border-radius: 14px;
}

.production-table-panel {
    padding: 0;
    border-radius: 12px;
}

.production-table {
    min-width: 100%;
}

.production-table th,
.production-table td {
    padding: 13px 14px;
}

.reports-grid {
    align-items: start;
}

.reports-page-header {
    margin-bottom: 14px;
}

.eyebrow {
    margin: 0 0 6px;
    color: #77500d;
    font-size: .78rem;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.reports-workflow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.workflow-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 253, 247, .88);
    box-shadow: var(--shadow-soft);
}

.workflow-step strong {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #ebdfca;
    color: var(--ink-strong);
}

.workflow-step.active strong {
    background: var(--green);
    color: #fff;
}

.workflow-step span {
    display: block;
    color: var(--ink-strong);
    font-weight: 850;
}

.workflow-step small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    line-height: 1.35;
}

.reports-layout {
    grid-template-columns: minmax(430px, 560px) minmax(0, 1fr);
}

.report-config-panel {
    padding: 20px;
}

.report-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.report-type-card {
    min-height: 98px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fffdf8;
    color: var(--ink);
    text-align: left;
    box-shadow: none;
}

.report-type-card:hover,
.report-type-card:focus-visible {
    border-color: #b28a3b;
    box-shadow: 0 0 0 3px rgba(214, 154, 39, .18);
}

.report-type-card.selected {
    border-color: var(--green);
    background: linear-gradient(180deg, #f5fbf4, #fff8e8);
    box-shadow: inset 4px 0 0 var(--honey), var(--shadow-soft);
}

.report-type-card span {
    display: block;
    color: var(--ink-strong);
    font-weight: 850;
    line-height: 1.25;
}

.report-type-card small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-weight: 600;
    line-height: 1.35;
}

.filter-panel {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(251, 246, 234, .72);
}

.filter-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.filter-panel-header h3 {
    margin: 0 0 3px;
}

.filter-required {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--green-soft);
    color: #1f5f3b;
    font-size: .82rem;
    font-weight: 850;
    white-space: nowrap;
}

.required-mark {
    color: var(--red);
    font-weight: 900;
}

.active-filter-row,
.summary-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.active-filter-row {
    margin-top: 14px;
}

.filter-chip,
.empty-filter-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #d6c7ad;
    background: #fffaf0;
    color: var(--ink-strong);
    font-size: .88rem;
    font-weight: 750;
}

.empty-filter-chip {
    color: var(--muted);
    font-weight: 700;
}

.report-actions {
    margin-top: 16px;
}

.report-alert {
    display: grid;
    gap: 4px;
}

.report-alert ul {
    margin: 4px 0 0 18px;
    padding: 0;
}

.report-summary-modern {
    min-height: 100%;
}

.report-summary-card {
    padding: 18px 18px 20px;
}

.report-summary-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.report-summary-header h2 {
    margin-bottom: 6px;
}

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.summary-item {
    padding: 14px 15px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel-muted);
}

.summary-item-wide {
    grid-column: 1 / -1;
}

.summary-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 700;
}

.compact-steps {
    margin-top: 0;
}

.compact-steps div {
    background: #fffefb;
}

.report-help-box {
    padding: 14px 15px;
    border-radius: var(--radius);
    border: 1px solid rgba(47, 125, 81, .24);
    background: linear-gradient(180deg, #f7fbf4, #fffaf0);
}

.report-help-box strong {
    display: block;
    margin-bottom: 4px;
}

.report-help-box p {
    margin: 0;
    color: var(--muted);
}

.demo-preview-button {
    background: #e7f1ee !important;
    border-color: #b8d7cb !important;
    color: #1e5e48 !important;
}

.demo-preview-button:hover {
    background: #d7e8e1 !important;
}

.demo-preview-hint {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: .88rem;
    line-height: 1.4;
}

@media (min-width: 1400px) {
    .flow-step-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .operation-grid,
    .operation-grid-wide,
    .split-layout.form-left {
        grid-template-columns: minmax(440px, 520px) minmax(0, 1fr);
    }
}

@media (max-width: 1360px) {
    .flow-step-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .flow-hub-header,
    .page-header-balanced,
    .report-summary-header,
    .section-heading-row {
        display: grid;
    }

    .flow-step-grid,
    .reports-workflow,
    .report-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .operation-grid-wide,
    .split-layout.form-left,
    .operation-grid,
    .reports-layout {
        grid-template-columns: 1fr;
    }

    .header-highlight-card {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 18px 14px 24px;
    }

    .flow-step-grid,
    .reports-workflow,
    .report-type-grid,
    .report-summary-grid,
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .flow-step-card p {
        min-height: 0;
    }

    .header-highlight-card {
        min-width: 0;
    }
}

/* Pas 16 — rafinare vizuală finală: carduri informative, checkbox activ și ecrane Full HD */
.table-panel.info-panel,
.report-summary.info-panel,
.settings-layout .table-panel.info-panel {
    padding: 1.35rem 1.45rem;
    box-sizing: border-box;
}

.table-panel.info-panel > h2,
.table-panel.info-panel > h3,
.report-summary.info-panel > h2,
.report-summary.info-panel > h3 {
    margin: 0 0 .9rem;
    line-height: 1.2;
}

.info-panel > p,
.report-summary > p,
.settings-layout .table-panel.info-panel > p {
    margin: 0 0 1rem;
    color: var(--muted);
    line-height: 1.55;
}

.info-steps,
.step-list {
    display: grid;
    gap: .75rem;
    margin-top: 1.05rem;
}

.info-step,
.step-list .step-row {
    padding: .95rem 1.05rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 252, 247, .86);
    box-shadow: 0 8px 22px rgba(47, 35, 19, .045);
}

.report-summary .summary-lines,
.report-summary .summary-meta {
    display: grid;
    gap: .65rem;
    margin-bottom: 1.1rem;
}

.report-summary .summary-lines p,
.report-summary .summary-meta p {
    margin: 0;
    line-height: 1.45;
}

.active-toggle {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    margin-top: .35rem;
    padding: .45rem .55rem .45rem 0;
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
    user-select: none;
}

.active-toggle input.active-checkbox,
input[type="checkbox"].active-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    margin: 0;
    border: 2px solid #bba783;
    border-radius: 7px;
    background: #fffaf2;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05);
    position: relative;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.active-toggle input.active-checkbox:checked,
input[type="checkbox"].active-checkbox:checked {
    background: var(--green);
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(47, 126, 90, .12);
}

.active-toggle input.active-checkbox:checked::after,
input[type="checkbox"].active-checkbox:checked::after {
    content: "✓";
    position: absolute;
    inset: -1px 0 0 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 17px;
    font-weight: 900;
    line-height: 1;
}

.active-toggle input.active-checkbox:focus-visible,
input[type="checkbox"].active-checkbox:focus-visible {
    outline: 3px solid rgba(219, 158, 29, .35);
    outline-offset: 3px;
}

@media (min-width: 1400px) and (min-height: 850px) {
    .operation-grid .form-panel,
    .operation-grid .table-panel {
        max-height: none;
        overflow: visible;
    }

    .page-title-section {
        margin-bottom: 1.05rem;
    }

    .operation-grid .form-panel {
        padding: 1.1rem 1.25rem;
    }

    .operation-grid input,
    .operation-grid select,
    .operation-grid textarea,
    .settings-layout input,
    .settings-layout textarea {
        padding: .64rem .8rem;
        min-height: 42px;
    }

    .operation-grid textarea,
    .settings-layout textarea {
        min-height: 74px;
    }

    .operation-grid .form-grid.two-columns {
        gap: .65rem .85rem;
    }

    .operation-grid label,
    .settings-layout label {
        margin-top: .5rem;
        margin-bottom: .25rem;
    }

    .loss-preview {
        padding: .78rem 1rem;
        margin-top: .7rem;
    }
}

/* Sidebar compact modern polish */
@media (min-width: 1025px) {
    .app-shell {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .sidebar {
        padding: 16px 14px 14px;
        scrollbar-width: thin;
        scrollbar-color: rgba(241, 189, 81, .55) rgba(255, 255, 255, .08);
    }

    .sidebar-header {
        margin-bottom: 12px;
    }

    .topbar {
        min-height: 64px;
        padding: 0 28px;
    }
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .06);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(241, 189, 81, .42);
    border-radius: 999px;
}

.brand {
    gap: 10px;
    margin-bottom: 0;
    padding: 0 4px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    font-size: .9rem;
}

.brand strong {
    font-size: 1rem;
    line-height: 1.1;
}

.brand small {
    margin-top: 2px;
    font-size: .78rem;
    line-height: 1.2;
}

.nav-menu {
    gap: 12px;
}

.nav-group {
    gap: 4px;
}

.nav-group-title {
    padding: 0 8px 2px;
    font-size: .68rem;
    line-height: 1.1;
    letter-spacing: .15em;
    color: rgba(236, 244, 236, .66);
}

.nav-menu a {
    position: relative;
    gap: 9px;
    min-height: 36px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: .94rem;
    font-weight: 760;
    line-height: 1.2;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease, transform .14s ease;
}

.nav-menu a::before {
    content: attr(data-icon);
    width: 23px;
    height: 23px;
    min-width: 23px;
    border-radius: 7px;
    display: inline-grid;
    place-items: center;
    background: rgba(255, 255, 255, .08);
    color: #f4d68d;
    font-size: .66rem;
    font-weight: 900;
    letter-spacing: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .08);
    color: #fffaf0;
    transform: translateX(2px);
}

.nav-menu a.active {
    background: linear-gradient(90deg, rgba(214, 154, 39, .26), rgba(255, 255, 255, .11));
    border-color: rgba(241, 189, 81, .28);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--honey), 0 8px 18px rgba(0, 0, 0, .10);
}

.nav-menu a.active::before {
    background: var(--honey);
    color: #231804;
    box-shadow: none;
}

@media (max-width: 1024px) {
    .nav-menu a {
        min-height: 42px;
        padding: 9px 10px;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
    }
}

@media (min-width: 1500px) {
    .operation-grid.production-layout {
        grid-template-columns: minmax(520px, .7fr) minmax(820px, 1.3fr);
    }
}


/* Pas 16 - layout profesional pentru pagini operaționale late și notificări */
.operation-grid.operation-grid-wide {
    grid-template-columns: 1fr !important;
    align-items: stretch;
}

.operation-grid.operation-grid-wide .form-panel {
    position: static;
    top: auto;
    max-width: none;
    width: 100%;
}

.operation-grid.operation-grid-wide .table-panel {
    width: 100%;
}

.operation-grid.operation-grid-wide.table-first .form-panel,
.operation-grid.operation-grid-wide .production-form-panel {
    order: -1;
}

.operation-grid.operation-grid-wide .compact-form table,
.form-panel table {
    min-width: 0;
}

.operation-grid.operation-grid-wide .compact-form table th,
.operation-grid.operation-grid-wide .compact-form table td,
.form-panel table th,
.form-panel table td {
    padding: 11px 14px;
}

.operation-grid.operation-grid-wide .compact-form table td:has(> button),
.operation-grid.operation-grid-wide .compact-form table td:has(> .btn),
.form-panel table td:has(> button),
.form-panel table td:has(> .btn) {
    min-width: 130px;
}

.inline-check {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: .6rem;
    margin: .25rem 0 .6rem;
    font-weight: 750;
    color: #354239;
}

.inline-check input[type="checkbox"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    accent-color: var(--honey);
}

.toast-host {
    position: fixed;
    top: 92px;
    right: 24px;
    z-index: 90;
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

.page-toast {
    pointer-events: auto;
    width: 100%;
    min-height: 0;
    border-radius: 14px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, .55);
    box-shadow: 0 18px 44px rgba(31, 36, 28, .22);
    backdrop-filter: blur(12px);
    animation: toast-slide-in .18s ease-out, toast-soft-fade 7s ease-in forwards;
}

.page-toast:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 48px rgba(31, 36, 28, .26);
}

.page-toast .toast-icon {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    font-weight: 900;
    background: rgba(255, 255, 255, .56);
}

.toast-content {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.toast-content strong {
    font-size: .95rem;
    color: inherit;
}

.toast-content small {
    font-size: .88rem;
    line-height: 1.35;
    color: inherit;
    opacity: .86;
}

.toast-close {
    font-size: 1.25rem;
    opacity: .66;
    line-height: 1;
}

.page-toast.toast-error {
    background: rgba(255, 241, 238, .96);
    border-color: #e8b9b2;
    color: #8e2d26;
}

.page-toast.toast-success {
    background: rgba(237, 247, 238, .96);
    border-color: #c7dec8;
    color: #245b3c;
}

@keyframes toast-slide-in {
    from { opacity: 0; transform: translateY(-8px) translateX(12px); }
    to { opacity: 1; transform: translateY(0) translateX(0); }
}

@keyframes toast-soft-fade {
    0%, 78% { opacity: 1; }
    100% { opacity: .08; }
}

@media (max-width: 768px) {
    .toast-host {
        top: 74px;
        right: 14px;
        left: 14px;
        width: auto;
    }

    .page-toast {
        grid-template-columns: 30px minmax(0, 1fr) auto;
        padding: 12px 13px;
    }
}


/* Patch - lățime uniformă formulare operaționale */
.operation-grid.operation-grid-wide,
.operation-grid.operation-grid-wide > .form-panel,
.operation-grid.operation-grid-wide > .table-panel {
    width: 100%;
    max-width: none;
}

.operation-grid.operation-grid-wide > .form-panel {
    justify-self: stretch;
}

.operation-grid.operation-grid-wide .form-grid.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 920px) {
    .operation-grid.operation-grid-wide .form-grid.two-columns {
        grid-template-columns: 1fr;
    }
}

/* Jurnal audit */
.form-grid.four-columns {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.audit-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .65rem;
    flex-wrap: wrap;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.small-text {
    display: block;
    font-size: .78rem;
    margin-top: .15rem;
}

@media (max-width: 1100px) {
    .form-grid.four-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .form-grid.four-columns {
        grid-template-columns: 1fr;
    }

    .audit-pager {
        justify-content: flex-start;
    }
}
