:root {
    --bg: #f4f7fb;
    --sidebar: #102a43;
    --sidebar-active: #193b5a;
    --accent: #3fa9f5;
    --primary: #16324f;
    --primary-hover: #214b74;
    --secondary: #e8eef5;
    --secondary-hover: #d8e6f2;
    --text: #172334;
    --muted: #66788a;
    --line: #d8e2ee;
    --header: #e8eef5;
    --white: #ffffff;
    --ok: #2f9e44;
    --due: #f59f00;
    --overdue: #d9480f;
    --locked: #495057;
    --lost: #7b2cbf;
}

.manufacturer-form {
    padding: 18px;
}

.manufacturer-form fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}

.manufacturer-links {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.add-manufacturer-link {
    margin-top: 12px;
}

.privacy-panel {
    max-width: 720px;
}

.privacy-panel h2 {
    font-size: 1rem;
    margin: 20px 0 6px;
}

.manufacturer-link-row {
    display: grid;
    grid-template-columns: minmax(130px, .7fr) minmax(150px, 1fr) minmax(260px, 2fr) auto;
    gap: 10px;
    align-items: center;
}

.radio-row {
    align-items: center;
    display: inline-flex;
    gap: 6px;
    white-space: nowrap;
}

.migration-action {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 16px;
}

@media (max-width: 760px) {
    .manufacturer-link-row {
        grid-template-columns: 1fr;
    }

    .migration-action {
        align-items: stretch;
        flex-direction: column;
    }
}

* {
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    margin: 0;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
}

a {
    color: inherit;
}

.login-shell {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #102a43 0%, #183b5c 42%, #f4f7fb 42%);
}

.login-panel {
    width: min(520px, 100%);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 18px 48px rgba(16, 42, 67, 0.2);
}

.register-panel {
    width: min(720px, 100%);
}

.login-logo {
    width: 190px;
    display: block;
    margin: 0 0 20px;
    background: var(--sidebar);
    border-radius: 6px;
    padding: 12px;
}

.app-shell {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 230px 1fr;
}

.sidebar {
    background: var(--sidebar);
    color: #dbe7f3;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.brand {
    min-height: 110px;
    display: grid;
    place-items: center;
    padding: 18px 18px 10px;
}

.brand img {
    max-width: 190px;
    width: 100%;
    height: auto;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.nav a {
    text-decoration: none;
    padding: 16px 26px;
    border-left: 4px solid transparent;
    font-size: 1rem;
    cursor: grab;
}

.nav a:hover,
.nav a.active {
    background: var(--sidebar-active);
    border-left-color: var(--accent);
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    font-size: 0.85rem;
    color: #b9c9d8;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer-links {
    display: grid;
    gap: 6px;
    margin-top: 14px;
}

.sidebar-footer-links a {
    color: #dbe7f3;
    text-decoration: none;
}

.sidebar-footer-links a:hover {
    color: #fff;
    text-decoration: underline;
}

.logout-link {
    display: inline-flex;
    margin-top: 14px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.logout-link:hover {
    color: #bfe3ff;
}

.support-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0 0 18px;
    padding: 10px 14px;
    border: 1px solid #f6c56f;
    border-radius: 6px;
    background: #fff4d6;
    color: #5f3e00;
    font-weight: 700;
}

.support-banner form,
.inline-form {
    margin: 0;
    display: inline-flex;
}

.content {
    min-width: 0;
    padding: 24px 28px;
}

.topbar {
    display: none;
}

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

h1 {
    margin: 0;
    color: var(--sidebar);
    font-size: clamp(1.65rem, 1.2rem + 0.8vw, 2.05rem);
    line-height: 1.15;
}

.subtle {
    color: var(--muted);
    margin: 6px 0 0;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 18px;
}

.button,
button,
input[type="submit"] {
    appearance: none;
    border: none;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    min-height: 40px;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.button.secondary,
button.secondary {
    background: var(--secondary);
    color: var(--sidebar);
    border: 1px solid #d4e0ec;
}

.button.secondary:hover,
button.secondary:hover {
    background: var(--secondary-hover);
    border-color: #a9bed2;
}

.field-link {
    display: inline-flex;
    margin-top: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
}

.grid {
    display: grid;
    gap: 14px;
}

.metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 22px;
}

.metric {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    cursor: grab;
}

.metric-link {
    color: inherit;
    text-decoration: none;
}

.metric-link:hover {
    border-color: #a9bed2;
    transform: translateY(-1px);
}

.metric-link.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(47, 166, 226, 0.16);
}

.dragging {
    opacity: 0.55;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--sidebar);
}

.metric-label {
    color: var(--muted);
    margin-top: 4px;
}

.panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.settings-section {
    margin: 0 0 20px;
}

.settings-section h2 {
    margin: 0 0 10px;
    color: var(--sidebar);
    font-size: 1.08rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.settings-card {
    min-height: 112px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    color: var(--text);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

a.settings-card:hover {
    border-color: #a9bed2;
    transform: translateY(-1px);
}

.settings-card strong {
    color: var(--sidebar);
    font-size: 1rem;
}

.settings-card span {
    color: var(--text);
    line-height: 1.35;
}

.settings-card small {
    margin-top: auto;
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    background: var(--white);
}

th {
    background: var(--header);
    color: var(--sidebar);
    text-align: left;
    font-weight: 800;
    padding: 9px 10px;
    border-right: 1px solid #d2dce8;
    white-space: nowrap;
    font-size: 0.9rem;
}

th[draggable="true"] {
    cursor: grab;
    user-select: none;
}

th[draggable="true"]::before {
    content: "v";
    color: #6b7f92;
    font-size: 0.72rem;
    margin-right: 6px;
}

th.column-drop-left {
    box-shadow: inset 3px 0 0 var(--accent);
}

th.column-drop-right {
    box-shadow: inset -3px 0 0 var(--accent);
}

td {
    padding: 8px 10px;
    border-top: 1px solid #e2e8f0;
    vertical-align: middle;
    font-size: 0.9rem;
}

.action-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

tr:hover td {
    background: #f8fbff;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    white-space: nowrap;
}

.status::before {
    content: "";
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: currentColor;
}

.status.ok { color: var(--ok); }
.status.due { color: var(--due); }
.status.overdue { color: var(--overdue); }
.status.locked { color: var(--locked); }
.status.lost { color: var(--lost); }

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

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    font-weight: 700;
    color: var(--sidebar);
}

.field > label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.help-tip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.help-tip {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #9cafc2;
    background: transparent;
    color: #6b7c8f;
    font-size: 0.68rem;
    line-height: 16px;
    font-weight: 800;
    display: inline-grid;
    place-items: center;
    transform: none;
    box-shadow: none;
}

.help-tip:hover,
.help-tip:focus-visible,
.help-tip.is-open {
    background: #e8eef5;
    border-color: var(--primary);
    color: var(--primary);
    transform: none;
}

.help-popover {
    position: absolute;
    z-index: 40;
    left: 22px;
    top: 50%;
    width: min(300px, 78vw);
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    box-shadow: 0 10px 28px rgba(16, 42, 67, 0.18);
    font-size: 0.86rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translate(0, -50%);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
}

.help-tip-wrap.is-open .help-popover,
.help-tip-wrap:hover .help-popover,
.help-tip:focus-visible + .help-popover {
    opacity: 1;
    visibility: visible;
    transform: translate(4px, -50%);
}

input,
select,
textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid #c8d4e0;
    border-radius: 5px;
    padding: 7px 9px;
    font: inherit;
    color: var(--text);
    background: var(--white);
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.equipment-commandbar {
    display: grid;
    grid-template-columns: minmax(320px, 620px) 120px 105px;
    gap: 12px;
    align-items: center;
    margin: 0 0 18px;
}

.equipment-search {
    min-height: 40px;
}

.equipment-new {
    min-width: 116px;
}

.equipment-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 10px 18px;
    margin: 0 0 16px;
}

.equipment-actions-compact {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
}

.equipment-actions-compact > .button,
.equipment-actions-compact > .action-menu {
    min-width: 150px;
}

.equipment-actions .button {
    min-height: 42px;
    font-size: 0.92rem;
}

.action-menu {
    position: relative;
}

.action-menu > summary {
    list-style: none;
}

.action-menu > summary::-webkit-details-marker {
    display: none;
}

.action-menu-panel {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    left: 0;
    width: min(520px, calc(100vw - 48px));
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: 0 14px 34px rgba(16, 42, 67, 0.16);
}

.action-menu-panel .button,
.action-menu-panel button {
    width: 100%;
}

.archive-equipment-form {
    display: block;
}

.table-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

.equipment-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    margin: 0 0 14px;
    font-size: 0.9rem;
}

.equipment-filters label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.date-filter-group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.equipment-filters select,
.equipment-filters input {
    width: auto;
    min-width: 116px;
}

.data-table {
    min-width: 0;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    overflow-wrap: anywhere;
}

.data-table th {
    white-space: nowrap;
    overflow-wrap: normal;
}

.data-table [data-column="status"] { width: 80px; }
.data-table [data-column="asset_number"] { width: 92px; }
.data-table [data-column="name"] { width: 150px; }
.data-table [data-column="type_name"] { width: 95px; }
.data-table [data-column="location"] { width: 95px; }
.data-table [data-column="user_name"] { width: 100px; }
.data-table [data-column="inspector"] { width: 100px; }
.data-table [data-column="next_inspection_date"] { width: 144px; }
.data-table [data-column="id"] { width: 64px; }
.data-table [data-column="interval_months"] { width: 92px; }
.data-table [data-column="last_inspection_date"] { width: 132px; }
.data-table [data-column="manufacturer"] { width: 120px; }
.data-table [data-column="norm_file_path"] { width: 118px; }
.data-table [data-column="default_interval_months"] { width: 92px; }
.data-table [data-column="default_tolerance"] { width: 150px; }
.data-table [data-column="default_deviation"] { width: 150px; }
.data-table [data-column="active"] { width: 64px; }
.data-table [data-column="actions"] { width: 132px; }

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.table-actions form {
    margin: 0;
}

.table-actions .button {
    width: auto;
}

.icon-delete {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #b42318;
    box-shadow: none;
}

.icon-delete:hover {
    background: transparent;
    color: #8f1d14;
    transform: none;
}

.icon-delete svg {
    display: block;
}

.icon-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-button svg {
    display: block;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.button.danger,
button.danger {
    background: #fff;
    color: #b42318;
    border-color: #f2b8b5;
}

.button.danger:hover,
button.danger:hover {
    background: #fff3f2;
    border-color: #e08a84;
}

.column-tools {
    position: relative;
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 8px;
}

.column-menu-button {
    min-width: 98px;
}

.column-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 8px 14px;
    min-width: 360px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(16, 42, 67, 0.18);
}

.column-menu[hidden] {
    display: none;
}

.column-menu label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.column-menu input {
    width: 18px;
    min-height: 18px;
}

.column-hidden {
    display: none !important;
}

.inline-check input,
.checkbox-row input {
    width: 20px;
    min-height: 20px;
}

.data-table tbody tr {
    cursor: pointer;
}

.data-table tbody tr.selected-row td {
    background: #d9eaff;
}

.desktop-form {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 18px 20px;
}

.example-box {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
}

.example-box summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--primary);
}

.example-box p {
    margin: 10px 0 0;
    color: var(--muted);
}

.desktop-form-grid {
    display: grid;
    grid-template-columns: 300px minmax(320px, 1fr);
    gap: 10px 18px;
    align-items: center;
}

.desktop-form-grid > label {
    font-size: 1rem;
    font-weight: 500;
}

.desktop-form-grid > label small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.25;
}

.desktop-form-grid input,
.desktop-form-grid select,
.desktop-form-grid textarea {
    min-height: 48px;
    border-radius: 7px;
    font-size: 1rem;
    background: #fff;
}

.desktop-form-grid textarea {
    min-height: 104px;
}

.file-row {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 12px;
}

.file-button {
    position: relative;
    min-height: 52px;
    font-size: 1rem;
    overflow: hidden;
}

.file-button input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-height: 42px;
}

.privacy-consent {
    align-items: flex-start;
    margin-top: 6px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.35;
}

.privacy-consent input {
    width: 18px;
    min-height: 18px;
    margin-top: 2px;
    flex: 0 0 auto;
}

.checkbox-field .checkbox-row {
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--white);
}

.checkbox-field .checkbox-row input {
    width: 20px;
    min-height: 20px;
}

.notice {
    padding: 12px 14px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    border-radius: 8px;
    margin-bottom: 16px;
}

.error {
    padding: 12px 14px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 8px;
    margin-bottom: 16px;
}

.print-page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px;
    background: #fff;
}

.certificate {
    color: #000;
    font-family: Arial, "Segoe UI", sans-serif;
    padding: 42px 36px 34px;
}

.certificate h1 {
    color: #000;
    text-align: center;
    font-size: 2rem;
    line-height: 1.1;
    margin: 0 0 18px;
    font-weight: 800;
}

.certificate-subtitle {
    text-align: center;
    font-size: 1.28rem;
    font-weight: 700;
    margin: -8px 0 28px;
}

.certificate-date {
    font-size: 1.08rem;
    margin: 0 0 32px 12px;
}

.certificate-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: fixed;
    border: 1px solid #cbd5e1;
    font-size: 1.08rem;
}

.certificate-table th {
    background: var(--primary);
    color: #fff;
    text-align: left;
    font-size: 1.08rem;
    font-weight: 800;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
}

.certificate-table th:first-child,
.certificate-table td:first-child {
    width: 30%;
}

.certificate-table td {
    color: #000;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    font-size: 1.08rem;
    vertical-align: top;
}

.certificate-table tbody tr:nth-child(even) td {
    background: #f2f5fa;
}

.certificate-signature {
    margin: 54px 0 0 12px;
    font-size: 1.08rem;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 12mm;
    }

    body,
    .print-body {
        background: #fff;
    }

    .sidebar,
    .toolbar,
    .button {
        display: none !important;
    }

    .print-page {
        max-width: none;
        padding: 0;
    }

    .certificate {
        padding: 0;
    }

    .table-wrap {
        border: none;
        overflow: visible;
    }

    table {
        min-width: 0;
        font-size: 10pt;
    }

    .certificate-table,
    .certificate-table th,
    .certificate-table td {
        font-size: 12pt;
    }
}

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

    .equipment-commandbar {
        grid-template-columns: 1fr 150px 130px;
    }

    .desktop-form-grid {
        grid-template-columns: 230px minmax(280px, 1fr);
    }
}

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

    .sidebar {
        min-height: auto;
    }

    .brand {
        min-height: 86px;
    }

    .nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 8px 8px;
    }

    .nav a {
        border-left: none;
        border-bottom: 4px solid transparent;
        white-space: nowrap;
        padding: 13px 14px;
    }

    .nav a:hover,
    .nav a.active {
        border-left-color: transparent;
        border-bottom-color: var(--accent);
    }

    .sidebar-footer {
        display: none;
    }

    .content {
        padding: 22px 18px;
    }

    .page-head {
        flex-direction: column;
    }

    .toolbar {
        justify-content: flex-start;
    }

    .equipment-commandbar,
    .desktop-form-grid,
    .file-row {
        grid-template-columns: 1fr;
    }

    .equipment-filters select,
    .equipment-filters input {
        width: 100%;
    }

    .column-tools {
        justify-content: flex-start;
    }

    .column-menu {
        left: 0;
        right: auto;
        grid-template-columns: 1fr;
        min-width: min(320px, calc(100vw - 36px));
    }
}

@media (max-width: 620px) {
    .metrics,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .button,
    button,
    input[type="submit"] {
        width: 100%;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

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

@media (max-width: 720px) {
    html {
        font-size: 14px;
    }

    body {
        background: #f6f9fd;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 50;
        min-height: auto;
        box-shadow: 0 8px 22px rgba(16, 42, 67, 0.16);
    }

    .brand {
        min-height: 58px;
        justify-content: flex-start;
        padding: 10px 14px 6px;
    }

    .brand img {
        max-width: 128px;
    }

    .nav {
        flex-direction: row;
        gap: 4px;
        overflow-x: auto;
        padding: 0 10px 10px;
        scrollbar-width: thin;
    }

    .nav a {
        flex: 0 0 auto;
        padding: 9px 11px;
        border-left: 0;
        border-bottom: 3px solid transparent;
        border-radius: 5px;
        font-size: 0.92rem;
        white-space: nowrap;
    }

    .nav a.active,
    .nav a:hover {
        border-left-color: transparent;
        border-bottom-color: var(--accent);
    }

    .sidebar-footer {
        display: none;
    }

    .content {
        padding: 14px 12px 24px;
    }

    .page-head {
        margin-bottom: 12px;
    }

    h1 {
        font-size: 1.55rem;
    }

    .subtle {
        font-size: 0.92rem;
    }

    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 14px;
    }

    .metric {
        padding: 12px;
        min-height: 88px;
    }

    .metric-value {
        font-size: 1.75rem;
    }

    .equipment-commandbar {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }

    .equipment-actions-compact {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .equipment-actions-compact > .button,
    .equipment-actions-compact > .action-menu {
        min-width: 0;
        width: 100%;
    }

    .equipment-actions .button,
    .equipment-actions summary.button {
        min-height: 38px;
        padding: 7px 10px;
        font-size: 0.9rem;
    }

    .action-menu-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        top: auto;
        width: auto;
        grid-template-columns: 1fr;
        max-height: 70dvh;
        overflow: auto;
    }

    .equipment-filters {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }

    .equipment-filters label,
    .date-filter-group {
        width: 100%;
    }

    .date-filter-group {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 8px;
        white-space: normal;
    }

    .date-filter-group input[type="date"] {
        min-width: 0;
    }

    .column-tools {
        margin: 6px 0 10px;
    }

    .column-menu {
        position: fixed;
        left: 12px;
        right: 12px;
        width: auto;
        min-width: 0;
        max-height: 72dvh;
        overflow: auto;
    }

    .table-wrap {
        border: 0;
        overflow: visible;
        background: transparent;
    }

    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100% !important;
        min-width: 0;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody {
        display: grid;
        gap: 10px;
    }

    .data-table tr {
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--white);
        box-shadow: 0 6px 16px rgba(16, 42, 67, 0.08);
        overflow: hidden;
    }

    .data-table tr.selected-row {
        outline: 2px solid #8cc7ff;
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 14px;
        padding: 9px 12px;
        border: 0;
        border-bottom: 1px solid #eef3f8;
        overflow-wrap: anywhere;
    }

    .data-table td:last-child {
        border-bottom: 0;
    }

    .data-table td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        color: var(--muted);
        font-weight: 700;
        font-size: 0.82rem;
    }

    .data-table td.column-hidden {
        display: none !important;
    }

    .desktop-form {
        padding: 12px;
        border-radius: 8px;
    }

    .desktop-form-grid,
    .file-row {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .desktop-form-grid > label {
        margin-top: 6px;
        font-size: 0.92rem;
    }

    .desktop-form-grid input,
    .desktop-form-grid select,
    .desktop-form-grid textarea {
        min-height: 40px;
        font-size: 0.95rem;
    }

    .file-button {
        min-height: 40px;
    }

    .form-actions {
        gap: 8px;
    }
}

@media (max-width: 430px) {
    .metrics,
    .equipment-actions-compact {
        grid-template-columns: 1fr;
    }

    .data-table td {
        display: block;
    }

    .data-table td::before {
        display: block;
        margin-bottom: 4px;
    }
}

/* RoGo portal design system: shared with Leadliste and Rechtskataster */
@font-face {
    font-family: "Inter Variable";
    src: url("fonts/inter-latin-variable.woff2") format("woff2-variations");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #f6f8fb;
    --sidebar: #132b46;
    --sidebar-active: #ffffff;
    --accent: #f97316;
    --primary: #132b46;
    --primary-hover: #102846;
    --secondary: #ffffff;
    --secondary-hover: #f8fafc;
    --text: #102033;
    --muted: #64748b;
    --line: #dfe7f1;
    --header: #f8fafc;
    --white: #ffffff;
}

html {
    font-size: 16px;
    background: var(--bg);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Inter Variable", Inter, Arial, sans-serif;
    line-height: 1.5;
}

svg.lucide {
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1000;
    padding: 9px 12px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    background: #fff;
    color: var(--primary);
    font-weight: 800;
    text-decoration: none;
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

.app-shell {
    display: grid;
    grid-template-columns: 256px minmax(0, 1fr);
    min-height: 100dvh;
    transition: grid-template-columns 0.2s ease;
}

.app-shell.is-collapsed {
    grid-template-columns: 72px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    background: #f8fafc;
    color: #334155;
    border-right: 1px solid #e2e8f0;
}

.brand {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
}

.brand-mark {
    display: block;
    width: 146px;
    height: 48px;
    flex: 0 0 146px;
    overflow: hidden;
    transition: width 0.2s ease, flex-basis 0.2s ease;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
    transform: scale(2);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
}

.nav a {
    position: relative;
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 0;
    border-radius: 6px;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav a:hover,
.nav a.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.nav a.active {
    border-left-color: transparent;
}

.nav a.active::before {
    content: "";
    position: absolute;
    left: -12px;
    width: 4px;
    height: 24px;
    border-radius: 0 4px 4px 0;
    background: var(--accent);
}

.nav svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
}

.sidebar-footer {
    display: grid;
    gap: 3px;
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid #e2e8f0;
    color: var(--muted);
    font-size: 0.76rem;
}

.sidebar-footer > strong {
    overflow: hidden;
    color: #334155;
    font-size: 0.84rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer-links {
    display: grid;
    gap: 2px;
    margin-top: 10px;
}

.sidebar-footer-links a,
.logout-link {
    display: flex;
    min-height: 38px;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 8px 9px;
    border-radius: 5px;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-footer-links a:hover,
.logout-link:hover {
    background: #fff;
    color: #0f172a;
    text-decoration: none;
}

.logout-link {
    background: transparent;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    margin-top: 4px;
}

.logout-form {
    margin: 0;
}

.sidebar-collapse {
    position: fixed;
    z-index: 45;
    top: 54px;
    left: 242px;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    background: #fff;
    color: #64748b;
    box-shadow: 0 2px 7px rgba(15, 23, 42, 0.1);
    transition: left 0.2s ease, color 0.15s ease;
}

.sidebar-collapse:hover {
    background: #fff;
    color: #0f172a;
    transform: none;
}

.app-shell.is-collapsed .sidebar-collapse {
    left: 58px;
}

.app-shell.is-collapsed .brand {
    justify-content: center;
    padding-inline: 8px;
}

.app-shell.is-collapsed .brand-mark {
    width: 48px;
    flex-basis: 48px;
}

.app-shell.is-collapsed .brand-mark img {
    transform: scale(4) translateX(10px);
}

.app-shell.is-collapsed .nav a {
    justify-content: center;
    padding-inline: 8px;
}

.app-shell.is-collapsed .nav a span,
.app-shell.is-collapsed .sidebar-footer > strong,
.app-shell.is-collapsed .sidebar-footer > span,
.app-shell.is-collapsed .sidebar-footer a span,
.app-shell.is-collapsed .sidebar-footer button span {
    display: none;
}

.app-shell.is-collapsed .sidebar-footer {
    align-items: center;
    padding-inline: 12px;
}

.app-shell.is-collapsed .sidebar-footer a,
.app-shell.is-collapsed .sidebar-footer button {
    justify-content: center;
}

.app-frame {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: block;
    height: 64px;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
}

.topbar-inner {
    width: min(1600px, 100%);
    height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 auto;
    padding: 0 30px;
}

.topbar-title {
    display: grid;
}

.topbar-title strong {
    color: #0f172a;
    font-size: 0.9rem;
}

.topbar-title span {
    color: var(--muted);
    font-size: 0.72rem;
}

.profile-menu {
    position: relative;
    margin-left: auto;
}

.profile-menu summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: pointer;
    list-style: none;
}

.profile-menu summary::-webkit-details-marker {
    display: none;
}

.profile-menu summary:hover {
    background: #f1f5f9;
}

.profile-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
}

.profile-copy {
    display: grid;
    min-width: 0;
}

.profile-copy strong {
    max-width: 180px;
    overflow: hidden;
    color: #1e293b;
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-copy small {
    color: var(--muted);
    font-size: 0.7rem;
}

.profile-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 210px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}

.profile-popover a {
    display: flex;
    min-height: 40px;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 5px;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 650;
    text-decoration: none;
}

.profile-popover a:hover {
    background: #f8fafc;
    color: #0f172a;
}

.content {
    width: min(1600px, 100%);
    min-width: 0;
    margin: 0 auto;
    padding: 28px 30px 42px;
}

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

.page-head {
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    color: var(--primary);
    font-size: clamp(1.65rem, 1.45rem + 0.45vw, 2rem);
    letter-spacing: 0;
}

h2 {
    color: #1e293b;
}

.subtle,
.muted {
    color: var(--muted);
}

.button,
button,
input[type="submit"] {
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-size: 0.86rem;
    font-weight: 700;
    box-shadow: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
    background: var(--primary-hover);
    transform: none;
}

.button.secondary,
button.secondary {
    border: 1px solid #d8e1eb;
    background: #fff;
    color: #334155;
}

.button.secondary:hover,
button.secondary:hover {
    border-color: #b9c7d6;
    background: #f8fafc;
}

.button:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(249, 115, 22, 0.24);
    outline-offset: 2px;
}

.icon-button {
    display: inline-grid;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
}

.icon-button:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.icon-button.mobile-menu,
.icon-button.sidebar-close {
    display: none;
}

input,
select,
textarea {
    min-height: 40px;
    border-color: #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #0f172a;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #94a3b8;
    outline: 3px solid rgba(249, 115, 22, 0.12);
}

.field label,
.desktop-form-grid > label {
    color: #334155;
    font-size: 0.82rem;
    font-weight: 700;
}

.desktop-form {
    border-color: var(--line);
    background: #fff;
    box-shadow: none;
}

.desktop-form-grid input,
.desktop-form-grid select,
.desktop-form-grid textarea {
    min-height: 42px;
    font-size: 0.92rem;
}

.panel,
.metric,
.settings-card,
.dashboard-kpi {
    border-color: var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
}

.panel {
    margin-bottom: 22px;
}

.metric,
.dashboard-kpi {
    padding: 18px;
}

.metric-link,
.dashboard-kpi {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.metric-link:hover,
.metric-link.active,
.dashboard-kpi:hover {
    border-color: #fdba74;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.08);
    transform: none;
}

.metric-link.active {
    border-color: var(--accent);
}

.metric-value,
.dashboard-kpi strong {
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.settings-card {
    min-height: 108px;
}

a.settings-card:hover {
    border-color: #fdba74;
    transform: none;
}

.table-wrap {
    border-color: var(--line);
    border-radius: 8px;
    background: #fff;
}

table {
    background: #fff;
}

th {
    padding: 10px 11px;
    border-right-color: #e2e8f0;
    background: #f8fafc;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 750;
}

th[draggable="true"]::before {
    color: #94a3b8;
}

th.column-drop-left {
    box-shadow: inset 3px 0 0 var(--accent);
}

th.column-drop-right {
    box-shadow: inset -3px 0 0 var(--accent);
}

td {
    padding: 9px 11px;
    border-top-color: #eef2f7;
    color: #334155;
    font-size: 0.84rem;
}

tr:hover td {
    background: #f8fafc;
}

.data-table tbody tr.selected-row td {
    background: #fff7ed;
}

.status::before {
    width: 9px;
    height: 9px;
}

.column-menu,
.action-menu-panel {
    border-color: var(--line);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

.notice,
.error,
.support-banner {
    border-radius: 7px;
    font-size: 0.84rem;
}

.support-banner {
    border-color: #fdba74;
    background: #fff7ed;
    color: #9a3412;
}

.support-banner > span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-tip {
    border-color: #cbd5e1;
    color: #64748b;
}

.help-tip:hover,
.help-tip:focus-visible {
    border-color: var(--accent);
    background: #fff7ed;
    color: #c2410c;
}

.help-popover {
    border-color: var(--line);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
}

/* Authentication */
.login-shell {
    min-height: 100dvh;
    padding: 24px;
    background: #f1f5f9;
}

.login-panel {
    width: min(448px, 100%);
    padding: 30px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.1);
}

.register-panel {
    width: min(620px, 100%);
}

.login-logo {
    display: block;
    width: 196px;
    height: 64px;
    max-width: none;
    margin: 0 0 28px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
    transform: scale(1.8);
    transform-origin: left center;
}

.login-panel h1 {
    font-size: 1.6rem;
}

.login-panel .field {
    margin-top: 16px;
}

.login-panel .form-actions {
    margin-top: 24px;
}

@media (max-width: 1100px) {
    .content {
        padding-inline: 22px;
    }
}

@media (max-width: 899px) {
    .app-shell,
    .app-shell.is-collapsed {
        display: block;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 60;
        width: 272px;
        max-width: 88vw;
        min-height: 100dvh;
        max-height: 100dvh;
        box-shadow: 16px 0 40px rgba(15, 23, 42, 0.18);
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }

    body.nav-open {
        overflow: hidden;
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .app-shell.is-collapsed .brand {
        justify-content: space-between;
        padding-inline: 16px;
    }

    .app-shell.is-collapsed .brand-mark {
        width: 146px;
        flex-basis: 146px;
    }

    .app-shell.is-collapsed .brand-mark img {
        transform: scale(2);
    }

    .app-shell.is-collapsed .nav a {
        justify-content: flex-start;
        padding-inline: 12px;
    }

    .app-shell.is-collapsed .nav a span,
    .app-shell.is-collapsed .sidebar-footer > strong,
    .app-shell.is-collapsed .sidebar-footer > span,
    .app-shell.is-collapsed .sidebar-footer a span {
        display: initial;
    }

    .app-shell.is-collapsed .sidebar-footer a {
        justify-content: flex-start;
    }

    .icon-button.sidebar-close {
        display: inline-grid;
    }

    .sidebar-collapse {
        display: none;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 55;
        display: block;
        width: 100%;
        height: 100%;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: rgba(15, 23, 42, 0.42);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    body.nav-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .icon-button.mobile-menu {
        display: inline-grid;
    }

    .topbar-inner {
        padding-inline: 18px;
    }

    .content {
        padding: 22px 18px 34px;
    }

    .profile-copy {
        display: none;
    }

    .profile-menu summary > svg {
        display: none;
    }

    .equipment-commandbar,
    .desktop-form-grid,
    .file-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    html {
        font-size: 15px;
    }

    .topbar-inner {
        padding-inline: 12px;
    }

    .content {
        padding: 16px 12px 28px;
    }

    .page-head {
        align-items: flex-start;
    }

    .login-shell {
        padding: 14px;
    }

    .login-panel {
        padding: 22px;
    }

    .login-logo {
        width: 168px;
        height: 56px;
        margin-bottom: 22px;
    }

    .help-popover {
        position: fixed;
        z-index: 100;
        top: 76px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        transform: translateY(-4px);
    }

    .help-tip-wrap.is-open .help-popover,
    .help-tip-wrap:hover .help-popover,
    .help-tip:focus-visible + .help-popover {
        transform: none;
    }

    .data-table tbody tr {
        border-color: var(--line);
        box-shadow: 0 5px 16px rgba(15, 23, 42, 0.06);
    }
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.section-title {
    margin: 26px 0 12px;
    font-size: 1rem;
    color: var(--primary);
}

.field-hint,
.manufacturer-priority small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 0.78rem;
}

.manufacturer-assignment-list,
[data-equipment-manufacturer-list] {
    display: grid;
    gap: 7px;
    margin-top: 8px;
}

.manufacturer-assignment,
.manufacturer-priority-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--primary);
    font: inherit;
    text-align: left;
    cursor: grab;
}

.manufacturer-assignment:active,
.manufacturer-priority-row:active {
    cursor: grabbing;
}

.manufacturer-assignment.dragging,
.manufacturer-priority-row.dragging {
    opacity: 0.55;
    border-color: #f97316;
}

.manufacturer-assignment input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.manufacturer-assignment small {
    margin-left: auto;
    color: var(--muted);
}

.drag-handle {
    color: #64748b;
    font-weight: 700;
    letter-spacing: 1px;
}

.manufacturer-priority {
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafc;
}

.manufacturer-priority[hidden] {
    display: none;
}

@media print {
    .topbar,
    .sidebar,
    .sidebar-overlay,
    .sidebar-collapse,
    .skip-link {
        display: none !important;
    }

    .app-shell,
    .app-shell.is-collapsed {
        display: block;
    }

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

    .certificate,
    .certificate-table,
    .certificate-table th,
    .certificate-table td {
        font-family: Arial, "Segoe UI", sans-serif;
    }
}
