:root {
    --bg: #f3f6fb;
    --panel: #ffffff;
    --line: #d9e2ef;
    --line-strong: #c7d4e5;
    --text: #172b42;
    --muted: #5e718a;
    --accent: #2f6fed;
    --accent-dark: #1d4db8;
    --danger: #d9475d;
    --success: #2da168;
    --warning: #f0a229;
    --shadow-sm: 0 3px 10px rgba(16, 35, 63, 0.06);
    --shadow-md: 0 10px 30px rgba(19, 44, 79, 0.1);
}

* {
    box-sizing: border-box;
}

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

a,
button,
input,
select,
textarea,
summary {
    transition: 0.2s ease;
}

h1,
h2,
h3 {
    margin-top: 0;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 12% 15%, rgba(47, 111, 237, 0.12) 0, rgba(47, 111, 237, 0) 40%),
        radial-gradient(circle at 85% 88%, rgba(45, 161, 104, 0.1) 0, rgba(45, 161, 104, 0) 35%),
        linear-gradient(160deg, #edf3fc 0%, #f8fbff 55%, #eaf1fb 100%);
}

.auth-card {
    width: min(440px, calc(100vw - 32px));
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.auth-card h1 {
    font-size: 25px;
    margin: 0 0 14px;
    color: #1e3f86;
    line-height: 1.35;
}

.auth-card h2 {
    margin: 0 0 14px;
    font-size: 19px;
    color: var(--muted);
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-form input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.filter-row input[type="text"],
.filter-row input[type="date"],
.filter-row select,
.inline-form input {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

.auth-form input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.filter-row input[type="text"]:focus,
.filter-row input[type="date"]:focus,
.filter-row select:focus,
.inline-form input:focus {
    border-color: #9ab8f7;
    box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
    outline: none;
}

.auth-form button,
.btn-primary,
.btn-outline,
.btn-success,
.btn-warning,
.btn-danger,
.portal-logout {
    border: 0;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.auth-form button,
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 5px 14px rgba(47, 111, 237, 0.28);
}

.auth-form button:hover,
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 18px rgba(47, 111, 237, 0.3);
}

.btn-outline {
    background: #f6f9fe;
    border: 1px solid var(--line);
    color: var(--text);
    text-decoration: none;
    display: inline-block;
}

.btn-outline:hover {
    border-color: #aec2de;
    background: #edf3fc;
}

.btn-success {
    background: linear-gradient(135deg, #30a96b, #2b8f5b);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, #ffbe50, #f09f1b);
    color: #222;
}

.btn-danger {
    background: linear-gradient(135deg, #ea5b70, #ce4055);
    color: #fff;
}

.auth-error {
    color: #b31e3f;
    font-size: 13px;
    text-align: left;
}

.auth-hint {
    margin-top: 14px;
    font-size: 12px;
    color: var(--muted);
}

.portal-body {
    min-height: 100vh;
}

.portal-shell {
    display: grid;
    grid-template-columns: 268px 1fr;
    min-height: 100vh;
}

.portal-sidebar {
    background: linear-gradient(180deg, #1f5ecc, #1848a2);
    color: #fff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 6px 0 16px rgba(15, 37, 77, 0.15);
    z-index: 20;
    min-height: 0;
}

.portal-logo {
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 700;
    letter-spacing: 0.1px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.portal-menu {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 10px;
    gap: 4px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.portal-menu-link {
    color: #e7efff;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 500;
    line-height: 1.35;
    border: 1px solid transparent;
}

.portal-menu-link:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
}

.portal-menu-link.is-active {
    background: #fff;
    color: #143979;
    border-color: #dbe6fa;
    box-shadow: 0 4px 12px rgba(12, 39, 86, 0.15);
    font-weight: 700;
}

.portal-side-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.portal-ppe {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
}

.portal-region {
    font-size: 13px;
    margin-bottom: 14px;
    color: #e4ecff;
}

.portal-logout {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.portal-logout:hover {
    background: rgba(255, 255, 255, 0.18);
}

.portal-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.portal-topbar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid #dde6f3;
    padding: 14px 20px;
    backdrop-filter: blur(6px);
}

.portal-menu-toggle {
    display: none;
    border: 1px solid var(--line);
    background: #fff;
    color: #1b3f84;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.portal-sidebar-collapse-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cfdcf2;
    background: #fff;
    color: #1b3f84;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.portal-sidebar-collapse-toggle:hover {
    background: #f2f7ff;
    border-color: #bad0ef;
}

.portal-top-info {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-right: auto;
}

.portal-top-info span {
    font-size: 13px;
    color: #27415f;
    background: #eef3fc;
    border: 1px solid #dbe5f4;
    border-radius: 999px;
    padding: 6px 10px;
}

.portal-exam-date-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.portal-exam-date-form select {
    border: 1px solid #c6d5ec;
    border-radius: 999px;
    background: #f7faff;
    color: #1b2f4b;
    min-height: 32px;
    padding: 4px 10px;
    font: inherit;
}

.portal-clock {
    background: #1e2a3c;
    color: #fff;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 10px;
    min-width: 132px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    font-size: 13px;
}

.portal-content {
    padding: 20px;
}

@media (min-width: 981px) {
    .portal-shell {
        display: block;
    }

    .portal-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 268px;
        height: 100vh;
        max-height: 100vh;
        overflow: hidden;
        transition: width 0.22s ease, opacity 0.22s ease;
    }

    .portal-side-footer {
        margin-top: 0;
    }

    .portal-main {
        margin-left: 268px;
        transition: margin-left 0.22s ease;
    }

    .portal-shell.is-sidebar-collapsed .portal-main {
        margin-left: 0;
    }

    .portal-shell.is-sidebar-collapsed .portal-sidebar {
        width: 0;
        min-width: 0;
        overflow: hidden;
        opacity: 0;
        border-right: 0;
        box-shadow: none;
        pointer-events: none;
    }
}

.page-title {
    margin: 0 0 16px;
    font-size: clamp(24px, 2.5vw, 30px);
    font-weight: 800;
    letter-spacing: -0.2px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.tab {
    border: 1px solid #d8e3f3;
    background: #f7faff;
    padding: 8px 13px;
    border-radius: 10px;
    color: #2a486b;
    font-weight: 600;
    cursor: pointer;
}

.tab:hover {
    background: #edf4ff;
}

.tab.is-active {
    background: #fff;
    border-color: #aac2ec;
    color: #194796;
    box-shadow: inset 0 -2px 0 #2f6fed;
}

.card {
    background: var(--panel);
    border: 1px solid #dce6f4;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}

.card h3 {
    margin-bottom: 12px;
}

.success-box,
.error-box {
    border-left-width: 4px;
    border-left-style: solid;
}

.success-box {
    border-left-color: var(--success);
    background: #f1fbf5;
}

.error-box {
    border-left-color: var(--danger);
    color: #8f1730;
    background: #fff3f6;
}

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

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

.metric-card {
    min-height: 128px;
    background: linear-gradient(160deg, #ffffff, #f4f8ff);
    border: 1px solid #d9e4f5;
}

.metric-title {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.metric-value {
    font-size: clamp(28px, 2.6vw, 34px);
    font-weight: 800;
    color: #173d78;
    line-height: 1.1;
}

.metric-hint {
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}

.progress {
    width: 100%;
    height: 12px;
    background: #e4ecf8;
    border-radius: 999px;
    overflow: hidden;
    margin: 12px 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2f6fed, #5f8dff);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    overflow: hidden;
    border: 1px solid #dbe5f3;
    border-radius: 12px;
}

.table th {
    position: sticky;
    top: 0;
    background: #255e9d;
    color: #fff;
    text-align: left;
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5edf8;
    color: #24394f;
    white-space: nowrap;
}

/* Журнал действий: горизонтальный скролл при необходимости, без наложения колонок */
.table-wrap--audit {
    overflow-x: auto;
    margin-top: 8px;
    margin-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.table-wrap--audit .table {
    overflow: visible;
}

/* Колонка «Событие»: ширина и перенос (перебивает white-space: nowrap у .table td) */
.table--activity-log {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
}

/* Колонка «Роль»: перенос длинных названий, без налезания на «Дата экзамена» */
.table--activity-log th:nth-child(3),
.table--activity-log td:nth-child(3) {
    width: 10%;
    max-width: 7.5rem;
    min-width: 0;
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: break-word;
    vertical-align: top;
    line-height: 1.3;
}

.table--activity-log .table-cell--message {
    width: 22%;
    max-width: 13rem;
    min-width: 0;
    overflow-wrap: anywhere;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal !important;
    vertical-align: top;
    hyphens: auto;
}

.table--activity-log th.table-cell--message {
    white-space: normal !important;
    line-height: 1.35;
}

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

.table tr:hover td {
    background: #f2f7ff;
}

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

.form-grid label {
    grid-column: span 2;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.form-grid textarea {
    grid-column: span 2;
    min-height: 92px;
    resize: vertical;
}

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

.users-grid .checkbox-inline {
    min-height: 38px;
    align-self: center;
}

.users-grid .actions {
    grid-column: span 2;
    margin-top: 4px;
}

details {
    margin-top: 10px;
}

details summary {
    cursor: pointer;
    color: #1f4f9e;
    font-weight: 700;
}

details[open] summary {
    margin-bottom: 8px;
}

.user-actions-cell {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.user-actions-cell form,
.user-actions-cell details {
    margin: 0;
}

.user-actions-cell details .form-grid {
    margin-top: 8px;
}

.user-action-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid #d2def0;
    background: #f7faff;
    color: #1f4f9e;
    cursor: pointer;
    padding: 0;
}

.user-action-icon-btn:hover {
    background: #edf4ff;
    border-color: #bdd0ea;
}

.user-action-icon-btn--danger {
    color: #b12d4b;
    background: #fff1f4;
    border-color: #efc7d1;
}

.user-action-icon-btn--danger:hover {
    background: #ffe8ed;
    border-color: #e9b3c1;
}

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

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

.status-transfer-note {
    background: #e6f5ff;
    border-color: #c5e6fb;
    color: #35506d;
    font-weight: 600;
}

.status-table-head {
    display: flex;
    justify-content: flex-start;
    margin: 6px 0 12px;
}

.status-table-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f6ff;
    border: 1px solid #d5e2f6;
    border-radius: 8px;
    padding: 6px 10px;
    color: #1f3654;
    line-height: 1.2;
}

.status-table-meta-label {
    font-weight: 700;
}

.status-table-meta-value {
    font-weight: 700;
    color: #18448f;
}

.table-wrap {
    overflow-x: auto;
}

.admin-monitoring-table th[data-sort-key] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.admin-monitoring-table th[data-sort-key]::after {
    content: "  ";
}

.admin-monitoring-table th[data-sort-key].is-asc::after {
    content: " ▲";
}

.admin-monitoring-table th[data-sort-key].is-desc::after {
    content: " ▼";
}

.admin-monitoring-table__filters input {
    width: 100%;
    min-width: 110px;
    border: 1px solid #d5deed;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    background: #fff;
    color: #1b2f4b;
}

.status-transfer-table th,
.status-transfer-table td {
    white-space: nowrap;
}

.status-transfer-table td:first-child {
    white-space: normal;
    min-width: 280px;
}

.status-transfer-action-cell {
    text-align: right;
}

.status-transfer-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.status-transfer-actions.has-secondary {
    display: grid;
    justify-items: end;
    gap: 6px;
}

.status-transfer-action-cell form {
    margin: 0;
}

.status-transfer-action {
    min-width: 148px;
}

.status-transfer-action.is-blocked {
    opacity: 0.7;
}

.status-transfer-table .text-center {
    text-align: center;
}

.status-transfer-row-ok td {
    background: #eef8f0 !important;
}

.status-transfer-row-out td {
    background: #fdf1f1 !important;
}

.status-card {
    background: #fff;
    border: 1px solid #dce7f5;
    border-radius: 12px;
    padding: 14px;
}

.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.actions form {
    margin: 0;
}

.actions.compact {
    gap: 6px;
}

.mt-12 {
    margin-top: 12px;
}

.is-hidden {
    display: none;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filter-row input[type="text"],
.filter-row input[type="date"],
.filter-row select {
    min-width: 220px;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #294661;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form input:not([type="file"]):not([type="checkbox"]):not([type="radio"]) {
    width: 140px;
}

.inline-form input[type="file"] {
    width: auto;
    min-width: 200px;
    max-width: 100%;
}

.file-input {
    width: auto;
    max-width: 360px;
    border: 1px solid #d3e1f4;
    background: #fff;
    border-radius: 10px;
    padding: 4px 6px;
    color: #27415f;
}

.file-input::file-selector-button {
    border: 1px solid #c6d5ec;
    border-radius: 8px;
    background: #f7faff;
    color: #1b2f4b;
    padding: 7px 10px;
    margin-right: 10px;
    cursor: pointer;
    font: inherit;
}

.file-input:hover::file-selector-button {
    background: #edf4ff;
}

.speed-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.speed-field .btn-outline {
    white-space: nowrap;
    padding: 10px 12px;
}

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

.knowledge-item {
    border: 1px solid #d9e4f5;
    border-radius: 10px;
    padding: 12px;
    background: #fbfdff;
}

.knowledge-item h4 {
    margin: 0 0 8px;
    color: #163c79;
}

.knowledge-item p {
    margin: 0;
    color: #294661;
    line-height: 1.45;
}

.knowledge-item--accordion {
    padding: 10px 12px;
}

.knowledge-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.knowledge-item-head h4 {
    margin: 0;
}

.knowledge-toggle {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #d0def2;
    background: #f5f9ff;
    color: #1f4f9e;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.knowledge-toggle:hover {
    background: #edf4ff;
}

.knowledge-toggle-icon {
    font-size: 12px;
    line-height: 1;
}

.knowledge-item-body {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #dfe8f6;
}

.knowledge-admin-form .card-grid {
    margin-bottom: 10px;
}

.knowledge-admin-form input[type="text"],
.knowledge-admin-form input[type="number"] {
    min-height: 40px;
    border: 1px solid #cfdcf2;
    border-radius: 10px;
    background: #f9fbff;
    color: #1f3654;
    padding: 9px 12px;
    box-sizing: border-box;
}

.knowledge-admin-form textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid #cfdcf2;
    border-radius: 10px;
    background: #f9fbff;
    color: #1f3654;
    padding: 10px 12px;
    box-sizing: border-box;
    resize: vertical;
}

.knowledge-admin-form input[type="text"]:focus,
.knowledge-admin-form input[type="number"]:focus,
.knowledge-admin-form textarea:focus {
    outline: none;
    border-color: #2f6fed;
    box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
    background: #fff;
}

.knowledge-admin-actions {
    margin-top: 10px;
}

.knowledge-admin-item {
    background: #fff;
    border-color: #d7e4f6;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row a {
    color: #1f4f9e;
    text-decoration: none;
    font-weight: 600;
}

.incident-chat {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.incident-chat-message {
    border: 1px solid #d7e4f6;
    border-radius: 10px;
    padding: 10px 12px;
}

.incident-chat-message.is-own {
    background: #f4f9ff;
}

.incident-chat-message.is-support {
    background: #eefdf3;
}

.incident-chat-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: #3e5b79;
    margin-bottom: 6px;
}

.incident-chat-text {
    white-space: pre-wrap;
    color: #213a58;
}

.incident-chat-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.incident-chat-images a {
    display: block;
    width: 120px;
    height: 90px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #d7e4f6;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.incident-chat-images a:hover {
    opacity: 0.85;
}

.incident-chat-images img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.incident-file-upload {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.incident-file-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid #cdddf3;
    border-radius: 8px;
    background: #f4f9ff;
    color: #2f6fed;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.incident-file-btn:hover {
    background: #e4f0ff;
    border-color: #2f6fed;
}

.incident-file-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.incident-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.incident-file-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #d7e4f6;
    flex-shrink: 0;
}

.incident-file-preview-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.incident-file-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: background 0.15s;
}

.incident-file-preview-remove:hover {
    background: rgba(200,30,30,0.8);
}

.incident-chat-form textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid #cdddf3;
    border-radius: 10px;
    background: #fbfdff;
    padding: 12px;
    color: #1f3654;
    resize: vertical;
    box-sizing: border-box;
}

.incident-chat-form textarea:focus {
    outline: none;
    border-color: #2f6fed;
    box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.incident-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.incident-status-badge.is-open {
    background: #e9f8ef;
    color: #1f7a44;
    border-color: #bce7cc;
}

.incident-status-badge.is-closed-ppe {
    background: #fff6e8;
    color: #9a5d00;
    border-color: #f2d5a7;
}

.incident-status-badge.is-closed-rcoi {
    background: #ffeef1;
    color: #b12d4b;
    border-color: #f3bcc8;
}

.incident-status-badge.is-default {
    background: #f3f6fb;
    color: #3d5877;
    border-color: #d7e2f0;
}

.docs-upload-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    background: #f8fbff;
    border: 1px solid #dce6f4;
    border-radius: 12px;
}

.docs-upload-toolbar .docs-upload-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.docs-upload-toolbar__delete {
    margin-left: auto;
    flex-shrink: 0;
}

.docs-upload-toolbar__delete .btn-danger {
    white-space: nowrap;
}

.docs-upload-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.docs-upload-form input[type="text"],
.docs-upload-form input[type="date"],
.docs-upload-form select {
    min-width: 170px;
    border: 1px solid #c7d4e5;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.docs-upload-form input[type="text"]:focus,
.docs-upload-form input[type="date"]:focus,
.docs-upload-form select:focus {
    outline: none;
    border-color: #2f6fed;
    box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
}

.docs-upload-form input[type="text"]::placeholder,
.docs-upload-form input[type="text"]::-webkit-input-placeholder {
    color: var(--muted);
}

.docs-upload-form select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235e718a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.docs-upload-form .file-input {
    width: auto;
    min-width: 260px;
    max-width: min(400px, 100%);
    flex: 1 1 240px;
    border: 1px solid #c7d4e5;
    border-radius: 10px;
    padding: 6px 10px;
    background: #fff;
    font-size: 14px;
    box-sizing: border-box;
}

.docs-upload-form .file-input::file-selector-button {
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

.docs-upload-form .btn-primary {
    flex-shrink: 0;
}

.transfer-qty-form input[type="number"] {
    width: 90px;
    min-height: 34px;
}

.transfer-info-card {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.transfer-info-card p {
    margin: 0;
    color: #1f3654;
    line-height: 1.4;
}

.transfer-info-card p:nth-child(2) {
    padding-top: 8px;
    border-top: 1px solid #d9e4f5;
    font-weight: 700;
}

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

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

    .portal-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 268px;
        height: 100vh;
        max-height: 100vh;
        overflow: hidden;
        transition: left 0.25s ease;
    }

    .portal-side-footer {
        margin-top: 0;
    }

    .portal-sidebar.is-open {
        left: 0;
    }

    .portal-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .portal-sidebar-collapse-toggle {
        display: none;
    }

    .portal-topbar {
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .portal-top-info span {
        font-size: 12px;
        padding: 5px 8px;
    }

    .card-grid,
    .metric-grid,
    .form-grid,
    .users-grid {
        grid-template-columns: 1fr;
    }

    .form-grid label,
    .form-grid textarea,
    .users-grid .actions {
        grid-column: span 1;
    }
}

@media (max-width: 640px) {
    .portal-content {
        padding: 14px;
    }

    .card {
        padding: 12px;
        border-radius: 12px;
    }

    .table {
        font-size: 13px;
        display: block;
        overflow-x: auto;
        max-width: 100%;
    }
}

/* Pagination styling for Laravel default tailwind templates. */
nav[role="navigation"] {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

/* Hide duplicate compact block rendered for mobile in tailwind template. */
nav[role="navigation"] > div:first-child {
    display: none;
}

nav[role="navigation"] > div:last-child {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

nav[role="navigation"] p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

nav[role="navigation"] [class*="inline-flex"][class*="shadow-sm"] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: none !important;
}

nav[role="navigation"] [aria-current="page"] > span,
nav[role="navigation"] a[rel="prev"],
nav[role="navigation"] a[rel="next"],
nav[role="navigation"] [aria-label="pagination.previous"] > span,
nav[role="navigation"] [aria-label="pagination.next"] > span,
nav[role="navigation"] a[href*="page="] {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 1px solid #c7d4e5;
    background: #fff;
    color: #1b2f4b;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1;
    padding: 0 10px;
}

nav[role="navigation"] [aria-current="page"] > span {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-color: #1e56bd;
    color: #fff;
}

nav[role="navigation"] a[href*="page="]:hover,
nav[role="navigation"] a[rel="prev"]:hover,
nav[role="navigation"] a[rel="next"]:hover {
    border-color: #9fb5d6;
    background: #f4f8ff;
}

nav[role="navigation"] .pagination svg,
nav[role="navigation"] svg.w-5.h-5 {
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
}
