/* PETRONOR design system. Local assets; native Segoe UI/Arial font stack. */
:root {
    --nav: #182d43;
    --nav-soft: #253f59;
    --blue: #145b98;
    --blue-light: #edf4fa;
    --text: #203248;
    --muted: #5c6c7d;
    --line: #dce3eb;
    --canvas: #f3f5f8;
    --surface: #fff;
    --red: #a53535;
    --green: #216d4d;
    --radius: 8px;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font:
        14px/1.5 "Segoe UI",
        Arial,
        Helvetica,
        sans-serif;
    color: var(--text);
    background: var(--canvas);
}
a {
    color: var(--blue);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
button,
input,
textarea,
select {
    font: inherit;
}
button,
a,
input,
select,
textarea {
    touch-action: manipulation;
}
button {
    cursor: pointer;
}
button:disabled {
    cursor: wait;
    opacity: 0.6;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
    outline: 3px solid #72a7db;
    outline-offset: 3px;
}
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #72a7db;
    outline-offset: 1px;
}
[hidden] {
    display: none !important;
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 232px;
    background: var(--nav);
    color: #fff;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 25px 16px;
}
.brand {
    display: block;
    letter-spacing: 1px;
    font-size: 24px;
    font-weight: 600;
    color: inherit;
    padding: 0 12px;
    margin-bottom: 27px;
}
.brand:hover {
    text-decoration: none;
}
.brand span {
    color: #84bbe5;
}
.brand small {
    display: block;
    letter-spacing: 0;
    font-size: 12px;
    font-weight: 400;
    color: #a9bed1;
    margin-top: 2px;
}
.nav-label {
    font-size: 10px;
    letter-spacing: 1.3px;
    color: #a9bed1;
    margin: 16px 12px 10px;
}
.nav-item {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    margin: 3px 0;
    color: #c4d2df;
    font-size: 13px;
}
.nav-item:hover,
.nav-item.selected {
    background: var(--nav-soft);
    color: #fff;
    text-decoration: none;
}
.nav-item.selected {
    box-shadow: inset 3px 0 #8dbbdf;
}
.sidebar-foot {
    font-size: 11px;
    color: #a9bed1;
    padding: 24px 12px;
    margin-top: auto;
}
.application {
    margin-left: 232px;
}
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    min-height: 73px;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}
.topbar-title {
    font-weight: 600;
}
.account {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 12px;
}
.account small {
    display: block;
    color: var(--muted);
    font-size: 11px;
}
.account form {
    margin: 0;
}
.text-button {
    border: 0;
    background: none;
    color: var(--blue);
    padding: 7px 2px;
}
.content {
    max-width: 1550px;
    margin: auto;
    padding: 28px 32px 45px;
}
h1,
h2,
h3 {
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 10px;
}
h1 {
    font-size: 26px;
    letter-spacing: -0.4px;
}
h2 {
    font-size: 17px;
}
h3 {
    font-size: 15px;
}
p {
    margin: 0 0 14px;
}
.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 23px;
}
.page-heading p {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
    max-width: 840px;
}
.date-stamp {
    font-size: 12px;
    white-space: nowrap;
    color: var(--muted);
}
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    min-width: 0;
}
.panel h2 {
    margin-bottom: 10px;
}
.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    align-items: start;
    margin-bottom: 16px;
}
.section-heading p {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}
.panel-foot {
    font-size: 12px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    padding-top: 13px;
    margin-top: 14px;
}
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.metric {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 19px;
    border-radius: var(--radius);
    min-width: 0;
}
.metric-label {
    color: var(--muted);
    font-size: 12px;
}
.metric-value {
    font-size: 25px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.6px;
    margin: 9px 0;
    overflow-wrap: anywhere;
}
.metric .muted {
    font-size: 11px;
}
.muted {
    color: var(--muted);
    font-size: 12px;
}
.danger {
    color: var(--red) !important;
}
.positive {
    color: var(--green);
}
.strong {
    font-weight: 600;
}
.columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.columns > .panel {
    height: fit-content;
}
.badge {
    display: inline-block;
    white-space: nowrap;
    color: var(--blue);
    background: var(--blue-light);
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 11px;
}
.badge.bad {
    color: var(--red);
    background: #fff0ef;
}
.table-scroll {
    overflow-x: auto;
}
table {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
}
th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    padding: 10px 10px 13px;
    border-bottom: 1px solid var(--line);
    vertical-align: bottom;
}
td {
    padding: 12px 10px;
    border-bottom: 1px solid #e8edf2;
    vertical-align: middle;
    overflow-wrap: anywhere;
}
tbody tr:last-child td {
    border-bottom: 0;
}
tbody tr:hover {
    background: #f8fafc;
}
.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.stock-loaded {
    font-weight: 600;
    color: var(--blue);
}
.inventory-table {
    min-width: 730px;
    table-layout: fixed;
}
.inventory-table th.numeric {
    white-space: normal;
}
.inventory-table th:first-child {
    width: 13%;
}
.inventory-table th:nth-child(2) {
    width: 8%;
}
.inventory-table th:nth-child(6) {
    width: 14%;
}
.inventory-table th:nth-child(7) {
    width: 20%;
}
.inventory-table th {
    max-width: 160px;
}
.empty {
    text-align: center;
    padding: 30px 12px;
    color: var(--muted);
    font-size: 13px;
}
.priority {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.priority:last-of-type {
    border: 0;
}
.row-between {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: start;
}
.priority .muted {
    margin-top: 4px;
}
.priority-bottom {
    font-size: 12px;
    margin-top: 6px;
}
.potential-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
    margin-top: 10px;
    font-size: 12px;
}
.potential-total strong {
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    margin-bottom: 22px;
}
.local-filter {
    margin: 15px 0;
    gap: 9px;
}
.local-filter label {
    flex: 1;
    min-width: 120px;
}
.local-filter select {
    min-width: 0;
}
.filters label {
    font-size: 11px;
}
.filters select,
.filters input {
    font-size: 13px;
}
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--blue);
    color: #fff;
    border: 1px solid var(--blue);
    border-radius: 6px;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 13px;
    min-height: 40px;
    text-decoration: none;
    white-space: normal;
    line-height: 1.4;
}
.button:hover {
    background: #104c82;
    color: #fff;
    text-decoration: none;
}
.button.secondary {
    background: #fff;
    color: var(--text);
    border-color: #c9d3df;
}
.button.secondary:hover {
    background: #f3f6fa;
}
.button.compact {
    padding: 7px 10px;
    font-size: 12px;
    min-height: 34px;
}
.stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.stack .button {
    align-self: start;
}
label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    min-width: 0;
}
input,
select,
textarea {
    width: 100%;
    background: #fff;
    color: var(--text);
    border: 1px solid #bdc9d5;
    border-radius: 5px;
    padding: 9px 10px;
    min-height: 40px;
    max-width: 100%;
}
textarea {
    resize: vertical;
}
input[readonly] {
    background: #f4f6f9;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 17px 22px;
}
.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}
.form-actions .button {
    margin-left: auto;
}
.line-item {
    background: #f8fafc;
    border: 1px solid var(--line);
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 12px;
}
.line-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    align-items: start;
}
.line-grid .remove-line {
    justify-self: end;
    align-self: end;
}
.line-grid label[data-source-wrap] {
    grid-column: span 2;
}
.field-help {
    font-size: 11px;
    color: var(--red);
}
fieldset {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 15px;
}
legend {
    font-size: 12px;
    color: var(--muted);
    padding: 0 8px;
}
.notice {
    padding: 13px 16px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid;
}
.notice.success {
    color: #205b43;
    background: #eef8f2;
    border-color: #cbe5d5;
}
.notice.error {
    color: #8f2828;
    background: #fff0ee;
    border-color: #efceca;
}
.notice.info {
    color: #254c75;
    background: #edf4fb;
    border-color: #cadff2;
}
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
    padding-bottom: 12px;
}
.tabs a {
    color: var(--muted);
    font-size: 13px;
    padding: 8px 11px;
    border-radius: 5px;
}
.tabs a.selected {
    color: var(--blue);
    background: #e8f0f8;
    font-weight: 600;
}
.stock-config-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr auto;
    gap: 14px;
    align-items: end;
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
}
.stock-config-row > span {
    align-self: center;
}
.stock-config-row:last-child {
    border: 0;
}
.inline-form {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.document-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}
.document-meta strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-top: 4px;
}
.document-totals {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
    padding: 20px 0;
}
.document-totals strong {
    font-weight: 600;
}
.note {
    white-space: normal;
}
.document-meta + .table-scroll {
    border-top: 1px solid var(--line);
}
td small {
    display: block;
}
summary {
    cursor: pointer;
    font-weight: 600;
}
details p {
    margin-top: 14px;
}
.narrow {
    max-width: 550px;
}
.action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-box {
    width: 100%;
    max-width: 430px;
    background: #fff;
    border: 1px solid var(--line);
    border-top: 4px solid var(--blue);
    border-radius: 9px;
    padding: 35px;
}
.login-brand {
    padding: 0;
    margin-bottom: 30px;
    color: var(--nav);
}
.login-brand span {
    color: var(--blue);
}
.login-brand small {
    color: var(--muted);
}
.login-box h1 {
    font-size: 22px;
}
.login-box p {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 24px;
}
.login-box .button {
    width: 100%;
}
.login-foot {
    color: var(--muted);
    font-size: 11px;
    margin-top: 28px;
    border-top: 1px solid var(--line);
    padding-top: 18px;
}
.login-wrap > .notice {
    max-width: 430px;
    width: 100%;
}
@media (min-width: 1500px) {
    .metrics {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
@media (max-width: 1100px) {
    .sidebar {
        width: 206px;
    }
    .application {
        margin-left: 206px;
    }
    .content {
        padding: 23px;
    }
    .topbar {
        padding: 16px 23px;
    }
    .columns {
        grid-template-columns: 1fr;
    }
    .line-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .document-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stock-config-row {
        grid-template-columns: 1fr 1fr;
    }
    .topbar-title {
        display: none;
    }
}
@media (max-width: 760px) {
    .sidebar {
        position: static;
        width: auto;
        padding: 14px 18px;
        overflow: visible;
    }
    .brand {
        padding: 0;
        margin-bottom: 8px;
        font-size: 21px;
    }
    .sidebar nav {
        display: flex;
        gap: 5px;
        overflow-x: auto;
    }
    .nav-item {
        white-space: nowrap;
        margin: 0;
        font-size: 12px;
        padding: 8px 10px;
    }
    .nav-label,
    .sidebar-foot {
        display: none;
    }
    .application {
        margin: 0;
    }
    .topbar {
        padding: 12px 18px;
        min-height: auto;
        justify-content: flex-end;
    }
    .account {
        flex-wrap: wrap;
        gap: 12px;
        width: 100%;
        justify-content: space-between;
    }
    .content {
        padding: 22px 16px;
    }
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .page-heading {
        align-items: start;
    }
    .page-heading .button {
        font-size: 11px;
    }
    .panel {
        padding: 17px;
    }
    .stock-config-row {
        grid-template-columns: 1fr 1fr;
    }
    .filters {
        gap: 10px;
    }
    .filters label {
        flex: 1;
        min-width: 135px;
    }
    .inventory-table {
        min-width: 690px;
    }
    .form-actions {
        flex-wrap: wrap;
    }
}
@media (max-width: 440px) {
    h1 {
        font-size: 23px;
    }
    .metrics {
        grid-template-columns: 1fr;
    }
    .form-grid,
    .line-grid,
    .document-meta {
        grid-template-columns: 1fr;
    }
    .line-grid label[data-source-wrap] {
        grid-column: auto;
    }
    .page-heading {
        flex-wrap: wrap;
    }
    .filters label {
        width: 100%;
    }
    .form-actions .button {
        width: 100%;
        margin: 0;
    }
    .section-heading {
        flex-wrap: wrap;
    }
    .potential-total {
        flex-wrap: wrap;
    }
    .login-box {
        padding: 25px;
    }
    .stock-config-row {
        grid-template-columns: 1fr;
    }
    .line-grid .remove-line {
        justify-self: start;
    }
    input,
    select,
    textarea {
        font-size: 16px;
        min-height: 44px;
    }
    .button,
    .text-button {
        min-height: 44px;
    }
}
@media print {
    body {
        background: #fff;
        font-size: 11px;
    }
    .sidebar,
    .topbar,
    .no-print,
    .page-heading button,
    .notice {
        display: none !important;
    }
    .application {
        margin: 0;
    }
    .content {
        padding: 0;
        max-width: none;
    }
    .panel {
        border: 0;
        padding: 10px 0;
        box-shadow: none;
        break-inside: avoid;
    }
    .page-heading {
        margin: 10px 0;
    }
    a {
        color: #000;
    }
    table {
        font-size: 10px;
    }
    .table-scroll {
        overflow: visible;
    }
}
