:root {
    --mm-primary: #167f73;
    --mm-primary-dark: #0f625a;
    --mm-primary-soft: #e9f5f2;
    --mm-navy: #14283b;
    --mm-sidebar: #f8faf9;
    --mm-sidebar-deep: #f1f4f3;
    --mm-sidebar-active: #e9f5f2;
    --mm-canvas: #f5f7f6;
    --mm-border: #e1e8e5;
    --mm-muted: #6d7b82;
    --mm-success: #16836f;
    --mm-shadow: 0 10px 30px rgba(31, 58, 55, 0.055);
    --bs-primary: #167f73;
    --bs-primary-rgb: 22, 127, 115;
    --bs-link-color: #167f73;
    --bs-link-hover-color: #0f625a;
}

body {
    background: var(--mm-canvas);
    color: #263746;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.app-main {
    background:
        radial-gradient(circle at 92% 5%, rgba(22, 127, 115, 0.035), transparent 22%),
        var(--mm-canvas);
}

.app-content {
    padding-bottom: 2rem;
}

.btn {
    border-radius: 0.65rem;
    font-weight: 600;
}

.btn-primary {
    --bs-btn-bg: var(--mm-primary);
    --bs-btn-border-color: var(--mm-primary);
    --bs-btn-hover-bg: var(--mm-primary-dark);
    --bs-btn-hover-border-color: var(--mm-primary-dark);
    --bs-btn-active-bg: var(--mm-primary-dark);
    --bs-btn-active-border-color: var(--mm-primary-dark);
    --bs-btn-disabled-bg: var(--mm-primary);
    --bs-btn-disabled-border-color: var(--mm-primary);
    box-shadow: 0 7px 17px rgba(22, 127, 115, 0.14);
}

.btn-outline-primary {
    --bs-btn-color: var(--mm-primary);
    --bs-btn-border-color: rgba(22, 127, 115, 0.42);
    --bs-btn-hover-bg: var(--mm-primary);
    --bs-btn-hover-border-color: var(--mm-primary);
    --bs-btn-active-bg: var(--mm-primary-dark);
    --bs-btn-active-border-color: var(--mm-primary-dark);
}

.form-control:focus,
.form-select:focus {
    border-color: #6aaea5;
    box-shadow: 0 0 0 0.2rem rgba(22, 127, 115, 0.11);
}

.form-check-input:checked {
    background-color: var(--mm-primary);
    border-color: var(--mm-primary);
}

.sidebar-shell {
    background: linear-gradient(
        180deg,
        var(--mm-sidebar) 0%,
        var(--mm-sidebar-deep) 100%
    );
    border-right: 1px solid var(--mm-border);
    box-shadow: 5px 0 24px rgba(35, 62, 59, 0.055);
}

.sidebar-brand {
    background: rgba(255, 255, 255, 0.72);
    border-bottom: 1px solid var(--mm-border);
}

.brand-link {
    align-items: center;
    display: flex;
    gap: 0.8rem;
    min-height: 68px;
    padding: 0.78rem 1rem;
    text-decoration: none;
}

.sidebar-logo {
    align-items: center;
    background: #fff;
    border: 1px solid #dce7e3;
    border-radius: 0.72rem;
    box-shadow: 0 7px 18px rgba(27, 73, 66, 0.1);
    display: inline-flex;
    height: 36px;
    justify-content: center;
    overflow: hidden;
    width: 44px;
}

.sidebar-logo img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.sidebar-shell .brand-text {
    color: var(--mm-navy) !important;
    font-size: 1.02rem;
    font-weight: 750;
    letter-spacing: -0.015em;
}

.sidebar-heading {
    color: #899590;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin: 0 1rem 0.6rem;
    text-transform: uppercase;
}

.sidebar-shell .sidebar-menu .nav-link {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 0.65rem;
    box-sizing: border-box;
    color: #45545d;
    display: flex;
    margin: 0.15rem 0.65rem;
    min-height: 44px;
    padding: 0.66rem 0.75rem;
    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}

.sidebar-shell .sidebar-menu > .nav-item > .nav-link {
    margin-left: 0.65rem;
    margin-right: 0.65rem;
    width: calc(100% - 1.3rem);
}

.sidebar-shell .sidebar-menu .nav-link:hover,
.sidebar-shell .sidebar-menu .nav-link:focus-visible {
    background: rgba(22, 127, 115, 0.065);
    color: var(--mm-primary-dark);
}

.sidebar-shell .sidebar-menu .nav-link .nav-icon {
    color: #52716d;
    font-size: 1rem;
    margin-right: 0.7rem;
}

.sidebar-menu .nav-link p {
    align-items: center;
    display: flex;
    flex: 1;
    font-size: 0.9rem;
    gap: 0.5rem;
    justify-content: space-between;
    margin: 0;
    min-width: 0;
}

.sidebar-shell .sidebar-menu > .nav-item > .nav-link.active {
    background: var(--mm-sidebar-active) !important;
    border-color: rgba(22, 127, 115, 0.32);
    box-shadow: none;
    color: var(--mm-primary-dark) !important;
}

.sidebar-shell .sidebar-menu .nav-link.active .nav-icon {
    color: var(--mm-primary) !important;
}

.sidebar-shell .sidebar-menu > .nav-item.menu-open > .nav-link,
.sidebar-shell .sidebar-menu > .nav-item.menu-open > .nav-link.active {
    background: #e9eeec !important;
    border-color: transparent;
    color: var(--mm-navy) !important;
}

.sidebar-shell .sidebar-menu > .menu-open > .nav-link .nav-icon {
    color: var(--mm-primary-dark) !important;
}

.sidebar-menu .nav-link.disabled {
    color: #8e9a9d;
    opacity: 1;
}

.sidebar-menu .nav-link.disabled .nav-icon {
    color: #9aa7a7;
}

.sidebar-menu-toggle {
    align-items: center;
    background: #dfe9e6;
    border-radius: 0.32rem;
    display: inline-flex;
    flex: 0 0 20px;
    font-size: 0;
    height: 20px;
    justify-content: center;
    margin-left: auto;
    color: var(--mm-primary-dark);
    width: 20px;
}

.sidebar-menu-toggle::before {
    content: "+";
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
}

.sidebar-menu .menu-open > .nav-link .sidebar-menu-toggle::before {
    content: "\2212";
}

.sidebar-menu .nav-treeview {
    margin: 0.2rem 0.65rem 0.45rem 1.25rem;
    padding-left: 0.75rem;
    position: relative;
}

.sidebar-menu .nav-treeview::before {
    background: #cddbd7;
    bottom: 0.55rem;
    content: "";
    left: 0;
    position: absolute;
    top: 0;
    width: 1px;
}

.sidebar-menu .nav-treeview .nav-item {
    position: relative;
}

.sidebar-menu .nav-treeview .nav-item::before {
    background: #cddbd7;
    content: "";
    height: 1px;
    left: -0.8rem;
    position: absolute;
    top: 1.35rem;
    width: 0.55rem;
}

.sidebar-menu .nav-treeview .nav-link {
    border-radius: 0.55rem;
    margin-left: 0;
    margin-right: 0;
    min-height: 40px;
    padding: 0.55rem 0.55rem;
    width: 100%;
}

.sidebar-menu .nav-treeview .nav-link .nav-icon {
    display: none;
}

.sidebar-menu .nav-treeview .nav-link p {
    font-size: 0.86rem;
    line-height: 1.3;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.sidebar-shell .sidebar-menu .nav-treeview .nav-link.active {
    background: #f4faf8 !important;
    border-color: rgba(22, 127, 115, 0.28);
    box-shadow: none;
    color: var(--mm-primary-dark) !important;
}

@media (min-width: 992px) {
    .sidebar-mini.sidebar-collapse .sidebar-menu-toggle,
    .sidebar-mini.sidebar-collapse .sidebar-heading,
    .sidebar-mini.sidebar-collapse .sidebar-menu .nav-treeview {
        display: none;
    }
}

.app-header {
    background: rgba(255, 255, 255, 0.96) !important;
    border-bottom: 1px solid var(--mm-border);
    box-shadow: 0 2px 16px rgba(32, 57, 54, 0.035);
    min-height: 64px;
}

.app-header .nav-link {
    color: #5e6e73;
}

.app-header .nav-link:hover,
.app-header .nav-link:focus-visible {
    color: var(--mm-primary);
}

.company-context,
.user-menu .dropdown-toggle > span {
    display: flex;
    flex-direction: column;
}

.company-context {
    border-left: 1px solid var(--mm-border);
    line-height: 1.2;
    margin-left: 0.5rem;
    padding-left: 1rem;
}

.company-name,
.user-name {
    color: var(--mm-navy);
    font-size: 0.84rem;
    font-weight: 700;
}

.company-period,
.user-role {
    color: var(--mm-muted);
    font-size: 0.72rem;
    margin-top: 0.2rem;
}

.company-period {
    white-space: nowrap;
}

.user-avatar {
    align-items: center;
    background: var(--mm-primary-soft);
    border-radius: 50%;
    color: var(--mm-primary);
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 800;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.user-avatar-lg {
    flex: 0 0 auto;
    font-size: 1rem;
    height: 48px;
    width: 48px;
}

.profile-menu {
    background: #fff;
    border: 1px solid var(--mm-border);
    border-radius: 0.9rem;
    box-shadow: 0 16px 38px rgba(27, 52, 49, 0.11) !important;
    min-width: 260px;
    padding: 0.55rem;
}

.profile-summary {
    align-items: center;
    display: flex;
    gap: 0.8rem;
    padding: 0.55rem;
}

.profile-summary div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-summary strong {
    font-size: 0.9rem;
}

.profile-summary span:last-child {
    color: var(--mm-muted);
    font-size: 0.76rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu .dropdown-item {
    border-radius: 0.45rem;
    font-size: 0.86rem;
    padding: 0.62rem 0.7rem;
}

.profile-menu .dropdown-item:hover,
.profile-menu .dropdown-item:focus {
    background: var(--mm-primary-soft);
    color: var(--mm-primary-dark);
}

.page-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    min-height: 76px;
}

.page-heading h1 {
    color: var(--mm-navy);
    font-size: clamp(1.5rem, 2vw, 1.85rem);
    font-weight: 700;
    margin: 0;
}

.page-eyebrow {
    color: var(--mm-primary);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    margin: 0 0 0.2rem;
    text-transform: uppercase;
}

.period-pill {
    align-items: center;
    background: #fff;
    border: 1px solid var(--mm-border);
    border-radius: 2rem;
    box-shadow: 0 5px 16px rgba(35, 62, 59, 0.035);
    color: #506067;
    display: flex;
    font-size: 0.8rem;
    gap: 0.55rem;
    padding: 0.55rem 0.85rem;
}

.period-pill i {
    color: var(--mm-primary);
}

.welcome-panel {
    align-items: center;
    background: linear-gradient(
        120deg,
        #0f6f67 0%,
        #1a8f81 58%,
        #39a89a 100%
    );
    border-radius: 1.1rem;
    box-shadow: 0 16px 34px rgba(15, 111, 103, 0.16);
    color: #fff;
    display: flex;
    justify-content: space-between;
    overflow: hidden;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    position: relative;
}

.welcome-panel::before,
.welcome-panel::after {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    content: "";
    pointer-events: none;
    position: absolute;
}

.welcome-panel::before {
    background: rgba(255, 255, 255, 0.055);
    height: 260px;
    right: -75px;
    top: -135px;
    width: 260px;
}

.welcome-panel::after {
    background: rgba(255, 255, 255, 0.04);
    bottom: -130px;
    height: 225px;
    right: 105px;
    width: 225px;
}

.welcome-panel > * {
    position: relative;
    z-index: 1;
}

.welcome-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    opacity: 0.76;
    text-transform: uppercase;
}

.welcome-panel h2 {
    font-size: clamp(1.5rem, 3vw, 2.15rem);
    font-weight: 700;
}

.welcome-panel p:last-child {
    margin: 0;
    max-width: 650px;
    opacity: 0.8;
}

.welcome-mark {
    align-items: center;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 1rem;
    display: flex;
    font-size: 2rem;
    height: 76px;
    justify-content: center;
    margin-left: 1rem;
    width: 76px;
}

.welcome-brand-logo {
    background: #fff;
    border-radius: 0.7rem;
    height: 56px;
    object-fit: contain;
    padding: 0.2rem;
    width: 64px;
}

.status-card,
.content-card {
    background: #fff;
    border: 1px solid var(--mm-border);
    border-radius: 1rem;
    box-shadow: var(--mm-shadow);
}

.status-card .card-body {
    padding: 1.35rem;
}

.status-icon,
.content-icon {
    align-items: center;
    border-radius: 0.7rem;
    display: flex;
    height: 42px;
    justify-content: center;
    margin-bottom: 1.1rem;
    width: 42px;
}

.status-icon-primary,
.content-icon {
    background: var(--mm-primary-soft);
    color: var(--mm-primary);
}

.status-icon-success {
    background: #e7f5f1;
    color: var(--mm-primary-dark);
}

.status-icon-neutral {
    background: #edf5f3;
    color: #47776f;
}

.status-label {
    color: var(--mm-muted);
    font-size: 0.76rem;
    font-weight: 650;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
}

.status-card h3 {
    color: var(--mm-navy);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.22rem;
}

.status-meta {
    color: var(--mm-muted);
    font-size: 0.8rem;
}

.app-footer {
    background: #fff;
    border-top: 1px solid var(--mm-border);
    color: var(--mm-muted);
    display: flex;
    font-size: 0.76rem;
    justify-content: space-between;
}

.move-draft-modal {
    border: 1px solid var(--mm-border);
    border-radius: 1rem;
    box-shadow: 0 24px 64px rgba(25, 54, 50, 0.18);
    overflow: hidden;
}

.move-draft-message,
.move-draft-voucher {
    color: var(--mm-muted);
    font-size: 0.84rem;
}

.move-draft-voucher {
    background: var(--mm-primary-soft);
    border-radius: 0.55rem;
    color: var(--mm-primary-dark);
    font-weight: 700;
    padding: 0.55rem 0.7rem;
}

.voucher-history-card {
    overflow: hidden;
}

.voucher-history-header {
    align-items: center;
    border-bottom: 1px solid var(--mm-border);
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
}

.voucher-history-header .content-icon {
    flex: 0 0 42px;
    margin: 0;
}

.voucher-history-header h2 {
    color: var(--mm-navy);
    font-size: 1rem;
    margin: 0;
}

.voucher-history-header p {
    color: var(--mm-muted);
    font-size: 0.78rem;
    margin: 0.2rem 0 0;
}

.voucher-revision {
    background: var(--mm-primary-soft);
    border-radius: 99px;
    color: var(--mm-primary-dark);
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: auto;
    padding: 0.35rem 0.65rem;
    white-space: nowrap;
}

.voucher-history-table {
    min-width: 850px;
}

.voucher-history-table th {
    background: #f5f8f7;
    color: #53676d;
    font-size: 0.68rem;
    padding: 0.7rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.voucher-history-table td {
    border-color: #edf1ef;
    font-size: 0.78rem;
    padding: 0.7rem;
    vertical-align: top;
}

.voucher-history-reason {
    min-width: 240px;
    overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
    .voucher-history-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .voucher-revision {
        margin-left: 0;
    }
}

/* Authentication */
.auth-page {
    background:
        radial-gradient(circle at 12% 15%, rgba(22, 127, 115, 0.14), transparent 24%),
        radial-gradient(circle at 85% 85%, rgba(82, 158, 143, 0.09), transparent 26%),
        linear-gradient(145deg, #fafbf9, #eef3f1);
    min-height: 100vh;
}

.auth-page::before {
    background-image:
        linear-gradient(rgba(22, 83, 76, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 83, 76, 0.03) 1px, transparent 1px);
    background-size: 42px 42px;
    content: "";
    inset: 0;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
    pointer-events: none;
    position: fixed;
}

.auth-shell {
    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    position: relative;
}

.auth-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(218, 225, 238, 0.9);
    border-radius: 1.15rem;
    box-shadow: 0 24px 70px rgba(27, 62, 57, 0.12);
    max-width: 440px;
    padding: clamp(1.5rem, 5vw, 2.4rem);
    width: 100%;
}

.auth-brand {
    align-items: center;
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    min-width: 0;
}

.auth-logo {
    align-items: center;
    background: #fff;
    border: 1px solid #e1e6ef;
    border-radius: 1rem;
    box-shadow: 0 12px 28px rgba(22, 94, 84, 0.12);
    display: flex;
    flex: 0 0 92px;
    height: 68px;
    justify-content: center;
    overflow: hidden;
    padding: 0.35rem;
    width: 92px;
}

.auth-logo img {
    display: block;
    height: 54px;
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    width: 82px;
}

.auth-brand-copy {
    min-width: 0;
}

.auth-eyebrow {
    color: var(--mm-primary);
    font-size: 0.67rem;
    font-weight: 750;
    letter-spacing: 0.11em;
    margin: 0 0 0.25rem;
    text-transform: uppercase;
}

.auth-brand h1 {
    color: var(--mm-navy);
    font-size: clamp(1.25rem, 4vw, 1.55rem);
    font-weight: 750;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0;
}

.auth-subtitle {
    color: var(--mm-muted);
    font-size: 0.82rem;
    margin: 0.3rem 0 0;
}

.auth-card .form-label {
    color: #344057;
    font-size: 0.8rem;
    font-weight: 650;
}

.auth-input .input-group-text,
.auth-input .form-control,
.password-toggle {
    background: #f9fafc;
    border-color: #dbe1eb;
    min-height: 48px;
}

.auth-input .input-group-text {
    border-right: 0;
    color: #7d8799;
    padding-left: 0.9rem;
}

.auth-input .form-control {
    border-left: 0;
    box-shadow: none;
    font-size: 0.9rem;
}

.auth-input .form-control:first-child {
    border-left: 1px solid #dbe1eb;
}

.auth-input:focus-within .input-group-text,
.auth-input:focus-within .form-control,
.auth-input:focus-within .password-toggle {
    background: #fff;
    border-color: #6aaea5;
}

.password-toggle {
    border: 1px solid #dbe1eb;
    border-left: 0;
    color: #6e798d;
    padding: 0 0.9rem;
}

.password-toggle:hover,
.password-toggle:focus {
    color: var(--mm-primary);
}

.form-check-label,
.security-note {
    color: var(--mm-muted);
    font-size: 0.76rem;
}

.form-check-input:checked {
    background-color: var(--mm-primary);
    border-color: var(--mm-primary);
}

.security-note {
    color: #6d7890;
}

.security-note i {
    color: var(--mm-success);
}

.auth-submit {
    align-items: center;
    background: linear-gradient(105deg, var(--mm-primary), var(--mm-primary-dark));
    border: 0;
    border-radius: 0.65rem;
    box-shadow: 0 10px 22px rgba(22, 127, 115, 0.2);
    display: flex;
    font-size: 0.9rem;
    font-weight: 700;
    justify-content: center;
    min-height: 48px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.auth-submit i {
    margin-left: 0.55rem;
    transition: transform 0.18s ease;
}

.auth-submit:hover {
    box-shadow: 0 12px 26px rgba(22, 127, 115, 0.27);
    transform: translateY(-1px);
}

.auth-submit:hover i {
    transform: translateX(2px);
}

.auth-alert {
    border: 0;
    border-radius: 0.6rem;
    font-size: 0.79rem;
    padding: 0.8rem 0.9rem;
}

.auth-support,
.auth-footer {
    color: #7b8598;
    font-size: 0.72rem;
    margin: 1.5rem 0 0;
    text-align: center;
}

.auth-footer {
    margin-top: 1.25rem;
}

.password-help,
.password-help ul {
    color: var(--mm-muted);
    font-size: 0.75rem;
}

.password-help ul {
    margin-bottom: 0;
    padding-left: 1.1rem;
}

@media (max-width: 575.98px) {
    .app-header {
        min-height: 58px;
    }

    .company-context {
        border-left: 0;
        margin-left: 0;
        max-width: 215px;
        padding-left: 0.15rem;
    }

    .company-context .company-name {
        display: none;
    }

    .company-period {
        font-size: 0.62rem;
        line-height: 1.25;
        white-space: normal;
    }

    .user-menu .dropdown-toggle {
        padding-left: 0.3rem;
        padding-right: 0.3rem;
    }

    .user-avatar {
        height: 32px;
        width: 32px;
    }

    .auth-shell {
        justify-content: flex-start;
        padding-top: 3rem;
    }

    .auth-brand {
        align-items: flex-start;
    }

    .auth-logo {
        border-radius: 0.85rem;
        flex-basis: 76px;
        height: 58px;
        width: 76px;
    }

    .auth-logo img {
        height: 46px;
        width: 70px;
    }

    .security-note {
        display: none;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.8rem;
        padding: 1rem 0;
    }

    .welcome-mark {
        display: none;
    }
}
