:root {
    --font-sans: "Plus Jakarta Sans", "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
    --border: #dbe3ee;
    --bg-soft: #f5f7fb;
}

body {
    font-family: var(--font-sans);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.internal-chat-root .hidden {
    display: none !important;
}

.crm-body {
    background: linear-gradient(180deg, #f8fafc 0%, #f2f5fa 100%);
    color: #0f172a;
}

.crm-sidebar {
    width: 280px;
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, #f8fbff 0%, #f5f8ff 48%, #f8fafc 100%);
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: inset -1px 0 0 rgba(148, 163, 184, 0.15);
}

.crm-sidebar-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 88px;
}

.crm-sidebar-logo {
    display: block;
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.crm-sidebar-logo-dark {
    display: none;
}

html[data-theme='dark'] .crm-sidebar-logo-light {
    display: none;
}

html[data-theme='dark'] .crm-sidebar-logo-dark {
    display: block;
}

.crm-menu-nav {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    isolation: isolate;
}

.crm-menu-indicator {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 12px;
    height: 46px;
    border-radius: 14px;
    border: 1px solid #bfd2ff;
    background: linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
    box-shadow: 0 12px 22px rgba(37, 99, 235, 0.15);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    transition:
        top .55s cubic-bezier(0.68, -0.55, 0.265, 1.55),
        height .28s ease,
        opacity .2s ease;
}

.crm-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 700;
    color: #334155;
    border: 1px solid transparent;
    position: relative;
    z-index: 2;
    transition: color .22s ease, transform .22s ease;
}

.crm-menu-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.crm-menu-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-menu-label {
    position: relative;
    z-index: 2;
}

.menu-activity-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: radial-gradient(circle at 35% 30%, #ff8e8e 0%, #ef4444 45%, #d91515 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    margin-left: auto;
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow:
        0 0 0 2px rgba(239, 68, 68, 0.55),
        0 8px 16px rgba(239, 68, 68, 0.45);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.menu-activity-badge.hidden {
    display: none !important;
}

.top-nav-badge {
    margin-left: 6px;
    transform: translateY(-6px);
}

.crm-menu-item:hover {
    color: #1d4ed8;
    transform: translateX(4px);
}

.crm-menu-item-active {
    color: #1e40af;
}

.crm-topbar {
    height: 84px;
    border-bottom: 1px solid var(--border);
    background: #ffffff;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}

.crm-primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffb04e 0%, #f88a1a 52%, #dd6a06 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    padding: 12px 20px;
    box-shadow: 0 12px 24px rgba(233, 127, 22, 0.34);
    transition: all .2s ease;
}

.crm-primary-btn:hover {
    background: linear-gradient(135deg, #ffb964 0%, #fd952a 52%, #e5760f 100%);
}

.crm-search-form {
    width: min(620px, 60vw);
    display: flex;
    align-items: center;
    gap: 8px;
}

.crm-search-input,
.crm-input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font-size: 15px;
    padding: 10px 12px;
    outline: none;
    transition: box-shadow .2s ease, border-color .2s ease;
}

.crm-search-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 48px;
    padding-left: 16px;
}

.crm-search-submit {
    height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #475569;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.crm-search-submit:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.crm-search-input:focus,
.crm-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, .2);
}

.crm-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.crm-column {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
}

.crm-card {
    border-radius: 14px;
    border: 1px solid #dbe4ef;
    background: #fff;
    padding: 14px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    cursor: grab;
    transition: border-color .16s ease, box-shadow .2s ease, transform .14s ease, opacity .18s ease;
}

.crm-card:hover {
    border-color: #9fb8e6;
    transform: translateY(-1px);
}

.crm-card.dragging {
    opacity: .6;
}

.crm-card.is-saving {
    opacity: .74;
    pointer-events: none;
}

.crm-dropzone.drag-over {
    background: rgba(59, 130, 246, .08);
    border-radius: 12px;
}

.crm-dropzone {
    transition: background-color .16s ease;
}

.crm-icon-btn {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 9px;
}

.crm-icon-btn:hover {
    background: #e2e8f0;
}

.invoice-note-wrap {
    margin-top: 10px;
}

.invoice-note-btn {
    border: 1px solid #f59e0b;
    background: #fffbeb;
    color: #92400e;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .02em;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.invoice-note-btn:hover {
    background: #fef3c7;
    border-color: #d97706;
}

.invoice-note-result {
    margin-top: 6px;
    border: 1px solid #f5d08f;
    background: #fffbeb;
    border-radius: 8px;
    padding: 7px 9px;
    display: none;
}

.invoice-note-result.is-open {
    display: block;
}

.invoice-note-line {
    margin: 0;
    font-size: 12px;
    color: #92400e;
}

.invoice-note-line + .invoice-note-line {
    margin-top: 2px;
}

.crm-order-panel {
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #fff;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.07);
    padding: 18px;
    position: sticky;
    top: 96px;
}

.crm-order-panel [data-close-order-panel] {
    display: none;
}

.crm-order-panel.panel-hidden {
    display: none;
}

@media (max-width: 1279px) {
    .crm-order-panel {
        position: fixed;
        inset: 0 0 0 auto;
        top: 0;
        width: min(100vw, 420px);
        height: 100vh;
        overflow-y: auto;
        border-radius: 0;
        z-index: 80;
        transform: translateX(100%);
        transition: transform .25s ease;
    }

    .crm-order-panel [data-close-order-panel] {
        display: inline-flex;
    }

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

    .crm-search-form {
        width: min(520px, 52vw);
    }
}

@media (max-width: 1024px) {
    .crm-topbar {
        height: auto;
        padding: 14px;
        gap: 10px;
        flex-direction: column;
        align-items: stretch;
    }

    .crm-search-form {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .crm-primary-btn {
        width: 100%;
        justify-content: center;
        font-size: 14px;
        padding: 10px 12px;
    }
}

.crm-theme-toggle {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: all .2s ease;
}

.crm-theme-toggle:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

html[data-theme='dark'] .crm-body {
    background: linear-gradient(180deg, #1d1d1d 0%, #252525 100%);
    color: #ececec;
}

html[data-theme='dark'] .crm-sidebar {
    background: linear-gradient(180deg, #2b2b2b 0%, #303030 48%, #2a2a2a 100%);
    border-right-color: #454545;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
}

html[data-theme='dark'] .crm-menu-indicator {
    border-color: #5f5f5f;
    background: linear-gradient(135deg, #414141 0%, #373737 100%);
    box-shadow: 0 10px 18px rgba(2, 6, 23, 0.5);
}

html[data-theme='dark'] .crm-menu-item {
    color: #d7d7d7;
}

html[data-theme='dark'] .crm-menu-item:hover {
    color: #ffffff;
}

html[data-theme='dark'] .crm-menu-item-active {
    color: #ffffff;
}

html[data-theme='dark'] .crm-topbar {
    background: #2b2b2b;
    border-bottom-color: #454545;
}

html[data-theme='dark'] .crm-search-input,
html[data-theme='dark'] .crm-input {
    background: #252525;
    border-color: #555555;
    color: #ececec;
}

html[data-theme='dark'] .crm-search-submit {
    background: #2a2a2a;
    border-color: #5a5a5a;
    color: #dddddd;
}

html[data-theme='dark'] .crm-search-submit:hover {
    background: #3b3b3b;
    border-color: #737373;
}

html[data-theme='dark'] .crm-search-input:focus,
html[data-theme='dark'] .crm-input:focus {
    border-color: #7a7a7a;
    box-shadow: 0 0 0 3px rgba(200, 200, 200, .18);
}

html[data-theme='dark'] .crm-search-input::placeholder,
html[data-theme='dark'] .crm-input::placeholder {
    color: #a8a8a8;
}

html[data-theme='dark'] .crm-label {
    color: #d7d7d7;
}

html[data-theme='dark'] .crm-column {
    background: #2d2d2d;
    border-color: #454545;
}

html[data-theme='dark'] .crm-card {
    background: #303030;
    border-color: #4a4a4a;
    color: #ececec;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.45);
}

html[data-theme='dark'] .crm-card.is-saving {
    opacity: .7;
}

html[data-theme='dark'] .crm-icon-btn {
    background: #2a2a2a;
    border-color: #5a5a5a;
    color: #dddddd;
}

html[data-theme='dark'] .crm-icon-btn:hover {
    background: #3b3b3b;
}

html[data-theme='dark'] .invoice-note-btn {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    color: #fde68a;
}

html[data-theme='dark'] .invoice-note-btn:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: #fbbf24;
}

html[data-theme='dark'] .invoice-note-result {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(120, 53, 15, 0.35);
}

html[data-theme='dark'] .invoice-note-line {
    color: #fde68a;
}

html[data-theme='dark'] .crm-order-panel {
    background: #303030;
    border-color: #4a4a4a;
    box-shadow: 0 16px 30px rgba(2, 6, 23, 0.55);
}

html[data-theme='dark'] .crm-theme-toggle {
    background: #2a2a2a;
    border-color: #5a5a5a;
    color: #ececec;
}

html[data-theme='dark'] .crm-theme-toggle:hover {
    background: #3b3b3b;
    border-color: #737373;
}

/* Overrides para classes utilitarias mais usadas nas telas Tailwind */
html[data-theme='dark'] .bg-slate-100 { background-color: #252525 !important; }
html[data-theme='dark'] .bg-slate-50 { background-color: #2f2f2f !important; }
html[data-theme='dark'] .bg-white { background-color: #303030 !important; }
html[data-theme='dark'] .text-slate-900 { color: #ececec !important; }
html[data-theme='dark'] .text-slate-800 { color: #e3e3e3 !important; }
html[data-theme='dark'] .text-slate-700 { color: #d2d2d2 !important; }
html[data-theme='dark'] .text-slate-600 { color: #b5b5b5 !important; }
html[data-theme='dark'] .text-slate-500 { color: #aaaaaa !important; }
html[data-theme='dark'] .border-slate-200 { border-color: #4a4a4a !important; }
html[data-theme='dark'] .border-slate-300 { border-color: #5a5a5a !important; }
html[data-theme='dark'] .divide-slate-200 > :not([hidden]) ~ :not([hidden]) { border-color: #4a4a4a !important; }

.internal-chat-root {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1200;
}

.order-notification-alert {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1400;
    width: min(390px, calc(100vw - 28px));
    overflow: hidden;
    border: 1px solid #f0b95b;
    border-radius: 14px;
    background: #fffaf0;
    box-shadow: 0 18px 40px rgba(120, 53, 15, .24);
    color: #422006;
}

.order-notification-alert[hidden] {
    display: none !important;
}

.order-notification-alert-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #f3d49b;
    background: #ffedd5;
}

.order-notification-alert-icon {
    font-size: 22px;
}

.order-notification-alert-head div {
    display: grid;
    gap: 2px;
}

.order-notification-alert-head strong {
    font-size: 13px;
}

.order-notification-alert-head span:not(.order-notification-alert-icon) {
    color: #9a5a13;
    font-size: 11px;
    font-weight: 700;
}

.order-notification-alert-list {
    display: grid;
    gap: 1px;
    max-height: 330px;
    overflow-y: auto;
}

.order-notification-alert-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    background: rgba(255, 255, 255, .78);
}

.order-notification-alert-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.order-notification-alert-copy strong {
    color: #c2410c;
    font-size: 15px;
}

.order-notification-alert-copy span {
    overflow: hidden;
    color: #7c4a16;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-notification-alert-actions {
    flex: 0 0 auto;
    display: inline-flex;
    gap: 6px;
}

.order-notification-alert-actions a {
    border: 1px solid #e7a83d;
    border-radius: 8px;
    background: #fff;
    color: #9a4b08;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
}

.order-notification-alert-actions a:hover {
    background: #ffedd5;
}

.internal-chat-toggle {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.14);
    transition: transform .16s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease;
}

.internal-chat-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 22px rgba(15, 23, 42, 0.2);
}

.internal-chat-toggle:active {
    transform: translateY(0) scale(0.97);
}

.internal-chat-icon {
    font-size: 18px;
    line-height: 1;
}

.internal-chat-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 1px solid #ffffff;
    background: #dc2626;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.internal-chat-panel {
    position: absolute;
    right: 0;
    bottom: 56px;
    width: min(92vw, 680px);
    height: min(78vh, 520px);
    border-radius: 14px;
    border: 1px solid #dbe3ee;
    background: #ffffff;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.26);
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px) scale(.985);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    will-change: transform, opacity;
}

.internal-chat-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.internal-chat-header {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.internal-chat-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
}

.internal-chat-header p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #64748b;
}

.internal-chat-close {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: transform .12s ease, background-color .2s ease, border-color .2s ease;
}

.internal-chat-close:hover {
    transform: scale(1.04);
}

.internal-chat-close:active {
    transform: scale(0.96);
}

.internal-chat-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 0;
    height: calc(100% - 55px);
}

.internal-chat-contacts-wrap {
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.internal-chat-section-title {
    margin: 0;
    padding: 10px 12px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #64748b;
}

.internal-chat-contacts {
    overflow-y: auto;
    display: grid;
    gap: 4px;
    padding: 0 8px 10px;
}

.internal-chat-contact {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    color: #0f172a;
    text-align: left;
    padding: 8px 10px;
    cursor: pointer;
    transition: border-color .16s ease, background-color .16s ease, transform .12s ease;
}

.internal-chat-contact:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.internal-chat-contact.active {
    border-color: #2563eb;
    background: #dbeafe;
}

.internal-chat-contact.group {
    border-color: #c4b5fd;
    background: #f5f3ff;
}

.internal-chat-contact.group:hover {
    border-color: #8b5cf6;
    background: #ede9fe;
}

.internal-chat-contact.group.active {
    border-color: #7c3aed;
    background: #ddd6fe;
}

.internal-chat-contact:active {
    transform: scale(.99);
}

.internal-chat-contact-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
}

.internal-chat-contact-login {
    margin-top: 2px;
    font-size: 11px;
    color: #64748b;
}

.internal-chat-contact-unread {
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.internal-chat-thread-wrap {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.internal-chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 13px;
}

.internal-chat-thread {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.internal-chat-active-user {
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 12px;
}

.internal-chat-active-user strong {
    display: block;
    font-size: 13px;
    color: #0f172a;
}

.internal-chat-active-user span {
    font-size: 11px;
    color: #64748b;
}

.internal-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: grid;
    gap: 8px;
    background: #f8fafc;
}

.internal-chat-msg {
    max-width: 82%;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.35;
    word-break: break-word;
}

.internal-chat-msg.self {
    margin-left: auto;
    background: #dbeafe;
    color: #1e3a8a;
    border: 1px solid #93c5fd;
}

.internal-chat-msg.other {
    margin-right: auto;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #d1d5db;
}

.internal-chat-msg-author {
    margin-bottom: 3px;
    color: #6d28d9;
    font-size: 10px;
    font-weight: 800;
}

.internal-chat-msg-time {
    margin-top: 4px;
    font-size: 10px;
    opacity: .7;
}

.internal-chat-msg.pending {
    opacity: .78;
}

.internal-chat-msg.pending .internal-chat-msg-time {
    font-style: italic;
}

.internal-chat-msg.failed {
    border-color: #ef4444 !important;
}

.internal-chat-msg.failed .internal-chat-msg-time {
    color: #b91c1c;
    font-weight: 700;
}

.internal-chat-form {
    border-top: 1px solid #e2e8f0;
    padding: 8px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.internal-chat-form input {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    padding: 8px 10px;
    font-size: 12px;
}

.internal-chat-form button {
    border: 1px solid #2563eb;
    border-radius: 8px;
    background: #2563eb;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 10px;
    cursor: pointer;
    transition: transform .12s ease, filter .2s ease;
}

.internal-chat-form button:hover {
    filter: brightness(1.05);
}

.internal-chat-form button:active {
    transform: scale(.98);
}

@media (max-width: 820px) {
    .internal-chat-panel {
        width: min(96vw, 560px);
        height: min(82vh, 620px);
    }

    .internal-chat-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 145px 1fr;
    }

    .internal-chat-contacts-wrap {
        border-right: 0;
        border-bottom: 1px solid #e2e8f0;
    }
}

html[data-theme='dark'] .internal-chat-toggle {
    border-color: #595959;
    background: #2a2a2a;
    color: #ececec;
}

html[data-theme='dark'] .order-notification-alert {
    border-color: #9a6d25;
    background: #352b1c;
    color: #fef3c7;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .4);
}

html[data-theme='dark'] .order-notification-alert-head {
    border-color: #715427;
    background: #493719;
}

html[data-theme='dark'] .order-notification-alert-head span:not(.order-notification-alert-icon),
html[data-theme='dark'] .order-notification-alert-copy span {
    color: #e7c986;
}

html[data-theme='dark'] .order-notification-alert-item {
    background: rgba(48, 48, 48, .94);
}

html[data-theme='dark'] .order-notification-alert-copy strong {
    color: #fb923c;
}

html[data-theme='dark'] .order-notification-alert-actions a {
    border-color: #8b672d;
    background: #292929;
    color: #fde68a;
}

html[data-theme='dark'] .internal-chat-panel {
    border-color: #4a4a4a;
    background: #2f2f2f;
}

html[data-theme='dark'] .internal-chat-header,
html[data-theme='dark'] .internal-chat-active-user,
html[data-theme='dark'] .internal-chat-form,
html[data-theme='dark'] .internal-chat-contacts-wrap {
    border-color: #4a4a4a;
}

html[data-theme='dark'] .internal-chat-header h3,
html[data-theme='dark'] .internal-chat-active-user strong {
    color: #ececec;
}

html[data-theme='dark'] .internal-chat-header p,
html[data-theme='dark'] .internal-chat-section-title,
html[data-theme='dark'] .internal-chat-active-user span,
html[data-theme='dark'] .internal-chat-contact-login,
html[data-theme='dark'] .internal-chat-empty {
    color: #b5b5b5;
}

html[data-theme='dark'] .internal-chat-close {
    border-color: #595959;
    background: #383838;
    color: #ececec;
}

html[data-theme='dark'] .internal-chat-contact {
    border-color: #4a4a4a;
    background: #373737;
    color: #ececec;
}

html[data-theme='dark'] .internal-chat-contact:hover {
    border-color: #6b7280;
    background: #404040;
}

html[data-theme='dark'] .internal-chat-contact.active {
    border-color: #93c5fd;
    background: #1f344d;
}

html[data-theme='dark'] .internal-chat-messages {
    background: #333333;
}

html[data-theme='dark'] .internal-chat-msg.self {
    border-color: #3b82f6;
    background: #1f3b63;
    color: #dbeafe;
}

html[data-theme='dark'] .internal-chat-msg.other {
    border-color: #4a4a4a;
    background: #3b3b3b;
    color: #ececec;
}

html[data-theme='dark'] .internal-chat-msg.failed {
    border-color: #b91c1c !important;
}

html[data-theme='dark'] .internal-chat-msg.failed .internal-chat-msg-time {
    color: #fca5a5;
}

html[data-theme='dark'] .internal-chat-form input {
    border-color: #595959;
    background: #2a2a2a;
    color: #ececec;
}

.login-page {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
    background-image:
        linear-gradient(135deg, rgba(5, 24, 52, 0.54), rgba(28, 9, 56, 0.64)),
        var(--login-wallpaper);
    background-size: cover;
    background-position: center;
    color: #f8fbff;
}

.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 14% 22%, rgba(58, 184, 216, 0.34), transparent 48%),
        radial-gradient(circle at 85% 10%, rgba(129, 78, 255, 0.25), transparent 52%);
    pointer-events: none;
}

.login-lockscreen {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 24px;
    background: linear-gradient(165deg, #30c5d9 6%, #3b91cc 40%, #51459b 95%);
    transition: opacity .45s ease, visibility .45s ease, transform .45s ease;
    cursor: pointer;
}

.login-lockscreen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 40%, rgba(8, 10, 32, 0.25) 100%);
}

.login-lockscreen-content,
.login-lock-hint {
    position: relative;
    z-index: 1;
}

.login-lock-company {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    opacity: .8;
}

.login-lock-time {
    display: block;
    margin-top: 18px;
    font-size: clamp(48px, 10vw, 94px);
    line-height: 1;
    font-weight: 300;
    letter-spacing: .03em;
}

.login-lock-date {
    display: block;
    margin-top: 10px;
    font-size: clamp(18px, 2.5vw, 31px);
    line-height: 1.2;
    font-weight: 400;
    text-transform: capitalize;
}

.login-lock-city {
    margin: 26px 0 2px;
    font-size: 14px;
    letter-spacing: .1em;
    text-transform: uppercase;
    opacity: .78;
}

.login-lock-temperature {
    margin: 0;
    font-size: clamp(18px, 3.4vw, 34px);
    font-weight: 600;
    letter-spacing: .02em;
}

.login-market-board {
    margin-top: 22px;
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 12px;
}

.login-market-item {
    border-radius: 12px;
    border: 1px solid rgba(245, 251, 255, 0.26);
    background: rgba(2, 19, 49, 0.24);
    padding: 10px 12px;
    text-align: left;
}

.login-market-name {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .1em;
    opacity: .8;
}

.login-market-value {
    display: block;
    margin-top: 4px;
    font-size: 21px;
    line-height: 1.1;
    font-weight: 700;
}

.login-market-change {
    display: inline-flex;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
}

.login-market-change.is-up {
    color: #b6ffd4;
}

.login-market-change.is-down {
    color: #ffd2da;
}

.login-market-change.is-flat {
    color: rgba(232, 244, 255, 0.82);
}

.login-lock-hint {
    position: absolute;
    bottom: 52px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 13px;
    letter-spacing: .12em;
    text-transform: lowercase;
    color: rgba(244, 252, 255, 0.88);
    animation: loginLockPulse 1.7s ease-in-out infinite;
}

.login-auth-card {
    width: min(460px, calc(100vw - 30px));
    border-radius: 28px;
    border: 1px solid rgba(190, 225, 255, 0.28);
    background: rgba(5, 17, 34, 0.62);
    backdrop-filter: blur(12px);
    box-shadow: 0 22px 56px rgba(3, 11, 24, 0.36);
    padding: 30px;
    z-index: 20;
    transform: translateY(0) scale(1);
    transition: opacity .34s ease, transform .34s ease, filter .34s ease;
}

.login-auth-title {
    margin: 0;
    font-size: 26px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: .01em;
    color: #ffffff;
}

.login-auth-subtitle {
    margin: 8px 0 0;
    font-size: 13px;
    color: #b9d1ef;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.login-form {
    margin-top: 20px;
    display: grid;
    gap: 14px;
}

.login-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: #d6e4fb;
}

.login-input {
    width: 100%;
    border: 1px solid rgba(146, 185, 225, 0.48);
    border-radius: 14px;
    background: rgba(1, 9, 20, 0.68);
    color: #eaf5ff;
    font-size: 15px;
    padding: 12px 14px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.login-input:focus {
    border-color: #6ec6ff;
    box-shadow: 0 0 0 3px rgba(95, 185, 255, 0.2);
}

.login-submit {
    margin-top: 4px;
    width: 100%;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #21b7ff, #2970ff);
    color: #f8fdff;
    font-size: 15px;
    font-weight: 700;
    padding: 12px 14px;
    cursor: pointer;
    transition: transform .15s ease, filter .2s ease;
}

.login-submit:hover {
    filter: brightness(1.08);
}

.login-submit:active {
    transform: scale(.985);
}

.login-footnote {
    margin: 16px 0 0;
    font-size: 12px;
    color: #96b8db;
}

.login-alert {
    margin-top: 16px;
    border-radius: 12px;
    border: 1px solid;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.35;
}

.login-alert-success {
    border-color: rgba(52, 211, 153, 0.48);
    background: rgba(6, 78, 59, 0.36);
    color: #d1fae5;
}

.login-alert-error {
    border-color: rgba(251, 113, 133, 0.5);
    background: rgba(127, 29, 29, 0.34);
    color: #ffe4e6;
}

.login-page.is-locked .login-auth-card {
    opacity: 0;
    filter: blur(12px);
    transform: translateY(20px) scale(.99);
    pointer-events: none;
}

.login-page.is-unlocked .login-lockscreen {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.01);
    pointer-events: none;
}

@keyframes loginLockPulse {
    0%,
    100% {
        opacity: .35;
    }

    50% {
        opacity: .95;
    }
}

@media (max-width: 640px) {
    .login-auth-card {
        padding: 24px 18px;
        border-radius: 20px;
    }

    .login-lock-hint {
        bottom: 32px;
        font-size: 12px;
    }

    .login-market-board {
        grid-template-columns: 1fr;
    }
}

/* ========================================================================== */
/* Design refresh: visual only (no behavior changes)                          */
/* ========================================================================== */
:root {
    --crm-bg: #f3f6fb;
    --crm-bg-top: #f8faff;
    --crm-bg-bottom: #eef3fb;
    --crm-panel: #ffffff;
    --crm-panel-soft: #f8fbff;
    --crm-border: #dde6f3;
    --crm-border-strong: #cfdcf0;
    --crm-text: #0f172a;
    --crm-muted: #64748b;
    --crm-primary: #2f67ff;
    --crm-primary-strong: #1f54e6;
    --crm-shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.06);
    --crm-shadow-md: 0 18px 38px rgba(15, 23, 42, 0.1);
    --border: var(--crm-border);
}

html[data-theme='dark'] {
    --crm-bg: #1f1f1f;
    --crm-bg-top: #1d1d1d;
    --crm-bg-bottom: #252525;
    --crm-panel: #2b2b2b;
    --crm-panel-soft: #303030;
    --crm-border: #454545;
    --crm-border-strong: #5e5e5e;
    --crm-text: #ececec;
    --crm-muted: #b5b5b5;
    --crm-primary: #dddddd;
    --crm-primary-strong: #ffffff;
    --crm-shadow-soft: 0 12px 26px rgba(2, 6, 23, 0.45);
    --crm-shadow-md: 0 20px 44px rgba(2, 6, 23, 0.56);
    --border: var(--crm-border);
}

.crm-body {
    background: linear-gradient(180deg, var(--crm-bg-top) 0%, var(--crm-bg-bottom) 100%);
    color: var(--crm-text);
    font-family: var(--font-sans);
}

.crm-body .min-h-screen.bg-slate-100 {
    background: transparent !important;
}

.crm-sidebar {
    background: linear-gradient(180deg, var(--crm-panel) 0%, var(--crm-panel-soft) 100%);
    border-right: 1px solid var(--crm-border);
    box-shadow: inset -1px 0 0 rgba(148, 163, 184, 0.08);
}

.crm-sidebar .border-slate-200 {
    border-color: var(--crm-border) !important;
}

.crm-sidebar .bg-white {
    background: var(--crm-panel-soft) !important;
}

.crm-sidebar .text-slate-800,
.crm-sidebar .text-slate-700 {
    color: var(--crm-text) !important;
}

.crm-sidebar .text-slate-500 {
    color: var(--crm-muted) !important;
}

.crm-sidebar-logo-link {
    height: 92px;
    padding: 8px 0;
}

.crm-menu-nav {
    gap: 7px;
    padding: 12px 10px 14px;
}

.crm-menu-indicator {
    left: 10px;
    right: 10px;
    border: 1px solid #c7d8fb;
    border-radius: 13px;
    background: linear-gradient(135deg, #f7fbff 0%, #ecf3ff 100%);
    box-shadow: 0 14px 24px rgba(47, 103, 255, 0.18);
}

.crm-menu-item {
    border-radius: 13px;
    border: 1px solid transparent;
    color: #30435f;
    font-weight: 700;
    padding: 11px 14px;
}

.crm-menu-item:hover {
    color: var(--crm-primary-strong);
    transform: translateX(3px);
}

.crm-menu-item-active {
    color: var(--crm-primary-strong);
}

.crm-topbar {
    height: auto;
    min-height: 86px;
    padding: 12px 20px;
    background: var(--crm-panel);
    border-bottom: 1px solid var(--crm-border);
    box-shadow: var(--crm-shadow-soft);
    backdrop-filter: blur(6px);
}

.crm-topbar .text-slate-600 {
    color: var(--crm-muted) !important;
}

.crm-topbar a.rounded-lg.border {
    border-color: var(--crm-border) !important;
    background: var(--crm-panel-soft);
    color: #2f405f !important;
    transition: transform .16s ease, box-shadow .2s ease, border-color .2s ease;
}

.crm-topbar a.rounded-lg.border:hover {
    border-color: var(--crm-border-strong) !important;
    box-shadow: var(--crm-shadow-soft);
    transform: translateY(-1px);
}

.crm-primary-btn {
    border-radius: 13px;
    border: 1px solid transparent;
    background: linear-gradient(135deg, #ffb04e 0%, #f88a1a 52%, #dd6a06 100%);
    color: #f8fbff;
    box-shadow: 0 12px 24px rgba(233, 127, 22, 0.34);
}

.crm-primary-btn:hover {
    background: linear-gradient(135deg, #ffb964 0%, #fd952a 52%, #e5760f 100%);
}

.crm-search-form {
    width: min(660px, 62vw);
    gap: 10px;
}

.crm-search-input,
.crm-input {
    border-radius: 12px;
    border: 1px solid var(--crm-border);
    background: var(--crm-panel);
    color: var(--crm-text);
    min-height: 44px;
}

.crm-search-input::placeholder,
.crm-input::placeholder {
    color: #94a3b8;
}

.crm-search-input:focus,
.crm-input:focus {
    border-color: #8fb4ff;
    box-shadow: 0 0 0 4px rgba(47, 103, 255, 0.13);
}

.crm-search-submit {
    height: 44px;
    border-radius: 11px;
    border: 1px solid var(--crm-border);
    background: var(--crm-panel-soft);
    color: #375074;
    font-size: 12px;
    font-weight: 800;
    padding: 0 16px;
}

.crm-search-submit:hover {
    background: #eef4ff;
    border-color: var(--crm-border-strong);
}

.crm-theme-toggle {
    width: 34px;
    height: 34px;
    border: 1px solid var(--crm-border);
    background: var(--crm-panel-soft);
    color: #2f4260;
}

.crm-theme-toggle:hover {
    border-color: var(--crm-border-strong);
    background: #eef4ff;
}

.crm-column {
    background: var(--crm-panel-soft);
    border: 1px solid var(--crm-border);
    border-radius: 16px;
    box-shadow: var(--crm-shadow-soft);
}

.crm-card {
    border-radius: 14px;
    border: 1px solid var(--crm-border);
    background: var(--crm-panel);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.07);
}

.crm-card:hover {
    border-color: #bfd4fb;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.11);
    transform: translateY(-1px);
}

.crm-order-panel {
    border-radius: 18px;
    border: 1px solid var(--crm-border);
    background: var(--crm-panel);
    box-shadow: var(--crm-shadow-md);
}

.internal-chat-toggle {
    border-color: var(--crm-border);
    background: var(--crm-panel);
    color: #2f4260;
}

.internal-chat-panel {
    border-radius: 16px;
    border: 1px solid var(--crm-border);
    background: var(--crm-panel);
    box-shadow: var(--crm-shadow-md);
}

.internal-chat-header,
.internal-chat-active-user,
.internal-chat-form,
.internal-chat-contacts-wrap {
    border-color: var(--crm-border);
}

.internal-chat-contacts,
.internal-chat-messages {
    background: var(--crm-panel-soft);
}

html[data-theme='dark'] .crm-body {
    background: linear-gradient(180deg, var(--crm-bg-top) 0%, var(--crm-bg-bottom) 100%);
    color: var(--crm-text);
}

html[data-theme='dark'] .crm-sidebar {
    background: linear-gradient(180deg, #2b2b2b 0%, #303030 45%, #2a2a2a 100%);
    border-right-color: var(--crm-border);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
}

html[data-theme='dark'] .crm-menu-indicator {
    border-color: #5f5f5f;
    background: linear-gradient(135deg, #414141 0%, #373737 100%);
    box-shadow: 0 10px 18px rgba(2, 6, 23, 0.5);
}

html[data-theme='dark'] .crm-menu-item {
    color: #d7d7d7;
}

html[data-theme='dark'] .crm-menu-item:hover,
html[data-theme='dark'] .crm-menu-item-active {
    color: #ffffff;
}

html[data-theme='dark'] .crm-topbar {
    background: #2b2b2b;
    border-bottom-color: var(--crm-border);
}

html[data-theme='dark'] .crm-topbar a.rounded-lg.border {
    background: #2f2f2f;
    border-color: var(--crm-border) !important;
    color: #ececec !important;
}

html[data-theme='dark'] .crm-topbar a.rounded-lg.border:hover {
    border-color: var(--crm-border-strong) !important;
    background: #3a3a3a;
}

html[data-theme='dark'] .crm-search-input,
html[data-theme='dark'] .crm-input {
    background: #252525;
    border-color: var(--crm-border);
    color: var(--crm-text);
}

html[data-theme='dark'] .crm-search-input::placeholder,
html[data-theme='dark'] .crm-input::placeholder {
    color: #a8a8a8;
}

html[data-theme='dark'] .crm-search-submit {
    background: #2a2a2a;
    border-color: var(--crm-border);
    color: #dddddd;
}

html[data-theme='dark'] .crm-search-submit:hover {
    background: #3b3b3b;
    border-color: var(--crm-border-strong);
}

html[data-theme='dark'] .crm-theme-toggle {
    background: #2a2a2a;
    border-color: var(--crm-border);
    color: #ececec;
}

html[data-theme='dark'] .crm-theme-toggle:hover {
    background: #3b3b3b;
    border-color: var(--crm-border-strong);
}

html[data-theme='dark'] .crm-column {
    background: #2d2d2d;
    border-color: var(--crm-border);
}

html[data-theme='dark'] .crm-card,
html[data-theme='dark'] .crm-order-panel,
html[data-theme='dark'] .internal-chat-panel {
    background: #303030;
    border-color: var(--crm-border);
}

html[data-theme='dark'] .crm-icon-btn,
html[data-theme='dark'] .internal-chat-close {
    background: #2a2a2a;
    border-color: var(--crm-border);
    color: #ececec;
}

html[data-theme='dark'] .internal-chat-messages {
    background: #333333;
}

html[data-theme='dark'] .internal-chat-contact {
    background: #373737;
    border-color: var(--crm-border);
    color: #ececec;
}

html[data-theme='dark'] .internal-chat-contact:hover {
    background: #404040;
    border-color: var(--crm-border-strong);
}

html[data-theme='dark'] .internal-chat-contact.active {
    background: #1f344d;
    border-color: #93c5fd;
}

html[data-theme='dark'] .internal-chat-msg.self {
    background: #1f3b63;
    border-color: #3b82f6;
    color: #dbeafe;
}

html[data-theme='dark'] .internal-chat-msg.other {
    background: #3b3b3b;
    border-color: var(--crm-border);
    color: #ececec;
}

html[data-theme='dark'] .internal-chat-form input {
    background: #2a2a2a;
    border-color: var(--crm-border);
    color: #ececec;
}

.internal-chat-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.internal-chat-archive {
    border: 1px solid #f59e0b;
    border-radius: 999px;
    background: #fffbeb;
    color: #92400e;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .02em;
    padding: 6px 10px;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .14s ease;
}

.internal-chat-archive:hover {
    border-color: #d97706;
    background: #fef3c7;
}

.internal-chat-archive:active {
    transform: scale(.98);
}

.internal-chat-archive[disabled] {
    opacity: .64;
    cursor: wait;
}

html[data-theme='dark'] .internal-chat-archive {
    border-color: #78350f;
    background: #2b2112;
    color: #fde68a;
}

html[data-theme='dark'] .internal-chat-archive:hover {
    border-color: #92400e;
    background: #3a2b16;
}

/* ========================================================================== */
/* Dashboard ZIP adaptation: responsive layout layer (visual only)            */
/* ========================================================================== */
:root {
    --crm-layout-max: 1720px;
    --crm-radius-md: 14px;
    --crm-radius-lg: 18px;
    --crm-surface-1: #ffffff;
    --crm-surface-2: #f8fbff;
    --crm-stroke: #d8e3f2;
    --crm-shadow-1: 0 12px 28px rgba(15, 23, 42, 0.08);
}

html[data-theme='dark'] {
    --crm-surface-1: #2f2f2f;
    --crm-surface-2: #343434;
    --crm-stroke: #4a4a4a;
    --crm-shadow-1: 0 14px 30px rgba(2, 6, 23, 0.5);
}

.crm-main {
    padding: clamp(12px, 2vw, 24px);
}

.crm-main > * {
    width: min(100%, var(--crm-layout-max));
    margin-left: auto;
    margin-right: auto;
}

.crm-topbar {
    gap: 14px;
}

.crm-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
}

.crm-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.crm-mobile-menu-toggle {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    border: 1px solid var(--crm-stroke);
    background: var(--crm-surface-2);
    color: #2f4567;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.07);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
}

.crm-mobile-menu-toggle:hover {
    transform: translateY(-1px);
    border-color: #bfd1ef;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.crm-mobile-menu-toggle-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.crm-mobile-menu-toggle-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-main .rounded-2xl.border,
.crm-main .rounded-xl.border,
.crm-main .rounded-lg.border {
    border-color: var(--crm-stroke) !important;
    background: var(--crm-surface-1) !important;
    box-shadow: var(--crm-shadow-1);
}

.crm-main .overflow-x-auto {
    scrollbar-width: thin;
    scrollbar-color: #b8c9e5 transparent;
}

.crm-main .overflow-x-auto::-webkit-scrollbar {
    height: 8px;
}

.crm-main .overflow-x-auto::-webkit-scrollbar-thumb {
    background: #b8c9e5;
    border-radius: 999px;
}

.crm-main .overflow-x-auto::-webkit-scrollbar-track {
    background: transparent;
}

.crm-main table {
    border-collapse: separate;
    border-spacing: 0;
}

.crm-main table thead th {
    letter-spacing: .06em;
    font-size: 11px;
    color: #667a98;
}

.crm-main table tbody tr {
    transition: background-color .15s ease;
}

.crm-main table tbody tr:hover {
    background: #f3f8ff;
}

.crm-mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 95;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.crm-mobile-menu-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.crm-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: min(88vw, 330px);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--crm-surface-1) 0%, var(--crm-surface-2) 100%);
    border-right: 1px solid var(--crm-stroke);
    box-shadow: 0 22px 44px rgba(2, 6, 23, 0.32);
    transform: translateX(-102%);
    transition: transform .26s cubic-bezier(.2, .8, .2, 1);
    pointer-events: none;
}

.crm-mobile-menu.is-open {
    transform: translateX(0);
    pointer-events: auto;
}

.crm-mobile-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 14px 10px;
    border-bottom: 1px solid var(--crm-stroke);
}

.crm-mobile-menu-logo-link {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    height: 48px;
}

.crm-mobile-menu-logo-link .crm-sidebar-logo {
    height: 48px;
}

.crm-mobile-menu-close {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
    border: 1px solid var(--crm-stroke);
    background: var(--crm-surface-2);
    color: #334155;
    cursor: pointer;
}

.crm-mobile-menu-close svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-mobile-menu-nav {
    flex: 1;
    overflow-y: auto;
    display: grid;
    gap: 6px;
    padding: 10px;
}

.crm-mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 11px 12px;
    color: #334155;
    font-weight: 700;
    text-decoration: none;
    background: transparent;
    transition: transform .14s ease, border-color .2s ease, background-color .2s ease, color .2s ease;
}

.crm-mobile-menu-item:hover {
    transform: translateX(2px);
    border-color: #cad9ef;
    background: #edf3ff;
    color: #1d4ed8;
}

.crm-mobile-menu-item.is-active {
    border-color: #bfd1ef;
    background: linear-gradient(135deg, #f8fbff 0%, #ecf3ff 100%);
    color: #1e40af;
}

.crm-mobile-menu-label {
    min-width: 0;
}

.crm-mobile-menu-foot {
    border-top: 1px solid var(--crm-stroke);
    padding: 12px;
    display: grid;
    gap: 10px;
}

.crm-mobile-user {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--crm-stroke);
    border-radius: 12px;
    background: var(--crm-surface-2);
    padding: 10px;
}

.crm-mobile-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dbe5f4;
    color: #2f4260;
    font-weight: 800;
    font-size: 14px;
}

.crm-mobile-user-meta {
    min-width: 0;
}

.crm-mobile-user-name {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.crm-mobile-user-login {
    margin: 1px 0 0;
    font-size: 11px;
    color: #64748b;
    word-break: break-all;
}

.crm-mobile-menu-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    border: 1px solid var(--crm-stroke);
    border-radius: 11px;
    background: var(--crm-surface-2);
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

html.crm-mobile-menu-open,
html.crm-mobile-menu-open body {
    overflow: hidden;
}

@media (min-width: 1024px) {
    .crm-mobile-menu,
    .crm-mobile-menu-backdrop {
        display: none !important;
    }
}

@media (max-width: 1279px) {
    .crm-topbar-left {
        flex-wrap: wrap;
    }

    .crm-topbar-left .crm-search-form {
        flex: 1 1 100%;
        width: 100%;
        order: 3;
    }
}

@media (max-width: 1024px) {
    .crm-topbar {
        padding: 12px 14px;
        gap: 10px;
        min-height: 0;
    }

    .crm-topbar-left,
    .crm-topbar-right {
        width: 100%;
    }

    .crm-topbar-right {
        justify-content: space-between;
    }

    .crm-topbar .text-slate-600 {
        display: none !important;
    }

    .crm-search-input {
        height: 42px;
        min-height: 42px;
    }

    .crm-search-submit {
        height: 42px;
        padding: 0 12px;
    }
}

@media (max-width: 768px) {
    .crm-main {
        padding: 12px;
    }

    .crm-topbar-left {
        gap: 8px;
    }

    .crm-primary-btn {
        width: 100%;
        justify-content: center;
    }

    .crm-main .rounded-2xl.border,
    .crm-main .rounded-xl.border,
    .crm-main .rounded-lg.border {
        border-radius: var(--crm-radius-md) !important;
    }

    .crm-main table {
        min-width: 680px;
    }
}

@media (max-width: 520px) {
    .crm-mobile-menu {
        width: 92vw;
    }

    .crm-topbar-right a.rounded-lg.border {
        padding: 8px 10px;
        font-size: 12px;
    }
}

html[data-theme='dark'] .crm-mobile-menu-toggle {
    border-color: var(--crm-stroke);
    background: #313131;
    color: #ededed;
}

html[data-theme='dark'] .crm-mobile-menu-toggle:hover {
    border-color: #666666;
    background: #3a3a3a;
}

html[data-theme='dark'] .crm-main table thead th {
    color: #aeb7c4;
}

html[data-theme='dark'] .crm-main table tbody tr:hover {
    background: #383838;
}

html[data-theme='dark'] .crm-mobile-menu {
    background: linear-gradient(180deg, #2b2b2b 0%, #303030 100%);
    border-right-color: var(--crm-stroke);
}

html[data-theme='dark'] .crm-mobile-menu-close,
html[data-theme='dark'] .crm-mobile-menu-logout,
html[data-theme='dark'] .crm-mobile-user {
    border-color: var(--crm-stroke);
    background: #353535;
    color: #ececec;
}

html[data-theme='dark'] .crm-mobile-user-avatar {
    background: #4a4a4a;
    color: #f1f1f1;
}

html[data-theme='dark'] .crm-mobile-user-name {
    color: #ececec;
}

html[data-theme='dark'] .crm-mobile-user-login {
    color: #b5b5b5;
}

html[data-theme='dark'] .crm-mobile-menu-item {
    color: #d5d5d5;
}

html[data-theme='dark'] .crm-mobile-menu-item:hover {
    border-color: #5f5f5f;
    background: #3b3b3b;
    color: #ffffff;
}

html[data-theme='dark'] .crm-mobile-menu-item.is-active {
    border-color: #6b7280;
    background: #404040;
    color: #ffffff;
}

.crm-budget-card {
    position: relative;
}

.crm-budget-title-row {
    padding-right: 78px;
}

.crm-budget-notify-wrap {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
}

.crm-budget-notify-wrap.with-production-check {
    right: 48px;
}

.crm-budget-notify-toggle {
    width: 30px;
    height: 30px;
    border: 1px solid #f0b95b;
    border-radius: 999px;
    background: #fff8e8;
    color: #d97706;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(120, 53, 15, .12);
    transition: transform .14s ease, border-color .2s ease, background-color .2s ease;
}

.crm-budget-notify-toggle:hover,
.crm-budget-notify-toggle.is-active {
    transform: translateY(-1px);
    border-color: #f59e0b;
    background: #fef3c7;
}

.crm-budget-notify-popover {
    position: absolute;
    top: 38px;
    right: 0;
    width: min(280px, 72vw);
    padding: 12px;
    border: 1px solid #d6deea;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 16px 32px rgba(15, 23, 42, .24);
}

.crm-budget-notify-popover[hidden] {
    display: none !important;
}

.crm-budget-notify-popover label {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

.crm-budget-notify-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
}

.crm-budget-notify-controls select,
.crm-budget-notify-controls button {
    min-width: 0;
    min-height: 36px;
    border-radius: 8px;
    font-size: 12px;
}

.crm-budget-notify-controls select {
    width: 100%;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1e293b;
    padding: 0 8px;
}

.crm-budget-notify-controls button {
    border: 0;
    background: #d97706;
    color: #fff;
    padding: 0 11px;
    font-weight: 800;
    cursor: pointer;
}

.crm-budget-notify-controls button:disabled {
    opacity: .6;
    cursor: wait;
}

.crm-budget-notify-feedback {
    display: block;
    min-height: 16px;
    margin-top: 6px;
    color: #15803d;
    font-size: 11px;
    font-weight: 700;
}

.crm-budget-notify-feedback.is-error {
    color: #dc2626;
}

.crm-budget-production-check-form {
    position: absolute;
    top: 10px;
    right: 10px;
    margin: 0;
    z-index: 2;
}

.crm-budget-production-check-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #ffffff;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
    transition: transform .14s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease, color .2s ease;
    cursor: pointer;
}

.crm-budget-production-check-btn:hover {
    transform: translateY(-1px);
    border-color: #94a3b8;
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.14);
}

.crm-budget-production-check-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-budget-production-check-btn.is-marked {
    border-color: #22c55e;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(34, 197, 94, 0.28);
}

.crm-budget-production-check-btn:disabled {
    cursor: default;
    transform: none;
    opacity: 1;
}

.crm-budget-production-flag {
    margin-top: 10px;
    border: 1px solid #86efac;
    border-left-width: 4px;
    border-radius: 10px;
    background: #f0fdf4;
    padding: 8px 10px;
    display: grid;
    gap: 2px;
}

.crm-budget-production-flag-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .02em;
    color: #166534;
}

.crm-budget-production-flag-meta {
    font-size: 10px;
    color: #15803d;
}

html[data-theme='dark'] .crm-budget-production-check-btn {
    border-color: #5d6675;
    background: #343c48;
    color: #d6dde8;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

html[data-theme='dark'] .crm-budget-notify-toggle {
    border-color: #9a6d25;
    background: #5a421d;
    color: #fde68a;
}

html[data-theme='dark'] .crm-budget-notify-toggle:hover,
html[data-theme='dark'] .crm-budget-notify-toggle.is-active {
    border-color: #f0b95b;
    background: #725321;
}

html[data-theme='dark'] .crm-budget-notify-popover {
    border-color: #5a5a5a;
    background: #303030;
}

html[data-theme='dark'] .crm-budget-notify-popover label {
    color: #ececec;
}

html[data-theme='dark'] .crm-budget-notify-controls select {
    border-color: #5a5a5a;
    background: #252525;
    color: #ececec;
}

html[data-theme='dark'] .crm-budget-production-check-btn:hover {
    border-color: #778397;
    background: #3f4958;
}

html[data-theme='dark'] .crm-budget-production-check-btn.is-marked {
    border-color: #22c55e;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
}

html[data-theme='dark'] .crm-budget-production-flag {
    border-color: #2f8f5a;
    background: rgba(17, 64, 42, 0.45);
}

html[data-theme='dark'] .crm-budget-production-flag-title {
    color: #86efac;
}

html[data-theme='dark'] .crm-budget-production-flag-meta {
    color: #6ee7b7;
}
