html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    width: 100%;
    min-height: 100%;
    margin: 0;
}

body {
    overflow-x: hidden;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.auth-wrapper {
    --ayzo-navy: #071846;
    --ayzo-blue: #2457ff;
    --ayzo-slate: #f5f7fb;
    --ayzo-border: #d8deea;
    box-sizing: border-box;
    min-height: 100dvh;
    background:
        radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--ayzo-blue) 14%, transparent), transparent 28%),
        radial-gradient(circle at 88% 82%, color-mix(in srgb, var(--ayzo-navy) 10%, transparent), transparent 30%),
        linear-gradient(135deg, #eef3ff 0%, var(--ayzo-slate) 50%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    overflow: hidden;
}

.auth-shell {
    display: grid;
    grid-template-columns: 60% 40%;
    width: min(1180px, 100%);
    min-height: min(680px, calc(100dvh - 2.5rem));
    max-height: calc(100dvh - 2.5rem);
    overflow: hidden;
    border: 1px solid var(--ayzo-border);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(18px);
}

.auth-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
    color: #ffffff;
    overflow: hidden;
    background:
        linear-gradient(145deg, var(--ayzo-navy), color-mix(in srgb, var(--ayzo-blue) 82%, var(--ayzo-navy) 18%)),
        url("data:image/svg+xml,%3Csvg width='180' height='180' viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='rgba(255,255,255,0.16)' stroke-width='1'%3E%3Cpath d='M0 60h180M0 120h180M60 0v180M120 0v180'/%3E%3C/g%3E%3C/svg%3E");
}

.auth-brand-panel::after {
    position: absolute;
    right: -120px;
    bottom: -120px;
    width: 320px;
    height: 320px;
    content: "";
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.auth-logo-card {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 220px;
    min-height: 76px;
    padding: 0.85rem 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.2);
}

.auth-brand-copy {
    position: relative;
    z-index: 1;
    max-width: 560px;
}

.auth-eyebrow {
    margin-bottom: 1rem;
    color: #c9d8ff;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.auth-brand-copy h1 {
    margin: 0;
    font-size: clamp(2.35rem, 4vw, 4.25rem);
    font-weight: 900;
    line-height: 0.98;
    letter-spacing: -0.055em;
}

.auth-brand-copy p:last-child {
    max-width: 470px;
    margin-top: 1.4rem;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1.02rem;
    line-height: 1.7;
}

.auth-proof-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.auth-proof-grid span {
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.82rem;
    font-weight: 800;
    text-align: center;
}

.auth-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--mud-palette-surface);
    width: 100%;
    min-height: 100%;
    box-shadow: -18px 0 55px rgba(15, 23, 42, 0.08);
}

.auth-header {
    color: var(--mud-palette-text-primary);
    padding: 3rem 3rem 1rem;
    text-align: left;
}

.auth-body {
    padding: 1.5rem 3rem 2rem;
}

.logo-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.auth-logo {
    width: 174px;
    height: 48px;
    object-fit: contain;
}

.auth-logo-mobile {
    display: none;
    margin-bottom: 1rem;
}

.auth-form .mud-input-root {
    background: var(--mud-palette-surface);
}

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 48px;
    padding: 1rem 1.25rem !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg, var(--mud-palette-primary), var(--mud-palette-secondary)) !important;
    color: #ffffff !important;
    font-size: 1rem !important;
    font-weight: 800 !important;
    text-transform: none !important;
    box-shadow: 0 14px 30px rgba(30, 58, 138, 0.18) !important;
}

.auth-submit:hover {
    background: linear-gradient(135deg, var(--mud-palette-primary-darken), var(--mud-palette-secondary-darken)) !important;
    color: #ffffff !important;
}

.auth-submit .mud-button-label,
.auth-submit .mud-icon-root {
    color: #ffffff !important;
}

.app-brand-header {
    justify-content: center;
    height: 64px;
    min-height: 64px;
}

.app-brand-logo {
    flex: 0 0 auto;
    object-fit: contain;
}

.app-brand-logo-compact {
    width: 40px;
    height: 40px;
}

.app-brand-logo-expanded {
    width: 150px;
    height: 44px;
}

.auth-footer {
    padding: 1.35rem 3rem 3rem;
    background: var(--mud-palette-surface);
    border-top: 1px solid #e2e8f0;
    text-align: left;
}

.select-business-page {
    padding: 1.5rem 0 2rem;
}

.select-business-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.select-business-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.select-business-header-copy {
    max-width: 38rem;
}

.select-business-title {
    margin-top: 0.35rem !important;
    font-weight: 900 !important;
    letter-spacing: -0.04em !important;
}

.select-business-subtitle {
    margin-top: 0.45rem !important;
}

.select-business-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.select-business-action {
    text-transform: none !important;
    font-weight: 700 !important;
}

.select-business-panel {
    padding: 1.5rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 18px;
    background: var(--mud-palette-surface);
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.05);
}

.select-business-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 18rem;
    text-align: center;
}

.select-business-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.select-business-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.select-business-item {
    padding: 1rem 1.1rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 14px;
    cursor: pointer;
    background: var(--mud-palette-surface);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.select-business-item:hover {
    transform: translateY(-1px);
    border-color: var(--mud-palette-primary);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    background: color-mix(in srgb, var(--mud-palette-primary) 4%, var(--mud-palette-surface) 96%);
}

.select-business-item.active {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 7%, var(--mud-palette-surface) 93%);
}

.select-business-item-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.select-business-avatar {
    flex: 0 0 auto;
    font-weight: 800;
}

.select-business-item-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.select-business-name {
    font-weight: 800 !important;
    line-height: 1.2;
}

.select-business-item-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.setup-page {
    padding: 1.5rem 0 2rem;
}

.setup-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setup-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.setup-header-copy {
    max-width: 42rem;
}

.setup-title {
    margin-top: 0.35rem !important;
    font-weight: 900 !important;
    letter-spacing: -0.04em !important;
}

.setup-subtitle {
    margin-top: 0.45rem !important;
}

.setup-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.setup-action {
    text-transform: none !important;
    font-weight: 700 !important;
}

.setup-panel {
    padding: 1.5rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 18px;
    background: var(--mud-palette-surface);
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.05);
}

.setup-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.setup-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.auth-brand-copy h1 {
    font-size: clamp(2.25rem, 4vw, 3.65rem);
}

@media (max-width: 960px) {
    .auth-wrapper {
        padding: 1rem;
        overflow: auto;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        width: min(520px, 100%);
        min-height: auto;
        max-height: none;
        border-radius: 22px;
        box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
    }

    .auth-brand-panel {
        display: none;
    }

    .auth-card {
        min-height: auto;
        box-shadow: none;
    }

    .auth-header {
        padding: 2rem 1.5rem 0.75rem;
        text-align: center;
    }

    .auth-logo-mobile {
        display: inline-block;
    }

    .auth-body {
        padding: 1.25rem 1.5rem 1.5rem;
    }

    .auth-footer {
        padding: 1.25rem 1.5rem 2rem;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .auth-wrapper {
        align-items: stretch;
        padding: 0;
    }

    .auth-shell {
        width: 100%;
        min-height: 100vh;
        border-width: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .auth-header {
        padding-top: 1.5rem;
    }
}

@media (max-width: 640px) {
    .select-business-page {
        padding-top: 1rem;
    }

    .select-business-panel {
        padding: 1rem;
        border-radius: 14px;
    }

    .select-business-list-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .select-business-item-content {
        align-items: flex-start;
        gap: 0.85rem;
    }

    .select-business-item-meta {
        margin-left: auto;
    }

    .setup-page {
        padding-top: 1rem;
    }

    .setup-panel {
        padding: 1rem;
        border-radius: 14px;
    }

    .setup-panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .setup-actions {
        justify-content: stretch;
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .setup-actions .mud-button-root {
        width: 100%;
        min-width: 0;
    }
}

.register-wrapper {
    align-items: stretch;
    padding: 1.25rem;
    overflow: auto;
}

.register-shell {
    display: grid;
    grid-template-columns: minmax(320px, 34%) minmax(0, 66%);
    width: min(1240px, 100%);
    min-height: min(680px, calc(100dvh - 2.5rem));
    max-height: calc(100dvh - 2.5rem);
    margin: auto;
    overflow: hidden;
    border: 1px solid var(--ayzo-border);
    border-radius: 28px;
    background: var(--mud-palette-surface);
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.18);
}

.register-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: 3rem;
    overflow: hidden;
    color: #ffffff;
    background:
        linear-gradient(145deg, var(--ayzo-navy), color-mix(in srgb, var(--ayzo-blue) 82%, var(--ayzo-navy) 18%)),
        url("data:image/svg+xml,%3Csvg width='180' height='180' viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='rgba(255,255,255,0.16)' stroke-width='1'%3E%3Cpath d='M0 60h180M0 120h180M60 0v180M120 0v180'/%3E%3C/g%3E%3C/svg%3E");
}

.register-brand-panel::after {
    position: absolute;
    right: -140px;
    bottom: -140px;
    width: 340px;
    height: 340px;
    content: "";
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.register-card {
    max-height: calc(100dvh - 2.5rem);
    padding: 2rem 2.75rem;
    overflow-y: auto;
    background: var(--mud-palette-surface);
}

.register-card-header {
    max-width: 760px;
    margin-bottom: 1.35rem;
}

.register-title {
    color: var(--mud-palette-text-primary);
    font-weight: 900 !important;
    letter-spacing: -0.04em !important;
}

.register-subtitle {
    margin-top: 0.55rem !important;
    font-size: 1.04rem !important;
}

.register-form {
    max-width: 840px;
}

.register-section {
    margin-bottom: 1.25rem;
}

.register-section-last {
    margin-bottom: 1.5rem;
}

.register-section-title {
    display: flex;
    align-items: center;
    margin-bottom: 0.85rem !important;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-primary);
    font-weight: 800 !important;
}

.register-field {
    margin-bottom: 0.25rem;
}

.register-plan-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.85rem;
    padding: 1rem;
    border: 1px solid color-mix(in srgb, var(--ayzo-blue) 24%, var(--mud-palette-lines-default) 76%);
    border-radius: 16px;
    background: color-mix(in srgb, var(--ayzo-blue) 5%, var(--mud-palette-surface) 95%);
}

.register-plan-summary-title,
.register-plan-price {
    color: var(--mud-palette-text-primary);
    font-weight: 800 !important;
}

.register-submit {
    margin-top: 0.25rem;
}

.register-footer-link {
    margin-top: 1.25rem;
    text-align: center;
}

@media (max-width: 1100px) {
    .register-wrapper {
        overflow: auto !important;
    }

    .register-shell {
        grid-template-columns: 1fr;
        width: min(860px, 100%);
        max-height: none;
        overflow: visible;
    }

    .register-brand-panel {
        min-height: auto;
        padding: 2rem;
    }

    .register-brand-panel .auth-brand-copy h1,
    .register-brand-panel .auth-brand-copy p:last-child,
    .register-brand-panel .auth-proof-grid {
        display: none;
    }

    .register-card {
        max-height: none;
    }
}

@media (max-width: 640px) {
    .register-wrapper {
        padding: 0;
        overflow: auto !important;
    }

    .register-shell {
        min-height: 100dvh;
        max-height: none;
        border: 0;
        border-radius: 0;
        overflow: visible;
    }

    .register-brand-panel {
        display: none;
    }

    .register-card {
        padding: 1.5rem;
        max-height: none;
    }

    .register-card-header {
        text-align: center;
    }
}

@media print {
    .no-print {
        display: none !important;
    }
    .print-only {
        display: block !important;
    }
    .mud-layout {
        display: block !important;
    }
    .mud-main-content {
        padding: 0 !important;
        margin: 0 !important;
    }
    body {
        background-color: white !important;
        color: black !important;
    }
    .mud-container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .no-elevation-print {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
    .mud-table-root {
        width: 100% !important;
    }
}

.print-only {
    display: none;
}

.print-document {
    padding: 20px;
    background: white;
    color: black;
}

.print-header {
    border-bottom: 2px solid #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.print-table th, .print-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.print-table th {
    background-color: #f2f2f2;
}

.print-footer {
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

/* Modern Utilities */
.tracking-wider {
    letter-spacing: 0.05em;
}

.opacity-10 {
    opacity: 0.1;
}

.uppercase {
    text-transform: uppercase;
}

.font-bold {
    font-weight: 700;
}

.font-800 {
    font-weight: 800;
}

.rounded-xl {
    border-radius: 1rem !important;
}

.text-red-accent-4 {
    color: #d50000 !important;
}

/* Drawer Contextual Panels (Below Appbar) */
.below-appbar-drawer {
    top: 48px !important;
    height: calc(100% - 48px) !important;
}

.below-appbar-drawer ~ .mud-drawer-overlay {
    top: 48px !important;
    height: calc(100% - 48px) !important;
}

.bg-slate-50 { background-color: #fbfcfd !important; }
.color-slate-800 { color: #1e293b !important; }
.color-slate-700 { color: #334155 !important; }
.color-slate-600 { color: #475569 !important; }
.color-slate-500 { color: #64748b !important; }
.color-slate-400 { color: #94a3b8 !important; }
.color-primary { color: var(--mud-palette-primary) !important; }

.custom-scroll::-webkit-scrollbar {
    width: 4px;
}
.custom-scroll::-webkit-scrollbar-thumb {
    background-color: #e2e8f0;
    border-radius: 10px;
}

.line-height-1-4 { line-height: 1.4; }
.line-height-1 { line-height: 1.1; }

/* Professional Mini Sidebar Alignment - Final */
.mud-drawer-mini .mud-nav-link {
    justify-content: center !important;
}

.mud-drawer-mini .mud-nav-link-icon-default,
.mud-drawer-mini .mud-icon-root {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

.mini-activator {
    width: 100%;
}

.mini-nav-item .mud-tooltip-root {
    width: 100%;
}

/* Fix for MudMenu in Mini Drawer */
.sidebar-drawer,
.sidebar-drawer .mud-drawer-content {
    overflow: visible !important;
}

.sidebar-flyout {
    z-index: 2000 !important;
}

.hover-bg-light:hover {
    background-color: var(--mud-palette-action-default-hover) !important;
}

.invoice-command-bar {
    position: sticky;
    top: 0;
    z-index: 11;
    background: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-divider);
}

.invoice-totals {
    position: sticky;
    top: 5rem;
}

.invoice-entry-page {
    padding: 0.75rem 1rem 1.5rem;
    background: var(--mud-palette-background);
}

.invoice-entry-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.5rem;
    padding: 0.55rem 0.75rem;
    margin: -0.75rem -1rem 0.75rem;
    background: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-divider);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.invoice-title {
    font-weight: 800;
    line-height: 1.2;
}

.invoice-toolbar-actions,
.invoice-grid-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.invoice-validation-alert {
    margin-bottom: 0.75rem;
}

.invoice-scan-strip {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-info);
    border-radius: 6px;
    position: sticky;
    top: calc(var(--mud-appbar-height, 64px) + 0.35rem);
    z-index: 4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.invoice-scan-input {
    min-width: 0;
    width: 100%;
}

.invoice-scan-input .mud-input-control {
    width: 100%;
}

.invoice-scan-help {
    grid-column: 1 / -1;
}

.invoice-entry-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    gap: 0.75rem;
    align-items: start;
}

.invoice-entry-main {
    min-width: 0;
}

.invoice-panel,
.invoice-summary-card {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
}

.invoice-header-panel {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.invoice-lines-panel {
    overflow: visible;
    margin-bottom: 0.9rem;
}

.invoice-form-modern {
    display: block;
}

.invoice-only-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    gap: 0.75rem;
}

.invoice-only-main {
    max-width: 100%;
}

.invoice-only-aside {
    height: fit-content;
}

.invoice-only-summary-card {
    margin-top: 0;
}

.invoice-sections-grid {
    margin-top: 0.9rem;
}

.invoice-section-block {
    align-self: stretch;
}

.invoice-panel-grid {
    align-items: flex-start;
    row-gap: 0.75rem;
}

.invoice-panel-cell {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.invoice-address-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    min-height: 100%;
}

.invoice-vat-inclusive {
    margin-top: 1.5rem;
}

.invoice-panel-cell .invoice-attachment-box {
    min-height: 100%;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 0.65rem;
}

.invoice-attachment-box .mud-button-root {
    margin-bottom: 0.45rem;
}

.invoice-grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.invoice-section-title {
    font-weight: 800;
}

.invoice-paste-panel {
    padding: 0.75rem;
    border-bottom: 1px solid var(--mud-palette-divider);
    background: var(--mud-palette-background-grey);
}

.invoice-lines-table {
    border-radius: 0;
    overflow: visible;
}

.invoice-lines-table .mud-table-body tr:nth-child(4n+3) > td,
.invoice-lines-table .mud-table-body tr:nth-child(4n+4) > td {
    background: color-mix(in srgb, var(--mud-palette-surface) 96%, var(--mud-palette-background-grey) 4%);
}

.invoice-lines-table .mud-table-container {
    overflow: visible !important;
}

.invoice-lines-table table {
    table-layout: fixed;
    width: 100%;
}

.invoice-lines-table .mud-table-head th {
    background: color-mix(in srgb, var(--mud-palette-surface) 70%, var(--mud-palette-background-grey) 30%) !important;
    color: var(--mud-palette-text-primary);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.invoice-lines-table .mud-table-foot td {
    background: color-mix(in srgb, var(--mud-palette-surface) 78%, var(--mud-palette-background-grey) 22%) !important;
    border-top: 1px solid var(--mud-palette-divider);
    position: sticky;
    bottom: 0;
    z-index: 1;
}

.invoice-lines-table .mud-table-cell {
    padding: .5rem !important;
    vertical-align: middle;
    min-width: 0;
}

.outstanding-documents-table .mud-table-cell,
.outstanding-documents-table .mud-table-head .mud-table-cell,
.outstanding-documents-table .mud-table-body .mud-table-cell {
    padding: 0.28rem 0.45rem !important;
    vertical-align: middle;
}

.outstanding-documents-table .mud-input-control,
.outstanding-documents-table .mud-input-root {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.outstanding-documents-table .mud-input-slot,
.outstanding-documents-table .mud-input,
.outstanding-documents-table .mud-input-control-input-container {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.erp-col-rownum { width: 2.5rem; text-align: center !important; color: var(--mud-palette-text-secondary); font-size: 0.75rem; font-weight: 600; }
.erp-col-code { width: 23%; }
.erp-col-description { width: 20%; }
/*.erp-col-warehouse { width: 15%; }*/
.erp-col-uom { width: 7%; }
.erp-col-num { width: 10%; text-align: right !important; }
.erp-col-qty { width: 6%; }
.erp-col-discount { width: 6%; }
.erp-col-tax { width: 12%; }
.erp-col-total { width: 11%; text-align: right !important; font-weight: 700; white-space: nowrap; }
.erp-col-action { width: 2.5rem; text-align: center !important; padding-left: 0 !important; }

.erp-cell-input .mud-input,
.erp-cell-input .mud-input-control {
    width: 100%;
    min-width: 0;
    font-size: 0.82rem;
}

.erp-cell-input.mud-input-control {
    margin-top: 0 !important;
}

.erp-cell-input .mud-input-outlined {
    padding: 0 8px !important;
    background-color: var(--mud-palette-surface);
    min-height: unset !important;
    height: calc(1.4rem + 8px) !important;
}

.erp-cell-input .mud-input-outlined input,
.erp-cell-input .mud-input-outlined .mud-select-input,
.erp-cell-input .mud-input-outlined .mud-input-slot {
    padding: 0 !important;
    height: 1.4rem !important;
    line-height: 1.4rem !important;
}

.erp-cell-input .mud-input-adornment {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    height: 1.4rem !important;
}

.erp-cell-input .mud-input-adornment .mud-svg-icon {
    font-size: 1.15rem !important;
}

.erp-cell-input .mud-input-control-input-container,
.erp-cell-input .mud-input-slot {
    min-width: 0;
}

.invoice-item-editor {
    flex: 1 1 auto;
    min-width: 0;
}

.erp-number-input input {
    text-align: right;
}

.erp-qty-cell {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    min-width: 0;
}

.erp-muted-cell {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    color: var(--mud-palette-text-secondary);
    font-size: 0.82rem;
}

.erp-item-description-input {
    margin-top: -0.15rem;
}

.erp-item-selected {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2rem;
    padding: 0.22rem 0.2rem;
    border: 1px dashed color-mix(in srgb, var(--mud-palette-divider) 72%, transparent 28%);
    border-radius: 6px;
    cursor: pointer;
}

.erp-item-main {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    flex: 1;
}

.erp-item-code {
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--mud-palette-text-primary);
    white-space: nowrap;
}

.erp-item-name {
    font-size: 0.8rem;
    color: var(--mud-palette-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.erp-item-edit-icon {
    margin-left: auto;
    color: var(--mud-palette-text-secondary);
}


.invoice-item-info-icon {
    padding: 0 !important;
    margin-left: 0.1rem;
    color: var(--mud-palette-text-secondary) !important;
}

.invoice-item-popup {
    min-width: 300px;
    max-width: 380px;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 6px;
    background: var(--mud-palette-surface);
}

.invoice-item-popup-row {
    display: grid;
    grid-template-columns: 6.2rem minmax(0, 1fr);
    gap: 0.5rem;
    align-items: start;
    padding: 0.2rem 0;
}

.invoice-item-popup-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

.invoice-item-popup-value {
    font-size: 0.8rem;
    color: var(--mud-palette-text-primary);
    overflow-wrap: anywhere;
}

.line-item-product-popover {
    width: 520px !important;
    max-width: min(520px, calc(100vw - 24px)) !important;
}

.product-search-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: 100%;
    padding: 0.2rem 0;
}

.product-search-primary {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    min-width: 0;
}

.product-search-code {
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--mud-palette-text-primary);
    white-space: nowrap;
}

.product-search-name {
    font-size: 0.79rem;
    color: var(--mud-palette-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-search-meta {
    display: flex;
    gap: 0.6rem;
    font-size: 0.72rem;
    color: var(--mud-palette-text-secondary);
}

/* ── Type indicator dot ── */
.erp-type-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 0.3rem;
    vertical-align: middle;
}

.erp-type-dot--good {
    background-color: var(--mud-palette-info);
    box-shadow: 0 0 4px color-mix(in srgb, var(--mud-palette-info) 50%, transparent);
}

.erp-type-dot--service {
    background-color: var(--mud-palette-success);
    box-shadow: 0 0 4px color-mix(in srgb, var(--mud-palette-success) 50%, transparent);
}

/* ── Detail row (progressive disclosure) ── */
.erp-detail-row > td {
    padding: 0 !important;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.erp-detail-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 2.25rem;
    padding: 0.4rem 0.75rem 0.5rem 3.2rem;
    font-size: 0.76rem;
    color: var(--mud-palette-text-secondary);
    background: color-mix(in srgb, var(--mud-palette-surface) 92%, var(--mud-palette-primary) 8%);
    border-top: 1px dashed color-mix(in srgb, var(--mud-palette-divider) 60%, transparent);
}

.erp-detail-strip-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    white-space: nowrap;
}

.erp-detail-label {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.03em;
    color: var(--mud-palette-text-secondary);
}

.erp-detail-value {
    color: var(--mud-palette-text-primary);
    font-weight: 500;
}

.erp-detail-toggle {
    padding: 0 !important;
    min-width: 0 !important;
    width: 1.2rem;
    height: 1.2rem;
}

/* ── Empty row treatment ── */
.erp-row-empty > td {
    opacity: 0.45;
}

.erp-row-empty:hover > td {
    opacity: 0.7;
}

/* ── Row action menu ── */
.erp-row-action-btn {
    padding: 2px !important;
    min-width: 0 !important;
}

/* ── Stock indicators ── */
.erp-stock-ok { color: var(--mud-palette-success); }
.erp-stock-low { color: var(--mud-palette-warning); }
.erp-stock-out { color: var(--mud-palette-error); }

/* ── Mobile line item cards ── */
.erp-line-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.erp-line-card {
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    background: var(--mud-palette-surface);
    overflow: hidden;
    border-left: 3px solid var(--mud-palette-lines-default);
    transition: border-color 0.2s ease;
}

.erp-line-card--good {
    border-left-color: var(--mud-palette-info);
}

.erp-line-card--service {
    border-left-color: var(--mud-palette-success);
}

.erp-line-card-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.65rem 0.35rem;
}

.erp-line-card-rownum {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--mud-palette-text-secondary);
    background: color-mix(in srgb, var(--mud-palette-background-grey) 50%, transparent);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    min-width: 1.4rem;
    text-align: center;
}

.erp-line-card-product {
    flex: 1;
    min-width: 0;
}

.erp-line-card-meta {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    padding: 0 0.65rem 0.3rem;
    font-size: 0.72rem;
    color: var(--mud-palette-text-secondary);
}

.erp-line-card-meta .mud-chip {
    height: 1.2rem;
    font-size: 0.65rem;
}

.erp-line-card-desc {
    padding: 0 0.65rem;
}

.erp-line-card-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 0.65rem;
    padding: 0.4rem 0.65rem;
}

/* Mobile cards input styles: support larger touch targets and clean label alignment */
.erp-line-card .erp-cell-input .mud-input-outlined {
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 10px !important;
}

.erp-line-card .erp-cell-input .mud-input-outlined input,
.erp-line-card .erp-cell-input .mud-input-outlined .mud-select-input,
.erp-line-card .erp-cell-input .mud-input-outlined .mud-input-slot {
    height: 40px !important;
    line-height: 40px !important;
    padding: 4px 0 !important;
}

.erp-line-card .erp-cell-input .mud-input-label-outlined {
    transform: translate(14px, 12px) scale(1);
}

.erp-line-card .erp-cell-input .mud-input-label-outlined.mud-input-label-inputcontrol {
    transform: translate(14px, -6px) scale(0.75);
}

.erp-line-card .erp-cell-input .mud-input-adornment {
    height: 40px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.erp-line-card-context {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.74rem;
    color: var(--mud-palette-text-secondary);
    border-top: 1px dashed var(--mud-palette-divider);
}

.erp-line-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.65rem;
    border-top: 1px solid var(--mud-palette-divider);
    background: color-mix(in srgb, var(--mud-palette-surface) 92%, var(--mud-palette-background-grey) 8%);
}

.erp-line-card-total {
    font-weight: 700;
    font-size: 0.92rem;
}

.erp-line-cards-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    background: color-mix(in srgb, var(--mud-palette-surface) 85%, var(--mud-palette-primary) 15%);
    font-weight: 600;
}

.invoice-notes-panel {
    margin-top: 0.9rem;
}

.sales-order-shipping-panel {
    margin-top: 0.75rem;
    padding: 0.75rem;
}

.sales-order-shipping-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: start;
}

.sales-order-shipping-panel {
    margin-top: 0.75rem;
    padding: 0.75rem;
}

.sales-order-shipping-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: start;
}

.sales-order-shipping-col {
    min-width: 0;
}

.sales-order-shipping-toggle {
    display: flex;
    align-items: center;
    min-height: 56px;
    padding-top: 0.2rem;
}

.sales-order-notes-row {
    margin-top: 0.25rem;
}

.invoice-address-summary {
    min-height: 4.15rem;
    padding: 0.55rem 0.65rem;
    background: var(--mud-palette-background-grey);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 6px;
}

.invoice-address-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 1.5rem;
}

.invoice-address-label {
    font-weight: 800;
    color: var(--mud-palette-text-secondary);
    text-transform: uppercase;
}

.invoice-address-text {
    display: -webkit-box;
    margin-top: 0.2rem;
    overflow: hidden;
    color: var(--mud-palette-text-primary);
    line-height: 1.35;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.invoice-address-toggle {
    margin-bottom: 0.25rem;
}

.invoice-summary-rail {
    position: sticky;
    top: 4.25rem;
}

.invoice-summary-card {
    padding: 0.85rem;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0;
    font-size: 0.88rem;
    border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-divider) 78%, transparent 22%);
}

.summary-row span {
    color: var(--mud-palette-text-secondary);
}

.summary-grand {
    margin-top: 0.35rem;
    padding-top: 0.75rem;
    font-size: 1rem;
    border-top: 2px solid var(--mud-palette-divider);
}

.summary-grand strong {
    color: var(--mud-palette-primary);
    font-size: 1.15rem;
}

.summary-balance strong {
    color: var(--mud-palette-error);
}

.summary-base {
    margin-top: 0.65rem;
    padding: 0.45rem;
    background: var(--mud-palette-background-grey);
    border-radius: 6px;
    color: var(--mud-palette-text-secondary);
    font-size: 0.8rem;
    text-align: right;
}

.invoice-attachment-box {
    border: 1px dashed var(--mud-palette-divider);
    border-radius: 8px;
    padding: 0.75rem;
}

.invoice-attachment-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

@media (max-width: 960px) {
    .invoice-command-bar,
    .invoice-totals {
        position: static;
    }

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

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

    .invoice-summary-rail,
    .invoice-entry-toolbar {
        position: static;
    }

    .invoice-only-aside {
        position: static;
    }

    .invoice-vat-inclusive {
        margin-top: 0.35rem;
    }

    .invoice-entry-toolbar,
    .invoice-grid-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .invoice-toolbar-actions,
    .invoice-grid-actions {
        justify-content: flex-start;
    }

    .invoice-scan-input {
        width: 100%;
    }

    .invoice-lines-table .mud-table-head th,
    .invoice-lines-table .mud-table-foot td {
        position: static;
    }

    .sales-order-shipping-grid {
        grid-template-columns: 1fr;
    }

    .sales-order-shipping-toggle {
        min-height: auto;
        padding-top: 0;
    }
}

@media (max-width: 600px) {
    .invoice-scan-strip {
        padding: 0.5rem;
        gap: 0.5rem;
    }
}

/* Shared responsive filter bars */
.filter-toolbar {
    width: 100%;
    row-gap: 0.5rem;
}

.filter-search {
    flex: 0 0 25rem !important;
    width: 25rem;
    min-width: 25rem;
    max-width: 25rem;
}

.filter-quick-filters {
    flex: 0 1 auto;
    min-width: 0;
    row-gap: 0.25rem;
}

.filter-inline-select {
    flex: 0 1 14rem;
    min-width: 12rem;
    max-width: 15rem;
}

.filter-toggle {
    margin-left: auto !important;
    flex: 0 0 auto;
}

.filter-active-chips {
    row-gap: 0.25rem;
}

.filter-clear-button {
    margin-left: auto !important;
}

@media (max-width: 960px) {
    .filter-toolbar-divider {
        display: none !important;
    }

    .filter-search {
        flex: 1 1 18rem !important;
        min-width: 14rem;
        max-width: none;
    }

    .filter-inline-select {
        flex: 1 1 12rem;
        max-width: none;
    }
}

@media (max-width: 600px) {
    .filter-toolbar {
        align-items: stretch !important;
    }

    .filter-search,
    .filter-quick-filters,
    .filter-inline-select {
        flex: 1 1 100% !important;
        min-width: 0;
        max-width: none;
    }

    .filter-toggle {
        margin-left: 0 !important;
        align-self: flex-end;
    }

    .filter-clear-button {
        margin-left: 0 !important;
        width: 100%;
        justify-content: center;
    }
}
.text-right {
    text-align: right !important;
}

.dashboard-root {
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
}

.dashboard-shell {
    max-width: 100% !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    display: grid;
    gap: 1.5rem;
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dashboard-kpi-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 600px) {
    .dashboard-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 960px) {
    .dashboard-kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.dashboard-kpi {
    border: 1px solid var(--mud-palette-divider);
    border-left-width: 4px;
    padding: 0.85rem;
}

.dashboard-kpi-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.dashboard-kpi-value {
    font-weight: 800;
}

.dashboard-kpi-primary { border-left-color: var(--mud-palette-primary); }
.dashboard-kpi-success { border-left-color: var(--mud-palette-success); }
.dashboard-kpi-warning { border-left-color: var(--mud-palette-warning); }
.dashboard-kpi-error { border-left-color: var(--mud-palette-error); }
.dashboard-kpi-info { border-left-color: var(--mud-palette-info); }
.dashboard-kpi-default { border-left-color: var(--mud-palette-action-default); }

.dashboard-panel {
    border: 1px solid var(--mud-palette-divider);
}

.dashboard-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.dashboard-empty {
    padding: 1.25rem;
    display: grid;
    place-items: center;
    gap: 0.4rem;
}

.fund-amount-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    line-height: 1.2;
    min-width: 10rem;
}

/* Theme-aware Backgrounds and Text */
.bg-gray-50 { background-color: var(--mud-palette-background-grey) !important; }
.bg-light { background-color: var(--mud-palette-background-grey) !important; }
.bg-warning-light { background-color: var(--mud-palette-warning-hover) !important; }
.text-warning-dark { color: var(--mud-palette-warning-text) !important; }
.text-muted { color: var(--mud-palette-text-secondary) !important; }

/* ==========================================================================
   GLOBAL DASHBOARD & REPORTING STYLES
   ========================================================================== */

/* --- Typography --- */
.font-black { font-weight: 900 !important; }
.font-bold { font-weight: 700 !important; }
.font-medium { font-weight: 500 !important; }
.uppercase { text-transform: uppercase !important; }
.tracking-wider { letter-spacing: 0.05em !important; }
.report-item-label { color: var(--mud-palette-text-primary) !important; opacity: 0.9 !important; }

/* --- Backgrounds & Borders --- */
.bg-slate-50-theme { background-color: var(--mud-palette-background-grey) !important; }
.border-solid-2 { border: 2px solid var(--mud-palette-divider) !important; }
.border-solid-b { border-bottom: 1px solid var(--mud-palette-divider) !important; }
.border-solid-t { border-top: 1px solid var(--mud-palette-divider) !important; }
.border-dashed-b { border-bottom: 1px dashed var(--mud-palette-divider) !important; }
.opacity-20 { opacity: 0.2 !important; }

/* --- Responsive Filter Bar --- */
.sticky-filter-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider) !important;
}
.filter-search-container { width: 300px; }
.filter-main-item { width: 250px; max-width: 100%; }
.filter-quick-filters {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
}
.filter-quick-filters::-webkit-scrollbar { display: none; }
.filter-quick-filters .mud-chip { flex-shrink: 0; }

@media (max-width: 600px) {
    .filter-toolbar { flex-direction: column !important; align-items: stretch !important; }
    .filter-search-container, .filter-main-item, .filter-quick-filters-container { width: 100%; }
}

/* --- KPI Dashboards --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1rem;
}

@media (min-width: 600px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1280px) {
    .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

/* Explicit class for reports that MUST have 4 columns on large screens */
.kpi-grid-4 {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1rem;
}

@media (min-width: 600px) {
    .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
    .kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Explicit class for reports that MUST have 6 columns on large screens */
.kpi-grid-6 {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1rem;
}

@media (min-width: 600px) {
    .kpi-grid-6 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
    .kpi-grid-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1400px) {
    .kpi-grid-6 { grid-template-columns: repeat(6, 1fr); }
}

.kpi-inner {
    background: var(--mud-palette-surface);
    transition: transform 0.2s ease;
}
.kpi-label { 
    text-transform: uppercase; 
    letter-spacing: 0.1em; 
    font-weight: 800; 
    opacity: 0.7; 
    font-size: 0.7rem; 
}
.kpi-card-success .kpi-inner { border-left: 4px solid var(--mud-palette-success); background: color-mix(in srgb, var(--mud-palette-success) 5%, transparent); }
.kpi-card-error .kpi-inner { border-left: 4px solid var(--mud-palette-error); background: color-mix(in srgb, var(--mud-palette-error) 5%, transparent); }
.kpi-card-primary .kpi-inner { border-left: 4px solid var(--mud-palette-primary); background: color-mix(in srgb, var(--mud-palette-primary) 5%, transparent); }
.kpi-card-info .kpi-inner { border-left: 4px solid var(--mud-palette-info); background: color-mix(in srgb, var(--mud-palette-info) 5%, transparent); }
.kpi-card-warning .kpi-inner { border-left: 4px solid var(--mud-palette-warning); background: color-mix(in srgb, var(--mud-palette-warning) 5%, transparent); }
.kpi-card-default .kpi-inner { border-left: 4px solid var(--mud-palette-action-default); background: color-mix(in srgb, var(--mud-palette-action-default) 5%, transparent); }

/* Form standardization (pilot) */
.form-standard .mud-input-control {
    margin-top: 0.1rem;
    margin-bottom: 0.1rem;
}

.form-standard .mud-input-label {
    font-weight: 600;
}

.form-standard .mud-paper.rounded-lg {
    border: 1px solid var(--mud-palette-divider);
}

/* Product form */
.product-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem);
    gap: 1rem;
    align-items: start;
}

.product-form-main,
.product-form-aside {
    min-width: 0;
}

.product-form-aside {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-form-section,
.product-summary-panel {
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px;
    background: var(--mud-palette-surface);
}

.product-form-section {
    padding: 1rem;
    margin-bottom: 1rem;
}

.product-form-section-accent {
    border-left: 4px solid var(--mud-palette-info);
}

.product-summary-panel {
    padding: 1rem;
}

.product-section-header,
.product-summary-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.product-section-header-compact {
    margin-bottom: 0.75rem;
}

.product-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    border-radius: 8px;
    color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, var(--mud-palette-surface));
}

.product-section-icon-success {
    color: var(--mud-palette-success);
    background: color-mix(in srgb, var(--mud-palette-success) 10%, var(--mud-palette-surface));
}

.product-section-icon-info {
    color: var(--mud-palette-info);
    background: color-mix(in srgb, var(--mud-palette-info) 10%, var(--mud-palette-surface));
}

.product-section-icon-warning {
    color: var(--mud-palette-warning);
    background: color-mix(in srgb, var(--mud-palette-warning) 12%, var(--mud-palette-surface));
}

.product-inline-alert {
    min-height: 3.5rem;
}

.product-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.product-metric {
    min-height: 5rem;
    padding: 0.85rem;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    background: var(--mud-palette-background-grey);
}

.product-metric-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 700;
    text-transform: uppercase;
}

.product-summary-row,
.product-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.product-toggle-row {
    min-height: 4rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.product-summary-list {
    display: grid;
    gap: 0.85rem;
}

@media (max-width: 960px) {
    .product-form-layout {
        grid-template-columns: 1fr;
    }

    .product-form-aside {
        position: static;
        order: -1;
    }
}

@media (max-width: 600px) {
    .product-form-section,
    .product-summary-panel {
        padding: 0.85rem;
    }

    .product-metric-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Enhancements for Transaction Tables */
@media (max-width: 1200px) {
    .transaction-card .mud-table-head {
        display: none !important;
    }

    .transaction-card .mud-table-body .mud-table-row {
        border: 1px solid var(--mud-palette-divider) !important;
        display: flex !important;
        flex-direction: column;
        margin-bottom: 1rem;
        border-radius: 8px;
        overflow: hidden;
        background-color: var(--mud-palette-surface) !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .transaction-card .mud-table-cell {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center;
        width: 100% !important;
        padding: 0.65rem 0.75rem !important;
        border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-divider) 40%, transparent) !important;
        text-align: right !important;
        order: 0;
    }

    /* Mobile Header Styling: Targets .mobile-header OR first-child (if not disabled) */
    .transaction-card .mobile-header,
    .transaction-card .mud-table-cell:first-child:not(.no-mobile-header) {
        background-color: var(--mud-palette-background-grey);
        font-weight: 800 !important;
        font-size: 0.95rem !important;
        justify-content: center !important;
        text-align: center !important;
        border-bottom: 2px solid var(--mud-palette-divider) !important;
        order: -1; /* Move to the top of the card */
    }

    .transaction-card .mobile-header::before,
    .transaction-card .mud-table-cell:first-child:not(.no-mobile-header)::before {
        display: none !important;
    }

    /* Reset styling for first-child if it's explicitly marked as not a header */
    .transaction-card .mud-table-cell:first-child.no-mobile-header {
        background-color: transparent !important;
        font-weight: normal !important;
        font-size: inherit !important;
        justify-content: space-between !important;
        text-align: right !important;
        border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-divider) 40%, transparent) !important;
        order: 0;
    }
    .transaction-card .mud-table-cell:first-child.no-mobile-header::before {
        display: flex !important;
    }

    .transaction-card .mud-table-cell::before {
        content: attr(data-label);
        font-weight: 800;
        text-transform: uppercase;
        font-size: 0.7rem;
        opacity: 0.6;
        margin-right: 1rem;
        text-align: left;
        flex-shrink: 0;
    }

.transaction-card .mud-table-cell:last-child {
        border-bottom: none !important;
    }
}

@media (max-width: 599.98px) {
    .journal-lines-table > .mud-table-container > .mud-table-root .mud-table-cell {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .journal-lines-table .journal-mobile-label .mud-input-control,
    .journal-lines-table .journal-mobile-label .mud-input-control > div,
    .journal-lines-table .journal-mobile-label .mud-input-slot {
        width: 100% !important;
    }
}

@media (min-width: 600px) {
    .journal-lines-table .journal-mobile-label .mud-input-label {
        display: none !important;
    }

    .journal-lines-table .journal-mobile-label .mud-input-outlined-border legend {
        display: none !important;
    }
}

/* --- STANDARD VIEW PAGE STYLES --- */
.detail-shell {
    margin-top: 1.5rem;
    margin-bottom: 2.5rem;
}

/* Digital Document Sheet Style */
.view-document-sheet {
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease;
}

body.mud-theme-dark .view-document-sheet {
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
}

.document-sheet-header {
    border-bottom: 2px solid var(--mud-palette-divider);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.document-sheet-title {
    font-weight: 900;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.document-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.document-info-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.document-info-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mud-palette-text-secondary);
}

.document-info-value {
    font-weight: 700;
}

/* Stepper Pipeline */
.lifecycle-stepper-container {
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
    padding: 1.25rem 2rem;
    box-shadow: 0 2px 8px -1px rgba(0, 0, 0, 0.02);
}

.lifecycle-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.lifecycle-step {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--mud-palette-text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    white-space: nowrap;
}

.lifecycle-step .step-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--mud-palette-background-grey);
    border: 2px solid var(--mud-palette-divider);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--mud-palette-text-secondary);
}

.lifecycle-step .step-icon-wrapper .mud-icon-root {
    font-size: 1.1rem;
}

.lifecycle-step.completed {
    color: var(--mud-palette-success);
    font-weight: 600;
}

.lifecycle-step.completed .step-icon-wrapper {
    background-color: color-mix(in srgb, var(--mud-palette-success) 10%, var(--mud-palette-surface));
    border-color: var(--mud-palette-success);
    color: var(--mud-palette-success);
}

.lifecycle-step.active {
    color: var(--mud-palette-primary);
    font-weight: 700;
}

.lifecycle-step.active .step-icon-wrapper {
    background-color: var(--mud-palette-primary);
    border-color: var(--mud-palette-primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--mud-palette-primary) 15%, transparent);
}

.lifecycle-line {
    flex-grow: 1;
    height: 3px;
    background-color: var(--mud-palette-divider);
    margin: 0 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

.lifecycle-line.active {
    background-color: var(--mud-palette-success);
}

/* Metric KPI Cards */
.metric-card-wrapper {
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s ease;
    border: 1px solid var(--mud-palette-divider) !important;
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
}

.metric-card-wrapper:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.06);
}

body.mud-theme-dark .metric-card-wrapper:hover {
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.35);
}

.metric-card-total {
    background: linear-gradient(135deg, color-mix(in srgb, var(--mud-palette-primary) 4%, var(--mud-palette-surface) 96%) 0%, var(--mud-palette-surface) 100%) !important;
    border-left: 4px solid var(--mud-palette-primary) !important;
}

.metric-card-paid {
    background: linear-gradient(135deg, color-mix(in srgb, var(--mud-palette-success) 4%, var(--mud-palette-surface) 96%) 0%, var(--mud-palette-surface) 100%) !important;
    border-left: 4px solid var(--mud-palette-success) !important;
}

.metric-card-due {
    background: linear-gradient(135deg, color-mix(in srgb, var(--mud-palette-error) 4%, var(--mud-palette-surface) 96%) 0%, var(--mud-palette-surface) 100%) !important;
    border-left: 4px solid var(--mud-palette-error) !important;
}

.metric-card-settled {
    background: linear-gradient(135deg, color-mix(in srgb, var(--mud-palette-info) 4%, var(--mud-palette-surface) 96%) 0%, var(--mud-palette-surface) 100%) !important;
    border-left: 4px solid var(--mud-palette-info) !important;
}

/* Sidebar Info Card Styles */
.info-section-container .mud-paper {
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
    box-shadow: 0 2px 10px -2px rgba(0,0,0,0.02);
}

/* Stepper Responsive Adjustments */
@media (max-width: 768px) {
    .lifecycle-stepper {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .lifecycle-step {
        width: 100%;
    }
    
    .lifecycle-line {
        width: 3px;
        height: 24px;
        flex-grow: 0;
        margin: -8px 0 -8px 14px;
    }
}

/* Printable Document Settings */
@media print {
    body * {
        visibility: hidden;
    }
    
    .view-document-sheet, .view-document-sheet * {
        visibility: visible;
    }
    
    .view-document-sheet {
        position: absolute;
        left: 0;
        top: 0;
        width: 100% !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    .view-document-sheet .bg-gray-50 {
        background-color: #f1f5f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .no-print {
        display: none !important;
    }
    
    .print-full-width {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    .mud-table-cell {
        color: #000000 !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }
    
    .invoice-totals-panel {
        border-color: #cbd5e1 !important;
        background-color: #ffffff !important;
    }
    
    .invoice-grand-total, .invoice-balance-total {
        background-color: #f1f5f9 !important;
        border-top: 1.5px solid #000000 !important;
        border-bottom: 1.5px solid #000000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ==========================================================================
   List Page and Table Responsiveness
   ========================================================================== */

/* Bounded containers to prevent overall page horizontal overflow on mobile */
.list-shell {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Ensure MudPaper table wrappers stay within viewport and enforce scroll on children */
.list-shell .mud-paper {
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden !important; /* Contain the scrollable table inside the card border */
}

/* Force standard MudTable and MudDataGrid containers to scroll horizontally */
.list-shell .mud-table-container,
.list-shell .mud-data-grid {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar styling for list view tables */
.list-shell .mud-table-container::-webkit-scrollbar {
    height: 6px;
}

.list-shell .mud-table-container::-webkit-scrollbar-track {
    background: transparent;
}

.list-shell .mud-table-container::-webkit-scrollbar-thumb {
    background-color: var(--mud-palette-divider);
    border-radius: 3px;
}

/* Mobile responsive padding and density tweaks for list views */
@media (max-width: 600px) {
    .list-shell {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .list-shell .mud-paper.pa-4 {
        padding: 0.75rem !important; /* Reduce excessive card padding on mobile screens */
    }
}

/* ==========================================================================
   Invoice Details: Line Items Responsive Toggle
   ========================================================================== */

/* Desktop: show table, hide card list */
.invoice-items-desktop {
    display: block;
}

.invoice-items-mobile {
    display: none;
}

/* Mobile: hide table, show card list */
@media (max-width: 600px) {
    .invoice-items-desktop {
        display: none !important;
    }

    .invoice-items-mobile {
        display: block !important;
    }
}

/* ==========================================================================
   Ayzo AI Support Chatbot Styles
   ========================================================================== */
.ayzo-chat-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    font-family: inherit;
}

.ayzo-chat-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background-color: transparent;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease-in-out;
    padding: 0;
    overflow: hidden;
}

.ayzo-chat-trigger:hover {
    transform: scale(1.08);
}

.ayzo-chat-trigger-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ayzo-chat-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 320px;
    height: 460px;
    max-height: calc(100vh - 120px);
    max-width: 90vw;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    display: flex;
    flex-direction: column;
}

.ayzo-chat-window.closed {
    display: none !important;
}

.ayzo-chat-window.open {
    display: flex !important;
}

.ayzo-chat-messages {
    background-color: var(--mud-palette-background-grey);
}

.ayzo-chat-bubble {
    max-width: 85%;
    font-size: 0.9rem;
    line-height: 1.45;
}

.user-bubble {
    border-radius: 12px 12px 0 12px !important;
}

.assistant-bubble {
    border-radius: 12px 12px 12px 0 !important;
    background-color: var(--mud-palette-background-grey) !important;
}

.assistant-bubble p {
    margin-bottom: 8px;
}
.assistant-bubble p:last-child {
    margin-bottom: 0;
}
.assistant-bubble ul, .assistant-bubble ol {
    margin-bottom: 8px;
    padding-left: 16px;
}
.assistant-bubble li {
    margin-bottom: 4px;
}

/* Typing Dots Animation */
.dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #90a4ae;
    animation: wave 1.3s linear infinite;
}

.dot:nth-child(2) {
    animation-delay: -1.1s;
}

.dot:nth-child(3) {
    animation-delay: -0.9s;
}

@keyframes wave {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

/* --- RTL Global Typography Adjustments --- */
html[dir="rtl"] body {
    font-size: 1.05rem; /* Slightly larger base font size for Arabic legibility */
    letter-spacing: 0 !important; /* Arabic cursive script should not have letter spacing */
}

html[dir="rtl"] .mud-typography {
    line-height: 1.6;
}

html[dir="rtl"] .mud-input-label,
html[dir="rtl"] .mud-input-input {
    font-size: 0.95rem;
}

html[dir="rtl"] .mud-button-label {
    font-size: 0.95rem;
    font-weight: 700;
}

/* ==========================================================================
   Business Copilot Page Styles
   ========================================================================== */
.copilot-root {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
    background-color: var(--mud-palette-background);
}

.copilot-shell {
    max-width: 100% !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

.copilot-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.copilot-eyebrow {
    letter-spacing: 0.15em;
    font-weight: 800;
    color: var(--mud-palette-primary);
    margin-bottom: 0.25rem;
    display: block;
}

.copilot-title {
    font-weight: 900;
    letter-spacing: -0.03em;
}

.copilot-subtitle {
    color: var(--mud-palette-text-secondary);
    opacity: 0.8;
}

.copilot-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.copilot-chat-panel {
    display: flex;
    flex-direction: column;
    height: 720px;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
    overflow: hidden;
}

.copilot-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background-color: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-divider);
}

.copilot-panel-title {
    font-weight: 700;
}

.copilot-panel-subtitle {
    color: var(--mud-palette-text-secondary);
}

.copilot-suggestions {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--mud-palette-background-grey);
    border-bottom: 1px solid var(--mud-palette-divider);
    overflow-x: auto;
    scrollbar-width: none;
}

.copilot-suggestions::-webkit-scrollbar {
    display: none;
}

.copilot-suggestion-button {
    white-space: nowrap;
    border-radius: 99px !important;
    background-color: var(--mud-palette-surface) !important;
    text-transform: none !important;
    font-size: 0.8rem !important;
    border: 1px solid var(--mud-palette-divider) !important;
}

.copilot-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background-color: var(--mud-palette-background);
}

.copilot-message-row {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.copilot-message-row.user {
    align-self: flex-end;
    align-items: flex-end;
}

.copilot-message-row.assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.copilot-message-bubble {
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.user-bubble {
    background-color: var(--mud-palette-primary);
    color: #ffffff;
    border-radius: 16px 16px 0 16px;
}

.assistant-bubble {
    background-color: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 16px 16px 16px 0;
}

.copilot-message-time {
    font-size: 0.7rem;
    color: var(--mud-palette-text-secondary);
    margin-top: 0.35rem;
    opacity: 0.6;
    padding: 0 36px;
}

.copilot-message-row.user .copilot-message-time {
    text-align: right;
}

.copilot-tool-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0 36px;
}

.copilot-thinking {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
}

.copilot-input {
    padding: 1.25rem 1.5rem;
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-divider);
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.copilot-input-field {
    background-color: var(--mud-palette-background);
    border-radius: 8px;
}

.copilot-sidebar-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.copilot-sidebar {
    padding: 1.25rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
}

.copilot-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

.copilot-metric {
    padding: 1rem;
    background-color: var(--mud-palette-background-grey);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
}

.copilot-metric-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--mud-palette-text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.copilot-metric-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--mud-palette-text-primary);
}

.copilot-metric-caption {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
    margin-top: 0.15rem;
    opacity: 0.8;
}

.copilot-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.copilot-list-row {
    display: flex;
    gap: 0.75rem;
}

.copilot-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 0.4rem;
    flex-shrink: 0;
}

.copilot-list-title {
    font-weight: 700;
}

.copilot-list-detail {
    color: var(--mud-palette-text-secondary);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.copilot-suggestion-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.copilot-suggestion-link {
    text-transform: none !important;
    text-align: left !important;
    justify-content: flex-start !important;
    padding-left: 0 !important;
}

.copilot-detail-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 1rem;
}

.copilot-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.65rem;
    border-bottom: 1px dashed var(--mud-palette-divider);
    font-size: 0.85rem;
}

.copilot-detail-row:last-child {
    border-bottom: none;
}

.copilot-detail-row span:first-child {
    color: var(--mud-palette-text-secondary);
}

.copilot-detail-row span:last-child {
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

@media (max-width: 960px) {
    .copilot-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .copilot-chat-panel {
        height: 600px;
    }
}

/* Sidebar Favorite & Reorder Actions */
.menu-item-wrapper {
    position: relative;
}
.menu-item-wrapper .action-buttons-container {
    opacity: 0.5;
    transition: opacity 0.2s ease-in-out;
}
.menu-item-wrapper:hover .action-buttons-container {
    opacity: 1;
}
.menu-item-wrapper .action-buttons-container .reorder-btn {
    opacity: 0;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.menu-item-wrapper:hover .action-buttons-container .reorder-btn {
    opacity: 0.6;
}
.menu-item-wrapper .action-buttons-container .reorder-btn:hover {
    opacity: 1;
    transform: scale(1.15);
}
.menu-item-wrapper .action-buttons-container .favorite-btn {
    transition: transform 0.2s ease-in-out;
}
.menu-item-wrapper .action-buttons-container .favorite-btn:hover {
    transform: scale(1.15);
}
