@font-face {
    font-family: VazirLocal;
    src: local("Vazirmatn"), local("IRANSans"), local("Tahoma");
}

/* Phase 15 hotfix: real mobile offcanvas sidebar */
@media screen and (max-width: 992px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    body .app {
        display: block !important;
        min-height: 100vh;
    }

    body .content,
    body.sidebar-collapsed .content {
        width: 100% !important;
        max-width: 100% !important;
        margin-right: 0 !important;
        padding: 12px !important;
    }

    body .sidebar,
    body.sidebar-collapsed .sidebar {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: min(280px, 88vw) !important;
        max-width: min(280px, 88vw) !important;
        height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        transform: translateX(110%) !important;
        transition: transform 0.25s ease !important;
        z-index: 1000 !important;
        overflow-y: auto !important;
        box-shadow: -16px 0 40px rgba(15, 23, 42, 0.26) !important;
    }

    body.sidebar-open .sidebar,
    body.sidebar-open.sidebar-collapsed .sidebar {
        transform: translateX(0) !important;
    }

    body .mobile-overlay {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(15, 23, 42, 0.48) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 0.2s ease, visibility 0.2s ease !important;
        z-index: 990 !important;
    }

    body.sidebar-open .mobile-overlay {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    body .topbar-menu {
        display: grid !important;
        flex: 0 0 42px !important;
    }

    body .topbar {
        position: sticky !important;
        top: 0 !important;
        z-index: 800 !important;
        width: 100% !important;
    }

    body.sidebar-open {
        overflow: hidden !important;
    }
}

@media screen and (min-width: 993px) {
    body .mobile-overlay {
        display: none !important;
    }
}

@media (max-width: 1200px) {
    body .content {
        padding: 18px;
    }

    body .dashboard-four-grid,
    body .dashboard-market-note-grid,
    body .stats,
    body .quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body .table-wrap {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 992px) {
    body .content,
    body.sidebar-collapsed .content {
        width: 100% !important;
        margin-right: 0 !important;
    }

    body .sidebar {
        position: fixed !important;
        inset: 0 auto 0 0;
        right: 0;
        transform: translateX(110%);
        z-index: 60;
        max-width: 86vw;
        height: 100vh;
        overflow-y: auto;
    }

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

    body .topbar {
        position: sticky;
        top: 0;
        z-index: 40;
        gap: 10px;
    }

    body .hero-title,
    body .card-header,
    body .section-heading,
    body .inline-actions {
        flex-wrap: wrap;
    }

    body .form-grid,
    body .info-grid,
    body .profile-metrics,
    body .print-info-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 13px;
    }

    body .content {
        padding: 12px !important;
    }

    body .dashboard-four-grid,
    body .dashboard-market-note-grid,
    body .stats,
    body .quick-actions,
    body .compact-stats {
        grid-template-columns: 1fr !important;
    }

    body .card,
    body .page-title,
    body .hero-title {
        padding: 14px !important;
        border-radius: 16px !important;
    }

    body .page-title h2,
    body .hero-title h2 {
        font-size: 20px !important;
        line-height: 1.5;
    }

    body .search-box,
    body .filters-row,
    body .mini-inline-form,
    body .inline-actions {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100%;
        gap: 8px;
    }

    body input,
    body select,
    body textarea,
    body .btn,
    body .small-link {
        max-width: 100%;
    }

    body .table-wrap {
        border: 1px solid rgba(245, 130, 32, 0.16);
        border-radius: 14px;
    }

    body table {
        min-width: 720px;
    }

    body .crm-modal-panel {
        width: min(96vw, 560px) !important;
        max-height: 88vh;
        overflow-y: auto;
        padding: 16px !important;
    }
}

@media (max-width: 576px) {
    body .topbar {
        padding: 10px !important;
    }

    body .topbar-profile-box,
    body .profile-dropdown summary {
        width: 100%;
    }

    body .brand h1,
    body .page-title h2,
    body .hero-title h2 {
        font-size: 18px !important;
    }

    body .btn,
    body button,
    body a.small-link,
    body button.small-link {
        min-height: 38px;
        justify-content: center;
        text-align: center;
    }

    body table {
        min-width: 640px;
        font-size: 11px;
    }

    body th,
    body td {
        padding: 8px 7px !important;
    }

    body .sidebar {
        max-width: 92vw;
    }
}

:root {
    --sidebar-open: 260px;
    --sidebar-closed: 80px;
    --bg: #f8f9fa;
    --surface: #ffffff;
    --surface-soft: #fbfcfd;
    --surface-muted: #f3f5f7;
    --border: #e7ebef;
    --text: #2f3a45;
    --text-strong: #1f2933;
    --muted: #778491;
    --accent: #f97316;
    --accent-soft: #fff3e8;
    --navy: #23364d;
    --navy-soft: #eef3f8;
    --green: #22a06b;
    --green-soft: #eaf8f1;
    --blue: #4f7dbf;
    --blue-soft: #edf4ff;
    --shadow-xs: 0 1px 2px rgba(31, 41, 51, 0.04);
    --shadow-sm: 0 8px 24px rgba(31, 41, 51, 0.06);
    --shadow-md: 0 16px 38px rgba(31, 41, 51, 0.08);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: VazirLocal, Tahoma, Arial, sans-serif;
    direction: rtl;
    line-height: 1.8;
}

a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 800;
}

.app {
    display: flex;
    min-height: 100vh;
}

.mobile-overlay {
    display: none;
}

.sidebar {
    width: var(--sidebar-open);
    background: rgba(255, 255, 255, 0.96);
    border-left: 1px solid var(--border);
    color: var(--text);
    padding: 16px 14px;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    box-shadow: 0 10px 40px rgba(31, 41, 51, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 30;
    transition: width 0.24s ease, transform 0.24s ease, box-shadow 0.24s ease;
}

.sidebar-head {
    display: grid;
    grid-template-columns: 38px 1fr;
    align-items: center;
    gap: 10px;
    padding-bottom: 16px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-toggle {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-soft);
    display: grid;
    place-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.sidebar-toggle:hover {
    background: var(--accent-soft);
    border-color: #ffd7b8;
}

.sidebar-toggle span {
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
    display: block;
}

.brand {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 10px;
    min-width: 0;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 950;
    border: 1px solid #ffe0c5;
    flex: 0 0 auto;
}

.brand-text {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.18s ease, width 0.18s ease;
}

.brand h1 {
    font-size: 17px;
    margin: 0 0 2px;
    color: var(--text-strong);
    letter-spacing: -0.2px;
}

.brand p {
    color: var(--muted);
    margin: 0;
    font-size: 12px;
}

.menu {
    display: grid;
    gap: 6px;
    padding-top: 6px;
}

.menu a {
    color: var(--text);
    padding: 10px 10px;
    border-radius: 14px;
    font-weight: 850;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.menu a:hover {
    background: var(--surface-muted);
    color: var(--text-strong);
}

.menu a.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.menu a.active::before {
    content: "";
    position: absolute;
    right: -14px;
    width: 3px;
    height: 24px;
    border-radius: 999px 0 0 999px;
    background: var(--accent);
}

.menu-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 16px;
    flex: 0 0 auto;
    transition: all 0.18s ease;
}

.menu a:hover .menu-icon,
.menu a.active .menu-icon {
    background: var(--surface);
    color: var(--accent);
    box-shadow: var(--shadow-xs);
}

.menu-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.18s ease, width 0.18s ease;
}

.sidebar-footer {
    margin-top: auto;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    display: grid;
    gap: 2px;
    overflow: hidden;
    transition: opacity 0.18s ease;
}

.sidebar-footer span {
    color: var(--muted);
    font-size: 12px;
}

.sidebar-footer strong {
    color: var(--text-strong);
    font-size: 13px;
}

.content {
    width: calc(100% - var(--sidebar-open));
    margin-right: var(--sidebar-open);
    padding: 22px 26px 36px;
    transition: width 0.24s ease, margin-right 0.24s ease;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-closed);
}

body.sidebar-collapsed .content {
    width: calc(100% - var(--sidebar-closed));
    margin-right: var(--sidebar-closed);
}

body.sidebar-collapsed .sidebar-head {
    grid-template-columns: 1fr;
    justify-items: center;
}

body.sidebar-collapsed .brand {
    justify-content: center;
}

body.sidebar-collapsed .brand-icon {
    margin-inline: auto;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .menu-text,
body.sidebar-collapsed .sidebar-footer {
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

body.sidebar-collapsed .menu a {
    justify-content: center;
    padding: 10px;
}

body.sidebar-collapsed .menu a:hover::after {
    content: attr(data-title);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-strong);
    color: #ffffff;
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    z-index: 40;
}

body.sidebar-collapsed .menu a:hover::before {
    display: none;
}

.topbar {
    min-height: 66px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    border: 0;
    border-radius: 0 0 20px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 14px;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 24;
}

.topbar-menu {
    display: none;
}

.topbar > div:not(.profile-menu) {
    display: grid;
    gap: 2px;
}

.topbar-kicker {
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    font-weight: 750;
}

.topbar strong {
    color: #ffffff;
    font-size: 16px;
}

.topbar-welcome strong {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.topbar-action,
.small-link {
    color: var(--accent);
    background: var(--accent-soft);
    padding: 9px 13px;
    border-radius: 12px;
    border: 1px solid #ffe0c5;
}

button.small-link {
    font-family: inherit;
    cursor: pointer;
}

.danger-link {
    color: #b42318;
    background: #fff1f1;
    border-color: #ffd6d6;
}

.page-title {
    background: var(--surface);
    color: var(--text-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.page-title::after {
    content: "";
    position: absolute;
    left: -70px;
    bottom: -78px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(249, 115, 22, 0.06);
}

.hero-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.hero-title > * {
    position: relative;
    z-index: 1;
}

.hero-actions,
.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.eyebrow {
    display: inline-flex;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 5px 11px;
    border-radius: 999px;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 950;
    border: 1px solid #ffe0c5;
}

.page-title h2 {
    margin: 0 0 6px;
    font-size: 28px;
    letter-spacing: -0.5px;
}

.page-title p {
    margin: 0;
    color: var(--muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.compact-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card,
.card,
.quick-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
}

.stat-card {
    padding: 17px;
    display: flex;
    align-items: center;
    gap: 13px;
    position: relative;
}

.stat-card.orange { color: var(--accent); }
.stat-card.navy { color: var(--navy); }
.stat-card.green { color: var(--green); }
.stat-card.blue { color: var(--blue); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--surface-muted);
    color: currentColor;
    font-size: 18px;
    flex: 0 0 auto;
}

.stat-card.orange .stat-icon { background: var(--accent-soft); }
.stat-card.navy .stat-icon { background: var(--navy-soft); }
.stat-card.green .stat-icon { background: var(--green-soft); }
.stat-card.blue .stat-icon { background: var(--blue-soft); }

.stat-card span,
.info-grid span,
.profile-metrics span {
    display: block;
    color: var(--muted);
    margin-bottom: 3px;
    font-size: 13px;
    font-weight: 750;
}

.stat-card strong {
    display: block;
    font-size: 24px;
    color: var(--text-strong);
    line-height: 1.35;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.quick-card {
    padding: 15px;
    display: grid;
    gap: 5px;
    color: var(--text);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.quick-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: #ffd9bd;
}

.quick-card span {
    width: 36px;
    height: 36px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: var(--surface-muted);
    color: var(--accent);
    font-size: 17px;
}

.quick-card strong {
    color: var(--text-strong);
}

.quick-card small {
    color: var(--muted);
    font-weight: 650;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.8fr);
    gap: 16px;
}

.card {
    padding: 21px;
    margin-bottom: 20px;
}

.elevated-card {
    box-shadow: var(--shadow-sm);
}

.card-header,
.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 17px;
}

.card h3,
.section-heading h3 {
    margin: 0 0 3px;
    color: var(--text-strong);
    letter-spacing: -0.2px;
}

.card-header p,
.section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.step-badge,
.count-badge,
.status-pill,
.form-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-weight: 900;
}

.step-badge {
    width: 34px;
    height: 34px;
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: 9px;
    border: 1px solid #ffe0c5;
}

.count-badge,
.status-pill,
.form-hint {
    background: var(--surface-muted);
    color: var(--text);
    padding: 7px 11px;
    font-size: 12px;
}

.status-pill {
    background: var(--blue-soft);
    color: var(--blue);
}

.status-pill.status-success {
    background: #ecfdf3;
    color: #027a48;
    border: 1px solid #abefc6;
}

.status-pill.status-warning {
    background: #fffaeb;
    color: #b54708;
    border: 1px solid #fedf89;
}

.status-pill.status-danger {
    background: #fff1f1;
    color: #b42318;
    border: 1px solid #ffd6d6;
}

.status-pill.status-info {
    background: #eff6ff;
    color: #175cd3;
    border: 1px solid #bfdbfe;
}

.btn {
    border: 1px solid transparent;
    background: var(--accent);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 13px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    box-shadow: 0 8px 18px rgba(249, 115, 22, 0.16);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(249, 115, 22, 0.22);
}

.btn.secondary {
    background: var(--navy);
    box-shadow: 0 8px 18px rgba(35, 54, 77, 0.12);
}

.btn.light,
.btn.outline-light,
.btn.ghost {
    background: var(--surface);
    color: var(--text-strong);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}

.btn.light:hover,
.btn.outline-light:hover,
.btn.ghost:hover {
    border-color: #ffd9bd;
    color: var(--accent);
}

.btn.large {
    padding: 13px 26px;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    background: var(--surface);
}

th,
td {
    text-align: right;
    padding: 13px 15px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 950;
}

tbody tr {
    transition: background 0.16s ease;
}

tbody tr:hover {
    background: #fffaf5;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.customer-link,
.activity-item {
    display: grid;
    gap: 3px;
    color: var(--text-strong);
}

.customer-link small,
.activity-item small {
    color: var(--muted);
    font-weight: 600;
}

.activity-list {
    display: grid;
    gap: 10px;
}

.activity-item {
    grid-template-columns: 40px 1fr;
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 10px;
    transition: all 0.18s ease;
}

.activity-item:hover {
    background: #fffaf5;
    border-color: #ffd9bd;
}

.mini-avatar,
.avatar {
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid #ffe0c5;
    font-weight: 950;
}

.mini-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
}

.empty {
    background: #fffaf5;
    color: #9a4d14;
    padding: 14px 15px;
    border-radius: 15px;
    border: 1px solid #ffe0c5;
}

.alert {
    padding: 14px 16px;
    border-radius: 15px;
    margin-bottom: 17px;
    font-weight: 850;
    border: 1px solid transparent;
}

.alert.success {
    background: var(--green-soft);
    color: #176448;
    border-color: #cceedd;
}

.alert.danger {
    background: #fff1f2;
    color: #9f1239;
    border-color: #ffe4e6;
}

.alert ul {
    margin: 10px 0 0;
}

.search-box {
    display: flex;
    gap: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 9px;
}

.filters-row select {
    max-width: 220px;
}

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

.inline-actions form {
    margin: 0;
}

.search-box input {
    flex: 1;
    border-color: transparent;
    background: transparent;
}

.customer-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.customer-pill {
    display: grid;
    gap: 6px;
    background: var(--surface);
    color: var(--text-strong);
    padding: 13px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}

.customer-pill:hover {
    border-color: #ffd9bd;
    transform: translateY(-1px);
}

.customer-pill span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.selected-customer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-top: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 15px;
}

.selected-customer span {
    display: block;
    color: var(--muted);
    margin-bottom: 4px;
    font-size: 13px;
}

.selected-customer strong {
    color: var(--text-strong);
    font-size: 20px;
}

.selected-customer p {
    margin: 5px 0 0;
    color: var(--muted);
}

.form-card {
    border-top: 0;
}

.form-section {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 19px;
    padding: 17px;
    margin-bottom: 17px;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.form-section-title span {
    width: 36px;
    height: 36px;
    border-radius: 13px;
    background: var(--navy-soft);
    color: var(--navy);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 950;
}

.form-section h4 {
    color: var(--text-strong);
    margin: 0;
    font-size: 17px;
}

.form-grid,
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-weight: 900;
    font-size: 13px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 12px 13px;
    font-family: inherit;
    font-size: 15px;
    background: var(--surface);
    color: var(--text-strong);
    transition: all 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: 4px solid rgba(249, 115, 22, 0.10);
    border-color: #ffc08d;
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.06);
}

input[readonly],
textarea[readonly] {
    background: var(--surface-muted);
    color: var(--muted);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.wide {
    grid-column: 1 / -1;
}

.info-grid > div,
.profile-metrics > div {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 13px;
}

.info-grid strong,
.profile-metrics strong {
    display: block;
    color: var(--text-strong);
}

.customer-profile {
    display: grid;
    gap: 17px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 17px;
    border-bottom: 1px solid var(--border);
}

.profile-header h3 {
    margin: 0 0 4px;
    color: var(--text-strong);
}

.profile-header p {
    margin: 0;
    color: var(--muted);
}

.profile-status {
    margin-right: auto;
    background: var(--green-soft);
    color: var(--green);
    border-radius: 999px;
    padding: 7px 12px;
    font-weight: 950;
    font-size: 12px;
}

.profile-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.avatar {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    font-size: 27px;
}

.placeholder {
    min-height: 220px;
    display: grid;
    align-content: center;
}

@media (max-width: 1180px) {
    .stats,
    .quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .app {
        display: block;
    }

    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(31, 41, 51, 0.24);
        z-index: 25;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        display: block;
    }

    body.sidebar-open .mobile-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        width: var(--sidebar-open);
        transform: translateX(105%);
        box-shadow: -16px 0 40px rgba(31, 41, 51, 0.14);
    }

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

    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-open);
    }

    .content,
    body.sidebar-collapsed .content {
        width: 100%;
        margin-right: 0;
        padding: 18px;
    }

    .topbar,
    .hero-title,
    .card-header,
    .section-heading,
    .selected-customer,
    .profile-header {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar {
        position: sticky;
        top: 0;
    }

    .topbar-profile-box {
        width: 100%;
        justify-content: space-between;
    }

    .topbar-search {
        flex: 1;
    }

    .topbar-search input {
        width: 100%;
    }

    .topbar-menu {
        display: grid;
        flex: 0 0 auto;
    }

    .stats,
    .compact-stats,
    .quick-actions,
    .form-grid,
    .info-grid,
    .profile-metrics {
        grid-template-columns: 1fr;
    }

    .search-box {
        flex-direction: column;
    }

    .page-title {
        padding: 23px;
    }

    .page-title h2 {
        font-size: 24px;
    }
}

@media print {
    @page {
        size: A5 portrait;
        margin: 8mm;
    }

    body.dashboard-note-printing * {
        visibility: hidden !important;
    }

    body.dashboard-note-printing .dashboard-note-print-area,
    body.dashboard-note-printing .dashboard-note-print-area * {
        visibility: visible !important;
    }

    body.dashboard-note-printing .topbar,
    body.dashboard-note-printing .sidebar,
    body.dashboard-note-printing .mobile-overlay,
    body.dashboard-note-printing .dashboard-note-form,
    body.dashboard-note-printing .no-print {
        display: none !important;
    }

    body.dashboard-note-printing .app,
    body.dashboard-note-printing .content,
    body.dashboard-note-printing .dashboard-note-card {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
        border: 0 !important;
        overflow: visible !important;
    }

    body.dashboard-note-printing .dashboard-note-print-area {
        display: block !important;
        position: absolute !important;
        inset: 0 auto auto 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    body.dashboard-note-printing .dashboard-note-print-card {
        display: block !important;
        width: 100% !important;
        min-height: 190mm !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
    }

    .no-print,
    .topbar,
    .sidebar,
    .mobile-overlay {
        display: none !important;
    }

    .content,
    .app {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .report-print-section {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #d1d5db !important;
        box-shadow: none !important;
        margin-bottom: 14px !important;
    }

    .report-print-section .card-header {
        border-bottom: 1px solid #f58220 !important;
    }

    .print-table th,
    .print-table td {
        font-size: 10px !important;
        padding: 6px !important;
    }
}

.invoice-items {
    display: grid;
    gap: 12px;
}

.invoice-item-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    align-content: center;
}

.checkbox-label input {
    width: auto;
}

.print-body {
    background: #ffffff;
    color: #111827;
}

.print-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 16mm;
    background: #ffffff;
}

.print-header {
    text-align: center;
    border-bottom: 2px solid #111827;
    padding-bottom: 10mm;
    margin-bottom: 8mm;
}

.print-header h1 {
    margin: 0 0 4mm;
}

.empty-print-header {
    min-height: 20mm;
    border-bottom: 1px solid #d1d5db;
}

.print-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 8mm;
}

.print-title h2 {
    margin: 0;
}

.print-title div,
.print-info {
    display: grid;
    gap: 4px;
}

.print-info {
    grid-template-columns: repeat(2, 1fr);
    border: 1px solid #d1d5db;
    padding: 5mm;
    margin-bottom: 8mm;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
}

.print-table th,
.print-table td {
    border: 1px solid #d1d5db;
    padding: 8px;
    white-space: normal;
}

.print-totals {
    width: 80mm;
    margin-right: auto;
    margin-top: 8mm;
    display: grid;
    gap: 4px;
}

.print-totals div {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
    padding: 6px 0;
}

.print-actions {
    width: 210mm;
    margin: 12px auto;
    display: flex;
    justify-content: flex-end;
}

@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        background: #ffffff !important;
    }

    .print-page {
        width: 210mm;
        min-height: 297mm;
        margin: 0;
        box-shadow: none;
    }

    .print-actions {
        display: none !important;
    }
}

/* Core auth phase overrides */
.sidebar {
    background: linear-gradient(180deg, #f97316, #ea580c);
    border-left: 0;
    color: #ffffff;
}

.sidebar .brand h1,
.sidebar .sidebar-footer strong,
.sidebar .menu a,
.sidebar .brand p,
.sidebar .sidebar-footer span {
    color: #ffffff;
}

.sidebar .brand-icon,
.sidebar .menu-icon,
.sidebar-toggle {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

.sidebar-toggle span {
    background: #ffffff;
}

.sidebar .menu a:hover,
.sidebar .menu a.active {
    background: rgba(255, 255, 255, 0.20);
    color: #ffffff;
}

.sidebar .menu a.active::before {
    background: #ffffff;
}

.sidebar .menu a:hover .menu-icon,
.sidebar .menu a.active .menu-icon {
    background: #ffffff;
    color: #ea580c;
}

.sidebar-footer {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.20);
}

.profile-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.topbar-profile-box {
    margin-inline-start: auto;
}

.topbar-search input {
    width: 180px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    padding: 0 12px;
    font-family: inherit;
    outline: 0;
}

.topbar-search input::placeholder {
    color: rgba(255, 255, 255, 0.78);
}

.profile-dropdown {
    position: relative;
}

.profile-dropdown summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    padding: 4px 8px;
    font-weight: 850;
}

.profile-dropdown summary::-webkit-details-marker {
    display: none;
}

.profile-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #ffffff;
    color: #ea580c;
    font-weight: 950;
}

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 210px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    padding: 8px;
    display: grid;
    gap: 6px;
    z-index: 50;
}

.profile-dropdown-menu a {
    color: var(--text);
    padding: 9px 10px;
    border-radius: 12px;
    font-weight: 850;
}

.profile-dropdown-menu a:hover {
    background: var(--surface-muted);
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #fff7ed;
}

.login-card {
    width: min(420px, 100%);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    padding: 28px;
}

.login-card h1 {
    margin: 0 0 8px;
    color: var(--text-strong);
}

.login-card p {
    margin-top: 0;
    color: var(--muted);
}

/* Phase 2 sales dashboard/customer tables */
.dashboard-four-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-market-note-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    margin-bottom: 16px;
}

.dashboard-market-note-grid.single-column {
    grid-template-columns: 1fr;
}

.dashboard-table-card {
    min-height: 340px;
}

.dashboard-market-note-grid > .card {
    min-width: 0;
    height: 100%;
}

.dashboard-note-form {
    display: grid;
    gap: 12px;
}

.dashboard-note-form textarea {
    min-height: 190px;
    resize: vertical;
    background: #ffffff;
    color: #111827;
    border-color: rgba(245, 130, 32, 0.32);
}

.dashboard-note-print-area {
    display: none;
}

.dashboard-note-print-card {
    width: 148mm;
    min-height: 210mm;
    margin: 0 auto;
    padding: 12mm;
    background: #fff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.dashboard-note-print-header {
    display: grid;
    gap: 4mm;
    padding-bottom: 6mm;
    margin-bottom: 7mm;
    border-bottom: 2px solid #f58220;
    text-align: center;
}

.dashboard-note-print-header span {
    color: #f58220;
    font-weight: 900;
    letter-spacing: .08em;
}

.dashboard-note-print-header h2 {
    margin: 0;
    font-size: 18px;
}

.dashboard-note-print-header small {
    color: #6b7280;
    font-size: 10px;
}

.dashboard-note-print-content {
    white-space: pre-wrap;
    line-height: 2;
    font-size: 12px;
    color: #111827;
}

.compact-table table {
    min-width: 720px;
}

.compact-table th,
.compact-table td {
    font-size: 10px;
    padding: 8px 9px;
    line-height: 1.6;
}

.warning-row {
    background: #fff7ed;
}

.danger-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #fff1f1;
    color: #b42318;
    border: 1px solid #ffd6d6;
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 900;
}

@media (max-width: 1180px) {
    .dashboard-four-grid,
    .dashboard-market-note-grid {
        grid-template-columns: 1fr;
    }
}

/* Phase 3 purchase/production refinements */
.compact-panel {
    padding: 14px;
}

.compact-panel .card-header h3,
.compact-panel h2,
.compact-panel h3 {
    margin-bottom: 4px;
}

.compact-panel p {
    margin: 0;
    font-size: 11px;
}

.purchase-subnav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.purchase-scroll-table {
    max-height: 330px;
    overflow: auto;
}

.purchase-scroll-table .inline-actions {
    gap: 5px;
}

.purchase-scroll-table .small-link,
.compact-table .small-link {
    padding: 5px 8px;
    font-size: 10px;
}

.report-print-section {
    margin-bottom: 16px;
}

.compact-customer-profile {
    padding: 14px;
    margin-bottom: 14px;
}

.compact-info-grid {
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 8px;
}

.compact-info-grid > div {
    padding: 9px 10px;
    border-radius: 12px;
}

.compact-info-grid span {
    font-size: 10px;
}

.compact-info-grid strong {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-finance-summary .compact-stats {
    margin-top: 0;
}

.status-note-form {
    min-width: 160px;
}

.status-note-input {
    min-height: 54px;
    font-size: 11px;
    padding: 7px 8px;
    margin-top: 5px;
}

.compact-table td {
    vertical-align: top;
}

@media (max-width: 1200px) {
    .compact-info-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.a5-page {
    width: 148mm;
    min-height: 210mm;
    padding: 12mm;
}

.a5-page .print-info {
    grid-template-columns: 1fr;
}

.mini-inline-form {
    display: grid;
    gap: 6px;
    min-width: 180px;
    margin-top: 6px;
    padding: 8px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 12px;
}

.mini-inline-form input,
.mini-inline-form select {
    width: 100%;
    min-height: 30px;
    padding: 5px 7px;
    font-size: 10px;
}

@media print {
    .report-print-section.card,
    .report-print-section.elevated-card {
        border: 0;
        box-shadow: none;
        padding: 0;
        margin-bottom: 8mm;
    }

    .report-print-section .card-header {
        padding: 0 0 4mm;
    }

    .a5-page {
        width: 148mm;
        min-height: 210mm;
        margin: 0;
        box-shadow: none;
    }
}

/* Unified CRM controls */
.btn,
.btn.secondary,
.btn.light,
.btn.outline-light,
.btn.ghost,
.small-link,
button.small-link,
.topbar-action {
    min-height: 36px;
    width: auto;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
    padding: 8px 14px;
    box-shadow: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.btn:hover,
.btn.secondary:hover,
.btn.light:hover,
.btn.outline-light:hover,
.btn.ghost:hover,
.small-link:hover,
button.small-link:hover,
.topbar-action:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: none;
}

.btn.large,
.compact-table .small-link,
.purchase-scroll-table .small-link {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 13px;
}

.danger-link,
button.danger-link {
    color: #111827;
    background: #ffffff;
    border-color: var(--accent);
}

.danger-link:hover,
button.danger-link:hover {
    background: #b42318;
    color: #ffffff;
    border-color: #b42318;
}

.table-wrap {
    border: 1px solid var(--accent);
    border-radius: 12px;
    background: #ffffff;
}

table {
    background: #ffffff;
    color: #111827;
}

th,
td {
    color: #111827;
    border-bottom: 1px solid #fed7aa;
}

th {
    background: #fff7ed;
    color: #111827;
}

tbody tr:hover {
    background: #fffaf5;
}

/* Strong table action buttons - cache busting v2 */
:root {
    --brand-orange: #f58220;
    --brand-navy: #1e2a44;
}

.table-wrap table a.small-link,
.table-wrap table button.small-link,
.table-wrap table .btn,
.table-wrap table a.btn,
.table-wrap table button.btn,
table a.small-link,
table button.small-link,
table .btn,
table a.btn,
table button.btn,
.compact-table table a.small-link,
.compact-table table button.small-link,
.purchase-scroll-table table a.small-link,
.purchase-scroll-table table button.small-link {
    min-height: 36px !important;
    width: auto !important;
    padding: 8px 14px !important;
    border: 1px solid var(--brand-orange) !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #111827 !important;
    box-shadow: none !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1.4 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    white-space: nowrap !important;
}

.table-wrap table a.small-link:hover,
.table-wrap table button.small-link:hover,
.table-wrap table .btn:hover,
.table-wrap table a.btn:hover,
.table-wrap table button.btn:hover,
table a.small-link:hover,
table button.small-link:hover,
table .btn:hover,
table a.btn:hover,
table button.btn:hover,
.compact-table table a.small-link:hover,
.compact-table table button.small-link:hover,
.purchase-scroll-table table a.small-link:hover,
.purchase-scroll-table table button.small-link:hover {
    background: var(--brand-orange) !important;
    color: #ffffff !important;
    border-color: var(--brand-orange) !important;
    transform: translateY(-1px);
}

.table-wrap table .danger-link,
.table-wrap table button.danger-link,
table .danger-link,
table button.danger-link {
    border-color: var(--brand-navy) !important;
    color: var(--brand-navy) !important;
}

.table-wrap table .danger-link:hover,
.table-wrap table button.danger-link:hover,
table .danger-link:hover,
table button.danger-link:hover {
    background: var(--brand-navy) !important;
    color: #ffffff !important;
    border-color: var(--brand-navy) !important;
}

/* Final modern UI/UX polish */
:root {
    --brand-orange: #f58220;
    --brand-navy: #1e2a44;
}

body .sidebar .sidebar-head {
    grid-template-columns: 38px !important;
    gap: 12px !important;
    padding: 10px 4px 12px !important;
    margin-bottom: 10px !important;
    border-bottom: 1px solid rgba(245, 130, 32, 0.22) !important;
    justify-content: center !important;
}

body .sidebar .brand.sidebar-logo-wrap {
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    padding: 0 !important;
}

body .sidebar .sidebar-logo.logo {
    display: none !important;
}

body.sidebar-collapsed .sidebar .sidebar-logo.logo {
    display: none !important;
}

body .topbar {
    min-height: 68px !important;
    background: #ffffff !important;
    border: 1px solid rgba(245, 130, 32, 0.18) !important;
    border-radius: 0 0 18px 18px !important;
    box-shadow: 0 10px 30px rgba(30, 42, 68, 0.07) !important;
    padding: 9px 16px !important;
}

body .topbar-kicker {
    color: var(--brand-navy) !important;
    font-size: 13px !important;
    font-weight: 950 !important;
}

body .topbar .topbar-clock {
    color: var(--brand-orange) !important;
    font-size: 13px !important;
    font-weight: 950 !important;
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
}

body .topbar-profile-box {
    background: #ffffff !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 6px 8px !important;
    gap: 12px !important;
}

body .topbar-search.live-search-wrap {
    position: relative !important;
    width: min(520px, 42vw) !important;
}

body .topbar-search.live-search-wrap input[type="search"] {
    width: 100% !important;
    min-height: 40px !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    border-radius: 10px !important;
    background: #f8fafc !important;
    color: #111827 !important;
    font-size: 12px !important;
}

body .topbar-search.live-search-wrap input[type="search"]:focus,
body .topbar-profile-box:focus,
body .topbar-profile-box:focus-within {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

body .live-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 80;
    background: #ffffff;
    border: 1px solid rgba(245, 130, 32, 0.32);
    border-radius: 14px;
    box-shadow: 0 18px 42px rgba(30, 42, 68, 0.14);
    overflow: hidden;
}

body .live-search-results.show {
    display: block;
}

body .live-search-results a,
body .live-search-empty {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    color: #111827;
    border-bottom: 1px solid #fff1e7;
    font-size: 12px;
}

body .live-search-results a:hover {
    background: #fff7ed;
}

body .live-search-results a strong {
    color: var(--brand-navy);
    font-size: 12px;
}

body .live-search-results a span,
body .live-search-empty {
    color: #64748b;
    font-size: 11px;
}

body .profile-dropdown summary {
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
    cursor: pointer !important;
    list-style: none !important;
}

body .profile-dropdown summary::-webkit-details-marker {
    display: none !important;
}

body .profile-name {
    color: var(--brand-navy) !important;
    font-size: 13px !important;
    font-weight: 950 !important;
    white-space: nowrap !important;
}

body .profile-avatar {
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    background: var(--brand-navy) !important;
    color: #ffffff !important;
    border: 2px solid var(--brand-orange) !important;
    display: inline-grid !important;
    place-items: center !important;
    font-size: 18px !important;
    box-shadow: 0 7px 18px rgba(30, 42, 68, 0.16) !important;
}

body .status-pill,
body table .status-pill,
body .count-badge,
body table .count-badge {
    background: var(--brand-orange) !important;
    color: #ffffff !important;
    border: 1px solid var(--brand-orange) !important;
    border-radius: 8px !important;
    min-height: 28px !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
    font-weight: 950 !important;
}

body table,
body table th,
body table td,
body .compact-table th,
body .compact-table td,
body .dashboard-table-card table,
body .dashboard-table-card th,
body .dashboard-table-card td {
    font-size: 12px !important;
    color: #111827 !important;
}

body .card-header {
    align-items: flex-start !important;
    min-height: 54px !important;
    margin-bottom: 14px !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid rgba(245, 130, 32, 0.14) !important;
}

body .card-header h3 {
    margin: 0 0 4px !important;
    line-height: 1.5 !important;
}

body .card-header p {
    margin: 0 !important;
    line-height: 1.6 !important;
}

@media (max-width: 1100px) {
    body .topbar-search.live-search-wrap {
        width: min(420px, 38vw) !important;
    }
}

@media (max-width: 900px) {
    body .topbar {
        flex-wrap: wrap !important;
    }

    body .topbar-search.live-search-wrap {
        width: 100% !important;
        order: 3 !important;
    }

    body .topbar-profile-box {
        flex-wrap: wrap !important;
    }
}

body .crm-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

body .crm-modal.is-open {
    display: flex;
}

body.modal-open {
    overflow: hidden;
}

body .crm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(30, 42, 68, 0.48);
    backdrop-filter: blur(2px);
}

body .crm-modal-panel {
    position: relative;
    width: min(520px, 94vw);
    background: #ffffff;
    border: 2px solid var(--brand-orange);
    border-radius: 18px;
    box-shadow: 0 28px 70px rgba(30, 42, 68, 0.24);
    padding: 22px;
    color: #111827;
}

body .crm-modal-panel h3 {
    margin: 0 0 16px;
    color: var(--brand-navy);
    font-size: 17px;
    font-weight: 950;
}

body .crm-modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid var(--brand-orange);
    background: #fff7ed;
    color: var(--brand-navy);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

body .direct-call-form {
    display: grid;
    gap: 12px;
}

body .direct-call-form label {
    display: grid;
    gap: 7px;
    color: var(--brand-navy);
    font-size: 12px;
    font-weight: 850;
}

body .direct-call-form select,
body .direct-call-form textarea {
    width: 100%;
    border: 1px solid rgba(245, 130, 32, 0.36);
    border-radius: 12px;
    background: #f8fafc;
    color: #111827;
    padding: 10px 12px;
    font-size: 12px;
}

body .direct-call-entity-name {
    min-height: 34px;
    display: flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 10px;
    background: #fff7ed;
    color: var(--brand-navy);
    font-size: 12px;
    font-weight: 950;
}

body .muted-note {
    margin: 0;
    color: #64748b;
    font-size: 11px;
}

body .reminder-tabs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

body .reminder-tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

body .reminder-tab-panel {
    display: none;
}

body .reminder-tab-panel.is-active {
    display: block;
}

/* Compact sidebar spacing */
body .sidebar {
    padding: 12px 10px !important;
}

body .sidebar .sidebar-head {
    padding: 6px 4px 8px !important;
    margin-bottom: 6px !important;
}

body .sidebar .sidebar-toggle {
    width: 34px !important;
    height: 34px !important;
    border-radius: 11px !important;
}

body .sidebar .menu {
    gap: 3px !important;
    padding-top: 4px !important;
}

body .sidebar .menu a {
    min-height: 38px !important;
    padding: 6px 8px !important;
    gap: 7px !important;
    border-radius: 11px !important;
    font-size: 12px !important;
    font-weight: 850 !important;
    line-height: 1.35 !important;
}

body .sidebar .menu-icon {
    width: 28px !important;
    height: 28px !important;
    border-radius: 9px !important;
    font-size: 13px !important;
}

body .sidebar .menu-text {
    font-size: 12px !important;
    line-height: 1.35 !important;
}

body .sidebar .menu a.active::before {
    right: -10px !important;
    width: 3px !important;
    height: 20px !important;
}

body .sidebar .sidebar-footer {
    padding: 9px !important;
    border-radius: 12px !important;
}

body .sidebar .sidebar-footer span {
    font-size: 10px !important;
}

body .sidebar .sidebar-footer strong {
    font-size: 11px !important;
}

body.sidebar-collapsed .sidebar .menu a {
    padding: 6px !important;
    justify-content: center !important;
}

body .module-permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 14px 0;
}

body .compact-module-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    min-width: 320px;
    max-height: 260px;
    overflow: auto;
}

body .module-checkbox {
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid rgba(245, 130, 32, 0.35);
    border-radius: 10px;
    background: #ffffff;
    color: #111827;
    font-size: 12px;
    font-weight: 850;
}

body .module-checkbox input {
    width: auto;
}

body .access-inline-form {
    min-width: 380px;
}

body .followup-status-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

body .followup-status-select,
body .followup-date-input,
body .followup-save-btn {
    width: auto !important;
    min-height: 30px !important;
    height: 30px !important;
    padding: 3px 8px !important;
    border: 1px solid var(--brand-orange, #f58220) !important;
    border-radius: 7px !important;
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    outline: 0 !important;
    font-size: 11px !important;
    font-weight: 850 !important;
    line-height: 1.4 !important;
}

body .followup-save-btn {
    cursor: pointer;
    min-width: 42px !important;
}

body .followup-save-btn:hover {
    background: var(--brand-orange, #f58220) !important;
    color: #ffffff !important;
}

body .followup-status-select {
    max-width: 118px;
}

body .followup-date-input {
    max-width: 112px;
}

body .followup-status-select:focus,
body .followup-date-input:focus {
    border-color: var(--brand-orange, #f58220) !important;
    outline: 0 !important;
    box-shadow: 0 0 0 2px rgba(245, 130, 32, 0.14) !important;
}

/* Daily reports */
.report-filter-form {
    align-items: center;
    flex-wrap: wrap;
}

.report-filter-form .report-date-input {
    flex: 0 0 150px;
    max-width: 150px;
    text-align: center;
}

.report-filter-form select {
    flex: 0 0 230px;
    max-width: 230px;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 12mm 10mm;
    }

    html,
    body,
    body.print-body {
        width: auto !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #111827 !important;
        font-family: VazirLocal, Tahoma, Arial, sans-serif !important;
        font-size: 10px !important;
        line-height: 1.45 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .no-print,
    .topbar,
    .sidebar,
    .mobile-overlay,
    .print-actions,
    .report-filter-card,
    button,
    .btn,
    nav,
    form {
        display: none !important;
    }

    .app,
    .content,
    main.daily-report,
    .daily-report.print-page,
    .print-page {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: #ffffff !important;
        overflow: visible !important;
    }

    .daily-report .print-title {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        gap: 6mm !important;
        margin: 0 0 6mm !important;
        padding: 0 0 3mm !important;
        border-bottom: 1px solid #111827 !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .daily-report .print-title h2 {
        margin: 0 !important;
        color: #111827 !important;
        font-size: 15px !important;
        line-height: 1.6 !important;
        font-weight: 950 !important;
    }

    .daily-report .print-title div,
    .daily-report .print-title span {
        color: #374151 !important;
        font-size: 10px !important;
        font-weight: 800 !important;
    }

    .daily-report .report-print-section,
    .daily-report .report-print-section.card,
    .daily-report .report-print-section.elevated-card {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 6mm !important;
        padding: 3mm !important;
        border: 1px solid #d1d5db !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #ffffff !important;
        overflow: visible !important;
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .daily-report .report-print-section .card-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin: 0 0 2.5mm !important;
        padding: 0 0 1.8mm !important;
        border-bottom: 1px solid #e5e7eb !important;
        break-after: avoid !important;
        page-break-after: avoid !important;
    }

    .daily-report .report-print-section .card-header h3 {
        margin: 0 !important;
        color: #111827 !important;
        font-size: 12px !important;
        font-weight: 950 !important;
        line-height: 1.5 !important;
    }

    .daily-report .report-print-section .card-header p,
    .daily-report .empty {
        margin: 0 !important;
        color: #6b7280 !important;
        font-size: 9px !important;
        font-weight: 700 !important;
    }

    .daily-report .table-wrap,
    .daily-report .compact-table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        background: #ffffff !important;
        box-shadow: none !important;
        overflow: visible !important;
        overflow-x: visible !important;
    }

    .daily-report table,
    .daily-report .print-table,
    .daily-report .compact-table table {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
        border-spacing: 0 !important;
        background: #ffffff !important;
        overflow: visible !important;
    }

    .daily-report thead {
        display: table-header-group !important;
    }

    .daily-report tfoot {
        display: table-footer-group !important;
    }

    .daily-report tr {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .daily-report th,
    .daily-report td,
    .daily-report .compact-table th,
    .daily-report .compact-table td,
    .daily-report .print-table th,
    .daily-report .print-table td {
        border: 0.5pt solid #d6dbe1 !important;
        padding: 2.2mm 1.6mm !important;
        color: #111827 !important;
        background: #ffffff !important;
        font-size: 9px !important;
        line-height: 1.45 !important;
        font-weight: 600 !important;
        text-align: right !important;
        vertical-align: top !important;
        white-space: normal !important;
        overflow: visible !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    .daily-report th,
    .daily-report .print-table th {
        background: #f3f4f6 !important;
        color: #111827 !important;
        font-size: 9.5px !important;
        font-weight: 950 !important;
    }

    .daily-report .print-table th:nth-child(1),
    .daily-report .print-table td:nth-child(1) {
        width: 13% !important;
        direction: ltr !important;
        text-align: center !important;
    }

    .daily-report .print-table th:nth-child(2),
    .daily-report .print-table td:nth-child(2) {
        width: 12% !important;
    }

    .daily-report .print-table th:nth-child(3),
    .daily-report .print-table td:nth-child(3) {
        width: 13% !important;
    }

    .daily-report .print-table th:nth-child(4),
    .daily-report .print-table td:nth-child(4) {
        width: 36% !important;
    }

    .daily-report .print-table th:nth-child(5),
    .daily-report .print-table td:nth-child(5) {
        width: 12% !important;
    }

    .daily-report .print-table th:nth-child(6),
    .daily-report .print-table td:nth-child(6) {
        width: 14% !important;
    }

    .daily-report .entity-print-table th,
    .daily-report .entity-print-table td {
        width: auto !important;
        direction: rtl !important;
        text-align: right !important;
    }

    .daily-report .entity-print-table th:first-child,
    .daily-report .entity-print-table td:first-child {
        width: 15% !important;
        direction: ltr !important;
        text-align: center !important;
    }

    .daily-report .entity-print-table th:nth-child(2),
    .daily-report .entity-print-table td:nth-child(2) {
        width: 13% !important;
    }

    .daily-report .entity-print-table th:nth-child(3),
    .daily-report .entity-print-table td:nth-child(3) {
        width: 18% !important;
    }

    .daily-report .entity-print-table th:nth-child(4),
    .daily-report .entity-print-table td:nth-child(4) {
        width: 14% !important;
    }

    .daily-report .entity-print-table th:nth-child(5),
    .daily-report .entity-print-table td:nth-child(5) {
        width: 13% !important;
    }

    .daily-report .entity-print-table th:nth-child(6),
    .daily-report .entity-print-table td:nth-child(6) {
        width: 15% !important;
    }

    .daily-report .entity-print-table th:nth-child(7),
    .daily-report .entity-print-table td:nth-child(7) {
        width: 12% !important;
    }

    .daily-report .list-print-table th,
    .daily-report .list-print-table td {
        width: auto !important;
        direction: rtl !important;
        text-align: right !important;
    }

    .daily-report .list-print-table th:nth-child(1),
    .daily-report .list-print-table td:nth-child(1) {
        width: 12% !important;
    }

    .daily-report .list-print-table th:nth-child(2),
    .daily-report .list-print-table td:nth-child(2) {
        width: 15% !important;
    }

    .daily-report .list-print-table th:nth-child(3),
    .daily-report .list-print-table td:nth-child(3) {
        width: 17% !important;
    }

    .daily-report .list-print-table th:nth-child(4),
    .daily-report .list-print-table td:nth-child(4) {
        width: 13% !important;
    }

    .daily-report .list-print-table th:nth-child(5),
    .daily-report .list-print-table td:nth-child(5) {
        width: 13% !important;
    }

    .daily-report .list-print-table th:nth-child(6),
    .daily-report .list-print-table td:nth-child(6) {
        width: 13% !important;
    }

    .daily-report .list-print-table th:nth-child(7),
    .daily-report .list-print-table td:nth-child(7) {
        width: 8% !important;
        text-align: center !important;
    }

    .daily-report .list-print-table th:nth-child(8),
    .daily-report .list-print-table td:nth-child(8) {
        width: 9% !important;
        direction: ltr !important;
        text-align: center !important;
    }

    .daily-report .print-info-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0 !important;
        border: 0.5pt solid #d6dbe1 !important;
        background: #ffffff !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .daily-report .print-info-grid div {
        display: grid !important;
        grid-template-columns: 34% 1fr !important;
        gap: 2mm !important;
        align-items: start !important;
        min-height: 8mm !important;
        padding: 2mm !important;
        border-left: 0.5pt solid #d6dbe1 !important;
        border-bottom: 0.5pt solid #d6dbe1 !important;
        background: #ffffff !important;
    }

    .daily-report .print-info-grid span {
        color: #4b5563 !important;
        font-size: 9px !important;
        font-weight: 850 !important;
    }

    .daily-report .print-info-grid strong {
        color: #111827 !important;
        font-size: 9px !important;
        font-weight: 800 !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    .daily-report .status-pill,
    .daily-report td .status-pill {
        display: inline !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        color: #111827 !important;
        box-shadow: none !important;
        font-size: inherit !important;
        font-weight: 800 !important;
        line-height: inherit !important;
        white-space: normal !important;
    }

    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }
}

/* Phase 15 mobile sidebar final override - keep at end of file */
@media screen and (max-width: 992px) {
    html,
    body {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    body .app {
        display: block !important;
        min-height: 100vh !important;
    }

    body .content,
    body.sidebar-collapsed .content {
        width: 100% !important;
        max-width: 100% !important;
        margin-right: 0 !important;
        padding: 12px !important;
    }

    body .sidebar,
    body.sidebar-collapsed .sidebar {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: min(280px, 88vw) !important;
        max-width: min(280px, 88vw) !important;
        height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        transform: translateX(110%) !important;
        transition: transform 0.25s ease !important;
        z-index: 1000 !important;
        overflow-y: auto !important;
        box-shadow: -16px 0 40px rgba(15, 23, 42, 0.26) !important;
    }

    body.sidebar-open .sidebar,
    body.sidebar-open.sidebar-collapsed .sidebar {
        transform: translateX(0) !important;
    }

    body .mobile-overlay {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(15, 23, 42, 0.48) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 0.2s ease, visibility 0.2s ease !important;
        z-index: 990 !important;
    }

    body.sidebar-open .mobile-overlay {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    body .topbar-menu {
        display: grid !important;
        flex: 0 0 42px !important;
    }

    body .topbar {
        position: sticky !important;
        top: 0 !important;
        z-index: 800 !important;
        width: 100% !important;
    }

    body.sidebar-open {
        overflow: hidden !important;
    }
}

@media screen and (min-width: 993px) {
    body .mobile-overlay {
        display: none !important;
    }
}

/* Phase 15 visibility hotfix - desktop sidebar and dashboard */
@media screen and (min-width: 993px) {
    body .app {
        display: flex !important;
        min-height: 100vh !important;
    }

    body .sidebar {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: var(--sidebar-open) !important;
        max-width: var(--sidebar-open) !important;
        height: 100vh !important;
        transform: none !important;
        z-index: 30 !important;
    }

    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-closed) !important;
        max-width: var(--sidebar-closed) !important;
        transform: none !important;
    }

    body .content {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: calc(100% - var(--sidebar-open)) !important;
        margin-right: var(--sidebar-open) !important;
        transform: none !important;
    }

    body.sidebar-collapsed .content {
        width: calc(100% - var(--sidebar-closed)) !important;
        margin-right: var(--sidebar-closed) !important;
    }

    body .topbar-menu {
        display: none !important;
    }
}

body .dashboard-market-note-grid,
body .dashboard-four-grid,
body .market-prices-card,
body .dashboard-note-card,
body .dashboard-table-card {
    visibility: visible !important;
    opacity: 1 !important;
}

body .dashboard-market-note-grid,
body .dashboard-four-grid {
    display: grid !important;
}

body .market-prices-card,
body .dashboard-note-card,
body .dashboard-table-card {
    display: block !important;
}

/* Phase 15 final layout rescue: header, sidebar, profile, dashboard */
body .profile-dropdown summary {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
}

body .profile-menu,
body .topbar-profile-box {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    margin-right: auto !important;
    margin-left: 0 !important;
    order: 10 !important;
}

body .topbar-welcome {
    order: 2 !important;
}

body .topbar-menu {
    order: 1 !important;
}

body .profile-dropdown-menu {
    left: 0 !important;
    right: auto !important;
}

body .notification-dropdown .profile-dropdown-menu {
    min-width: 190px;
    max-width: 240px;
    gap: 4px;
    padding: 6px;
}

body .notification-dropdown .status-pill {
    min-width: 18px;
    height: 18px;
    padding: 2px 6px;
    font-size: 9px !important;
    line-height: 1;
}

body .notification-dropdown .notification-item {
    display: grid;
    grid-template-columns: 10px 1fr;
    align-items: start;
    gap: 6px;
    padding: 7px 8px;
    border-radius: 10px;
    font-size: 10px !important;
    line-height: 1.7;
    font-weight: 750;
}

body .notification-dropdown .notification-item.notification-unread {
    background: rgba(249, 115, 22, .08);
}

body .notification-dropdown .notification-item.notification-read {
    background: rgba(148, 163, 184, .08);
    opacity: .7;
}

body .notification-dropdown .notification-dot {
    color: #f97316;
    font-size: 8px;
    line-height: 1.8;
}

body .notification-dropdown .notification-text {
    display: block;
    color: var(--text);
    overflow-wrap: anywhere;
}

body .notification-dropdown .profile-avatar {
    width: 28px;
    height: 28px;
    font-size: 14px;
}

@media screen and (min-width: 993px) {
    body .sidebar,
    body .sidebar .menu,
    body .sidebar .sidebar-head,
    body .sidebar .sidebar-footer {
        visibility: visible !important;
        opacity: 1 !important;
    }

    body .sidebar {
        display: flex !important;
        transform: none !important;
    }

    body .sidebar .menu {
        display: grid !important;
    }

    body .sidebar .menu a {
        display: flex !important;
    }

    body .topbar {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    body .topbar-menu {
        display: none !important;
    }
}

@media screen and (max-width: 992px) {
    body .topbar {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
    }

    body .topbar-menu.sidebar-toggle {
        display: grid !important;
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        border: 1px solid rgba(245, 130, 32, 0.35) !important;
        background: #fff7ed !important;
        color: #111827 !important;
        place-content: center !important;
        gap: 4px !important;
        border-radius: 12px !important;
        box-shadow: 0 8px 22px rgba(245, 130, 32, 0.18) !important;
    }

    body .topbar-menu.sidebar-toggle span {
        display: block !important;
        width: 20px !important;
        height: 2px !important;
        background: #f97316 !important;
        border-radius: 999px !important;
    }

    body .profile-menu,
    body .topbar-profile-box {
        width: auto !important;
        margin-right: auto !important;
        justify-content: flex-end !important;
    }

    body .topbar-search.live-search-wrap {
        order: 20 !important;
        width: 100% !important;
        flex-basis: 100% !important;
    }

    body .sidebar .sidebar-toggle {
        display: grid !important;
    }
}

body .dashboard-market-note-grid,
body .dashboard-four-grid {
    min-height: 1px !important;
}

body .dashboard-market-note-grid > *,
body .dashboard-four-grid > *,
body .dashboard-note-card,
body .market-prices-card,
body .dashboard-table-card {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 120px !important;
}

/* Phase 18/19: Production detail modal and clean A5 print */
body .production-detail-modal .crm-modal-panel {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 22px;
}

body .production-detail-modal .production-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

body .production-detail-modal .production-info-grid div {
    min-height: 72px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    background: #fff;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

body .production-detail-modal .production-info-grid .wide {
    grid-column: 1 / -1;
}

body .production-detail-modal .production-info-grid span {
    display: block;
    margin-bottom: 6px;
    color: #64748b;
    font-size: 12px;
}

body .production-detail-modal .production-info-grid strong {
    display: block;
    line-height: 1.9;
    color: #111827;
    font-size: 14px;
    white-space: pre-wrap;
}

body .production-a5-print .print-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.45);
    padding-bottom: 10px;
}

@media screen and (max-width: 576px) {
    body .production-detail-modal .production-info-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    @page {
        size: A5 portrait;
        margin: 8mm;
    }

    body:has(.production-detail-modal.is-open) .app-shell > *:not(.content),
    body:has(.production-detail-modal.is-open) .content > *:not(.production-detail-modal) {
        display: none !important;
    }

    body .production-detail-modal.is-open,
    body .production-detail-modal.is-open .crm-modal-panel,
    body .production-detail-modal.is-open .production-a5-print {
        position: static !important;
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        box-shadow: none !important;
        border: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    body .production-detail-modal.is-open .crm-modal-backdrop,
    body .production-detail-modal.is-open .crm-modal-close,
    body .production-detail-modal.is-open .no-print {
        display: none !important;
    }

    body .production-detail-modal.is-open .production-info-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 4mm !important;
    }

    body .production-detail-modal.is-open .production-info-grid div {
        min-height: 18mm !important;
        border: 1px solid #d1d5db !important;
        border-radius: 3mm !important;
        padding: 3mm !important;
        page-break-inside: avoid !important;
    }

    body .production-detail-modal.is-open .production-info-grid .wide {
        grid-column: 1 / -1 !important;
    }

    body .production-detail-modal.is-open .production-info-grid span {
        color: #475569 !important;
        font-size: 9pt !important;
    }

    body .production-detail-modal.is-open .production-info-grid strong {
        color: #111827 !important;
        font-size: 10pt !important;
        line-height: 1.7 !important;
    }
}

/* Final UI cleanup: compact tables and vertical action stacks */
body .compact-table table,
body .table-wrap table {
    font-size: 0.86rem;
}

body .compact-table th,
body .compact-table td,
body .table-wrap th,
body .table-wrap td {
    padding: 8px 7px;
    line-height: 1.65;
    vertical-align: top;
}

body .vertical-actions,
body .table-actions-stack {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    min-width: 92px;
    max-width: 150px;
}

body .table-actions-stack .small-link,
body .table-actions-stack button.small-link,
body .table-actions-stack summary.small-link,
body .table-actions-stack .status-pill,
body .table-actions-stack .mini-status-dot {
    display: inline-flex !important;
    width: 100%;
    justify-content: center;
    align-items: center;
    min-height: 28px;
    padding: 4px 8px !important;
    font-size: 0.76rem !important;
    line-height: 1.45 !important;
    white-space: normal !important;
    text-align: center;
}

body .table-actions-stack form,
body .table-actions-stack details {
    display: block !important;
    width: 100%;
    margin: 0 !important;
}

body .table-actions-stack .mini-inline-form {
    display: grid !important;
    gap: 5px !important;
    min-width: 130px;
}

body .dashboard-sales-inquiries-table {
    overflow-x: visible;
}

body .dashboard-sales-inquiries-table table {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
    font-size: 0.78rem;
}

body .dashboard-sales-inquiries-table th,
body .dashboard-sales-inquiries-table td {
    padding: 6px 5px;
    line-height: 1.45;
    word-break: break-word;
    white-space: normal;
}

body .dashboard-sales-inquiries-table th:nth-child(1),
body .dashboard-sales-inquiries-table td:nth-child(1) {
    width: 34px;
}

body .dashboard-sales-inquiries-table th:nth-child(2),
body .dashboard-sales-inquiries-table td:nth-child(2) {
    width: 96px;
}

body .dashboard-sales-inquiries-table th:nth-child(3),
body .dashboard-sales-inquiries-table td:nth-child(3) {
    width: 92px;
}

body .dashboard-sales-inquiries-table th:nth-child(6),
body .dashboard-sales-inquiries-table td:nth-child(6) {
    width: 78px;
}

body .dashboard-sales-inquiries-table th:nth-child(8),
body .dashboard-sales-inquiries-table td:nth-child(8) {
    width: 82px;
}

body .dashboard-actions-stack {
    min-width: 68px !important;
    max-width: 82px !important;
    gap: 4px !important;
}

body .dashboard-actions-stack .small-link {
    min-height: 26px;
    padding: 3px 6px !important;
    font-size: 0.72rem !important;
}

body .market-prices-card .card-header {
    align-items: center;
    gap: 12px;
}

body .market-prices-table-wrap {
    overflow-x: visible;
}

body .market-prices-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 0.8rem;
}

body .market-prices-table th,
body .market-prices-table td {
    padding: 7px 6px;
    line-height: 1.5;
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
}

body .market-prices-table th:nth-child(1),
body .market-prices-table td:nth-child(1) {
    width: 96px;
}

body .market-prices-table th:nth-child(3),
body .market-prices-table td:nth-child(3) {
    width: 118px;
}

body .market-prices-table th:nth-child(5),
body .market-prices-table td:nth-child(5) {
    width: 82px;
}

body .market-actions-stack {
    min-width: 68px !important;
    max-width: 82px !important;
    gap: 4px !important;
}

body .market-actions-stack .small-link {
    min-height: 26px;
    padding: 3px 6px !important;
    font-size: 0.72rem !important;
}

body .free-quote-actions {
    min-width: 78px !important;
    max-width: 96px !important;
    gap: 4px !important;
}

body .free-quote-actions .small-link,
body .free-quote-actions button.small-link {
    min-height: 25px;
    padding: 3px 6px !important;
    font-size: 9px !important;
    line-height: 1.35 !important;
}

body .free-quote-actions i {
    font-size: 9px;
    margin-left: 3px;
}

body .free-quote-actions .fa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 10px;
    font-style: normal;
}

body .free-quote-actions .fa-pen::before {
    content: "✎";
}

body .free-quote-actions .fa-trash::before {
    content: "🗑";
}

body .mini-status-dot {
    border-radius: 999px;
    font-weight: 800;
    border: 1px solid transparent;
    background: #f1f5f9;
    color: #334155;
}

body .mini-status-dot.status-success {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

body .mini-status-dot.status-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

body .mini-status-dot.status-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

body .mini-status-dot.status-info {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

body .inquiry-response-modal .crm-modal-panel {
    width: min(560px, calc(100vw - 28px));
}

body .inquiry-response-modal textarea {
    min-height: 120px;
    resize: vertical;
}

/* Shared compact CRM table standard */
body .table-wrap.compact-table {
    overflow-x: visible;
    border-radius: 16px;
}

body .table-wrap.compact-table > table,
body .compact-table > table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.76rem;
}

body .table-wrap.compact-table > table thead th,
body .compact-table > table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #0f172a !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 900;
    line-height: 1.45;
    white-space: normal;
}

body .table-wrap.compact-table > table th,
body .table-wrap.compact-table > table td,
body .compact-table > table th,
body .compact-table > table td {
    height: 48px;
    padding: 5px 6px;
    line-height: 1.35;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body .table-wrap.compact-table > table tbody tr:hover,
body .compact-table > table tbody tr:hover {
    background: rgba(249, 115, 22, .055);
}

body .table-wrap.compact-table > table .small-link,
body .table-wrap.compact-table > table button.small-link,
body .compact-table > table .small-link,
body .compact-table > table button.small-link {
    min-height: 24px;
    padding: 3px 7px !important;
    border-radius: 8px;
    font-size: 10px !important;
    line-height: 1.25 !important;
}

body .table-wrap.compact-table > table .status-pill,
body .compact-table > table .status-pill {
    min-height: 22px;
    padding: 3px 7px;
    font-size: 10px !important;
    line-height: 1.25;
    white-space: nowrap;
}

body .crm-total-row td {
    height: 40px !important;
    background: #fff7ed !important;
    color: #9a3412;
    font-weight: 950;
}

/* Compact CRM inquiries list */
body .inquiries-crm-card {
    overflow: visible;
}

body .inquiries-list-header {
    margin-bottom: 10px;
}

body .inquiries-toolbar {
    display: grid;
    grid-template-columns: minmax(210px, 1.35fr) repeat(3, minmax(120px, .75fr)) auto auto;
    gap: 8px;
    align-items: end;
    margin-bottom: 12px;
}

body .inquiries-toolbar label {
    display: grid;
    gap: 4px;
    color: #475569;
    font-size: 0.74rem;
    font-weight: 850;
}

body .inquiries-toolbar input,
body .inquiries-toolbar select {
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 10px;
    font-size: 0.78rem;
}

body .inquiry-quick-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

body .quick-filter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.76rem;
    font-weight: 900;
    text-decoration: none;
}

body .quick-filter-chip.is-active,
body .quick-filter-chip:hover {
    background: rgba(249, 115, 22, .12);
    border-color: rgba(249, 115, 22, .28);
    color: #c2410c;
}

body .inquiries-crm-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
    border-radius: 16px;
}

body .inquiries-crm-table {
    display: table;
    width: 100%;
    min-width: 0;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.76rem;
}

body .inquiries-crm-table thead {
    display: table-header-group;
}

body .inquiries-crm-table tbody {
    display: table-row-group;
}

body .inquiries-crm-table tr {
    display: table-row;
}

body .inquiries-crm-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #0f172a;
    color: #fff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .08);
}

body .inquiries-crm-table th,
body .inquiries-crm-table td {
    display: table-cell;
    height: 48px;
    max-height: 48px;
    padding: 8px 10px;
    line-height: 1.35;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

body .inquiries-crm-table th:nth-child(4),
body .inquiries-crm-table td:nth-child(4),
body .inquiries-crm-table th:nth-child(5),
body .inquiries-crm-table td:nth-child(5),
body .inquiries-crm-table th:nth-child(6),
body .inquiries-crm-table td:nth-child(6) {
    padding-inline: 8px;
}

body .inquiries-crm-table tbody .inquiry-compact-row {
    cursor: pointer;
    transition: background .18s ease, box-shadow .18s ease;
}

body .inquiries-crm-table tbody .inquiry-compact-row:hover {
    background: rgba(249, 115, 22, .055);
}

body .inquiries-crm-table .col-view {
    text-align: center;
    padding-inline: 6px;
}

body .inquiries-crm-table .inquiry-code-cell {
    text-align: center;
    padding-inline: 6px;
}

body .inquiries-crm-table .creator-cell {
    width: 88px;
    min-width: 80px;
    max-width: 95px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

body .inquiries-crm-table .date-cell {
    text-align: center;
}

body .inquiries-crm-table .customer-cell a {
    color: #ea580c;
    font-weight: 950;
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body .inquiries-crm-table .company-cell,
body .inquiries-crm-table .product-cell,
body .inquiries-crm-table .quantity-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

body .inquiries-crm-table .quantity-cell {
    text-align: right;
    direction: rtl;
    padding-inline: 8px;
}

body .inquiries-crm-table .status-pill {
    min-height: 22px;
    padding: 3px 7px;
    font-size: 0.68rem !important;
    line-height: 1.25;
    white-space: nowrap;
}

body .inquiry-actions-compact {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    margin-left: 12px;
}

body .inquiries-crm-table .actions-cell,
body .inquiries-crm-table th.actions-cell {
    padding-inline: 12px;
    overflow: visible;
    width: 165px;
    min-width: 150px;
    max-width: 165px;
    text-align: center;
}

body .inquiry-actions-compact form {
    display: inline-flex;
    margin: 0;
}

body .inquiries-crm-table .icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 30px;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 9px;
    background: #f8fafc;
    color: #0f172a;
    font-size: 12px;
    font-weight: 950;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

body .inquiries-crm-table .icon-action:hover,
body .inquiries-crm-table .icon-action.is-active {
    background: rgba(249, 115, 22, .14);
    border-color: rgba(249, 115, 22, .35);
    color: #c2410c;
}

body .inquiries-crm-table .icon-action.primary-action {
    background: #fff7ed;
    color: #c2410c;
}

body .inquiries-crm-table .icon-action.danger-link {
    background: #fff1f2;
    color: #be123c;
}

@media screen and (min-width: 769px) {
    body .inquiries-crm-table .desktop-inquiry-detail-row,
    body .inquiries-crm-table .desktop-inquiry-detail-row.hidden-inquiry-row,
    body .inquiries-crm-table .desktop-inquiry-detail-row[hidden]:not(.is-open) {
        display: none !important;
    }

    body .inquiries-crm-table .desktop-inquiry-detail-row.is-open {
        display: table-row !important;
    }

    body .inquiries-crm-table .desktop-inquiry-detail-row > td {
        height: auto;
        max-height: none;
        padding: 10px 12px;
        white-space: normal;
        overflow: visible;
        background: #fffaf5;
        border-top: 1px solid rgba(249, 115, 22, .18);
        border-bottom: 1px solid rgba(249, 115, 22, .18);
    }

    body .desktop-inquiry-detail-box {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        padding: 10px;
        border: 1px solid rgba(249, 115, 22, .18);
        border-radius: 14px;
        background: #ffffff;
    }

    body .desktop-inquiry-detail-box div {
        display: grid;
        gap: 4px;
        min-width: 0;
        padding: 7px 9px;
        border-radius: 10px;
        background: #f8fafc;
    }

    body .desktop-inquiry-detail-box .wide {
        grid-column: span 2;
    }

    body .desktop-inquiry-detail-box span {
        color: #64748b;
        font-size: 10px;
        font-weight: 850;
    }

    body .desktop-inquiry-detail-box strong {
        color: #0f172a;
        font-size: 11px;
        font-weight: 900;
        line-height: 1.7;
        overflow-wrap: anywhere;
    }
}

body .inquiry-actions-compact .customer-response-chip {
    display: none !important;
}

@media screen and (max-width: 768px) {
    body .compact-table table,
    body .table-wrap table {
        font-size: 0.8rem;
    }

    body .table-actions-stack {
        min-width: 84px;
        max-width: 120px;
    }

    body .inquiries-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    body .inquiry-quick-tabs {
        grid-column: 1 / -1;
    }

    body .inquiries-crm-table {
        font-size: 0.72rem;
    }

    body .inquiries-crm-table th,
    body .inquiries-crm-table td {
        height: 46px;
        padding: 4px 5px;
    }

    body .inquiries-crm-table th:nth-child(4),
    body .inquiries-crm-table td:nth-child(4),
    body .inquiries-crm-table th:nth-child(9),
    body .inquiries-crm-table td:nth-child(9),
    body .inquiries-crm-table th:nth-child(10),
    body .inquiries-crm-table td:nth-child(10) {
        display: none;
    }

    body .inquiries-crm-table th:nth-child(11),
    body .inquiries-crm-table td:nth-child(11) {
        width: 118px;
    }

    body .inquiry-actions-compact {
        gap: 3px;
    }

    body .icon-action {
        width: 24px;
        height: 24px;
        min-width: 24px;
        font-size: 11px;
    }

    body .inquiry-actions-compact .customer-response-chip {
        display: none !important;
    }

}

/* send_to_production compact editable layout */
body .send-production-card,
body .compact-production-form {
    width: 100%;
    max-width: none;
    margin-inline: 0;
}

body .send-production-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

body .send-production-grid label,
body .vertical-form-stack label {
    font-size: 0.86rem;
}

body .send-production-grid input,
body .send-production-grid textarea,
body .send-production-grid select {
    width: 100%;
    font-size: 0.86rem;
    padding: 9px 10px;
    min-height: 40px;
}

body .send-production-grid textarea {
    min-height: 110px;
    resize: vertical;
}

body .send-production-grid .wide {
    grid-column: 1 / -1;
}

body .gross-dimension-box {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(245, 130, 32, 0.2);
    border-radius: 16px;
    background: rgba(255, 247, 237, 0.5);
}

body .section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

body .section-title-row strong {
    color: #7c2d12;
    font-size: 0.94rem;
}

body .section-title-row span {
    color: #64748b;
    font-size: 0.78rem;
}

body .dimension-mode-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

body .dimension-mode-group .radio-card {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
}

body .gross-dimension-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

body .gross-dimension-group[data-section-type="cylinder"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body .gross-dimension-group.is-hidden {
    display: none !important;
}

body .vertical-form-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

body .sticky-form-action {
    position: sticky;
    bottom: 12px;
    z-index: 5;
    display: flex;
    justify-content: flex-end;
    padding: 12px;
    border: 1px solid rgba(245, 130, 32, 0.18);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

body .sticky-form-action .btn.large {
    min-width: 220px;
    font-weight: 900;
}

@media screen and (max-width: 768px) {
    body .send-production-grid {
        grid-template-columns: 1fr;
    }

    body .gross-dimension-group,
    body .gross-dimension-group[data-section-type="cylinder"] {
        grid-template-columns: 1fr;
    }

    body .sticky-form-action {
        position: static;
    }

    body .sticky-form-action .btn.large {
        width: 100%;
    }
}

@media print {
    @page {
        size: A5 portrait;
        margin: 8mm;
    }

    html,
    body {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    body * {
        visibility: hidden !important;
    }

    body .production-detail-modal.is-open,
    body .production-detail-modal.is-open *,
    body #productionOrderModal.is-open,
    body #productionOrderModal.is-open *,
    body .production-a5-print,
    body .production-a5-print * {
        visibility: visible !important;
    }

    body .app-shell,
    body .content,
    body .production-detail-modal.is-open,
    body #productionOrderModal.is-open {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        overflow: visible !important;
    }

    body .sidebar,
    body .topbar,
    body .sidebar-overlay,
    body .crm-modal-backdrop,
    body .crm-modal-close,
    body .modal-actions,
    body .no-print {
        display: none !important;
    }

    body .production-detail-modal.is-open .crm-modal-panel,
    body #productionOrderModal.is-open .crm-modal-panel,
    body .production-a5-print {
        display: block !important;
        position: absolute !important;
        inset: 0 auto auto 0 !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
    }

    body .production-detail-modal.is-open .production-info-grid,
    body #productionOrderModal.is-open .production-info-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 4mm !important;
        width: 100% !important;
    }

    body .production-detail-modal.is-open .production-info-grid div,
    body #productionOrderModal.is-open .production-info-grid div {
        min-height: 17mm !important;
        padding: 3mm !important;
        border: 1px solid #d1d5db !important;
        border-radius: 2mm !important;
        background: #fff !important;
        box-shadow: none !important;
        break-inside: avoid !important;
    }

    body .production-detail-modal.is-open .production-info-grid .wide,
    body #productionOrderModal.is-open .production-info-grid .wide {
        grid-column: 1 / -1 !important;
    }
}

@media print {
    @page {
        size: A5 portrait;
        margin: 8mm;
    }

    body.dashboard-note-printing * {
        visibility: hidden !important;
    }

    body.dashboard-note-printing .dashboard-note-print-area,
    body.dashboard-note-printing .dashboard-note-print-area * {
        visibility: visible !important;
    }

    body.dashboard-note-printing .dashboard-note-print-area {
        display: block !important;
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        background: #fff !important;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    body.report-print.report-print-a5 {
        width: 100% !important;
    }

    body.report-print,
    body.report-print.print-body {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        color: #111827 !important;
        font-family: VazirLocal, Tahoma, Arial, sans-serif !important;
        font-size: 11px !important;
        line-height: 1.6 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body.report-print * {
        visibility: visible !important;
    }

    body.report-print header,
    body.report-print .topbar,
    body.report-print .sidebar,
    body.report-print .mobile-overlay,
    body.report-print nav,
    body.report-print footer,
    body.report-print button,
    body.report-print .btn,
    body.report-print .no-print,
    body.report-print .report-filter-card,
    body.report-print .print-actions {
        display: none !important;
        visibility: hidden !important;
    }

    body.report-print .app,
    body.report-print .content,
    body.report-print main,
    body.report-print #reportPrintArea,
    body.report-print .report-print-area,
    body.report-print .daily-report,
    body.report-print .print-page,
    body.report-print .report-print-section,
    body.report-print .table-wrap,
    body.report-print .compact-table,
    body.report-print table,
    body.report-print thead,
    body.report-print tbody,
    body.report-print tr,
    body.report-print th,
    body.report-print td {
        visibility: visible !important;
    }

    body.report-print .app,
    body.report-print .content,
    body.report-print main,
    body.report-print #reportPrintArea,
    body.report-print .report-print-area,
    body.report-print .daily-report,
    body.report-print .print-page {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
        color: #111827 !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    body.report-print .print-title {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        gap: 8mm !important;
        width: 100% !important;
        margin: 0 0 7mm !important;
        padding: 0 0 4mm !important;
        border-bottom: 1.5pt solid #111827 !important;
        color: #111827 !important;
        background: #fff !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    body.report-print .print-title h2 {
        margin: 0 !important;
        color: #111827 !important;
        font-size: 17px !important;
        font-weight: 950 !important;
        line-height: 1.7 !important;
    }

    body.report-print .print-title span {
        color: #111827 !important;
        font-size: 11px !important;
        font-weight: 850 !important;
    }

    body.report-print .report-print-section,
    body.report-print .report-print-section.card,
    body.report-print .report-print-section.elevated-card {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 7mm !important;
        padding: 3mm !important;
        background: #fff !important;
        color: #111827 !important;
        border: 0.75pt solid #d1d5db !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    body.report-print .report-print-section .card-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin: 0 0 3mm !important;
        padding: 0 0 2mm !important;
        border-bottom: 0.75pt solid #e5e7eb !important;
        background: #fff !important;
        color: #111827 !important;
        break-after: avoid !important;
        page-break-after: avoid !important;
    }

    body.report-print .report-print-section .card-header h3 {
        margin: 0 !important;
        color: #111827 !important;
        font-size: 13px !important;
        font-weight: 950 !important;
    }

    body.report-print .report-print-section .card-header p,
    body.report-print .empty {
        margin: 0 !important;
        color: #374151 !important;
        font-size: 10px !important;
        font-weight: 750 !important;
    }

    body.report-print .table-wrap,
    body.report-print .compact-table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    body.report-print table,
    body.report-print .print-table,
    body.report-print .compact-table table {
        display: table !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
        border-spacing: 0 !important;
        background: #fff !important;
        color: #111827 !important;
        overflow: visible !important;
    }

    body.report-print thead {
        display: table-header-group !important;
    }

    body.report-print tbody {
        display: table-row-group !important;
    }

    body.report-print tr {
        display: table-row !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    body.report-print th,
    body.report-print td {
        display: table-cell !important;
        border: 0.5pt solid #cfd6df !important;
        padding: 2.2mm 1.5mm !important;
        color: #111827 !important;
        background: #fff !important;
        font-size: 10.5px !important;
        line-height: 1.55 !important;
        font-weight: 650 !important;
        text-align: right !important;
        vertical-align: top !important;
        white-space: normal !important;
        overflow: visible !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    body.report-print th {
        background: #f3f4f6 !important;
        color: #111827 !important;
        font-size: 11px !important;
        font-weight: 950 !important;
    }

    body.report-print .print-table th:nth-child(1),
    body.report-print .print-table td:nth-child(1) {
        width: 13% !important;
        direction: ltr !important;
        text-align: center !important;
    }

    body.report-print .print-table th:nth-child(2),
    body.report-print .print-table td:nth-child(2) {
        width: 12% !important;
    }

    body.report-print .print-table th:nth-child(3),
    body.report-print .print-table td:nth-child(3) {
        width: 13% !important;
    }

    body.report-print .print-table th:nth-child(4),
    body.report-print .print-table td:nth-child(4) {
        width: 34% !important;
    }

    body.report-print .print-table th:nth-child(5),
    body.report-print .print-table td:nth-child(5) {
        width: 12% !important;
    }

    body.report-print .print-table th:nth-child(6),
    body.report-print .print-table td:nth-child(6) {
        width: 16% !important;
    }

    body.report-print .status-pill,
    body.report-print td .status-pill {
        display: inline !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        color: #111827 !important;
        box-shadow: none !important;
        font-size: inherit !important;
        font-weight: 850 !important;
    }

    body.report-print.report-print-a5 {
        font-size: 9.5px !important;
    }

    body.report-print.report-print-a5 .print-title h2 {
        font-size: 14px !important;
    }

    body.report-print.report-print-a5 th,
    body.report-print.report-print-a5 td {
        padding: 1.7mm 1mm !important;
        font-size: 8.5px !important;
        line-height: 1.45 !important;
    }
}

.backup-restore-white-text,
.backup-restore-white-text:visited,
.backup-restore-white-text:hover,
.backup-restore-white-text:focus {
    color: #fff !important;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    body.customer-print,
    body.customer-print.print-body,
    body.supplier-print,
    body.supplier-print.print-body {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        color: #111827 !important;
        font-family: VazirLocal, Tahoma, Arial, sans-serif !important;
        font-size: 11px !important;
        line-height: 1.6 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body.customer-print *,
    body.supplier-print * {
        visibility: visible !important;
    }

    body.customer-print header,
    body.customer-print .topbar,
    body.customer-print .sidebar,
    body.customer-print .sidebar-overlay,
    body.customer-print nav,
    body.customer-print footer,
    body.customer-print button,
    body.customer-print .btn,
    body.customer-print .no-print,
    body.supplier-print header,
    body.supplier-print .topbar,
    body.supplier-print .sidebar,
    body.supplier-print .sidebar-overlay,
    body.supplier-print nav,
    body.supplier-print footer,
    body.supplier-print button,
    body.supplier-print .btn,
    body.supplier-print .no-print {
        display: none !important;
        visibility: hidden !important;
    }

    body.customer-print main,
    body.customer-print .customer-print-area,
    body.customer-print .daily-report,
    body.customer-print .print-page,
    body.customer-print .report-print-section,
    body.customer-print .table-wrap,
    body.customer-print .compact-table,
    body.supplier-print main,
    body.supplier-print .supplier-print-area,
    body.supplier-print .daily-report,
    body.supplier-print .print-page,
    body.supplier-print .report-print-section,
    body.supplier-print .table-wrap,
    body.supplier-print .compact-table {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
        color: #111827 !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    body.customer-print .print-title,
    body.supplier-print .print-title {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        gap: 8mm !important;
        width: 100% !important;
        margin: 0 0 7mm !important;
        padding: 0 0 4mm !important;
        border-bottom: 1.5pt solid #111827 !important;
        color: #111827 !important;
        background: #fff !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    body.customer-print .print-title h2,
    body.supplier-print .print-title h2 {
        margin: 0 !important;
        color: #111827 !important;
        font-size: 17px !important;
        font-weight: 950 !important;
        line-height: 1.7 !important;
    }

    body.customer-print .report-print-section,
    body.customer-print .report-print-section.card,
    body.supplier-print .report-print-section,
    body.supplier-print .report-print-section.card {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 7mm !important;
        padding: 3mm !important;
        background: #fff !important;
        color: #111827 !important;
        border: 0.75pt solid #d1d5db !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    body.customer-print table,
    body.customer-print .print-table,
    body.customer-print .compact-table table,
    body.supplier-print table,
    body.supplier-print .print-table,
    body.supplier-print .compact-table table {
        display: table !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
        border-spacing: 0 !important;
        background: #fff !important;
        color: #111827 !important;
        overflow: visible !important;
    }

    body.customer-print thead,
    body.supplier-print thead {
        display: table-header-group !important;
    }

    body.customer-print tbody,
    body.supplier-print tbody {
        display: table-row-group !important;
    }

    body.customer-print tr,
    body.supplier-print tr {
        display: table-row !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    body.customer-print th,
    body.customer-print td,
    body.supplier-print th,
    body.supplier-print td {
        display: table-cell !important;
        border: 0.5pt solid #cfd6df !important;
        padding: 2mm 1.4mm !important;
        color: #111827 !important;
        background: #fff !important;
        font-size: 10.5px !important;
        line-height: 1.55 !important;
        font-weight: 650 !important;
        text-align: right !important;
        vertical-align: top !important;
        white-space: normal !important;
        overflow: visible !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    body.customer-print th,
    body.supplier-print th {
        background: #f3f4f6 !important;
        color: #111827 !important;
        font-size: 11px !important;
        font-weight: 950 !important;
    }

    body.customer-print .status-pill,
    body.customer-print td .status-pill,
    body.supplier-print .status-pill,
    body.supplier-print td .status-pill {
        display: inline !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        color: #111827 !important;
        box-shadow: none !important;
        font-size: inherit !important;
        font-weight: 850 !important;
    }
}

/* Executive ERP dashboard redesign */
:root {
    --erp-orange: #f58220;
    --erp-orange-soft: #fff4ea;
    --erp-navy: #18243a;
    --erp-ink: #111827;
    --erp-muted: #6b7280;
    --erp-line: #edf0f4;
    --erp-bg: #f7f8fb;
    --erp-card: #ffffff;
    --erp-shadow: 0 18px 48px rgba(24, 36, 58, .08);
}

body {
    background: radial-gradient(circle at top left, rgba(245, 130, 32, .08), transparent 32%), var(--erp-bg) !important;
}

body .content {
    padding-top: 18px !important;
}

body .topbar {
    min-height: 76px !important;
    background: rgba(255, 255, 255, .94) !important;
    border: 1px solid rgba(245, 130, 32, .16) !important;
    border-radius: 22px !important;
    box-shadow: 0 16px 44px rgba(24, 36, 58, .08) !important;
    backdrop-filter: blur(14px);
    margin-bottom: 22px !important;
    padding: 12px 18px !important;
}

body .topbar-brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--erp-navy);
    font-weight: 950;
    letter-spacing: .3px;
    margin-inline-end: 4px;
}

body .topbar-brand-mark img,
body .sidebar-logo.logo {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    object-fit: contain;
    background: #fff;
    border: 1px solid rgba(245, 130, 32, .18);
    padding: 3px;
}

body .topbar-kicker,
body .profile-name {
    color: var(--erp-navy) !important;
}

body .topbar .topbar-clock {
    color: var(--erp-orange) !important;
}

body .topbar-search.live-search-wrap input[type="search"] {
    min-height: 44px !important;
    border-radius: 15px !important;
    background: #f6f7f9 !important;
    border: 1px solid transparent !important;
    padding-inline: 16px !important;
    font-size: 13px !important;
}

body .topbar-search.live-search-wrap input[type="search"]:focus {
    border-color: rgba(245, 130, 32, .34) !important;
    box-shadow: 0 0 0 4px rgba(245, 130, 32, .08) !important;
}

body .profile-dropdown summary {
    border-radius: 16px !important;
    background: #ffffff !important;
    border: 1px solid rgba(24, 36, 58, .08) !important;
    box-shadow: 0 8px 24px rgba(24, 36, 58, .06) !important;
    min-height: 46px !important;
    padding: 5px 8px 5px 12px !important;
}

body .profile-avatar {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    border-radius: 50% !important;
    border: 2px solid rgba(245, 130, 32, .78) !important;
    box-shadow: 0 8px 20px rgba(24, 36, 58, .13) !important;
}

body .profile-avatar-img {
    display: block !important;
    object-fit: cover !important;
    object-position: center !important;
    background: #fff !important;
}

body .profile-avatar-fallback,
body .notification-avatar {
    display: inline-grid !important;
    place-items: center !important;
    background: linear-gradient(135deg, var(--erp-navy), #26395b) !important;
    color: #fff !important;
    font-weight: 950 !important;
}

body .notification-avatar {
    background: #fff7ed !important;
    color: var(--erp-orange) !important;
}

body .sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #fffaf5 100%) !important;
    border-left: 1px solid rgba(245, 130, 32, .16) !important;
    box-shadow: -14px 0 42px rgba(24, 36, 58, .07) !important;
}

body .sidebar .sidebar-head {
    grid-template-columns: 38px minmax(0, 1fr) !important;
    justify-content: initial !important;
    padding: 12px 6px 14px !important;
}

body .sidebar .brand.sidebar-logo-wrap {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    min-width: 0 !important;
}

body .sidebar .sidebar-logo.logo,
body.sidebar-collapsed .sidebar .sidebar-logo.logo {
    display: block !important;
}

body .sidebar .brand-text h1 {
    margin: 0;
    font-size: 14px;
    color: var(--erp-navy);
}

body .sidebar .brand-text p {
    margin: 0;
    font-size: 10px;
    color: var(--erp-muted);
}

body.sidebar-collapsed .sidebar .brand.sidebar-logo-wrap {
    display: none !important;
}

.erp-dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: stretch;
    margin-bottom: 18px;
}

.erp-dashboard-hero > div:first-child,
.erp-dashboard-hero-card,
.erp-kpi-card,
.erp-chart-card {
    background: var(--erp-card);
    border: 1px solid rgba(24, 36, 58, .07);
    border-radius: 26px;
    box-shadow: var(--erp-shadow);
}

.erp-dashboard-hero > div:first-child {
    padding: 26px 30px;
    position: relative;
    overflow: hidden;
}

.erp-dashboard-hero > div:first-child::after {
    content: "";
    position: absolute;
    left: -70px;
    bottom: -82px;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    background: rgba(245, 130, 32, .08);
}

.erp-dashboard-eyebrow {
    display: inline-flex;
    color: var(--erp-orange);
    background: var(--erp-orange-soft);
    border: 1px solid rgba(245, 130, 32, .18);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 950;
    margin-bottom: 12px;
}

.erp-dashboard-hero h2 {
    margin: 0 0 8px;
    color: var(--erp-navy);
    font-size: 28px;
    line-height: 1.55;
    letter-spacing: -.5px;
}

.erp-dashboard-hero p,
.erp-dashboard-hero-card small,
.erp-kpi-card small,
.erp-chart-card .card-header p {
    color: var(--erp-muted);
}

.erp-dashboard-hero-card {
    padding: 22px;
    display: grid;
    align-content: center;
    gap: 8px;
}

.erp-dashboard-hero-card span,
.erp-kpi-label {
    color: var(--erp-muted);
    font-size: 13px;
    font-weight: 850;
}

.erp-dashboard-hero-card strong {
    color: var(--erp-navy);
    font-size: 36px;
    line-height: 1.2;
}

.erp-progress {
    height: 10px;
    border-radius: 999px;
    background: #eef1f5;
    overflow: hidden;
}

.erp-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--erp-orange), #ffb36c);
}

.erp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.erp-kpi-card {
    min-height: 148px;
    padding: 18px;
    display: grid;
    gap: 5px;
    color: inherit;
    position: relative;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.erp-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 56px rgba(24, 36, 58, .11);
    border-color: rgba(245, 130, 32, .24);
}

.erp-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: var(--erp-orange);
    background: var(--erp-orange-soft);
    font-size: 18px;
}

.erp-kpi-card.navy .erp-kpi-icon { color: var(--erp-navy); background: #eef2f7; }
.erp-kpi-card.green .erp-kpi-icon { color: #15803d; background: #ecfdf3; }
.erp-kpi-card.blue .erp-kpi-icon { color: #2563eb; background: #eff6ff; }

.erp-kpi-card strong {
    color: var(--erp-navy);
    font-size: 26px;
    line-height: 1.2;
}

.erp-analytics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .85fr) minmax(260px, .7fr);
    gap: 16px;
    margin-bottom: 18px;
}

.erp-chart-card {
    padding: 20px;
    margin-bottom: 0;
}

.erp-line-chart,
.erp-bar-chart {
    height: 168px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 8px 8px;
    border-radius: 18px;
    background: linear-gradient(180deg, #fbfcfe 0%, #ffffff 100%);
    border: 1px solid var(--erp-line);
}

.erp-line-point,
.erp-bar {
    flex: 1;
    min-width: 0;
    display: grid;
    justify-items: center;
    align-content: end;
    gap: 8px;
    color: var(--erp-muted);
    font-size: 11px;
    font-weight: 850;
}

.erp-line-point span {
    width: 100%;
    max-width: 34px;
    height: var(--point-height);
    border-radius: 999px 999px 8px 8px;
    background: linear-gradient(180deg, var(--erp-orange), #ffd0a8);
    box-shadow: 0 12px 24px rgba(245, 130, 32, .18);
}

.erp-chart-labels {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin-top: 10px;
    color: var(--erp-muted);
    font-size: 10px;
    text-align: center;
}

.erp-bar i {
    display: block;
    width: 100%;
    max-width: 42px;
    height: var(--bar-height);
    border-radius: 14px 14px 6px 6px;
    background: linear-gradient(180deg, var(--erp-navy), #50617d);
}

.erp-donut-card {
    display: grid;
    justify-items: center;
}

.erp-donut {
    width: 156px;
    height: 156px;
    border-radius: 50%;
    background: conic-gradient(var(--erp-orange) 0 var(--production), var(--erp-navy) var(--production) calc(var(--production) + var(--delivery)), #2563eb calc(var(--production) + var(--delivery)) 360deg);
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(24, 36, 58, .06);
}

.erp-donut::after {
    content: "";
    position: absolute;
    inset: 27px;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--erp-line);
}

.erp-donut-legend {
    width: 100%;
    display: grid;
    gap: 8px;
    margin-top: 16px;
    color: var(--erp-muted);
    font-size: 12px;
    font-weight: 850;
}

.erp-donut-legend span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.erp-donut-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-inline-end: 4px;
}

.erp-donut-legend .orange { background: var(--erp-orange); }
.erp-donut-legend .navy { background: var(--erp-navy); }
.erp-donut-legend .blue { background: #2563eb; }

body .dashboard-market-note-grid,
body .dashboard-four-grid {
    gap: 16px !important;
}

body .dashboard-table-card,
body .market-prices-card,
body .dashboard-note-card {
    border-radius: 24px !important;
    border: 1px solid rgba(24, 36, 58, .07) !important;
    box-shadow: var(--erp-shadow) !important;
}

@media (max-width: 1280px) {
    .erp-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .erp-analytics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .erp-dashboard-hero { grid-template-columns: 1fr; }
    .erp-kpi-grid { grid-template-columns: 1fr; }
    .erp-dashboard-hero h2 { font-size: 22px; }
    body .topbar-brand-mark span { display: none; }
}

/* Dashboard compact revision */
body .sidebar .menu {
    gap: 8px !important;
    padding: 10px 4px 0 !important;
}

body .sidebar .menu a {
    min-height: 48px !important;
    padding: 9px 12px !important;
    border-radius: 16px !important;
    color: #263246 !important;
    background: rgba(255, 255, 255, .72) !important;
    border: 1px solid rgba(24, 36, 58, .06) !important;
    font-size: 13px !important;
    font-weight: 950 !important;
    box-shadow: 0 5px 16px rgba(24, 36, 58, .035) !important;
}

body .sidebar .menu a:hover {
    color: var(--erp-navy) !important;
    background: #fff4ea !important;
    border-color: rgba(245, 130, 32, .24) !important;
    transform: translateX(-2px);
}

body .sidebar .menu a.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, var(--erp-orange), #ef7a1a) !important;
    border-color: transparent !important;
    box-shadow: 0 12px 26px rgba(245, 130, 32, .25) !important;
}

body .sidebar .menu-icon {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    color: var(--erp-navy) !important;
    font-size: 16px !important;
    box-shadow: inset 0 0 0 1px rgba(24, 36, 58, .06) !important;
}

body .sidebar .menu a.active .menu-icon {
    color: var(--erp-orange) !important;
    background: #ffffff !important;
}

body.sidebar-collapsed .sidebar .menu a {
    justify-content: center !important;
    padding-inline: 8px !important;
}

.erp-dashboard-hero {
    display: none !important;
}

.erp-analytics-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(260px, .8fr) minmax(240px, .65fr) !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
}

.erp-chart-card {
    padding: 14px !important;
    border-radius: 20px !important;
}

.erp-chart-card .card-header {
    min-height: 42px !important;
    margin-bottom: 8px !important;
    padding-bottom: 7px !important;
}

.erp-chart-card .card-header h3 {
    font-size: 14px !important;
    margin-bottom: 1px !important;
}

.erp-chart-card .card-header p {
    font-size: 11px !important;
}

.erp-line-chart,
.erp-bar-chart {
    height: 126px !important;
    padding: 10px 6px 6px !important;
    gap: 9px !important;
    border-radius: 15px !important;
}

.erp-line-point {
    gap: 4px !important;
}

.erp-line-point span {
    max-width: 26px !important;
    max-height: 98px !important;
}

.erp-bar i {
    max-width: 32px !important;
    max-height: 98px !important;
}

.erp-chart-labels {
    margin-top: 6px !important;
    font-size: 9px !important;
}

.erp-donut {
    width: 118px !important;
    height: 118px !important;
}

.erp-donut::after {
    inset: 22px !important;
}

.erp-donut-legend {
    gap: 5px !important;
    margin-top: 10px !important;
    font-size: 11px !important;
}

.erp-kpi-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
}

@media (min-width: 1181px) {
    .erp-kpi-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    }
}

.erp-kpi-card {
    min-height: 96px !important;
    padding: 10px 9px !important;
    border-radius: 17px !important;
    gap: 3px !important;
    box-shadow: 0 10px 26px rgba(24, 36, 58, .06) !important;
}

.erp-kpi-icon {
    width: 30px !important;
    height: 30px !important;
    border-radius: 11px !important;
    font-size: 14px !important;
}

.erp-kpi-label {
    font-size: 10px !important;
    line-height: 1.45 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-kpi-card strong {
    font-size: 19px !important;
    line-height: 1.2 !important;
}

.erp-kpi-card small {
    font-size: 9px !important;
    line-height: 1.4 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body .dashboard-four-grid {
    grid-template-columns: minmax(0, 1fr) !important;
}

@media (max-width: 1180px) {
    .erp-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

@media (max-width: 1280px) {
    .erp-analytics-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
    .erp-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* Mobile ERP/CRM isolated usability layer */
.crm-mobile-list {
    display: none;
}

.topbar-brand-mobile {
    display: none;
}

body .sidebar,
body.sidebar-collapsed .sidebar {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body .sidebar .sidebar-head {
    flex: 0 0 auto;
}

body .sidebar-menu-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 40px;
}

body .sidebar-footer {
    flex: 0 0 auto;
}

@media screen and (min-width: 769px) {
    body .crm-mobile-list {
        display: none !important;
    }

    body .table-wrap.compact-table > table,
    body .compact-table > table,
    body .inquiries-crm-table {
        display: table !important;
    }

    body .table-wrap.compact-table > table thead,
    body .compact-table > table thead,
    body .inquiries-crm-table thead {
        display: table-header-group !important;
    }

    body .table-wrap.compact-table > table tbody,
    body .compact-table > table tbody,
    body .inquiries-crm-table tbody {
        display: table-row-group !important;
    }

    body .table-wrap.compact-table > table tr,
    body .compact-table > table tr,
    body .inquiries-crm-table tr {
        display: table-row !important;
    }

    body .table-wrap.compact-table > table th,
    body .table-wrap.compact-table > table td,
    body .compact-table > table th,
    body .compact-table > table td,
    body .inquiries-crm-table th,
    body .inquiries-crm-table td {
        display: table-cell !important;
    }
}

@media screen and (max-width: 768px) {
    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    html,
    body {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    body.sidebar-open {
        overflow: hidden !important;
    }

    body .app,
    body .content,
    body .card,
    body .elevated-card,
    body form,
    body input,
    body select,
    body textarea {
        max-width: 100% !important;
    }

    body .content,
    body.sidebar-collapsed .content {
        width: 100% !important;
        margin-right: 0 !important;
        padding: 8px !important;
        padding-top: 8px !important;
    }

    body .topbar {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        min-height: 56px !important;
        height: 56px !important;
        padding: 7px 8px !important;
        gap: 7px !important;
        margin: -8px -8px 10px !important;
        border-radius: 0 0 16px 16px !important;
        overflow: visible !important;
    }

    body .topbar-menu.sidebar-toggle {
        order: 1 !important;
        display: grid !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        flex: 0 0 40px !important;
        margin: 0 !important;
        place-content: center !important;
        z-index: 950 !important;
    }

    body .topbar-brand-mark {
        order: 2 !important;
        display: inline-flex !important;
        width: auto !important;
        min-width: 0 !important;
        height: 38px !important;
        padding: 4px 7px !important;
        gap: 6px !important;
        flex: 0 1 auto !important;
    }

    body .topbar-brand-mark img {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
    }

    body .topbar-brand-mark span {
        display: inline-block !important;
        max-width: 112px !important;
        color: var(--erp-navy) !important;
        font-size: 11px !important;
        font-weight: 950 !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    body .topbar-brand-desktop {
        display: none !important;
    }

    body .topbar-brand-mobile {
        display: inline-block !important;
    }

    body .topbar-welcome,
    body .topbar-search.live-search-wrap {
        display: none !important;
    }

    body .profile-menu,
    body .topbar-profile-box {
        order: 20 !important;
        margin-right: auto !important;
        margin-left: 0 !important;
        gap: 5px !important;
        flex: 0 0 auto !important;
        min-width: 0 !important;
    }

    body .profile-dropdown summary {
        min-height: 38px !important;
        gap: 4px !important;
    }

    body .profile-avatar,
    body .profile-avatar-img,
    body .notification-dropdown .profile-avatar {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        font-size: 14px !important;
    }

    body .profile-name {
        display: none !important;
    }

    body .notification-dropdown .status-pill {
        min-width: 17px !important;
        height: 17px !important;
        padding: 1px 5px !important;
        font-size: 9px !important;
    }

    body .profile-dropdown-menu,
    body .notification-dropdown .profile-dropdown-menu {
        max-width: calc(100vw - 18px) !important;
        left: 0 !important;
        right: auto !important;
    }

    body .sidebar,
    body.sidebar-collapsed .sidebar {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: auto !important;
        left: auto !important;
        width: min(300px, 88vw) !important;
        max-width: min(300px, 88vw) !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        transform: translateX(110%) !important;
        transition: transform .24s ease !important;
        z-index: 1000 !important;
        border-radius: 0 !important;
        box-shadow: -16px 0 40px rgba(15, 23, 42, .26) !important;
    }

    body.sidebar-open .sidebar,
    body.sidebar-open.sidebar-collapsed .sidebar {
        transform: translateX(0) !important;
    }

    body .sidebar .sidebar-head {
        flex: 0 0 auto !important;
        min-height: 64px !important;
        padding: 10px 12px !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 2 !important;
        background: rgba(255, 255, 255, .96) !important;
        backdrop-filter: blur(14px);
    }

    body .sidebar-menu-scroll,
    body .sidebar .menu {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        display: grid !important;
        align-content: start !important;
        gap: 7px !important;
        padding: 8px 10px 40px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
    }

    body .sidebar .menu a {
        min-height: 44px !important;
        padding: 8px 10px !important;
        gap: 9px !important;
        border-radius: 13px !important;
        font-size: 12px !important;
        color: #1f2937 !important;
        background: #ffffff !important;
    }

    body .sidebar .menu-icon {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        font-size: 14px !important;
    }

    body .sidebar-footer {
        flex: 0 0 auto !important;
        margin: 0 !important;
        padding: 10px 12px calc(14px + env(safe-area-inset-bottom)) !important;
        background: rgba(255, 255, 255, .96) !important;
    }

    body .page-title,
    body .hero-title,
    body .card,
    body .elevated-card {
        padding: 12px !important;
        border-radius: 16px !important;
        margin-bottom: 10px !important;
    }

    body .page-title h2,
    body .hero-title h2,
    body .card-header h3 {
        font-size: 15px !important;
        line-height: 1.55 !important;
    }

    body .page-title p,
    body .hero-title p,
    body .card-header p {
        font-size: 11px !important;
        line-height: 1.65 !important;
    }

    body .search-box,
    body .inquiries-toolbar {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    body .search-box input,
    body .search-box select,
    body .search-box .btn,
    body .inquiries-toolbar input,
    body .inquiries-toolbar select,
    body .inquiries-toolbar .btn {
        width: 100% !important;
        min-width: 0 !important;
    }

    body .erp-analytics-grid,
    body .dashboard-market-note-grid,
    body .dashboard-four-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    body .erp-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    body .erp-kpi-card {
        min-height: 84px !important;
        padding: 9px !important;
    }

    body .erp-chart-card {
        padding: 11px !important;
    }

    body .erp-line-chart,
    body .erp-bar-chart {
        height: 104px !important;
        overflow: hidden !important;
    }

    body .table-wrap.compact-table,
    body .inquiries-crm-table-wrap {
        overflow: visible !important;
        max-height: none !important;
        border: 0 !important;
        background: transparent !important;
    }

    body .table-wrap.compact-table > table,
    body .compact-table > table,
    body .inquiries-crm-table {
        display: none !important;
    }

    body .crm-mobile-list {
        display: grid !important;
        gap: 8px;
        width: 100%;
        max-width: 100%;
    }

    body .crm-mobile-record {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    body .crm-mobile-record-summary {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto 40px;
        align-items: center;
        gap: 8px;
        min-height: 54px;
        width: 100%;
        max-width: 100%;
        padding: 7px 9px;
        border: 1px solid rgba(15, 23, 42, .08);
        border-radius: 14px;
        background: #ffffff;
        box-shadow: 0 7px 20px rgba(15, 23, 42, .05);
    }

    body .crm-mobile-record-text {
        min-width: 0;
        display: grid;
        gap: 1px;
    }

    body .crm-mobile-code,
    body .crm-mobile-record-text strong,
    body .crm-mobile-record-text small {
        display: block;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body .crm-mobile-code {
        color: #f97316;
        font-size: 10px;
        font-weight: 950;
    }

    body .crm-mobile-record-text strong {
        color: #0f172a;
        font-size: 12px;
        font-weight: 950;
        line-height: 1.45;
    }

    body .crm-mobile-record-text small {
        color: #64748b;
        font-size: 10px;
        line-height: 1.45;
    }

    body .crm-mobile-record-status {
        max-width: 98px;
        min-width: 0;
        overflow: hidden;
    }

    body .crm-mobile-record-status .status-pill,
    body .crm-mobile-record-status .mini-status-dot {
        max-width: 96px;
        min-height: 20px !important;
        padding: 3px 6px !important;
        font-size: 9px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body .crm-mobile-view {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        min-width: 40px;
        border: 1px solid rgba(249, 115, 22, .26);
        border-radius: 12px;
        background: #fff7ed;
        color: #c2410c;
        font-size: 15px;
        cursor: pointer;
    }

    body .crm-mobile-record.is-open .crm-mobile-record-summary {
        border-color: rgba(249, 115, 22, .35);
        box-shadow: 0 10px 24px rgba(249, 115, 22, .11);
    }

    body .crm-mobile-record-detail[hidden] {
        display: none !important;
    }

    body .crm-mobile-record-detail {
        display: block;
        margin-top: 6px;
    }

    body .crm-mobile-detail-box {
        display: grid;
        grid-template-columns: 1fr;
        gap: 7px;
        padding: 10px;
        border: 1px solid rgba(249, 115, 22, .22);
        border-radius: 14px;
        background: #fffaf5;
        box-shadow: inset 3px 0 0 rgba(249, 115, 22, .32);
    }

    body .crm-mobile-detail-item {
        display: grid;
        gap: 3px;
        min-width: 0;
        padding: 6px 7px;
        border-radius: 10px;
        background: rgba(255, 255, 255, .78);
    }

    body .crm-mobile-detail-item span {
        color: #64748b;
        font-size: 10px;
        font-weight: 850;
    }

    body .crm-mobile-detail-item strong {
        min-width: 0;
        color: #111827;
        font-size: 11px;
        font-weight: 850;
        line-height: 1.7;
        overflow-wrap: anywhere;
    }

    body .crm-mobile-actions,
    body .crm-mobile-actions .inline-actions,
    body .crm-mobile-actions .vertical-actions,
    body .crm-mobile-actions .table-actions-stack,
    body .crm-mobile-actions .inquiry-actions-compact {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 7px !important;
        align-items: center !important;
        margin: 0 !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    body .crm-mobile-actions {
        padding-top: 4px;
    }

    body .crm-mobile-actions a,
    body .crm-mobile-actions button,
    body .crm-mobile-actions .small-link,
    body .crm-mobile-actions .icon-action {
        min-width: 40px !important;
        min-height: 40px !important;
        width: auto !important;
        height: 40px !important;
        padding: 7px 10px !important;
        font-size: 11px !important;
        white-space: nowrap !important;
    }
}

@media screen and (max-width: 380px) {
    body .topbar-brand-mark span {
        max-width: 82px !important;
    }

    body .crm-mobile-record-summary {
        grid-template-columns: minmax(0, 1fr) 40px;
    }

    body .crm-mobile-record-status {
        grid-column: 1 / -1;
        grid-row: 2;
        max-width: 100%;
    }

    body .crm-mobile-view {
        grid-column: 2;
        grid-row: 1;
    }
}

/* Mobile header/sidebar alignment only */
@media screen and (max-width: 768px) {
    body .topbar {
        position: sticky !important;
        top: 0 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        direction: rtl !important;
        width: auto !important;
        min-height: 56px !important;
        height: 56px !important;
        padding: 7px 10px !important;
        gap: 8px !important;
        overflow: visible !important;
    }

    body .topbar-menu.sidebar-toggle {
        position: static !important;
        inset: auto !important;
        order: 1 !important;
        display: inline-grid !important;
        place-content: center !important;
        flex: 0 0 40px !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        margin: 0 !important;
        transform: none !important;
    }

    body .topbar-brand-mark {
        position: static !important;
        order: 2 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex: 0 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: 145px !important;
        height: 38px !important;
        margin: 0 !important;
        padding: 4px 6px !important;
        gap: 6px !important;
        transform: none !important;
    }

    body .topbar-brand-mark img {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
    }

    body .topbar-brand-mark .topbar-brand-desktop {
        display: none !important;
    }

    body .topbar-brand-mark .topbar-brand-mobile {
        display: inline-block !important;
        max-width: 102px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-size: 11px !important;
        font-weight: 950 !important;
        line-height: 1.2 !important;
    }

    body .topbar-welcome,
    body .topbar-search.live-search-wrap {
        display: none !important;
    }

    body .profile-menu.topbar-profile-box,
    body .topbar-profile-box {
        position: static !important;
        order: 10 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        margin-right: auto !important;
        margin-left: 0 !important;
        gap: 5px !important;
        transform: none !important;
    }

    body .profile-dropdown summary {
        min-height: 38px !important;
        padding: 0 !important;
        gap: 4px !important;
    }

    body .profile-avatar,
    body .profile-avatar-img,
    body .notification-dropdown .profile-avatar {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        font-size: 14px !important;
    }

    body .profile-name {
        display: none !important;
    }

    body .sidebar,
    body.sidebar-collapsed .sidebar {
        height: 100dvh !important;
        max-height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    body .sidebar .sidebar-head {
        flex: 0 0 auto !important;
    }

    body .sidebar-menu-scroll,
    body .sidebar .menu {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 40px !important;
    }
}

/* Brand navy header theme */
body .topbar {
    background: linear-gradient(135deg, var(--erp-navy, #18243a), #0f172a) !important;
    border-color: rgba(255, 255, 255, .10) !important;
    box-shadow: 0 16px 34px rgba(15, 23, 42, .18) !important;
}

body .topbar,
body .topbar a,
body .topbar span,
body .topbar strong,
body .topbar-kicker,
body .topbar .topbar-clock,
body .topbar-brand-mark,
body .topbar-brand-mark span {
    color: #f8fafc !important;
}

body .topbar-brand-mark,
body .topbar-profile-box,
body .topbar-search.live-search-wrap input[type="search"],
body .profile-dropdown summary {
    background: rgba(255, 255, 255, .10) !important;
    border-color: rgba(255, 255, 255, .16) !important;
}

body .topbar-search.live-search-wrap input[type="search"] {
    color: #ffffff !important;
}

body .topbar-search.live-search-wrap input[type="search"]::placeholder {
    color: rgba(248, 250, 252, .72) !important;
}

body .notification-avatar,
body .topbar-menu.sidebar-toggle {
    background: rgba(255, 255, 255, .14) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, .18) !important;
}

body .topbar-menu.sidebar-toggle span {
    background: #ffffff !important;
}

body .topbar .status-danger,
body .notification-dropdown .status-pill {
    background: var(--erp-orange, #f58220) !important;
    color: #ffffff !important;
}
