:root {
    --bg: #f4f7fb;
    --bg-accent: #e9eef6;
    --panel: rgba(255, 255, 255, 0.96);
    --text: #171b22;
    --muted: #67707d;
    --line: rgba(93, 105, 122, 0.22);
    --brand: #aa3f24;
    --brand-soft: #ffe7c3;
    --ok: #3d9b63;
    --shadow: 0 14px 34px rgba(38, 50, 67, 0.12);
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --tab-line: #d9a26b;
    --active-tab: #fff0bf;
    --green-action: #9ddcae;
    --green-action-strong: #71c58d;
}

* {
    box-sizing: border-box;
}

body.role-user:not(.page-mpg) .sheet-head-form,
body.role-user:not(.page-mpg) .sheet-head-actions {
    display: none !important;
}

body {
    margin: 0;
    color: var(--text);
    font: 16px/1.6 "Segoe UI", Tahoma, sans-serif;
    background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 44%, #f7f9fc 100%);
}

.layout {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 16px 18px 32px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.topbar-secure {
    align-items: flex-start;
}

.topbar-title {
    font-size: clamp(24px, 3vw, 38px);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nav a {
    text-decoration: none;
    color: var(--text);
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.import-progress-panel {
    border-color: rgba(15, 76, 117, 0.2);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 248, 255, 0.9));
}

.import-jobs {
    display: grid;
    gap: 12px;
}

.import-job {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.import-job-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.import-job-title {
    color: #0b3f66;
}

.import-job-state {
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
}

.import-progress-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7edf5;
    border: 1px solid rgba(11, 63, 102, 0.12);
}

.import-progress-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6dc58d, #0b75b7);
    transition: width 0.35s ease;
}

.import-job-stage {
    margin: 0;
    color: var(--muted);
}

.import-job-done .import-progress-fill {
    background: linear-gradient(90deg, #54ad72, #7ed89b);
}

.import-job-failed {
    border-color: rgba(170, 63, 36, 0.35);
    background: #fff7f5;
}

.import-job-failed .import-progress-fill {
    background: linear-gradient(90deg, #aa3f24, #d66b4a);
}

.sheet-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    overflow-x: auto;
    margin: 0 0 16px;
    border: 1px solid #6d7278;
    background: #676d73;
}

.sheet-tab {
    flex: 0 0 auto;
    padding: 8px 14px;
    border-right: 1px solid #8b9095;
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.1;
    background: #676d73;
}

.sheet-tab:hover {
    background: #5f666d;
}

.sheet-tab-active {
    background: #cfe7a5;
    color: #204326;
    font-weight: 700;
}

.sheet-tab-disabled {
    color: rgba(255, 255, 255, 0.78);
    cursor: default;
}

.secure-userbar {
    display: grid;
    gap: 10px;
    justify-items: end;
}

.secure-usercard {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    text-align: right;
}

.secure-usercard span {
    color: var(--muted);
    font-size: 13px;
}

.hero,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.auth-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-panel {
    width: min(1080px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
    gap: 24px;
    align-items: stretch;
}

.auth-copy,
.auth-form {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.auth-copy {
    padding: 34px;
}

.auth-form {
    display: grid;
    gap: 14px;
    padding: 28px;
}

.auth-panel-refined {
    gap: 28px;
}

.auth-panel-clean {
    width: min(360px, 100%);
    display: block;
}

.auth-form-clean {
    width: 100%;
    padding: 24px;
    gap: 16px;
}

.auth-copy-refined {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(156, 61, 30, 0.12), transparent 32%),
        linear-gradient(180deg, rgba(255, 252, 246, 0.96) 0%, rgba(247, 239, 224, 0.88) 100%);
}

.auth-copy-refined::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(156, 61, 30, 0.14) 0%, rgba(156, 61, 30, 0) 68%);
}

.auth-copy-refined > * {
    position: relative;
    z-index: 1;
}

.auth-lead {
    max-width: 620px;
}

.auth-feature-list {
    display: grid;
    gap: 12px;
    margin-top: 26px;
}

.auth-feature-card {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid rgba(30, 36, 48, 0.1);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
}

.auth-feature-card span {
    color: var(--muted);
    font-size: 14px;
}

.auth-form label,
.admin-user-form label,
.admin-inline-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--muted);
}

.auth-form input,
.admin-user-form input,
.admin-user-form select,
.admin-inline-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

.auth-note {
    margin-top: 20px;
}

.auth-contact-note {
    max-width: 360px;
}

.auth-contact-note p {
    margin: 6px 0 0;
}

.auth-form-refined {
    align-content: center;
    background: rgba(255, 255, 255, 0.96);
}

.auth-form-head {
    display: grid;
    gap: 6px;
    margin-bottom: 6px;
}

.auth-form-head p {
    margin: 0;
    color: var(--muted);
}

.auth-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 4px;
    font-size: 16px;
    font-weight: 700;
}

.admin-user-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    align-items: end;
}

.admin-user-form-span2 {
    grid-column: 1 / -1;
}

.org-structure-select {
    min-height: 260px;
    font-size: 14px;
    line-height: 1.45;
}

.password-change-panel {
    max-width: 720px;
    margin-inline: auto;
}

.password-change-form {
    max-width: 640px;
}

.hero {
    padding: 36px;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto -40px -60px auto;
    width: 260px;
    height: 260px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(156, 61, 30, 0.18), rgba(156, 61, 30, 0));
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--brand);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 13px;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.15;
}

h1 {
    max-width: 900px;
    font-size: clamp(32px, 5vw, 54px);
}

.hero-title {
    font-size: clamp(28px, 4vw, 44px);
}

.lead {
    max-width: 850px;
    color: var(--muted);
    font-size: 18px;
}

.meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.meta-card,
.card,
.note {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.meta-card {
    padding: 16px 18px;
}

.meta-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.panel {
    margin-top: 22px;
    padding: 16px;
}

.panel-heading p {
    margin: 8px 0 0;
    color: var(--muted);
}

.panel-heading-split {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px 18px;
}

.panel-heading-copy {
    display: grid;
    gap: 8px;
    min-width: min(100%, 720px);
    flex: 1 1 620px;
}

.panel-heading-copy h2,
.panel-heading-copy p {
    margin: 0;
}

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

.personnel-team-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 14px;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(46, 79, 91, 0.16);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.card {
    padding: 20px;
}

.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.badge {
    white-space: nowrap;
    border-radius: 999px;
    padding: 6px 10px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 12px;
    font-weight: 700;
}

.split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.stat-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
}

.note {
    padding: 22px;
}

.warning-panel {
    border-color: rgba(156, 61, 30, 0.35);
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-top: 16px;
    margin-bottom: 18px;
}

.filters label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--muted);
}

.filters input,
.filters select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: end;
    min-height: 44px;
    padding: 11px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--brand);
    color: #fff8f4;
    cursor: pointer;
    line-height: 1.15;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    text-align: left;
}

.data-table th {
    position: sticky;
    top: 0;
    background: #f7efe0;
}

.status-chip {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(44, 107, 62, 0.12);
    color: var(--ok);
    font-size: 12px;
    font-weight: 700;
}

.status-ok {
    background: rgba(44, 107, 62, 0.12);
    color: #234d2e;
}

.status-warning {
    background: rgba(163, 111, 20, 0.14);
    color: #7c5310;
}

.status-error {
    background: rgba(156, 61, 30, 0.12);
    color: #7b2f17;
}

.empty-state {
    padding: 20px;
    border: 1px dashed var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.62);
}

.import-note {
    margin-top: 18px;
}

.upload-form {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: end;
    margin-top: 18px;
    margin-bottom: 18px;
}

.import-assignment-form {
    display: grid;
    gap: 14px;
}

.import-file-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

.upload-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: min(100%, 420px);
    color: var(--muted);
}

.upload-box input[type="file"] {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

.alert {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
}

.alert-success {
    background: rgba(44, 107, 62, 0.12);
    color: #234d2e;
    border-color: rgba(44, 107, 62, 0.25);
}

.alert-error {
    background: rgba(156, 61, 30, 0.12);
    color: #7b2f17;
    border-color: rgba(156, 61, 30, 0.25);
}

.supported-files {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.file-chip {
    display: inline-block;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--line);
    font-size: 13px;
}

pre {
    overflow: auto;
    padding: 12px 14px;
    border-radius: 14px;
    background: #251d17;
    color: #f7f1ea;
}

ul {
    margin: 14px 0 0;
    padding-left: 18px;
}

@media (max-width: 720px) {
    .layout {
        padding: 18px 14px 36px;
    }

    .hero,
    .panel {
        padding: 20px;
        border-radius: 18px;
    }

    .lead {
        font-size: 16px;
    }

    .auth-panel {
        grid-template-columns: 1fr;
    }

    .secure-userbar {
        width: 100%;
        justify-items: stretch;
    }

    .secure-usercard {
        text-align: left;
    }
}

.import-toolbar {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.import-scope-field {
    display: grid;
    gap: 8px;
    max-width: 420px;
}

.import-scope-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

.generation-form {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: end;
}

.generation-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--muted);
}

.generation-form select {
    min-width: 180px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

.checkbox-line {
    flex-direction: row !important;
    align-items: center;
    gap: 10px !important;
    min-height: 46px;
}

.inline-form {
    margin: 0;
}

.button-secondary {
    background: #2e4f5b;
}

.button-danger {
    background: #9f3a1f;
}

.button-danger:hover {
    background: #842f19;
}

body.role-admin .filters input,
body.role-admin .filters select,
body.role-admin .generation-form select,
body.role-admin .upload-box input[type="file"],
body.role-admin .import-file-input,
body.role-admin .import-scope-field select,
body.role-user .filters input,
body.role-user .filters select,
body.role-user .generation-form select,
body.role-user .upload-box input[type="file"],
body.role-user .import-file-input,
body.role-user .import-scope-field select {
    min-height: 42px;
    border-color: rgba(130, 141, 156, 0.32);
    border-radius: 9px;
    background: #ffffff;
    box-shadow: inset 0 1px 1px rgba(25, 32, 44, 0.03);
}

body.role-admin .button,
body.role-user .button {
    min-height: 42px;
    border-radius: 9px;
    box-shadow: 0 8px 18px rgba(69, 89, 116, 0.12);
    font-weight: 700;
}

body.role-admin .button-secondary,
body.role-user .button-secondary {
    border: 1px solid rgba(88, 104, 124, 0.24);
    background: #ffffff;
    color: #253142;
}

body.role-admin .button-danger,
body.role-user .button-danger {
    background: linear-gradient(180deg, #b84c2e 0%, #9f3a1f 100%);
    color: #fff8f4;
}

body.role-admin .table-wrap,
body.role-user .table-wrap {
    border-color: rgba(139, 151, 168, 0.28);
    border-radius: 12px;
    background: #ffffff;
}

body.role-admin .data-table th,
body.role-user .data-table th {
    background: #f8fafc;
    color: #202733;
}

body.role-admin .data-table td,
body.role-user .data-table td {
    border-bottom-color: rgba(139, 151, 168, 0.22);
}

.mpg-root-clear-form {
    border-color: rgba(139, 151, 168, 0.28);
    background: transparent;
}

.button-small {
    padding: 8px 12px;
    font-size: 13px;
}

.muted-text {
    color: var(--muted);
    font-size: 13px;
}

.batch-table {
    margin-top: 16px;
    margin-bottom: 18px;
}

.admin-user-list {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.admin-user-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
}

.admin-user-card-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.admin-user-card-top p {
    margin: 8px 0 0;
}

.admin-user-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 16px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 14px;
}

.admin-user-manage-form {
    margin-top: 16px;
}

.admin-user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    margin-top: 14px;
}

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

.admin-password-form label {
    min-width: 240px;
}

.admin-overview-grid,
.admin-action-grid,
.admin-settings-grid,
.admin-edit-layout {
    display: grid;
    gap: 18px;
}

.admin-overview-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 18px;
}

.admin-overview-card,
.admin-action-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.82);
}

.admin-action-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-top: 18px;
}

.admin-action-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.admin-overview-card-link {
    display: block;
    text-decoration: none;
    color: var(--text);
}

.admin-overview-card-link:hover {
    border-color: var(--accent);
    box-shadow: 0 10px 24px rgba(176, 79, 31, 0.12);
}

.admin-action-card strong,
.admin-overview-card strong {
    font-size: 26px;
}

.admin-overview-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.admin-filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 18px;
    margin-bottom: 18px;
}

.admin-filters-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-filters-form input,
.admin-filters-form select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
}

.admin-filters-actions {
    display: flex;
    align-items: end;
    gap: 10px;
}

.admin-users-table__actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 116px;
    white-space: normal;
}

.admin-users-table__actions .inline-form {
    display: flex;
    margin: 0;
}

.admin-users-table__actions .button {
    width: 100%;
    min-height: 38px;
    padding: 9px 14px;
    border-radius: 11px;
}

.admin-users-table__actions .button-danger {
    background: #a94627;
}

.admin-users-table__actions .button-danger:hover {
    background: #87371f;
}

.panel-nested {
    margin: 0;
}

.admin-settings-grid,
.admin-edit-layout {
    margin-top: 18px;
}

.admin-quick-actions {
    display: grid;
    gap: 16px;
}

.admin-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.admin-role-note {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px dashed var(--line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
}

.mpg-cards {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.mpg-card {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
    padding: 18px;
}

.mpg-card-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.mpg-card-top h3 {
    margin-bottom: 6px;
}

.status-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

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

.mpg-grid div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(245, 239, 226, 0.6);
}

.mpg-grid strong {
    font-size: 12px;
    color: var(--muted);
}

.mpg-grid span {
    white-space: pre-wrap;
    word-break: break-word;
}

.mpg-message {
    grid-column: 1 / -1;
}

.layout-wide {
    width: 100%;
    max-width: 100%;
}

.mpg-panel {
    overflow: hidden;
}

.sheet-controls {
    display: grid;
    gap: 16px;
    margin-top: 18px;
    margin-bottom: 10px;
}

.page-mpg .panel {
    padding: 18px 18px 20px;
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(252, 249, 242, 0.94) 100%);
}

.page-mpg .panel-heading {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
}

.page-mpg .panel-heading h2 {
    font-size: clamp(24px, 2.8vw, 34px);
}

.page-mpg .panel-heading p {
    max-width: 980px;
    font-size: 14px;
}

.mpg-controls-modern {
    grid-template-columns: minmax(620px, 1.55fr) minmax(220px, 0.7fr) minmax(520px, 1.25fr);
    gap: 20px;
    align-items: end;
    margin-top: 12px;
    margin-bottom: 18px;
    padding: 4px 0 14px;
    border-bottom: 1px solid rgba(139, 151, 168, 0.18);
}

.mpg-control-card {
    display: grid;
    gap: 12px;
    align-content: end;
    min-height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.mpg-control-card-generate {
    grid-template-columns: minmax(170px, 0.8fr) minmax(150px, 0.65fr) minmax(260px, 1fr) minmax(220px, 0.95fr);
}

.mpg-control-card-period {
    grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 0.8fr);
}

.mpg-control-card-clear {
    grid-template-columns: minmax(190px, 0.9fr) minmax(210px, 1fr) minmax(150px, 0.72fr);
    padding-left: 20px;
    border-left: 1px solid rgba(139, 151, 168, 0.28);
}

.mpg-control-card label {
    display: grid;
    gap: 6px;
    color: #4a5565;
    font-size: 13px;
    font-weight: 600;
}

.mpg-control-card label > span {
    line-height: 1.2;
}

.mpg-control-card select,
.mpg-control-card input[type="text"],
.mpg-control-card input[type="search"] {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid rgba(117, 129, 147, 0.25);
    border-radius: 9px;
    background: #ffffff;
    color: #1d2837;
    font: inherit;
    box-shadow: inset 0 1px 1px rgba(25, 32, 44, 0.03);
}

.mpg-control-card-title {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: #24344a;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
}

.mpg-control-card-generate .mpg-control-card-title {
    grid-column: 4;
    grid-row: 1;
}

.mpg-control-card-period .mpg-control-card-title {
    grid-column: 1 / -1;
}

.mpg-control-card-clear .mpg-control-card-title {
    grid-column: 1 / -1;
}

.mpg-control-card-generate label,
.mpg-control-card-generate .mpg-action-button-generate,
.mpg-control-card-period label,
.mpg-control-card-period .checkbox-line,
.mpg-control-card-period .mpg-action-button-period,
.mpg-control-card-clear label,
.mpg-control-card-clear .checkbox-line,
.mpg-control-card-clear .mpg-action-button-clear {
    align-self: end;
}

.page-mpg .checkbox-line {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    font-size: 13px;
    font-weight: 600;
}

.page-mpg .checkbox-line input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.mpg-action-button {
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(69, 89, 116, 0.14);
}

.mpg-action-button-generate {
    background: linear-gradient(180deg, #97ddb0 0%, #79c897 100%);
    border-color: rgba(62, 135, 90, 0.28);
    color: #173d22;
}

.mpg-action-button-generate:hover {
    background: linear-gradient(180deg, #8bd6a6 0%, #6fbf8f 100%);
}

.mpg-action-button-period {
    background: linear-gradient(180deg, #ffffff 0%, #eef3f8 100%);
    border-color: rgba(102, 119, 142, 0.24);
    color: #24415f;
}

.mpg-action-button-period:hover {
    background: linear-gradient(180deg, #f9fcff 0%, #e8eef5 100%);
}

.mpg-action-button-clear {
    box-shadow: 0 8px 18px rgba(156, 61, 30, 0.16);
}

.mpg-control-card-period,
.mpg-control-card-clear {
    align-content: end;
}

.page-mpg .mpg-sheet-wrap {
    margin-top: 14px;
    border: 1px solid rgba(118, 126, 140, 0.55);
    border-radius: 14px;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.page-mpg .mpg-pagination,
.page-mpg .mpg-save-bar {
    border-radius: 12px;
}

.generation-form-sheet,
.sheet-filters {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
}

.sheet-filters {
    margin-top: 0;
    margin-bottom: 0;
}

.mpg-sheet-wrap {
    overflow: auto;
    margin-top: 12px;
    width: 100%;
    min-height: 620px;
    padding-bottom: 16px;
    border: 1px solid #8e9399;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
}

.ejn-sheet-wrap {
    overflow: auto;
    margin-top: 12px;
    width: 100%;
    min-height: 320px;
    padding-bottom: 16px;
    border: 1px solid #8e9399;
    background: #ffffff;
}

.personnel-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    margin-top: 14px;
    align-items: start;
}

.personnel-sheet-wrap {
    overflow: auto;
    width: 100%;
    border: 1px solid #8e9399;
    background: #ffffff;
}

.personnel-sheet-table th,
.personnel-sheet-table td {
    vertical-align: middle;
}

.personnel-toolbar,
.personnel-add-form {
    margin-bottom: 12px;
}

.page-personnel .panel-heading-copy > p:has(> a[href*="page=personnel-team"]) {
    margin-top: 4px;
}

.page-personnel .panel-heading-copy > p:has(> a[href*="page=personnel-team"]) a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 14px;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(46, 79, 91, 0.16);
}

.personnel-search-field {
    min-width: 260px;
}

.personnel-target-note {
    font-weight: 600;
}

.personnel-search-field input,
.personnel-add-select select {
    min-width: 240px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

.personnel-add-select {
    min-width: min(100%, 520px);
}

.personnel-add-select select[multiple] {
    min-height: 220px;
}

.personnel-hint {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.personnel-team-table td,
.personnel-team-table th {
    vertical-align: middle;
}

.personnel-team-actions {
    width: 170px;
    text-align: right !important;
    white-space: nowrap;
}

.personnel-edit-form {
    display: grid;
    gap: 14px;
}

.personnel-edit-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
}

.personnel-export-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.page-personnel .button,
.page-personnel .button-secondary,
.page-personnel .personnel-action-button,
.page-personnel .personnel-team-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 10px 22px rgba(46, 79, 91, 0.14);
}

.page-personnel .button-secondary,
.page-personnel .personnel-action-button,
.page-personnel .personnel-team-link {
    background: #2f5360;
    color: #f7fafc;
}

.page-personnel .button-secondary:hover,
.page-personnel .personnel-action-button:hover,
.page-personnel .personnel-team-link:hover {
    background: #274752;
}

.page-personnel .personnel-save-button {
    min-width: 190px;
}

.personnel-toolbar .personnel-action-button,
.personnel-add-form .personnel-action-button {
    align-self: end;
}

.personnel-edit-summary {
    display: grid;
    gap: 2px;
}

.personnel-edit-summary span {
    color: var(--muted);
    font-size: 14px;
}

.personnel-name-cell {
    display: grid;
    gap: 4px;
}

.personnel-name-main {
    font-weight: 600;
}

.personnel-name-meta {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
}

.personnel-remove-button {
    justify-self: start;
    min-height: 22px;
    padding: 2px 8px;
    border: 1px solid #b7bcc2;
    background: linear-gradient(180deg, #ffffff 0%, #ececec 100%);
    color: #5a1414;
    font-size: 11px;
    cursor: pointer;
}

.personnel-section-title {
    font-weight: 700;
    text-align: left;
    background: #ffffff;
}

.personnel-section-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
}

.personnel-section-label {
    display: inline-block;
    text-align: center;
}

.personnel-section-badge {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 36px;
    text-align: center;
}

.personnel-secondary-percent {
    vertical-align: middle;
    font-weight: 700;
    background: #ffffff;
}

.personnel-section-empty-row td {
    background: #ffffff;
}

.personnel-empty-row td {
    padding: 14px 12px !important;
    color: var(--muted);
    text-align: center;
    background: #faf7f0;
}

.ep-sheet-wrap {
    overflow: auto;
    margin-top: 12px;
    width: 100%;
    min-height: 360px;
    border: 1px solid #8e9399;
    background: #ffffff;
}

.tmc-order-sheet-wrap {
    overflow: auto;
    margin-top: 12px;
    width: 100%;
    min-height: 360px;
    border: 1px solid #8e9399;
    background: #ffffff;
}

.db-sheet-wrap {
    overflow: auto;
    margin-top: 12px;
    width: 100%;
    min-height: 320px;
    border: 1px solid #8e9399;
    background: #ffffff;
}

.ep-sheet-table {
    font-size: 9px;
    line-height: 1.1;
}

.tmc-order-sheet-table {
    font-size: 10px;
    line-height: 1.12;
}

.db-sheet-table {
    font-size: 10px;
    line-height: 1.12;
}

.ep-sheet-table th,
.ep-sheet-table td {
    min-width: 88px;
    padding: 3px 4px;
    white-space: normal;
}

.tmc-order-sheet-table th,
.tmc-order-sheet-table td {
    min-width: 92px;
    padding: 3px 4px;
    white-space: normal;
}

.db-sheet-table th,
.db-sheet-table td {
    min-width: 92px;
    padding: 3px 4px;
    white-space: normal;
}

.ep-sheet-table th {
    background: #efe47a;
}

.tmc-order-sheet-table th {
    background: #efe47a;
}

.db-sheet-table th {
    background: #efe47a;
}

.ep-sheet-table .ep-key-cell {
    background: #fff16a;
}

.tmc-order-sheet-table .tmc-order-key-cell {
    background: #fff16a;
}

.db-sheet-table .sheet-key-cell {
    background: #fff16a;
}

.personnel-sheet-table th,
.personnel-sheet-table td {
    padding: 0;
    text-align: center;
    vertical-align: middle;
}

.personnel-sheet-table td:first-child,
.personnel-sheet-table td:nth-child(2) {
    padding: 5px 8px;
    text-align: left;
}

.personnel-sheet-edit-table {
    font-size: 11px;
    line-height: 1.1;
}

.personnel-month-title {
    font-size: 16px;
    font-weight: 700;
}

.personnel-day-row th {
    min-height: 0;
    height: 118px;
    vertical-align: bottom;
    padding: 2px 1px;
}

.personnel-day-head span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: inline-block;
    white-space: nowrap;
    font-size: 11px;
}

.personnel-section-row td {
    padding: 5px 8px;
    background: #ffffff;
    font-weight: 700;
    text-align: center !important;
    font-size: 15px;
}

.personnel-weekend {
    background: #fff600 !important;
}

.personnel-cell {
    min-width: 30px;
    height: 28px;
}

.personnel-code-filled {
    background: #dce9f7;
}

.personnel-code-�,
.personnel-code-b {
    background: #dce9f7;
}

.personnel-code-�,
.personnel-code-o {
    background: #fff600;
}

.personnel-code-��� {
    background: #fff600;
}

.personnel-code-�,
.personnel-code-t {
    background: #dce9f7;
}

.personnel-percent {
    font-weight: 700;
}

.personnel-legend .note {
    position: sticky;
    top: 16px;
}

.personnel-legend-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.personnel-cell-input {
    width: 100%;
    min-width: 30px;
    height: 28px;
    border: 0;
    padding: 2px 3px;
    text-align: center;
    font: inherit;
    background: #ffffff;
    color: #1e2430;
    text-transform: uppercase;
}

.personnel-cell-input:focus {
    outline: 2px solid rgba(156, 61, 30, 0.28);
    outline-offset: -2px;
    position: relative;
    z-index: 2;
}

.personnel-cell-weekend {
    background: #fff600;
}

.personnel-cell-blue {
    background: #dce9f7;
}

.personnel-cell-yellow {
    background: #fff600;
}

.personnel-cell-holiday {
    background: #f45f5f;
}

.personnel-cell-shortday {
    background: #9fda64;
}

.personnel-percent {
    padding: 5px 0 !important;
    font-weight: 700;
}

.sheet-filter-form {
    display: block;
}

.mpg-sheet-table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 11px;
    line-height: 1.15;
    background: #fff;
    font-family: "Times New Roman", Georgia, serif;
}

.mpg-sheet-table th,
.mpg-sheet-table td {
    border: 1px solid #8f949a;
    padding: 4px 5px;
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.personnel-sheet-table.mpg-sheet-table th,
.personnel-sheet-table.mpg-sheet-table td,
.personnel-sheet-table .personnel-secondary-percent,
.personnel-sheet-table .personnel-percent {
    vertical-align: middle !important;
}

.personnel-sheet-table .sheet-head-title {
    min-height: 40px;
    align-items: center;
}

.mpg-sheet-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    overflow: visible;
    padding: 4px 4px;
    text-align: center;
    font-weight: 700;
    background: #d3d3d3;
    min-height: 78px;
}

.sheet-header-row th {
    top: 0;
    z-index: 4;
}

.sheet-filter-row th {
    top: 78px;
    z-index: 3;
    min-height: auto;
    padding: 2px 4px;
    background: #ececec;
    text-align: right;
}

.ejn-sheet-table .sheet-filter-row th,
.ep-sheet-table .sheet-filter-row th,
.tmc-order-sheet-table .sheet-filter-row th,
.db-sheet-table .sheet-filter-row th {
    top: 34px;
}

.mpg-sheet-table tbody tr:nth-child(even) {
    background: #fff;
}

.mpg-sheet-table tbody tr:hover {
    background: #f5f8fb;
}

.mpg-save-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.mpg-save-bar-bottom {
    margin-top: 12px;
    margin-bottom: 0;
    justify-content: flex-end;
}

.mpg-save-bar-text {
    font-size: 13px;
    color: #4c5560;
}

.mpg-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    margin-bottom: 10px;
    border: 1px solid #d5dbe3;
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
}

.mpg-pagination-bottom {
    margin-top: 10px;
    margin-bottom: 0;
}

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

.mpg-edit-input,
.mpg-edit-select,
.mpg-edit-area {
    width: 100%;
    border: 1px solid rgba(86, 96, 112, 0.45);
    background: rgba(255, 255, 255, 0.78);
    color: #172130;
    font: inherit;
    font-size: 11px;
    line-height: 1.2;
    box-sizing: border-box;
}

.mpg-edit-input,
.mpg-edit-select {
    min-height: 28px;
    padding: 4px 6px;
}

.mpg-edit-area {
    min-height: 58px;
    padding: 5px 6px;
    resize: vertical;
    white-space: pre-wrap;
}

.mpg-edit-area-note {
    min-height: 44px;
}

.mpg-edit-input::placeholder,
.mpg-edit-area::placeholder {
    color: #677385;
}

.mpg-readonly-value {
    display: flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    text-align: center;
    font-size: 11px;
    line-height: 1.2;
}

.mpg-hidden-textarea {
    display: none;
}

.mpg-personnel-cell {
    display: grid;
    gap: 6px;
}

.mpg-picker-multi-cell .sheet-mini-button {
    justify-self: stretch;
    min-height: 28px;
    padding: 4px 6px;
    line-height: 1.1;
}

.page-mpg .mpg-picker-multi-cell {
    gap: 4px;
}

.page-mpg .mpg-picker-multi-cell .mpg-personnel-preview {
    display: grid;
    gap: 3px;
    min-height: 0;
}

.page-mpg .mpg-picker-multi-cell .mpg-personnel-chip {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
    border-radius: 7px;
    padding: 3px 5px;
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fb 100%);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.page-mpg .mpg-picker-multi-cell .mpg-personnel-placeholder {
    display: block;
    text-align: center;
    font-size: 10px;
}

.mpg-picker-cell {
    display: grid;
    gap: 5px;
}

.mpg-picker-cell .sheet-mini-button {
    display: none;
}

.mpg-picker-cell .mpg-edit-input {
    cursor: pointer;
}

.mpg-personnel-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: flex-start;
    min-height: 28px;
}

.mpg-personnel-placeholder {
    color: #677385;
    font-size: 11px;
}

.mpg-personnel-chip {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border: 1px solid rgba(86, 96, 112, 0.35);
    background: rgba(255, 255, 255, 0.82);
    border-radius: 999px;
    font-size: 11px;
    line-height: 1.2;
}

.mpg-personnel-dialog {
    width: min(760px, calc(100vw - 40px));
    max-height: min(80vh, 760px);
    border: 1px solid rgba(30, 36, 48, 0.18);
    border-radius: 18px;
    padding: 18px;
    background: #fffdf8;
    box-shadow: 0 24px 80px rgba(30, 36, 48, 0.28);
}

.mpg-personnel-dialog::backdrop {
    background: rgba(23, 33, 48, 0.35);
}

.mpg-personnel-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.mpg-personnel-search {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 13px;
}

.mpg-personnel-search input {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid rgba(86, 96, 112, 0.35);
    border-radius: 10px;
    font: inherit;
}

.mpg-personnel-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(150px, 0.55fr);
    gap: 12px;
    margin-bottom: 12px;
}

.mpg-personnel-filter {
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.mpg-personnel-filter select {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid rgba(86, 96, 112, 0.35);
    border-radius: 10px;
    font: inherit;
    background: #fff;
}

.mpg-personnel-remember-filter {
    align-content: end;
}

.mpg-personnel-remember-filter input {
    width: 18px;
    height: 18px;
}

.mpg-personnel-dialog-list {
    display: grid;
    gap: 6px;
    overflow: auto;
    max-height: min(50vh, 460px);
    padding-right: 4px;
}

.mpg-personnel-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 8px 10px;
    border: 1px solid rgba(86, 96, 112, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.82);
}

.mpg-personnel-option input {
    margin-top: 2px;
}

.mpg-personnel-option-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.mpg-personnel-option-text strong,
.mpg-personnel-option-text small {
    overflow-wrap: anywhere;
}

.mpg-personnel-option-text small {
    color: #5f6773;
    font-size: 12px;
}

.mpg-personnel-empty {
    padding: 18px 8px;
    text-align: center;
    color: #5f6773;
}

.mpg-personnel-dialog-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.mpg-picker-scope-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin: 0 0 12px;
    padding: 7px 12px;
    border: 1px solid rgba(42, 78, 91, 0.32);
    border-radius: 999px;
    background: rgba(232, 243, 239, 0.9);
    color: #254e5c;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.mpg-picker-scope-toggle:hover {
    background: #dbeee8;
}

.mpg-single-picker-list {
    max-height: min(54vh, 520px);
}

.mpg-single-picker-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 9px 11px;
    border: 1px solid rgba(86, 96, 112, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.mpg-single-picker-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.mpg-single-picker-option-selected {
    border-color: rgba(38, 108, 74, 0.55);
    background: #eef9f0;
}

.mpg-single-picker-option:hover {
    border-color: rgba(42, 78, 91, 0.42);
    background: #f5fbf7;
}

.mpg-single-picker-option em {
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(51, 116, 75, 0.12);
    color: #2f7349;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
    white-space: nowrap;
}

.mpg-combo-popover {
    position: fixed;
    z-index: 1200;
    max-height: min(420px, calc(100vh - 20px));
    padding: 10px;
    border: 1px solid rgba(30, 36, 48, 0.22);
    border-radius: 12px;
    background: #fffdf8;
    box-shadow: 0 18px 50px rgba(30, 36, 48, 0.28);
}

.mpg-combo-popover[hidden] {
    display: none;
}

.mpg-combo-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    color: #202532;
    font-size: 13px;
}

.mpg-combo-close {
    width: 26px;
    height: 26px;
    border: 1px solid rgba(86, 96, 112, 0.25);
    border-radius: 8px;
    background: #fff;
    color: #44505f;
    cursor: pointer;
    font: inherit;
    font-size: 18px;
    line-height: 1;
}

.mpg-combo-search {
    width: 100%;
    min-height: 34px;
    margin-bottom: 8px;
    padding: 7px 9px;
    border: 1px solid rgba(86, 96, 112, 0.35);
    border-radius: 9px;
    font: inherit;
    font-size: 13px;
}

.mpg-combo-popover .mpg-picker-scope-toggle {
    width: 100%;
    margin-bottom: 8px;
}

.mpg-combo-list {
    display: grid;
    gap: 5px;
    max-height: 260px;
    overflow: auto;
    padding-right: 3px;
}

.mpg-combo-list .mpg-single-picker-option {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 7px 8px;
    border-radius: 9px;
}

.mpg-combo-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.mpg-autosave-status,
.mpg-autosave-hint {
    font-size: 13px;
    color: #4c5560;
}

.mpg-autosave-status[data-state="saving"] {
    color: #9c3d1e;
}

.mpg-autosave-status[data-state="saved"] {
    color: #2c6b3e;
}

.mpg-autosave-status[data-state="error"] {
    color: #b31111;
}

.mpg-cell-danger {
    background: #f5cfcf !important;
}

.mpg-row-emergency td {
    background-image: linear-gradient(90deg, rgba(178, 57, 28, 0.10), rgba(178, 57, 28, 0.03));
}

.mpg-driver-count-warning {
    background: #fff0b8 !important;
    border-color: #c28a16 !important;
}

.mpg-manual-work-panel {
    margin: 14px 0;
    padding: 12px 14px;
    border: 1px solid rgba(86, 96, 112, 0.22);
    border-radius: 14px;
    background: rgba(255, 253, 248, 0.88);
}

.mpg-manual-work-panel summary {
    cursor: pointer;
    font-weight: 800;
    color: #0a426d;
}

.mpg-manual-work-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 10px 12px;
    margin-top: 12px;
}

.mpg-manual-work-form label {
    display: grid;
    gap: 5px;
    font-size: 12px;
}

.mpg-manual-work-form input,
.mpg-manual-work-form select,
.mpg-manual-work-form textarea {
    width: 100%;
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid rgba(86, 96, 112, 0.28);
    border-radius: 8px;
    font: inherit;
    background: #fff;
}

.mpg-manual-work-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.vehicle-reservation-filters {
    margin-bottom: 14px;
}

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

.vehicle-reservation-conflict td {
    background: #fbe1de;
}

.reservation-warning {
    margin-top: 5px;
    color: #a9371f;
    font-weight: 800;
}

@media (max-width: 980px) {
    .mpg-manual-work-form {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
}

.mpg-cell-gold,
.mpg-cell-neutral {
    background: #efe47a !important;
}

.mpg-cell-tmc-site {
    background: #d7f0d4 !important;
}

.mpg-cell-tmc-res {
    background: #d7e7f8 !important;
}

.mpg-cell-tmc-central {
    background: #f3d6e7 !important;
}

.mpg-cell-tmc-missing {
    background: #f2c7c7 !important;
}

.mpg-tmc-line {
    display: block;
    margin: 0 0 4px;
    padding: 2px 4px;
    border-radius: 3px;
}

.mpg-tmc-line:last-child {
    margin-bottom: 0;
}

.mpg-tmc-line-site {
    background: #d7f0d4;
}

.mpg-tmc-line-res {
    background: #d7e7f8;
}

.mpg-tmc-line-central {
    background: #f3d6e7;
}

.mpg-tmc-line-missing {
    background: #f2c7c7;
}

.sheet-head-title {
    display: flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
}

.sheet-filter-sort-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3px;
    width: 100%;
}

.sheet-sort-toggle {
    width: 17px;
    height: 16px;
    padding: 0;
    border: 0;
    background: #ececec;
    color: #4e5560;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    opacity: 0.82;
}

.sheet-sort-toggle:hover {
    background: #ececec;
    color: #111827;
    opacity: 1;
}

.sheet-sort-toggle.sheet-sort-button-active {
    background: #d9ecff;
    color: #075985;
    box-shadow: inset 0 0 0 1px #38bdf8;
    opacity: 1;
    text-shadow: 0 0 0 #075985;
}

.sheet-head-form,
.sheet-head-actions {
    display: grid;
    gap: 4px;
    justify-items: center;
    margin-top: 4px;
}

.sheet-filter-actions {
    display: grid;
    gap: 3px;
    margin-top: 4px;
    width: 100%;
    box-sizing: border-box;
}

.sheet-filter-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    padding-top: 6px;
    margin-top: 6px;
    border-top: 1px solid #d7d7d7;
}

.sheet-filter-menu {
    position: relative;
    display: inline-block;
}

.sheet-filter-menu[open] {
    z-index: 20;
}

.sheet-filter-summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid #9ca3ad;
    background: linear-gradient(180deg, #ffffff 0%, #eceff3 100%);
    color: #4e5560;
    font-size: 9px;
    line-height: 1;
    cursor: pointer;
    list-style: none;
}

.sheet-filter-summary::-webkit-details-marker {
    display: none;
}

.sheet-filter-summary-active {
    background: linear-gradient(180deg, #fff7d8 0%, #f1d56f 100%);
    border-color: #b7951b;
    color: #634b00;
}

.sheet-filter-popup {
    position: fixed;
    top: calc(100% + 4px);
    right: 0;
    width: min(420px, calc(100vw - 24px));
    max-height: min(560px, calc(100vh - 170px));
    display: flex;
    flex-direction: column;
    padding: 8px 8px 10px;
    border: 1px solid #aeb4bb;
    background: #f4f4f4;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    text-align: left;
    overflow: hidden;
    box-sizing: border-box;
    z-index: 5000;
}

.sheet-filter-popup-title {
    margin-bottom: 6px;
    font-size: 10px;
    font-weight: 700;
}

.sheet-filter-toolbar {
    display: grid;
    gap: 2px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #d7d7d7;
}

.sheet-filter-search {
    width: 100%;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid #b7bcc2;
    background: #ffffff;
    color: #232323;
    font-size: 12px;
}

.sheet-filter-search-wrap {
    margin-bottom: 6px;
}

.sheet-filter-command {
    display: block;
    width: 100%;
    min-height: 24px;
    padding: 4px 6px;
    border: 0;
    background: transparent;
    color: #222222;
    text-align: left;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
}

.sheet-filter-command:hover:not(:disabled) {
    background: #e8edf5;
}

.sheet-filter-command-disabled,
.sheet-filter-command:disabled {
    color: #a0a5ab;
    cursor: default;
}

.sheet-filter-meta {
    color: #5d6168;
    font-size: 10px;
    line-height: 1.2;
    margin-bottom: 6px;
}

.sheet-filter-select-all {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
}

.sheet-filter-select-all input {
    margin: 0;
}

.sheet-filter-popup-scroll {
    flex: 0 1 auto;
    min-height: 64px;
    max-height: min(280px, calc(100vh - 330px));
    margin-bottom: 8px;
    overflow: auto;
    border: 1px solid #cbcbcb;
    background: #ffffff;
}

.sheet-filter-popup-list {
    display: grid;
    gap: 2px;
    flex: 1 1 auto;
    min-height: 120px;
    max-height: min(320px, calc(100vh - 360px));
    overflow: auto;
    padding: 6px;
    border: 1px solid #cbcbcb;
    background: #ffffff;
}

.sheet-filter-popup-scroll .sheet-filter-popup-list {
    min-height: 0;
    max-height: none;
    overflow: visible;
    border: 0;
}

.sheet-filter-option {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 6px;
    align-items: start;
    font-size: 12px;
    font-weight: 400;
}

.sheet-filter-option input {
    margin: 0;
}

.sheet-filter-option span {
    display: block;
    max-width: 100%;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.sheet-filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    min-width: 76px;
    padding: 2px 10px;
    border: 1px solid #8c8c8c;
    background: linear-gradient(180deg, #ffffff 0%, #ececec 100%);
    color: #232323;
    text-decoration: none;
    text-align: center;
    font-size: 12px;
    line-height: 1.1;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
    flex: 0 0 auto;
}

.sheet-filter-button-secondary {
    background: linear-gradient(180deg, #f8f8f8 0%, #e4e4e4 100%);
}

.sheet-filter-popup .sheet-filter-actions {
    flex: 0 0 auto;
    background: #f4f4f4;
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-top: 6px;
}

.sheet-tabs-bar {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid #d4a25f;
    border-bottom: 1px solid #c9d1dc;
    background: #f4f7fb;
}

.sheet-tabs-bar .sheet-tabs {
    flex: 1 1 auto;
    border-top: 0;
    border-bottom: 0;
}

.global-period-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-left: 1px solid #d6dee8;
    color: #123f66;
    font-size: 12px;
    white-space: nowrap;
}

.global-period-form label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.global-period-form select {
    min-height: 30px;
    min-width: 120px;
    padding: 3px 28px 3px 8px;
    border: 1px solid #bdc8d5;
    border-radius: 6px;
    background: #ffffff;
    color: #172130;
}

.global-period-form button {
    min-height: 30px;
    padding: 4px 12px;
    border: 1px solid #b8c5d4;
    border-radius: 6px;
    background: linear-gradient(180deg, #ffffff 0%, #edf3f9 100%);
    color: #123f66;
    font-weight: 700;
    cursor: pointer;
}

.global-period-check input {
    margin: 0;
}

.sheet-filter-row th:first-child .sheet-filter-popup,
.sheet-filter-row th:nth-child(2) .sheet-filter-popup,
.sheet-filter-row th:nth-child(3) .sheet-filter-popup {
    left: 0;
    right: auto;
}

.db-sheet-ejn {
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
    font-size: 8px;
    line-height: 1.05;
}

.db-sheet-ejn th,
.db-sheet-ejn td {
    min-width: 0;
    padding: 2px 3px;
    white-space: normal;
}

.db-sheet-ejn th:nth-child(1),
.db-sheet-ejn td:nth-child(1),
.db-sheet-ejn th:nth-child(3),
.db-sheet-ejn td:nth-child(3),
.db-sheet-ejn th:nth-child(4),
.db-sheet-ejn td:nth-child(4),
.db-sheet-ejn th:nth-child(11),
.db-sheet-ejn td:nth-child(11) {
    width: 7%;
}

.db-sheet-ejn th:nth-child(7),
.db-sheet-ejn td:nth-child(7) {
    width: 12%;
}

.db-sheet-ejn th:nth-child(8),
.db-sheet-ejn td:nth-child(8) {
    width: 7%;
}

.db-sheet-ejn th:nth-child(9),
.db-sheet-ejn td:nth-child(9),
.db-sheet-ejn th:nth-child(13),
.db-sheet-ejn td:nth-child(13) {
    width: 9%;
}

.sheet-mini-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid #8c8c8c;
    background: linear-gradient(180deg, #ffffff 0%, #ececec 100%);
    color: #232323;
    text-decoration: none;
    text-align: center;
    font: inherit;
    font-size: 10px;
    line-height: 1.15;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.sheet-mini-button[disabled] {
    color: #5d6168;
    cursor: not-allowed;
    opacity: 0.9;
}

.sheet-mini-button-static {
    pointer-events: none;
}

.sheet-mini-button-alert {
    color: #b31111;
    font-weight: 700;
}

body.role-admin,
body.role-user {
    background:
        linear-gradient(180deg, #fbfdff 0%, #f1f5fa 48%, #f7f9fc 100%);
}

body.role-admin .layout-wide,
body.role-user .layout-wide {
    padding: 0 22px 24px;
}

body.role-admin .topbar-secure,
body.role-user .topbar-secure {
    position: relative;
    align-items: center;
    min-height: 150px;
    margin: 0 -22px 0;
    padding: 22px 24px 18px;
    border-bottom: 1px solid rgba(139, 151, 168, 0.24);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 249, 253, 0.94) 100%);
    box-shadow: 0 10px 28px rgba(39, 52, 69, 0.08);
}

body.role-admin .topbar-secure::before,
body.role-user .topbar-secure::before {
    content: "MPG";
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 78px;
    height: 78px;
    margin-right: 18px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, transparent 0 18%, rgba(122, 194, 145, 0.95) 18% 34%, transparent 34% 42%, rgba(242, 173, 98, 0.95) 42% 58%, transparent 58% 66%, rgba(122, 194, 145, 0.95) 66% 82%, transparent 82%),
        #ffffff;
    color: #4a4f57;
    font-size: 25px;
    font-weight: 900;
    letter-spacing: 0;
    box-shadow: 0 8px 22px rgba(57, 92, 75, 0.14);
}

body.role-admin .topbar-secure > div:first-child,
body.role-user .topbar-secure > div:first-child {
    flex: 1 1 auto;
    min-width: min(100%, 420px);
}

body.role-admin .eyebrow,
body.role-user .eyebrow {
    margin: 0 0 4px;
    color: #7a818b;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

body.role-admin .topbar-title,
body.role-user .topbar-title {
    max-width: none;
    color: #14171d;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 0;
}

body.role-admin .secure-userbar,
body.role-user .secure-userbar {
    gap: 10px;
    align-self: flex-start;
}

body.role-admin .nav,
body.role-user .nav {
    gap: 10px;
    justify-content: flex-end;
}

body.role-admin .nav a,
body.role-user .nav a {
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid rgba(130, 141, 156, 0.28);
    border-radius: 10px;
    background: #ffffff;
    color: #20242c;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(43, 56, 74, 0.1);
}

body.role-admin .nav a:hover,
body.role-user .nav a:hover {
    background: #f8fafc;
}

body.role-admin .secure-usercard,
body.role-user .secure-usercard {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas:
        "avatar name"
        "avatar meta";
    align-items: center;
    min-width: 260px;
    padding: 11px 14px;
    border: 1px solid rgba(130, 141, 156, 0.28);
    border-radius: 10px;
    background: #ffffff;
    text-align: left;
    box-shadow: 0 10px 24px rgba(43, 56, 74, 0.12);
}

body.role-admin .secure-usercard::before,
body.role-user .secure-usercard::before {
    content: "";
    grid-area: avatar;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 38%, transparent 0 13%, #5ca56d 14% 20%, transparent 21%),
        radial-gradient(circle at 50% 68%, transparent 0 20%, #5ca56d 21% 28%, transparent 29%),
        #d8f0dd;
}

body.role-admin .secure-usercard strong,
body.role-user .secure-usercard strong {
    grid-area: name;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.role-admin .secure-usercard span,
body.role-user .secure-usercard span {
    grid-area: meta;
}

body.role-admin .sheet-tabs,
body.role-user .sheet-tabs {
    position: relative;
    margin: 0 -22px 14px;
    padding: 0 22px;
    border: 0;
    border-bottom: 1px solid rgba(139, 151, 168, 0.24);
    border-radius: 0;
    background: rgba(246, 249, 253, 0.94);
    box-shadow: none;
}

body.role-admin .sheet-tab,
body.role-user .sheet-tab {
    min-height: 44px;
    padding: 11px 18px 10px;
    border: 1px solid rgba(139, 151, 168, 0.32);
    border-top: 3px solid var(--tab-line);
    border-bottom: 0;
    background: #f8fafc;
    color: #1c232d;
    font-size: 15px;
    line-height: 1.2;
}

body.role-admin .sheet-tab + .sheet-tab,
body.role-user .sheet-tab + .sheet-tab {
    margin-left: -1px;
}

body.role-admin .sheet-tab:hover,
body.role-user .sheet-tab:hover {
    background: #ffffff;
}

body.role-admin .sheet-tab-active,
body.role-user .sheet-tab-active {
    position: relative;
    z-index: 1;
    border-color: #d1a441;
    border-top-color: #d8a346;
    background: linear-gradient(180deg, #fff7d9 0%, #ffe9a6 100%);
    color: #1d2127;
    box-shadow: inset 0 0 0 1px rgba(214, 166, 46, 0.35), 0 4px 12px rgba(174, 128, 36, 0.12);
}

body.role-admin .panel,
body.role-user .panel {
    margin-top: 0;
    padding: 18px;
    border: 1px solid rgba(139, 151, 168, 0.28);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 12px 34px rgba(39, 52, 69, 0.1);
}

body.role-admin .panel-heading h2,
body.role-user .panel-heading h2 {
    color: #171b22;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0;
}

body.role-admin .panel-heading p,
body.role-user .panel-heading p {
    color: #69717e;
    font-size: 15px;
}

.page-mpg .mpg-save-bar {
    margin: 10px 10px 8px;
    padding: 9px 12px;
    border: 1px solid rgba(119, 132, 150, 0.22);
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fb 100%);
}

.page-mpg .mpg-save-bar-text {
    color: #53606f;
}

.page-mpg .mpg-autosave-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid rgba(83, 144, 101, 0.22);
    border-radius: 999px;
    background: #eef8f0;
    color: #2d6840;
    font-weight: 700;
    white-space: nowrap;
}

.page-mpg .mpg-autosave-status[data-state="saving"] {
    border-color: rgba(156, 111, 30, 0.25);
    background: #fff7df;
    color: #8a5d10;
}

.page-mpg .mpg-autosave-status[data-state="error"] {
    border-color: rgba(179, 17, 17, 0.24);
    background: #fff0f0;
    color: #a41717;
}

.page-mpg .mpg-autosave-status[data-state="warning"] {
    border-color: rgba(194, 138, 22, 0.28);
    background: #fff3c4;
    color: #77520d;
}

.page-mpg .mpg-work-dates-cell {
    display: grid;
    gap: 5px;
}

.page-mpg .mpg-extra-work-dates {
    display: grid;
    gap: 4px;
}

.page-mpg .mpg-extra-work-date {
    display: grid;
    grid-template-columns: minmax(104px, 1fr) 22px;
    gap: 3px;
    align-items: center;
    margin: 0;
}

.page-mpg .mpg-extra-work-date-remove {
    width: 22px;
    height: 24px;
    border: 1px solid rgba(119, 132, 150, 0.35);
    border-radius: 6px;
    background: #fff;
    color: #9d2d1b;
    cursor: pointer;
    line-height: 1;
}

.page-mpg .mpg-add-work-day {
    min-height: 24px;
    padding: 2px 6px;
    font-size: 11px;
}

.page-mpg .mpg-pagination {
    margin: 8px 10px 10px;
    padding: 8px 10px;
    border-color: rgba(119, 132, 150, 0.22);
    background: #f8fafc;
}

.page-mpg .mpg-pagination-actions .sheet-filter-button {
    min-height: 32px;
    min-width: 86px;
    border-radius: 8px;
    border-color: rgba(88, 104, 124, 0.28);
    background: #ffffff;
}

.page-mpg .mpg-sheet-table {
    border-top: 1px solid rgba(139, 151, 168, 0.28);
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-size: 12px;
    line-height: 1.22;
}

.page-mpg .mpg-sheet-table th,
.page-mpg .mpg-sheet-table td {
    border-color: rgba(139, 151, 168, 0.2);
    padding: 8px 8px;
    vertical-align: middle;
}

.page-mpg .sheet-header-row th {
    min-height: 64px;
    background: #f8fafc;
    color: #172130;
    font-weight: 700;
}

.page-mpg .sheet-filter-row th {
    top: 64px;
    padding: 4px 6px;
    background: #f8fafc;
}

.page-mpg .mpg-sheet-table tbody tr:nth-child(even) {
    background: #f7f9fc;
}

.page-mpg .mpg-sheet-table tbody tr:hover {
    background: #eef5ff;
}

.page-mpg .mpg-edit-input,
.page-mpg .mpg-edit-select,
.page-mpg .mpg-edit-area {
    border-color: rgba(74, 88, 106, 0.28);
    background: #ffffff;
    border-radius: 7px;
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-size: 12px;
}

.page-mpg .mpg-edit-input:focus,
.page-mpg .mpg-edit-select:focus,
.page-mpg .mpg-edit-area:focus {
    outline: 2px solid rgba(52, 128, 83, 0.24);
    outline-offset: -1px;
}

.page-mpg .sheet-mini-button {
    border-color: rgba(107, 119, 135, 0.35);
    border-radius: 7px;
    background: linear-gradient(180deg, #ffffff 0%, #eef1f4 100%);
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-size: 11px;
}

.page-mpg .mpg-personnel-chip {
    border-color: rgba(107, 119, 135, 0.32);
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(36, 47, 61, 0.08);
    font-family: "Segoe UI", Tahoma, sans-serif;
}

.page-mpg .sheet-filter-summary {
    border-radius: 4px;
    background: #ffffff;
}

.page-mpg .sheet-sort-toggle {
    background: #f8fafc;
}

body.role-admin .layout-wide,
body.role-user .layout-wide {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0 22px 0;
}

body.role-admin .topbar-secure,
body.role-user .topbar-secure {
    display: grid;
    grid-template-columns: 360px minmax(360px, 1fr) auto;
    gap: 20px;
    align-items: center;
    min-height: 132px;
    margin: 0 -22px;
    padding: 20px 24px 18px;
}

body.role-admin .topbar-secure::before,
body.role-user .topbar-secure::before {
    display: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    width: 348px;
    max-width: 100%;
    text-decoration: none;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: auto;
}

body.role-admin .topbar-secure > div:first-of-type,
body.role-user .topbar-secure > div:first-of-type {
    min-width: 0;
}

body.role-admin .eyebrow,
body.role-user .eyebrow {
    color: #6b7280;
    font-size: 13px;
    text-transform: uppercase;
}

body.role-admin .topbar-title,
body.role-user .topbar-title {
    font-size: clamp(28px, 2.6vw, 40px);
    line-height: 1.05;
}

body.role-admin .secure-userbar,
body.role-user .secure-userbar {
    min-width: 300px;
}

body.role-admin .nav,
body.role-user .nav {
    justify-content: flex-end;
    flex-wrap: nowrap;
}

body.role-admin .nav a,
body.role-user .nav a {
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 8px;
    white-space: nowrap;
}

body.role-admin .sheet-tabs,
body.role-user .sheet-tabs {
    margin: 0 -22px 14px;
    padding: 0 22px;
    overflow-x: auto;
}

body.role-admin .sheet-tab,
body.role-user .sheet-tab {
    min-height: 42px;
    padding: 11px 18px 9px;
    white-space: nowrap;
}

body.role-admin .panel,
body.role-user .panel {
    flex: 0 0 auto;
    border-radius: 14px;
}

.page-mpg .panel {
    padding: 20px;
    border-radius: 14px;
    background: #ffffff;
}

.page-mpg .panel-heading {
    margin-bottom: 12px;
}

.page-mpg .panel-heading h2 {
    font-size: 27px;
}

.mpg-controls-modern {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 14px 18px;
    margin: 12px 0 14px;
    padding: 0 0 14px;
}

.mpg-control-card {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    min-width: 0;
}

.mpg-control-card-generate {
    flex: 1 1 760px;
}

.mpg-control-card-period {
    flex: 0 1 360px;
}

.mpg-control-card-clear {
    flex: 1 1 560px;
    padding-left: 18px;
}

.mpg-control-card-title {
    flex: 0 0 100%;
    min-height: 18px;
    color: #1f2937;
}

.mpg-control-card label {
    flex: 1 1 160px;
}

.mpg-control-card-generate label:nth-of-type(3) {
    flex-basis: 260px;
}

.mpg-control-card-clear label {
    flex-basis: 180px;
}

.page-mpg .checkbox-line {
    flex: 0 0 auto;
    min-height: 42px;
}

.mpg-action-button {
    flex: 0 0 auto;
}

.mpg-action-button-generate {
    min-width: 230px;
}

.mpg-action-button-clear {
    min-width: 170px;
}

.page-mpg .mpg-sheet-wrap {
    min-height: 560px;
    border-radius: 10px;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    min-height: 42px;
    margin: 18px -22px 0;
    padding: 10px 24px;
    border-top: 1px solid rgba(7, 63, 105, 0.16);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(238, 244, 250, 0.96) 100%);
    color: #073f69;
    font-size: 12px;
    letter-spacing: 0.02em;
}

.app-footer a {
    color: #073f69;
    text-decoration: none;
    font-weight: 700;
}

.app-footer a:hover {
    color: #0b5e93;
    text-decoration: underline;
}

.auth-footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    margin: 0;
}

.c-site {
    width: 60px;
}

.c-request {
    width: 74px;
}

.c-ppr {
    width: 62px;
}

.c-month {
    width: 34px;
}

.c-date {
    width: 72px;
}

.c-order {
    width: 74px;
}

.c-ejn {
    width: 78px;
}

.c-object {
    width: 120px;
}

.c-dispatcher {
    width: 124px;
}

.c-work {
    width: 126px;
}

.c-physical {
    width: 28px;
}

.c-type {
    width: 50px;
}

.c-repair {
    width: 58px;
}

.c-personnel {
    width: 100px;
}

.c-vehicle {
    width: 72px;
}

.c-driver {
    width: 56px;
}

.c-special {
    width: 82px;
}

.c-special-driver {
    width: 56px;
}

.c-route {
    width: 76px;
}

.c-tmc {
    width: 118px;
}

.c-note {
    width: 66px;
}

.e-mismatch {
    width: 120px;
}

.e-topo-order {
    width: 140px;
}

.e-defect {
    width: 140px;
}

.e-issue {
    width: 620px;
}

.e-site {
    width: 150px;
}

.e-date {
    width: 110px;
}

.e-status {
    width: 90px;
}

.p-name {
    width: 170px;
}

.p-position {
    width: 430px;
}

.p-day {
    width: 28px;
}

.p-percent {
    width: 52px;
}

@media (max-width: 900px) {
    .layout-wide {
        max-width: 100%;
    }

    body.role-admin .layout-wide,
    body.role-user .layout-wide {
        padding: 0 14px 22px;
    }

    body.role-admin .topbar-secure,
    body.role-user .topbar-secure,
    .page-mpg .topbar-secure {
        align-items: flex-start;
        flex-wrap: wrap;
        margin: 0 -14px 0;
        padding: 12px 14px;
        min-height: auto;
    }

    body.role-admin .topbar-secure::before,
    body.role-user .topbar-secure::before,
    .page-mpg .topbar-secure::before {
        width: 48px;
        height: 48px;
        margin-right: 10px;
        border-radius: 12px;
        font-size: 14px;
    }

    body.role-admin .topbar-title,
    body.role-user .topbar-title,
    .page-mpg .topbar-title {
        font-size: 21px;
    }

    body.role-admin .secure-userbar,
    body.role-user .secure-userbar,
    .page-mpg .secure-userbar {
        width: 100%;
        justify-items: stretch;
    }

    body.role-admin .nav,
    body.role-user .nav,
    .page-mpg .nav {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }

    body.role-admin .secure-usercard,
    body.role-user .secure-usercard,
    .page-mpg .secure-usercard {
        min-width: 0;
        text-align: left;
    }

    body.role-admin .sheet-tabs,
    body.role-user .sheet-tabs {
        margin: 0 -14px 12px;
        padding: 0 14px;
    }

    .generation-form-sheet,
    .sheet-filters {
        padding: 14px;
    }

    .mpg-sheet-table {
        font-size: 10px;
    }

    .mpg-save-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .mpg-save-bar-bottom {
        align-items: flex-end;
    }

    .sheet-mini-button {
        min-height: 24px;
        padding: 4px 6px;
        font-size: 9px;
    }

    .sheet-filter-row th {
        top: 72px;
    }

    .sheet-filter-popup {
        width: 180px;
    }

    .mpg-sheet-wrap {
        min-height: 320px;
    }

    .mpg-controls-modern {
        grid-template-columns: 1fr;
    }

    .mpg-control-card-generate,
    .mpg-control-card-period,
    .mpg-control-card-clear {
        grid-template-columns: 1fr;
        padding-left: 0;
        border-left: 0;
    }

    .mpg-control-card-generate .mpg-control-card-title {
        grid-column: 1;
    }

    .personnel-layout {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 901px) and (max-width: 1500px) {
    .mpg-controls-modern {
        grid-template-columns: 1fr;
    }

    .mpg-control-card-clear {
        padding-left: 0;
        border-left: 0;
    }
}

/* Final workbench corrections: stable PNG brand, initials-only users, Excel-like MPG grid. */
body.role-admin .topbar-secure,
body.role-user .topbar-secure {
    grid-template-columns: 420px minmax(340px, 1fr) auto;
    min-height: 118px;
    padding-top: 14px;
    padding-bottom: 12px;
}

.brand-mark {
    width: 400px;
    height: 92px;
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: left center;
}

body.role-admin .secure-usercard,
body.role-user .secure-usercard {
    grid-template-columns: 40px minmax(0, 1fr);
}

body.role-admin .secure-usercard::before,
body.role-user .secure-usercard::before {
    display: none;
}

.user-avatar-initials {
    grid-area: avatar;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(7, 63, 105, 0.18);
    border-radius: 50%;
    background: #e8f2fb;
    color: #073f69;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0;
}

.page-mpg .mpg-sheet-wrap {
    min-height: 620px;
    border: 1px solid #8e9399;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
}

.page-mpg .mpg-sheet-table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #ffffff;
    font-family: "Times New Roman", Georgia, serif;
    font-size: 11px;
    line-height: 1.15;
}

.page-mpg .mpg-sheet-table th,
.page-mpg .mpg-sheet-table td {
    border: 1px solid #8f949a;
    padding: 4px 5px;
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.page-mpg .mpg-sheet-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 78px;
    overflow: visible;
    padding: 4px;
    background: #d3d3d3;
    color: #000000;
    text-align: center;
    font-weight: 700;
}

.page-mpg .sheet-header-row th {
    top: 0;
    z-index: 4;
    min-height: 78px;
    background: #d3d3d3;
}

.page-mpg .sheet-filter-row th {
    top: 78px;
    z-index: 3;
    min-height: auto;
    padding: 2px 4px;
    background: #ececec;
    text-align: right;
}

.page-mpg .mpg-sheet-table tbody tr:nth-child(even) {
    background: #ffffff;
}

.page-mpg .mpg-sheet-table tbody tr:hover {
    background: #f5f8fb;
}

.page-mpg .mpg-edit-input,
.page-mpg .mpg-edit-select,
.page-mpg .mpg-edit-area {
    border: 1px solid rgba(86, 96, 112, 0.45);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.78);
    color: #172130;
    font: inherit;
    font-size: 11px;
    line-height: 1.2;
}

.page-mpg .mpg-edit-input,
.page-mpg .mpg-edit-select {
    min-height: 28px;
    padding: 4px 6px;
}

.page-mpg .sheet-mini-button,
.page-mpg .sheet-filter-button {
    border: 1px solid #9ba3ad;
    border-radius: 5px;
    background: linear-gradient(180deg, #ffffff 0%, #edf1f5 100%);
    color: #232323;
    box-shadow: 0 1px 2px rgba(31, 41, 55, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.page-mpg .sheet-mini-button:hover,
.page-mpg .sheet-filter-button:hover {
    border-color: #6f7d8b;
    background: linear-gradient(180deg, #ffffff 0%, #e3e9f0 100%);
}

.page-mpg .sheet-mini-button-alert {
    color: #b31111;
}

@media (max-width: 900px) {
    body.role-admin .topbar-secure,
    body.role-user .topbar-secure {
        grid-template-columns: 1fr;
    }

    .brand-mark {
        width: min(100%, 360px);
        height: 78px;
    }
}

/* Dark-blue site style from the MPG reference, while keeping the working Excel grid. */
body.role-admin,
body.role-user {
    background: #eef2f7;
}

body.role-admin .layout-wide,
body.role-user .layout-wide {
    padding: 0 6px;
}

body.role-admin .topbar-secure,
body.role-user .topbar-secure {
    grid-template-columns: 230px minmax(360px, 1fr) auto;
    gap: 22px;
    min-height: 88px;
    margin: 0 -6px;
    padding: 10px 18px;
    border-bottom: 0;
    background:
        linear-gradient(135deg, rgba(4, 45, 76, 0.96) 0%, rgba(4, 69, 110, 0.96) 58%, rgba(5, 50, 82, 0.96) 100%);
    box-shadow: 0 8px 22px rgba(2, 24, 43, 0.2);
}

.brand-mark {
    width: 218px;
    height: 58px;
    padding: 0;
    background: transparent;
}

.brand-mark img {
    filter: none;
}

body.role-admin .eyebrow,
body.role-user .eyebrow {
    margin: 0 0 2px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

body.role-admin .topbar-title,
body.role-user .topbar-title {
    color: #ffffff;
    font-size: clamp(22px, 2.2vw, 32px);
    line-height: 1.1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

body.role-admin .secure-userbar,
body.role-user .secure-userbar {
    min-width: 0;
    align-self: center;
}

body.role-admin .nav,
body.role-user .nav {
    gap: 8px;
}

body.role-admin .nav a,
body.role-user .nav a {
    min-height: 34px;
    padding: 7px 13px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    box-shadow: none;
    font-size: 12px;
    text-transform: uppercase;
}

body.role-admin .nav a:hover,
body.role-user .nav a:hover {
    background: rgba(255, 255, 255, 0.16);
}

body.role-admin .secure-usercard,
body.role-user .secure-usercard {
    min-width: 240px;
    padding: 8px 10px;
    border-color: rgba(255, 255, 255, 0.24);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 8px 18px rgba(2, 24, 43, 0.18);
}

.user-avatar-initials {
    width: 34px;
    height: 34px;
    border-color: rgba(7, 63, 105, 0.25);
    background: #edf5fb;
    color: #073f69;
}

body.role-admin .sheet-tabs,
body.role-user .sheet-tabs {
    margin: 0 -6px 14px;
    padding: 0 6px;
    border-bottom: 1px solid #bfc8d2;
    background: #f3f6fa;
}

body.role-admin .sheet-tab,
body.role-user .sheet-tab {
    min-height: 39px;
    padding: 10px 16px 8px;
    border-color: #c9d2dc;
    border-top-color: #d9a26b;
    background: #f8fafc;
    font-size: 14px;
}

body.role-admin .sheet-tab-active,
body.role-user .sheet-tab-active {
    background: linear-gradient(180deg, #fff4cd 0%, #ffe49b 100%);
}

body.role-admin .sheet-tabs-bar,
body.role-user .sheet-tabs-bar {
    margin: 0 -6px 14px;
}

body.role-admin .sheet-tabs-bar .sheet-tabs,
body.role-user .sheet-tabs-bar .sheet-tabs {
    margin: 0;
    padding: 0 6px;
    border: 0;
    background: transparent;
}

body.role-admin .panel,
body.role-user .panel {
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(37, 50, 68, 0.1);
}

.page-mpg .panel {
    padding: 16px 18px;
}

.page-mpg .panel-heading h2 {
    font-size: 24px;
}

.mpg-controls-modern {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px 16px;
    padding: 0 0 12px;
    margin: 10px 0 12px;
}

.mpg-control-card {
    display: contents;
}

.mpg-control-card-title {
    display: none;
}

.mpg-control-card label {
    display: grid;
    flex: 0 1 auto;
    min-width: 150px;
    max-width: 280px;
}

.mpg-control-card-generate label:nth-of-type(3) {
    min-width: 250px;
}

.mpg-control-card-clear {
    padding-left: 12px;
    border-left: 1px solid #d7dde5;
}

.mpg-action-button {
    min-height: 38px;
    padding: 8px 14px;
}

.mpg-action-button-generate {
    background: linear-gradient(180deg, #95dca9 0%, #72c68a 100%);
}

.mpg-action-button-clear {
    background: linear-gradient(180deg, #b94d2e 0%, #9e3a1f 100%);
}

.app-footer {
    margin: 16px -6px 0;
    background: #f3f6fa;
}

@media (max-width: 1100px) {
    body.role-admin .topbar-secure,
    body.role-user .topbar-secure {
        grid-template-columns: 220px 1fr;
    }

    body.role-admin .secure-userbar,
    body.role-user .secure-userbar {
        grid-column: 1 / -1;
        width: 100%;
        justify-items: stretch;
    }

    body.role-admin .nav,
    body.role-user .nav {
        justify-content: flex-start;
        overflow-x: auto;
    }
}

.notification-link {
    position: relative;
    min-width: 42px;
    justify-content: center;
}

.notification-mark {
    display: inline-grid;
    width: 18px;
    height: 18px;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(15, 70, 108, 0.35);
    color: #0f466c;
    font-weight: 800;
    line-height: 1;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    display: inline-grid;
    min-width: 18px;
    height: 18px;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    background: #b5482d;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.notification-link-active {
    border-color: rgba(181, 72, 45, 0.4);
    background: #fff6ef;
}

.reports-grid {
    display: grid;
    gap: 18px;
}

.reports-card {
    border: 1px solid rgba(119, 132, 150, 0.28);
    border-radius: 16px;
    background: #fff;
    padding: 16px;
    box-shadow: 0 14px 28px rgba(15, 35, 55, 0.06);
}

.reports-card h3 {
    margin: 0 0 12px;
}

.reports-table,
.reports-snapshot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.reports-table th,
.reports-table td,
.reports-snapshot-table th,
.reports-snapshot-table td {
    border: 1px solid #c8d0d8;
    padding: 7px 8px;
    vertical-align: top;
}

.reports-table th,
.reports-snapshot-table th {
    background: #e7ebef;
    font-weight: 800;
}

.reports-snapshot-wrap {
    overflow: auto;
    max-height: 68vh;
    border: 1px solid rgba(119, 132, 150, 0.28);
    border-radius: 12px;
}

.reports-snapshot-table {
    min-width: 2200px;
}

.reports-detail-head,
.report-review-form {
    display: flex;
    gap: 12px;
    align-items: end;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.report-review-form label {
    flex: 1 1 320px;
}

.report-status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.report-status-submitted {
    background: #fff3c4;
    color: #715500;
}

.report-status-accepted {
    background: #dff3e8;
    color: #1f6f42;
}

.report-status-revision {
    background: #ffe2dc;
    color: #934026;
}

.mpg-save-actions {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.button-report-submit {
    border: 1px solid rgba(31, 111, 66, 0.25);
    background: #71c98e;
    color: #0f3820;
    box-shadow: 0 10px 20px rgba(54, 149, 88, 0.18);
}

.button-report-submit:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    box-shadow: none;
}

.mpg-report-submit-hint {
    max-width: 260px;
    color: #715500;
    font-size: 12px;
    line-height: 1.25;
}

.mpg-autosave-locked {
    background: #fff3c4;
    color: #715500;
    border-color: rgba(113, 85, 0, 0.22);
}

.mpg-report-lock-alert a {
    color: #0f466c;
    font-weight: 800;
}

.sheet-filter-popup {
    max-height: min(620px, calc(100vh - 120px));
    overflow: auto;
}

.sheet-filter-popup-list {
    max-height: min(360px, calc(100vh - 310px));
    overflow: auto;
}

.sheet-filter-actions,
.sheet-filter-actions-row {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(247, 249, 252, 0.92), #f7f9fc 35%);
    padding-top: 10px;
}

/* Header correction: light corporate header, compact title block, fixed initials card. */
body.role-admin .topbar-secure,
body.role-user .topbar-secure {
    grid-template-columns: 330px minmax(320px, 1fr) auto;
    gap: 12px;
    min-height: 104px;
    margin: 0 -6px;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(7, 63, 105, 0.14);
    background: linear-gradient(180deg, #ffffff 0%, #f6f9fd 100%);
    box-shadow: 0 8px 22px rgba(7, 63, 105, 0.08);
}

.brand-mark {
    width: 320px;
    height: 86px;
}

body.role-admin .eyebrow,
body.role-user .eyebrow {
    color: #5f7184;
    font-size: 12px;
}

body.role-admin .topbar-title,
body.role-user .topbar-title {
    color: #073f69;
    font-size: clamp(24px, 2.4vw, 34px);
    text-shadow: none;
}

body.role-admin .nav a,
body.role-user .nav a {
    border-color: rgba(7, 63, 105, 0.18);
    background: #ffffff;
    color: #073f69;
    box-shadow: 0 4px 14px rgba(7, 63, 105, 0.08);
}

body.role-admin .nav a:hover,
body.role-user .nav a:hover {
    background: #edf5fb;
}

body.role-admin .secure-usercard,
body.role-user .secure-usercard {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-areas:
        "avatar name"
        "avatar meta";
    column-gap: 10px;
    row-gap: 2px;
    align-items: center;
    min-width: 260px;
    border-color: rgba(7, 63, 105, 0.14);
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(7, 63, 105, 0.1);
}

.user-avatar-initials {
    grid-area: avatar !important;
    width: 34px;
    height: 34px;
    line-height: 1;
    align-self: center;
    justify-self: center;
}

body.role-admin .secure-usercard strong,
body.role-user .secure-usercard strong {
    align-self: end;
    min-width: 0;
    overflow: hidden;
    color: #172130;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.role-admin .secure-usercard span:not(.user-avatar-initials),
body.role-user .secure-usercard span:not(.user-avatar-initials) {
    grid-area: meta;
    align-self: start;
    min-width: 0;
    overflow: hidden;
    color: #5d6878;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mpg-control-card-clear {
    flex: 1 0 100%;
    padding-top: 8px;
    padding-left: 0;
    border-top: 1px solid #d7dde5;
    border-left: 0;
}

.page-mpg .mpg-control-card {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px 16px;
}

.page-mpg .mpg-control-card-generate {
    flex: 1 1 760px;
}

.page-mpg .mpg-control-card-period {
    flex: 0 1 520px;
}

.page-mpg .mpg-control-card-clear {
    flex: 1 0 100%;
    padding-left: 14px;
}

.page-mpg .mpg-control-card-title {
    display: none;
}

.page-mpg .sheet-mini-button-static {
    display: none !important;
}

.page-mpg .c-date {
    width: 72px;
}

.page-mpg .c-vehicle {
    width: 72px;
}

.page-mpg .c-driver {
    width: 56px;
}

.page-mpg .c-special {
    width: 82px;
}

.page-mpg .c-special-driver {
    width: 56px;
}

.page-mpg .c-route {
    width: 76px;
}

.page-mpg .mpg-edit-input,
.page-mpg .mpg-edit-select,
.page-mpg .mpg-edit-area,
.page-mpg .mpg-readonly-value,
.page-mpg .mpg-personnel-chip {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.page-mpg .mpg-edit-input {
    min-width: 0;
}

.page-mpg .mpg-edit-input[type="date"] {
    min-width: 0;
    padding-left: 2px;
    padding-right: 2px;
    font-size: 10px;
}

@media (max-width: 1100px) {
    body.role-admin .topbar-secure,
    body.role-user .topbar-secure {
        grid-template-columns: minmax(220px, 300px) 1fr;
    }

    .brand-mark {
        width: min(100%, 286px);
    }
}

/* Requested compact workbench corrections. */
body.role-admin .topbar-secure,
body.role-user .topbar-secure {
    grid-template-columns: 390px minmax(320px, 1fr) auto;
}

.brand-mark {
    width: 380px;
    height: 98px;
}

.page-mpg .mpg-controls-modern {
    align-items: end;
    justify-content: flex-start;
}

.page-mpg .mpg-control-card-generate {
    flex: 0 1 auto;
}

.page-mpg .mpg-control-card-period {
    flex: 0 0 auto;
}

.page-mpg .mpg-action-button-generate,
.page-mpg .mpg-action-button-period {
    min-height: 42px;
    align-self: end;
}

.page-mpg .mpg-control-card-period label {
    align-self: end;
}

.page-mpg .mpg-picker-cell .mpg-edit-input,
.page-mpg input[name$="[route_sheet_number]"],
.page-mpg input[name$="[request_deadline]"],
.page-mpg input[name$="[ppr_deadline]"] {
    height: auto;
    min-height: 34px;
    padding: 4px 5px;
    line-height: 1.15;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.page-mpg .mpg-picker-cell {
    min-height: 34px;
}

.page-mpg .mpg-picker-cell .mpg-edit-input {
    display: block;
    text-align: left;
}

@media (max-width: 1100px) {
    body.role-admin .topbar-secure,
    body.role-user .topbar-secure {
        grid-template-columns: minmax(280px, 390px) 1fr;
    }

    .brand-mark {
        width: min(100%, 380px);
    }
}

/* Final MPG layout pass: larger logo, compact control row, wrapping cells. */
body.role-admin .topbar-secure,
body.role-user .topbar-secure {
    grid-template-columns: 460px minmax(320px, 1fr) auto;
}

.brand-mark {
    width: 440px;
    height: 112px;
}

.page-mpg .mpg-controls-modern {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 12px 14px;
}

.page-mpg .mpg-control-card {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px 12px;
    min-height: 86px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.page-mpg .mpg-control-card-generate,
.page-mpg .mpg-control-card-period {
    flex: 0 0 auto;
    max-width: max-content;
}

.page-mpg .mpg-control-card-clear {
    flex: 1 1 100%;
    padding-left: 0;
    border-left: 0;
}

.page-mpg .mpg-control-card label {
    flex: 0 0 auto;
    min-width: 180px;
}

.page-mpg .mpg-control-card-generate label:nth-of-type(3) {
    min-width: 260px;
}

.page-mpg .mpg-action-button-generate,
.page-mpg .mpg-action-button-period {
    min-height: 42px;
    margin-bottom: 0;
}

.page-mpg .mpg-edit-area-compact {
    min-height: 34px;
    max-height: none;
    padding: 4px 5px;
    overflow: hidden;
    resize: none;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.15;
    text-align: left;
}

.page-mpg .mpg-picker-cell .mpg-edit-area-compact {
    cursor: pointer;
}

.page-mpg .mpg-sheet-table td:has(.mpg-edit-area-compact) {
    vertical-align: top;
}

.mpg-management-panel {
    margin: 16px 0;
}

.mpg-management-head {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.mpg-management-head h2 {
    margin: 0 0 6px;
}

.mpg-management-head p {
    color: #536173;
    margin: 0;
}

.mpg-management-toolbar {
    display: grid;
    gap: 12px;
    margin: 18px 0;
}

.mpg-management-create,
.mpg-management-filters {
    align-items: end;
    background: #f8fafc;
    border: 1px solid #d7dde5;
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
}

.mpg-management-create strong,
.mpg-management-filters strong {
    color: #073f69;
    min-width: 150px;
}

.mpg-management-create label,
.mpg-management-filters label {
    display: grid;
    gap: 5px;
}

.mpg-management-create label span,
.mpg-management-filters label span {
    color: #536173;
    font-size: 12px;
}

.mpg-management-create select,
.mpg-management-filters select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    min-height: 38px;
    min-width: 170px;
    padding: 7px 10px;
}

.mpg-management-table-wrap {
    border-radius: 12px;
    overflow: auto;
}

.mpg-management-bulk-form {
    align-items: center;
    display: flex;
    justify-content: flex-end;
    margin: 0 0 10px;
}

.mpg-management-select-col {
    text-align: center;
    width: 38px;
}

.mpg-management-select-col input {
    cursor: pointer;
}

.mpg-management-table th,
.mpg-management-table td {
    font-size: 13px;
    padding: 8px 10px;
    white-space: nowrap;
}

.mpg-management-status {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 9px;
}

.mpg-management-status-active {
    background: #e6f4ec;
    color: #1f6b3a;
}

.mpg-management-status-archived {
    background: #eef2f7;
    color: #475569;
}

.mpg-management-actions {
    align-items: center;
    display: flex;
    gap: 6px;
}

.mpg-management-actions .inline-form {
    margin: 0;
}

.mpg-icon-action {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #073f69;
    cursor: pointer;
    display: inline-flex;
    font-size: 16px;
    font-weight: 700;
    height: 32px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    text-decoration: none;
    width: 34px;
}

.mpg-icon-action:hover {
    background: #e8f1f8;
    border-color: #8fb5d4;
}

.mpg-icon-action-danger {
    color: #af3f25;
}

.mpg-heading-actions {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.mpg-column-settings {
    position: relative;
}

.mpg-column-settings > summary {
    list-style: none;
}

.mpg-column-settings > summary::-webkit-details-marker {
    display: none;
}

.mpg-column-settings-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 80;
    width: min(360px, calc(100vw - 28px));
    padding: 12px;
    border: 1px solid rgba(7, 63, 105, 0.18);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 46px rgba(13, 34, 55, 0.18);
}

.mpg-column-settings-panel strong {
    display: block;
    margin-bottom: 8px;
    color: #073f69;
}

.mpg-column-settings-list {
    display: grid;
    gap: 6px;
    max-height: 320px;
    overflow: auto;
    padding-right: 4px;
    margin-bottom: 10px;
}

.mpg-column-settings-list label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    line-height: 1.25;
}

.mpg-column-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

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

col.mpg-column-hidden {
    visibility: collapse;
}

.mpg-column-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    z-index: 5;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
}

.mpg-column-resizer::after {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 3px;
    width: 1px;
    background: rgba(7, 63, 105, 0.28);
    opacity: 0;
}

.mpg-sheet-table th:hover > .mpg-column-resizer::after,
body.mpg-column-resizing .mpg-column-resizer::after {
    opacity: 1;
}

body.mpg-column-resizing {
    cursor: col-resize;
    user-select: none;
}

.mpg-management-inline-link {
    flex: 0 0 auto;
    margin-top: 2px;
}

.mpg-current-actions {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #d7dde5;
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0 16px;
    padding: 12px;
}

.mpg-current-actions .inline-form {
    margin: 0;
}

.mpg-current-actions .button[disabled] {
    cursor: not-allowed;
    opacity: 0.55;
}

@media (max-width: 1100px) {
    body.role-admin .topbar-secure,
    body.role-user .topbar-secure {
        grid-template-columns: minmax(300px, 460px) 1fr;
    }

    .brand-mark {
        width: min(100%, 440px);
    }
}

/* Final compact header and separated MPG controls. */
body.role-admin .topbar-secure,
body.role-user .topbar-secure {
    grid-template-columns: 300px minmax(320px, 1fr) auto;
    column-gap: 18px;
}

.brand-mark {
    width: 286px;
    height: 96px;
    overflow: hidden;
}

.brand-mark img {
    object-fit: contain;
    object-position: left center;
}

.topbar-secure > div:nth-child(2) {
    align-self: center;
}

.page-mpg .mpg-control-card-generate,
.page-mpg .mpg-control-card-period {
    min-height: 94px;
    padding: 12px 14px;
    border: 1px solid rgba(7, 63, 105, 0.14);
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 8px 20px rgba(7, 63, 105, 0.06);
}

.page-mpg .mpg-control-card-period {
    margin-left: 0;
    border-left: 3px solid rgba(7, 63, 105, 0.18);
}

.page-mpg .c-request {
    width: 88px;
}

.page-mpg .c-ppr {
    width: 78px;
}

.page-mpg .c-driver,
.page-mpg .c-special-driver {
    width: 92px;
}

.page-mpg .c-special {
    width: 110px;
}

.page-mpg .c-route {
    width: 104px;
}

.page-mpg .mpg-route-sheet-input {
    min-height: 34px;
    white-space: nowrap;
    text-overflow: clip;
}

.page-mpg .mpg-site-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 28px;
    padding: 4px 5px;
    font-size: 11px;
    white-space: nowrap;
}

.page-mpg .mpg-row-validation-ok > td {
    background: #f5d36a !important;
}

.page-mpg .mpg-row-validation-error > td {
    background: #f4b8b8 !important;
}

@media (max-width: 1100px) {
    body.role-admin .topbar-secure,
    body.role-user .topbar-secure {
        grid-template-columns: minmax(260px, 300px) 1fr;
    }

    .brand-mark {
        width: min(100%, 286px);
    }
}

/* Logo size tuned for the new wide PNG. */
body.role-admin .topbar-secure,
body.role-user .topbar-secure {
    grid-template-columns: 520px minmax(320px, 1fr) auto;
    column-gap: 14px;
}

.brand-mark {
    width: 500px;
    height: 126px;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: left center;
}

@media (max-width: 1100px) {
    body.role-admin .topbar-secure,
    body.role-user .topbar-secure {
        grid-template-columns: minmax(320px, 520px) 1fr;
    }

    .brand-mark {
        width: min(100%, 500px);
        height: 126px;
    }
}

/* Header uses a cropped logo asset, so keep the title close. */
body.role-admin .topbar-secure,
body.role-user .topbar-secure {
    grid-template-columns: 360px minmax(320px, 1fr) auto;
    column-gap: 12px;
}

.brand-mark {
    width: 348px;
    height: 122px;
}

.brand-mark img {
    object-fit: contain;
    object-position: left center;
}

@media (max-width: 1100px) {
    body.role-admin .topbar-secure,
    body.role-user .topbar-secure {
        grid-template-columns: minmax(300px, 360px) 1fr;
    }

    .brand-mark {
        width: min(100%, 348px);
        height: 122px;
    }
}

/* MPG transfer mode: hidden until the user explicitly enables it. */
.page-mpg .mpg-transfer-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin: 10px 0;
    padding: 10px 12px;
    border: 1px solid rgba(7, 63, 105, 0.16);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.page-mpg .mpg-transfer-toggle,
.page-mpg .mpg-transfer-date-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.page-mpg .mpg-transfer-date-control {
    flex-direction: column;
    align-items: flex-start;
}

.page-mpg .mpg-transfer-date-control input {
    min-width: 160px;
}

.page-mpg .mpg-transfer-submit {
    min-height: 38px;
}

.page-mpg .mpg-confirm-panel {
    border: 1px solid #aeb7c2;
    background: #f3f4f6;
    padding: 12px;
    margin: 12px 0;
    box-shadow: inset 0 1px 0 #fff;
}

.page-mpg .mpg-confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.42);
}

.page-mpg .mpg-confirm-modal-backdrop.is-hidden {
    display: none;
}

.page-mpg .mpg-confirm-modal {
    width: min(1220px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    margin: 0;
    border-color: #7d8794;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
}

.page-mpg .mpg-confirm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.page-mpg .mpg-confirm-title {
    font-weight: 800;
    margin-bottom: 4px;
}

.page-mpg .mpg-confirm-close {
    width: 30px;
    height: 30px;
    border: 1px solid #9aa5b1;
    border-radius: 4px;
    background: linear-gradient(#fff, #e8edf3);
    color: #182233;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.page-mpg .mpg-confirm-close:hover {
    background: linear-gradient(#fff, #dfe7f1);
}

.page-mpg .mpg-confirm-note {
    margin: 0 0 10px;
    color: #465466;
}

.page-mpg .mpg-confirm-card {
    border: 1px solid #c6ced8;
    background: #fff;
    padding: 10px;
    margin-bottom: 10px;
}

.page-mpg .mpg-confirm-grid {
    display: grid;
    grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1.3fr) minmax(180px, 1.3fr) minmax(90px, 0.45fr);
    gap: 8px;
    align-items: end;
}

.page-mpg .mpg-confirm-grid label,
.page-mpg .mpg-confirm-combo-grid {
    min-width: 0;
}

.page-mpg .mpg-confirm-grid label span {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 3px;
}

.page-mpg .mpg-confirm-grid input,
.page-mpg .mpg-confirm-combo-grid input,
.page-mpg .mpg-confirm-combo-grid select {
    width: 100%;
    min-height: 28px;
    border: 1px solid #aeb7c2;
    border-radius: 2px;
    background: #fff;
    padding: 4px 6px;
    box-sizing: border-box;
}

.page-mpg .mpg-confirm-grid input[readonly] {
    background: #f4f6f8;
    color: #4a5565;
}

.page-mpg .mpg-confirm-wide {
    grid-column: span 3;
}

.page-mpg .mpg-confirm-combo-grid {
    display: grid;
    grid-template-columns: 72px minmax(150px, 220px) 1fr;
    gap: 6px 10px;
    align-items: center;
    margin-top: 10px;
}

.page-mpg .mpg-confirm-day-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 8px 10px;
    margin-top: 10px;
    padding: 8px;
    border: 1px solid #d3dae3;
    background: #f8fafc;
}

.page-mpg .mpg-confirm-day-grid strong {
    flex: 1 0 100%;
    font-size: 12px;
}

.page-mpg .mpg-confirm-day-grid label {
    display: grid;
    gap: 3px;
    min-width: 104px;
}

.page-mpg .mpg-confirm-day-grid span {
    font-size: 12px;
    font-weight: 700;
}

.page-mpg .mpg-confirm-day-grid input {
    min-height: 28px;
    border: 1px solid #aeb7c2;
    border-radius: 2px;
    padding: 4px 6px;
}

.page-mpg .mpg-confirm-combo-grid span {
    font-size: 12px;
}

.page-mpg .mpg-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.page-mpg .mpg-transfer-column {
    display: none;
}

body.mpg-transfer-mode-active.page-mpg .mpg-transfer-column {
    display: table-cell;
}

body.mpg-transfer-mode-active.page-mpg col.mpg-transfer-column {
    display: table-column;
}

.page-mpg .mpg-selection-column {
    display: none;
}

.page-mpg col.mpg-selection-column {
    display: none;
}

body.mpg-transfer-mode-active.page-mpg .mpg-selection-column,
body.mpg-confirm-mode-active.page-mpg .mpg-selection-column {
    display: table-cell;
}

body.mpg-transfer-mode-active.page-mpg col.mpg-selection-column,
body.mpg-confirm-mode-active.page-mpg col.mpg-selection-column {
    display: table-column;
}

.page-mpg .c-transfer-select {
    width: 78px;
}

.page-mpg .c-transfer-date {
    width: 130px;
}

.page-mpg .mpg-transfer-select-all {
    display: grid;
    gap: 4px;
    justify-items: center;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.15;
}

.page-mpg .mpg-transfer-select-cell,
.page-mpg .mpg-transfer-date-cell {
    text-align: center;
    vertical-align: middle;
    background: #f7fbff;
}

.page-mpg .mpg-transfer-note {
    margin-bottom: 6px;
    padding: 4px 6px;
    border: 1px solid #e4c35d;
    border-radius: 6px;
    background: #fff4bf;
    color: #5e4700;
    font-weight: 700;
    font-size: 11px;
    line-height: 1.2;
}

.page-mpg .mpg-transfer-history {
    margin: 4px 0 6px;
    font-size: 11px;
}

.page-mpg .mpg-transfer-history summary {
    display: inline-flex;
    cursor: pointer;
    border: 1px solid #b8c5d2;
    border-radius: 6px;
    padding: 2px 7px;
    background: #f8fbff;
    color: #0b4778;
    font-weight: 700;
}

.page-mpg .mpg-transfer-history-list {
    display: grid;
    gap: 4px;
    margin-top: 5px;
}

.page-mpg .mpg-transfer-history-item {
    display: grid;
    gap: 2px;
    border-left: 3px solid #8ab7d6;
    padding: 4px 6px;
    background: #f7fbff;
}

.page-mpg .mpg-transfer-history-item em {
    color: #5d6470;
    font-style: normal;
}

.page-mpg .mpg-transfer-visibility-form {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    margin: 10px 0 12px;
    padding: 10px 12px;
    border: 1px solid rgba(7, 63, 105, 0.14);
    border-radius: 10px;
    background: #f8fbff;
}

.work-plans-page {
    overflow: hidden;
}

.work-plans-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin: 16px 0;
    padding: 14px;
    border: 1px solid #d8e0ea;
    border-radius: 12px;
    background: #f8fbff;
}

.work-plans-filters label {
    display: grid;
    gap: 5px;
    min-width: 150px;
    color: #334155;
    font-size: 13px;
}

.work-plans-filters input,
.work-plans-filters select {
    min-height: 34px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    padding: 5px 8px;
    background: #fff;
}

.work-plans-table {
    min-width: 1800px;
}

.work-plan-transfer,
.work-plan-emergency-mark {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.work-plan-transfer {
    background: #e8f3ff;
    color: #0b4778;
}

.work-plan-emergency,
.work-plan-emergency-mark {
    background: #fff1f0;
}

.work-plan-emergency-mark {
    color: #a9381c;
}

.page-mpg .mpg-transfer-visibility-form label {
    display: grid;
    gap: 4px;
    margin: 0;
}

.page-mpg .mpg-transfer-visibility-form select {
    min-width: 220px;
}

.directory-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 18px;
}

.directory-tab {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 13px;
    border: 1px solid #cfd8e3;
    border-radius: 10px;
    background: #ffffff;
    color: #0b4778;
    font-weight: 700;
    text-decoration: none;
}

.directory-tab:hover {
    border-color: #91adc5;
    background: #f5f9fd;
}

.directory-tab-active {
    border-color: #d5a642;
    background: #fff4c7;
    color: #1d2a3a;
}

.panel-heading-compact {
    margin-top: 8px;
    padding-top: 0;
}

.panel-heading-compact h3 {
    margin: 0 0 6px;
    font-size: 20px;
}
