:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --sidebar: #111827;
    --text: #101828;
    --muted: #667085;
    --muted-2: #98a2b3;
    --line: #eaecf0;
    --line-strong: #d0d5dd;
    --primary: #b42318;
    --primary-hover: #912018;
    --primary-soft: #fef3f2;
    --success: #12b76a;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 24px 64px rgba(16, 24, 40, 0.22);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

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;
}

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

/* ------------------------------------------------------------------ sidebar */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px 18px 18px;
    background:
        radial-gradient(circle at 15% 0%, rgba(249, 115, 22, 0.16), transparent 38%),
        var(--sidebar);
    color: #e5e7eb;
    overflow: hidden;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 4px 22px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    background: linear-gradient(145deg, #f97316, #b42318);
    color: #fff;
    box-shadow: 0 8px 18px rgba(180, 35, 24, 0.35);
}

.brand-mark svg {
    width: 24px;
    height: 24px;
}

.brand-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}

.brand-subtitle {
    margin-top: 2px;
    font-size: 11.5px;
    color: #9ca3af;
}

.sidebar-label {
    padding: 0 10px 8px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #6b7280;
}

.system-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #374151 transparent;
}

.system-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #d1d5db;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.system-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.system-item.active {
    background: #fff;
    color: var(--text);
    border-color: #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.system-code {
    display: inline-grid;
    place-items: center;
    min-width: 49px;
    padding: 5px 7px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.09);
    color: #e5e7eb;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.system-item.active .system-code {
    background: var(--primary-soft);
    color: var(--primary);
}

.system-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.system-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.system-count {
    font-size: 10.5px;
    color: #9ca3af;
}

.system-item.active .system-count {
    color: var(--muted);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-sidebar {
    width: 100%;
    justify-content: center;
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e5e7eb;
}

.btn-sidebar:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-note {
    margin: 11px 0 0;
    text-align: center;
    font-size: 10.5px;
    color: #6b7280;
}

/* --------------------------------------------------------------------- main */
.main {
    min-width: 0;
    padding: 30px 36px 48px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 24px;
}

.heading {
    min-width: 0;
}

.eyebrow {
    margin-bottom: 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.eyebrow span {
    color: var(--primary);
}

h1 {
    margin: 0;
    font-size: clamp(24px, 2.3vw, 32px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.system-title {
    max-width: 760px;
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
    white-space: pre-line;
}

.topbar-controls {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    padding-top: 4px;
}

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

.field-inline span {
    padding-left: 2px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
}

.field-inline input {
    min-width: 158px;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-inline input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

/* ------------------------------------------------------------------- buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(180, 35, 24, 0.18);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--line-strong);
    color: #344054;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #98a2b3;
}

.btn-ghost {
    background: transparent;
    color: #475467;
}

.btn-ghost:hover {
    background: #f2f4f7;
}

.btn:disabled,
.btn.is-loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #667085;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

.icon-btn:hover {
    background: #f2f4f7;
    color: #344054;
}

.icon-btn.danger:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.icon-btn:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------- stats */
.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
}

.stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat-value-date {
    font-size: 18px;
    padding-top: 3px;
}

.stat-label {
    margin-top: 4px;
    font-size: 11.5px;
    color: var(--muted);
}

/* --------------------------------------------------------------------- panel */
.panel {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.panel-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.panel-hint {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 190px;
}

.search-box input {
    width: 230px;
    padding: 9px 34px 9px 34px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, width 0.2s ease;
}

.search-box input::placeholder {
    color: var(--muted-2);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.search-box input::-webkit-search-cancel-button,
.search-box input::-webkit-search-decoration {
    display: none;
}

.search-icon {
    position: absolute;
    left: 11px;
    width: 15px;
    height: 15px;
    color: var(--muted-2);
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 5px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.search-clear svg {
    width: 13px;
    height: 13px;
}

.search-clear:hover {
    background: #f2f4f7;
    color: var(--text);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    contain: paint;
    transition: opacity 0.15s ease;
}

.panel.is-loading .table-wrap {
    opacity: 0.5;
}

table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
}

thead th {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    background: #f9fafb;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody td {
    padding: 13px 14px;
    border-bottom: 1px solid #f2f4f7;
    color: #344054;
    font-size: 12.5px;
    line-height: 1.5;
    vertical-align: top;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background: #fcfcfd;
}

.col-date {
    width: 92px;
}

.col-equipment {
    width: 132px;
}

.col-description {
    min-width: 340px;
}

.col-recommendations {
    width: 158px;
}

.col-signature {
    width: 112px;
}

.col-conclusion {
    width: 158px;
}

.col-actions {
    width: 78px;
    text-align: right;
}

.date-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

.description-cell {
    white-space: pre-line;
}

.muted {
    color: var(--muted-2);
}

.row-actions {
    display: inline-flex;
    gap: 2px;
    justify-content: flex-end;
}

/* --------------------------------------------------------------------- empty */
.empty {
    padding: 58px 20px 62px;
    text-align: center;
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin: 0 auto 14px;
    border-radius: 14px;
    background: #f9fafb;
    color: #98a2b3;
}

.empty-icon svg {
    width: 26px;
    height: 26px;
}

.empty h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.empty p {
    margin: 6px 0 18px;
    font-size: 13px;
    color: var(--muted);
}

.empty-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------- modal */
.modal {
    width: calc(100% - 32px);
    max-width: 760px;
    max-height: calc(100vh - 32px);
    padding: 0;
    border: none;
    border-radius: 16px;
    background: transparent;
    overflow: visible;
}

.modal::backdrop {
    background: rgba(16, 24, 40, 0.55);
    backdrop-filter: blur(2px);
}

.modal-card {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 32px);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px 17px;
    border-bottom: 1px solid var(--line);
}

.modal-head .eyebrow {
    margin-bottom: 4px;
}

.modal-head h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-close {
    margin: -2px -6px 0 0;
    width: 32px;
    height: 32px;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 22px;
    overflow-y: auto;
}

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

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

.field > span {
    font-size: 12px;
    font-weight: 600;
    color: #344054;
}

.field > span b {
    color: var(--primary);
}

.field input,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.45;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
    resize: vertical;
    min-height: 44px;
}

.field input::placeholder,
.field textarea::placeholder {
    color: #98a2b3;
}

.field input:focus,
.field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 22px;
    border-top: 1px solid var(--line);
    background: #fcfcfd;
}

.required-note {
    font-size: 11.5px;
    color: var(--muted-2);
}

.required-note b {
    color: var(--primary);
}

.modal-actions {
    display: flex;
    gap: 8px;
}

/* -------------------------------------------------------------------- toasts */
.toasts {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    max-width: 380px;
    padding: 11px 14px;
    border-left: 3px solid var(--success);
    border-radius: 10px;
    background: #101828;
    color: #f9fafb;
    font-size: 12.5px;
    line-height: 1.4;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.28);
    animation: toast-in 0.18s ease-out;
}

.toast.error {
    border-left-color: #f04438;
}

.toast.leaving {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

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

/* ----------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
    .app {
        grid-template-columns: 290px minmax(0, 1fr);
    }

    .main {
        padding: 26px 26px 40px;
    }

    .topbar {
        flex-direction: column;
        gap: 18px;
    }

    .topbar-controls {
        align-items: stretch;
        width: 100%;
        padding-top: 0;
    }
}

@media (max-width: 860px) {
    .app {
        display: block;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 16px 16px 14px;
    }

    .brand {
        padding-bottom: 14px;
    }

    .sidebar-label {
        padding-bottom: 7px;
    }

    .system-list {
        flex-direction: row;
        gap: 6px;
        padding-bottom: 4px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .system-item {
        flex: 0 0 auto;
        width: auto;
        min-width: 190px;
    }

    .sidebar-footer {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-top: 12px;
        padding-top: 12px;
    }

    .btn-sidebar {
        width: auto;
        padding: 8px 12px;
        font-size: 12px;
    }

    .sidebar-note {
        margin: 0;
    }

    .main {
        padding: 20px 14px 36px;
    }

    .stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat {
        padding: 13px 15px;
    }

    .stat-value {
        font-size: 21px;
    }

    .topbar-controls {
        flex-direction: column;
        gap: 10px;
    }

    .field-inline input {
        width: 100%;
    }

    .panel-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .panel-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .panel-actions .btn,
    .search-box,
    .search-box input {
        width: 100%;
    }

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

    .modal-foot {
        flex-direction: column-reverse;
        align-items: stretch;
    }

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

    .required-note {
        text-align: right;
    }
}

@media (max-width: 520px) {
    h1 {
        font-size: 22px;
    }

    .system-title {
        font-size: 11.5px;
    }

    .modal {
        width: calc(100% - 16px);
        max-height: calc(100vh - 16px);
    }

    .modal-card {
        max-height: calc(100vh - 16px);
    }

    .modal-head,
    .modal-body,
    .modal-foot {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ======================================================== users & equipment */
.system-list {
    min-height: 0;
}

.sidebar-tools {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #d1d5db;
    font-size: 12.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: #9ca3af;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.sidebar-link:hover svg {
    color: #fff;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 9px;
    background: linear-gradient(145deg, #f97316, #b42318);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.user-meta {
    min-width: 0;
    line-height: 1.25;
}

.user-name {
    overflow: hidden;
    color: #f3f4f6;
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    margin-top: 2px;
    color: #9ca3af;
    font-size: 10.5px;
}

.sidebar-logout {
    flex: 0 0 30px;
    margin-left: auto;
    color: #9ca3af;
}

.sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.period-selects {
    display: flex;
    gap: 6px;
}

.period-selects select,
.field select {
    min-width: 0;
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#monthSelect {
    min-width: 132px;
}

#yearSelect {
    width: 106px;
}

.period-selects select:focus,
.field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

/* ------------------------------------------------------------ entry extras */
.entry-extra {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px dashed var(--line);
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.45;
    white-space: pre-line;
}

.role-observer .col-actions {
    display: none;
}

/* --------------------------------------------------- equipment in the form */
.equipment-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 2px;
}

.field-label-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #344054;
}

.field-hint {
    margin: 0;
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--muted-2);
}

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

.equipment-placeholder {
    margin: 0;
    padding: 10px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 9px;
    color: var(--muted-2);
    font-size: 12px;
}

.equipment-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 88px 52px 30px;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fcfcfd;
}

.equipment-line-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 12.5px;
    font-weight: 600;
    color: #344054;
}

.equipment-line input {
    width: 100%;
    padding: 6px 7px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    font-size: 12.5px;
    text-align: right;
    outline: none;
}

.equipment-line input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.12);
}

.equipment-line-unit {
    color: var(--muted);
    font-size: 12px;
}

.equipment-add-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px 46px auto;
    align-items: center;
    gap: 8px;
}

.equipment-add-row select,
.equipment-add-row input {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: 12.5px;
    outline: none;
}

.equipment-add-row select:focus,
.equipment-add-row input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.equipment-unit {
    color: var(--muted);
    font-size: 12px;
}

.btn-sm {
    padding: 8px 11px;
    font-size: 12px;
}

/* --------------------------------------------------------------- admin UI */
.modal-lg {
    max-width: 980px;
}

.admin-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.admin-form .field {
    flex: 1 1 190px;
}

.admin-form .field-unit {
    flex: 0 0 100px;
}

.admin-form-actions {
    display: flex;
    gap: 8px;
    padding-bottom: 1px;
}

.field-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    color: #344054;
    font-size: 12.5px;
    cursor: pointer;
}

.field-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.admin-table-wrap {
    max-height: 46vh;
    border: 1px solid var(--line);
    border-radius: 11px;
    overflow: auto;
}

.admin-table {
    min-width: 0;
    width: 100%;
}

.admin-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
}

.admin-table .admin-actions {
    width: 78px;
    text-align: right;
}

.admin-table .admin-empty {
    padding: 24px;
    color: var(--muted);
    text-align: center;
}

.admin-user-name {
    font-weight: 600;
    color: #344054;
}

.admin-user-login {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11.5px;
}

.role-badge {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}

.role-badge.role-admin {
    background: #fef3f2;
    color: #b42318;
}

.role-badge.role-executor {
    background: #eff8ff;
    color: #175cd3;
}

.role-badge.role-customer {
    background: #ecfdf3;
    color: #027a48;
}

.role-badge.role-observer {
    background: #f2f4f7;
    color: #475467;
}

.status-active {
    color: #027a48;
    font-weight: 600;
}

.status-disabled {
    color: var(--muted-2);
}

.icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.icon-btn:disabled:hover {
    background: transparent;
    color: #667085;
}

/* ------------------------------------------------------------------- login */
.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(circle at 12% 0%, rgba(249, 115, 22, 0.2), transparent 42%),
        radial-gradient(circle at 88% 100%, rgba(180, 35, 24, 0.16), transparent 40%),
        var(--sidebar);
}

.login-shell {
    width: 100%;
    max-width: 420px;
}

.login-card {
    padding: 30px;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.35);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.login-brand .brand-title {
    color: var(--text);
}

.login-brand .brand-subtitle {
    color: var(--muted);
}

.login-card h1 {
    margin: 0;
    font-size: 23px;
    letter-spacing: -0.02em;
}

.login-hint {
    margin: 7px 0 20px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.5;
}

.login-error {
    margin-bottom: 16px;
    padding: 10px 12px;
    border-left: 3px solid var(--primary);
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12.5px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-submit {
    width: 100%;
    margin-top: 4px;
    padding-top: 11px;
    padding-bottom: 11px;
}

.login-note {
    margin: 20px 0 0;
    color: var(--muted-2);
    font-size: 11px;
    text-align: center;
}

/* ---------------------------------------------------------- responsive 2 */
@media (max-width: 860px) {
    .sidebar-tools {
        flex-direction: row;
        flex-wrap: wrap;
        margin-top: 10px;
        padding-top: 10px;
    }

    .sidebar-tools .sidebar-label {
        width: 100%;
    }

    .sidebar-link {
        width: auto;
    }

    .sidebar-footer {
        flex-wrap: wrap;
    }

    .sidebar-user {
        width: 100%;
        margin-bottom: 2px;
    }

    .field-inline {
        width: 100%;
    }

    .period-selects {
        width: 100%;
    }

    .period-selects select {
        flex: 1;
    }

    #yearSelect {
        flex: 0 0 106px;
    }

    .admin-form .field,
    .admin-form .field-unit {
        flex: 1 1 100%;
    }

    .admin-form-actions {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .login-card {
        padding: 22px 18px;
    }

    .equipment-line {
        grid-template-columns: minmax(0, 1fr) 72px 42px 30px;
    }

    .equipment-add-row {
        grid-template-columns: minmax(0, 1fr) 76px 40px;
    }

    .equipment-add-row .btn {
        grid-column: 1 / -1;
    }
}

/* ------------------------------------------------------- collapsible sidebar */
.heading-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.heading-row .heading {
    min-width: 0;
}

.sidebar-toggle {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    margin-top: 2px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: #475467;
}

.sidebar-toggle:hover {
    background: #f2f4f7;
    color: var(--text);
}

html.sidebar-collapsed .app {
    grid-template-columns: minmax(0, 1fr);
}

html.sidebar-collapsed .sidebar {
    display: none;
}

/* ------------------------------------------------------- action log dialog */
.log-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.log-toolbar .search-box {
    flex: 1 1 auto;
    min-width: 0;
}

.logs-table-wrap {
    max-height: 58vh;
}

.logs-table {
    min-width: 860px;
}

.logs-table .admin-actions {
    width: 130px;
    text-align: right;
}

.log-col-actions {
    width: 130px;
}

.logs-table th,
.logs-table td {
    vertical-align: top;
}

.log-col-time {
    width: 118px;
}

.log-col-user {
    width: 150px;
}

.log-col-action {
    width: 190px;
}

.log-time {
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
}

.log-user {
    overflow-wrap: anywhere;
    color: #344054;
    font-weight: 600;
}

.log-ip {
    margin-top: 2px;
    color: var(--muted-2);
    font-size: 10.5px;
}

.log-action {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}

.log-action.log-success {
    background: #ecfdf3;
    color: #027a48;
}

.log-action.log-warning {
    background: #fffaeb;
    color: #b54708;
}

.log-action.log-danger {
    background: #fef3f2;
    color: #b42318;
}

.log-action.log-info {
    background: #eff8ff;
    color: #175cd3;
}

.log-action.log-neutral {
    background: #f2f4f7;
    color: #475467;
}

.log-details {
    overflow-wrap: anywhere;
    color: #475467;
    font-size: 12px;
    line-height: 1.45;
}

.logs-hint {
    margin-top: 10px;
    text-align: right;
}

@media (max-width: 520px) {
    .log-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .log-toolbar .btn {
        width: 100%;
    }

    .sidebar-toggle {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
    }
}

.sidebar-toggle svg {
    transition: transform 0.2s ease;
}

html.sidebar-collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* ------------------------------------------------------------ media in form */
.media-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 2px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.media-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fcfcfd;
    overflow: hidden;
}

.media-card-pending {
    border-style: dashed;
}

.media-frame {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    background: #f2f4f7;
    overflow: hidden;
}

.media-frame img,
.media-frame video,
.media-frame a {
    display: block;
    width: 100%;
    height: 100%;
}

.media-frame img {
    object-fit: cover;
}

.media-frame video {
    object-fit: contain;
    background: #000;
}

.media-meta {
    padding: 6px 8px 7px;
    font-size: 11.5px;
    line-height: 1.35;
}

.media-name {
    overflow-wrap: anywhere;
    font-weight: 600;
    color: #344054;
}

.media-size {
    margin-top: 2px;
    color: var(--muted-2);
}

.media-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.18);
}

.media-upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.media-upload-row input[type="file"] {
    flex: 1 1 220px;
    min-width: 0;
    padding: 7px 9px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #fff;
    color: #475467;
    font-size: 12px;
}

.media-placeholder {
    grid-column: 1 / -1;
}

.media-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 7px;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: #475467;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.media-count svg {
    width: 13px;
    height: 13px;
}

.media-count:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.media-viewer-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.media-download {
    display: inline-block;
    margin-top: 4px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
}

.media-download:hover {
    text-decoration: underline;
}

/* ------------------------------------------------------ equipment web report */
.report-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.report-summary {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f9fafb;
    color: #475467;
    font-size: 12px;
    line-height: 1.45;
}

.report-table-wrap {
    max-height: 46vh;
}

.report-table {
    min-width: 760px;
}

.report-col-date {
    width: 92px;
}

.report-col-system {
    width: 82px;
}

.report-col-qty {
    width: 82px;
    text-align: right;
}

.report-col-unit {
    width: 62px;
}

.report-qty {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.report-source {
    max-width: 330px;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
}

.report-text-row td {
    background: #fffaeb;
}

.report-totals h3 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
}

.report-totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
}

.report-total-card {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fcfcfd;
}

.report-total-name {
    overflow-wrap: anywhere;
    color: #344054;
    font-size: 12px;
    font-weight: 600;
}

.report-total-value {
    margin-top: 3px;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.report-total-meta {
    margin-top: 2px;
    color: var(--muted-2);
    font-size: 10.5px;
}

@media (max-width: 520px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    .report-toolbar .btn {
        flex: 1 1 auto;
    }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    body * {
        visibility: hidden;
    }

    #equipmentReportDialog,
    #equipmentReportDialog * {
        visibility: visible;
    }

    #equipmentReportDialog {
        position: absolute;
        inset: 0;
        width: 100%;
        max-width: none;
        max-height: none;
        margin: 0;
    }

    #equipmentReportDialog .modal-card {
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }

    #equipmentReportDialog .report-toolbar,
    #equipmentReportDialog .modal-close {
        display: none;
    }

    #equipmentReportDialog .modal-body {
        overflow: visible;
    }

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

    .report-table {
        min-width: 0;
    }

    .report-table thead th {
        position: static;
    }
}
