#blazor-error-ui {
    background: #fff3cd;
    color: #664d03;
    bottom: 0;
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 10000;
    border-top: 1px solid #ffecb5;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.75rem;
}

html,
body,
#app {
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
}

body {
    overflow-x: hidden;
}

.crm-shell {
    position: relative;
    width: 100%;
}

.crm-sidebar {
    width: 280px;
    flex: 0 0 280px;
}

.crm-mobile-menu-toggle,
.crm-sidebar-backdrop {
    display: none;
}

.crm-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (min-width: 992px) {
    .crm-sidebar {
        transition: width 0.2s ease, flex-basis 0.2s ease;
    }

    .crm-shell.sidebar-collapsed .crm-sidebar {
        width: 84px;
        flex: 0 0 84px;
    }

    .crm-shell.sidebar-collapsed .sidebar {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .crm-shell.sidebar-collapsed .sidebar .crm-sidebar-brand-text,
    .crm-shell.sidebar-collapsed .sidebar .crm-sidebar-brand-badge,
    .crm-shell.sidebar-collapsed .sidebar .border-top {
        display: none !important;
    }

    .crm-shell.sidebar-collapsed .sidebar .nav-link {
        justify-content: center;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .crm-shell.sidebar-collapsed .sidebar .nav-link span {
        display: none !important;
    }
}

@media (max-width: 991.98px) {
    .crm-mobile-menu-toggle {
        display: inline-flex;
        position: fixed;
        left: 1rem;
        top: 1rem;
        z-index: 1052;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    }

    .crm-sidebar-backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 1048;
        border: 0;
        padding: 0;
    }

    .crm-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        height: 100vh;
        max-width: min(86vw, 320px);
        width: min(86vw, 320px);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 1049;
        overflow-y: auto;
        box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.25);
    }

    .crm-sidebar.open {
        transform: translateX(0);
    }

    .crm-main {
        width: 100%;
        min-width: 0;
    }

    .crm-header {
        padding-top: 4rem !important;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    .crm-header,
    .crm-page-header,
    .crm-filter-alert {
        flex-wrap: wrap;
    }

    .crm-page-actions,
    .crm-header-actions {
        width: 100%;
        justify-content: stretch;
    }

    .crm-page-actions > *,
    .crm-header-actions > * {
        flex: 1 1 auto;
    }

    .crm-content {
        padding: 1rem !important;
    }

    .modal-dialog {
        margin: 0.75rem;
    }

    .sticky-top {
        position: static !important;
        top: auto !important;
    }

    .btn-group {
        flex-wrap: wrap;
    }
}

@media (max-width: 767.98px) {
    .crm-page-header > div:first-child,
    .crm-filter-alert > span {
        width: 100%;
    }

    .table-responsive {
        font-size: 0.92rem;
    }
}

.crm-token-select {
    position: relative;
}

.crm-token-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #0d6efd;
    color: #fff;
    border-radius: 999px;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
}

.crm-token-pill .btn {
    text-decoration: none;
    line-height: 1;
}

.crm-token-results {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.12);
}

.crm-progress-circle {
    --size: 140px;
    --progress: 0;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: conic-gradient(#0d6efd calc(var(--progress) * 1%), #e9ecef 0);
    display: grid;
    place-items: center;
}

.crm-progress-inner {
    width: calc(var(--size) - 22px);
    height: calc(var(--size) - 22px);
    background: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    text-align: center;
}

[data-page-break="true"] {
    display: block;
    height: 0;
    border-top: 2px dashed #64748b;
    margin: 1rem 0;
    position: relative;
}

.crm-header-user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
}

/* AI Auto Reply Premium Button */
.btn-gradient-auto-reply {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 50%, #075E54 100%);
    border: none;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
    transition: all 0.25s ease-in-out;
}

.btn-gradient-auto-reply:hover {
    background: linear-gradient(135deg, #20bd5a 0%, #0e786c 50%, #054840 100%);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.5);
    transform: translateY(-1px);
}

.btn-gradient-auto-reply:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

[data-page-break="true"]::after {
    content: "Sayfa Sonu";
    position: absolute;
    top: -0.8rem;
    right: 0;
    font-size: 0.72rem;
    background: #fff;
    color: #64748b;
    padding: 0 0.35rem;
}

@media print {
    /* Hide global app header and navigation when printing invoices */
    .crm-header,
    .crm-mobile-menu-toggle,
    .crm-sidebar-backdrop,
    .navbar,
    header,
    .page-title {
        display: none !important;
    }

    /* Ensure banner/logo/footer images fit within printable area */
    .invoice-logo,
    .invoice-footer-img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        display: block;
        margin-bottom: 1rem;
    }

    [data-page-break="true"] {
        border: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        break-after: page;
        page-break-after: always;
    }

    [data-page-break="true"]::after {
        content: "" !important;
    }
}
