﻿:root {
    --primary: #0f766e;
    --primary-dark: #115e59;
    --primary-soft: #e7f7f4;
    --navy: #172554;
    --text: #172033;
    --muted: #667085;
    --background: #f4f7fb;
    --surface: #ffffff;
    --border: #e4e9f1;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #2563eb;
    --success: #15803d;
    --shadow: 0 12px 35px rgba(29, 41, 57, .08);
}

html {
    font-size: 14px;
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--background);
    font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
    direction: rtl;
}

a {
    color: var(--primary);
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.workspace-page { padding-top: 32px; padding-bottom: 55px; }
.page-title { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.page-title h1 { margin:0; font-size:1.7rem; font-weight:800; }
.page-title .section-label { color:var(--primary); }
.crm-grid, .operations-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; align-items:start; }
.operations-grid { grid-template-columns:repeat(3,minmax(0,1fr)); margin-bottom:20px; }
.crm-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; }
.crm-form label { display:grid; gap:6px; color:var(--muted); font-size:.8rem; font-weight:700; }
.crm-form input, .crm-form select, .crm-form textarea, .inline-search input, .status-form input, .status-form select {
    width:100%; padding:10px 12px; color:var(--text); background:#fff; border:1px solid var(--border); border-radius:10px; outline:none;
}
.crm-form textarea { min-height:82px; resize:vertical; }
.crm-form .full { grid-column:1/-1; }
.primary-button, .inline-search button, .status-form button, .small-action {
    padding:10px 16px; border:0; border-radius:10px; color:#fff; background:var(--primary); font-weight:700;
}
.table-wrap { overflow:auto; }
.crm-table { width:100%; border-collapse:collapse; }
.crm-table th, .crm-table td { padding:13px 10px; text-align:right; border-bottom:1px solid var(--border); }
.inline-search { display:flex; gap:8px; margin-bottom:15px; }
.case-list { display:grid; gap:11px; }
.case-card { display:flex; justify-content:space-between; gap:15px; padding:15px; border:1px solid var(--border); border-radius:14px; }
.case-card div, .case-card strong, .case-card span, .case-card small { display:block; }
.case-card span, .case-card small { margin-top:5px; color:var(--muted); }
.status-form { display:flex; flex-wrap:wrap; gap:7px; margin-top:8px; }
.status-form input, .status-form select { width:auto; min-width:120px; }
.compact-stats { margin-top:0; }
.queue-results { margin-top:20px; }
.timeline { list-style:none; padding:0; margin:0; display:grid; gap:12px; }
.timeline li { padding:12px; border-right:3px solid var(--primary); background:var(--primary-soft); border-radius:10px; }
.timeline span, .timeline small { display:block; margin-top:4px; color:var(--muted); }
.empty-state { padding:22px; text-align:center; color:var(--muted); }
.muted { color:var(--muted); }
.small-action { display:inline-block; white-space:nowrap; font-size:.78rem; }
.secondary-button { display:inline-block; padding:10px 16px; border:1px solid var(--border); border-radius:10px; color:var(--text); background:#fff; font-weight:700; }
.secondary-button:hover { color:var(--primary); border-color:var(--primary); }
.case-card-link { color:var(--text); transition:.18s ease; }
.case-card-link:hover { color:var(--text); border-color:#99d8d1; transform:translateY(-1px); box-shadow:0 7px 20px rgba(15,118,110,.08); }
.detail-link { display:inline-block !important; margin-top:9px; color:var(--primary) !important; font-weight:700; }
.renewal-overview { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin-bottom:20px; }
.renewal-overview div { padding:10px 14px; border-right:3px solid var(--primary); background:var(--primary-soft); border-radius:10px; }
.renewal-overview span, .renewal-overview strong { display:block; }
.renewal-overview span { color:var(--muted); font-size:.78rem; }
.renewal-overview strong { margin-top:6px; }
.document-list { display:grid; gap:10px; }
.document-list > div { padding:12px; border:1px solid var(--border); border-radius:11px; }
.document-list span, .document-list small { display:block; margin-top:4px; color:var(--muted); }

.app-header {
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
}

.app-header .navbar {
    min-height: 74px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
}

.brand:hover {
    color: var(--text);
}

.brand-mark {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), #14b8a6);
    font-size: 1.35rem;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 1.05rem;
}

.brand small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .72rem;
}

.nav-link {
    margin: 0 4px;
    padding: 10px 12px !important;
    color: var(--muted) !important;
    border-radius: 10px;
    font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary) !important;
    background: var(--primary-soft);
}

.login-area ul {
    align-items: center;
}

.login-area .nav-link {
    color: var(--primary) !important;
}

.hero {
    padding: 42px 0 76px;
    color: #fff;
    background:
        radial-gradient(circle at 15% 20%, rgba(45, 212, 191, .22), transparent 28%),
        linear-gradient(125deg, #123a52, #0f766e);
}

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

.eyebrow,
.section-label {
    display: block;
    margin-bottom: 7px;
    color: #8ce6d8;
    font-size: .78rem;
    font-weight: 700;
}

.hero h1 {
    margin: 0 0 12px;
    font-size: clamp(1.7rem, 4vw, 2.65rem);
    font-weight: 800;
}

.hero p {
    max-width: 670px;
    margin: 0;
    color: #d9f3ef;
    line-height: 1.9;
}

.date-card {
    min-width: 190px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 18px;
    background: rgba(255, 255, 255, .1);
}

.date-card span,
.date-card strong,
.date-card small {
    display: block;
}

.date-card strong {
    margin: 7px 0;
    font-size: 1.15rem;
}

.date-card small {
    color: #c9eee8;
}

.search-box {
    max-width: 820px;
    margin-top: 30px;
}

.search-box label {
    display: block;
    margin-bottom: 8px;
    font-size: .82rem;
    font-weight: 700;
}

.search-row {
    display: flex;
    gap: 9px;
    padding: 7px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(5, 44, 48, .22);
}

.search-row input {
    flex: 1;
    min-width: 0;
    padding: 12px 15px;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
}

.search-row button,
.task-item button {
    border: 0;
    border-radius: 11px;
    color: #fff;
    background: var(--primary);
    font-weight: 700;
}

.search-row button {
    padding: 11px 26px;
}

.dashboard {
    position: relative;
    margin-top: -40px;
    padding-bottom: 50px;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1.25fr repeat(3, 1fr);
    gap: 15px;
}

.quick-action,
.primary-action {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 88px;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 18px;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.primary-action {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
}

.quick-action:hover {
    color: var(--primary);
    transform: translateY(-2px);
}

.primary-action:hover {
    color: #fff;
    background: var(--primary-dark);
}

.action-icon {
    width: 45px;
    height: 45px;
    display: grid;
    flex: 0 0 45px;
    place-items: center;
    border-radius: 14px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 1.2rem;
    font-weight: 800;
}

.primary-action .action-icon {
    color: #fff;
    background: rgba(255, 255, 255, .15);
}

.quick-actions strong,
.quick-actions small {
    display: block;
}

.quick-actions small {
    margin-top: 5px;
    color: var(--muted);
    font-size: .76rem;
}

.primary-action small {
    color: #cff4ed;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 22px 0;
}

.stat-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
}

.stat-heading {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: .82rem;
}

.stat-card > strong {
    display: block;
    margin: 13px 0 7px;
    font-size: 2rem;
}

.stat-card small {
    color: var(--muted);
}

.stat-card.urgent {
    border-top: 4px solid var(--danger);
}

.stat-card.success {
    border-top: 4px solid var(--success);
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 5px #fee2e2;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr);
    gap: 20px;
}

.side-column {
    display: grid;
    gap: 20px;
    align-content: start;
}

.panel {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 5px 20px rgba(29, 41, 57, .04);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 18px;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 800;
}

.panel-header .section-label {
    color: var(--primary);
}

.task-list {
    display: grid;
}

.task-item {
    display: grid;
    grid-template-columns: 45px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 13px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.task-item:last-child {
    border-bottom: 0;
}

.customer-avatar,
.message-icon {
    display: grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 800;
}

.customer-avatar {
    width: 45px;
    height: 45px;
    border-radius: 14px;
}

.customer-avatar.blue {
    color: var(--info);
    background: #e8f0ff;
}

.customer-avatar.purple {
    color: #7c3aed;
    background: #f1eafe;
}

.task-info {
    min-width: 0;
}

.task-info strong,
.task-info span,
.task-info small {
    display: block;
}

.task-info span {
    margin: 4px 0;
    color: var(--muted);
    font-size: .78rem;
}

.task-info small {
    overflow: hidden;
    color: #8992a3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-item button {
    padding: 9px 12px;
    white-space: nowrap;
}

.badge {
    padding: 7px 9px;
    border-radius: 9px;
    font-size: .7rem;
}

.badge-danger {
    color: var(--danger);
    background: #fee2e2;
}

.badge-warning {
    color: var(--warning);
    background: #fff1d6;
}

.badge-info {
    color: var(--info);
    background: #e4edff;
}

.count-badge {
    padding: 6px 9px;
    border-radius: 9px;
    color: var(--danger);
    background: #fee2e2;
    font-size: .72rem;
    font-weight: 700;
}

.message-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.message-list li {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.message-list li:last-child {
    border: 0;
}

.message-icon {
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    border-radius: 12px;
}

.message-list strong,
.message-list small {
    display: block;
}

.message-list strong {
    font-size: .82rem;
}

.message-list small {
    margin-top: 4px;
    color: var(--muted);
    font-size: .72rem;
}

.activity-summary {
    display: grid;
    gap: 8px;
}

.activity-summary div {
    display: flex;
    justify-content: space-between;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
}

.activity-summary div:last-child {
    border: 0;
}

.activity-summary strong {
    color: var(--text);
}

.app-footer {
    padding: 22px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    background: var(--surface);
}

.app-footer .container {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

@media (max-width: 991px) {
    .navbar-collapse {
        padding: 14px 0;
    }

    .login-area {
        padding-top: 8px;
        border-top: 1px solid var(--border);
    }

    .hero-content {
        align-items: flex-start;
    }

    .date-card {
        display: none;
    }

    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }

    .primary-action {
        grid-column: 1 / -1;
    }

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

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

@media (max-width: 620px) {
    html {
        font-size: 13px;
    }

    .app-header .navbar {
        min-height: 66px;
    }

    .brand small {
        display: none;
    }

    .hero {
        padding: 28px 0 68px;
    }

    .hero h1 {
        line-height: 1.5;
    }

    .hero p {
        font-size: .85rem;
    }

    .search-row button {
        padding: 10px 16px;
    }

    .dashboard {
        margin-top: -34px;
    }

    .quick-actions {
        gap: 10px;
    }

    .quick-action,
    .primary-action {
        min-height: 76px;
        padding: 13px;
    }

    .action-icon {
        width: 39px;
        height: 39px;
        flex-basis: 39px;
    }

    .quick-actions small {
        display: none;
    }

    .stats-grid {
        gap: 10px;
        margin: 16px 0;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card > strong {
        font-size: 1.6rem;
    }

    .stat-card small {
        display: none;
    }

    .panel {
        padding: 16px;
        border-radius: 16px;
    }

    .task-item {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        gap: 10px;
    }

    .customer-avatar {
        width: 40px;
        height: 40px;
    }

    .task-item button {
        grid-column: 2 / -1;
        width: 100%;
    }

    .task-info small {
        display: none;
    }

    .app-footer .container {
        justify-content: center;
    }

    .app-footer span:last-child {
        display: none;
    }
}

.account-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

.account-menu form {
    margin: 0;
}

.account-link-button {
    border: 0;
    background: transparent;
}

.register-link {
    color: #ffffff !important;
    background: var(--primary);
}

.register-link:hover {
    color: #ffffff !important;
    background: var(--primary-dark);
}


/* ===== Account button visibility fix ===== */

.login-area .register-link,
.login-area .register-link:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 118px;
    padding: 11px 20px !important;
    color: #ffffff !important;
    background: var(--primary) !important;
    border: 1px solid var(--primary);
    border-radius: 12px;
    font-weight: 700;
    transition:
        background-color .2s ease,
        border-color .2s ease,
        transform .2s ease,
        box-shadow .2s ease;
}

.login-area .register-link:hover,
.login-area .register-link:focus-visible {
    color: #ffffff !important;
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark);
    box-shadow: 0 8px 20px rgba(15, 118, 110, .22);
    transform: translateY(-1px);
}

.login-area .register-link:focus-visible {
    outline: 3px solid rgba(20, 184, 166, .25);
    outline-offset: 2px;
}

.login-area .account-link-button {
    cursor: pointer;
}

/* ===== Additional responsive safeguards ===== */

img,
svg,
video {
    max-width: 100%;
    height: auto;
}

.container {
    width: min(100% - 32px, 1320px);
}

body {
    overflow-x: hidden;
}

@media (max-width: 991px) {
    .account-menu {
        align-items: stretch;
        gap: 8px;
        padding-top: 10px;
    }

    .account-menu .nav-item,
    .account-menu form {
        width: 100%;
    }

    .login-area .nav-link,
    .login-area .account-link-button,
    .login-area .register-link {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

@media (max-width: 620px) {
    .container {
        width: min(100% - 24px, 1320px);
    }

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

    .search-row button {
        width: 100%;
        min-height: 44px;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .primary-action {
        grid-column: auto;
    }

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

    .hero h1,
    .hero p,
    .task-info,
    .message-list span {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .brand strong {
        font-size: .92rem;
    }

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


/* ===== Visible responsive navigation button ===== */

.mobile-menu-button {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 78px;
    min-height: 44px;
    padding: 8px 12px;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid rgba(15, 118, 110, .22);
    border-radius: 12px;
    box-shadow: none;
}

.mobile-menu-button:hover,
.mobile-menu-button:focus {
    color: var(--primary-dark);
    background: #d8f2ed;
    border-color: var(--primary);
    box-shadow: none;
}

.mobile-menu-button:focus-visible {
    outline: 3px solid rgba(20, 184, 166, .25);
    outline-offset: 2px;
}

.menu-lines {
    width: 22px;
    display: grid;
    gap: 4px;
}

.menu-lines span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 10px;
    background: currentColor;
    transition: transform .2s ease, opacity .2s ease;
}

.menu-button-text {
    font-size: .78rem;
    font-weight: 700;
}

.mobile-menu-button[aria-expanded="true"] .menu-lines span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.mobile-menu-button[aria-expanded="true"] .menu-lines span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-button[aria-expanded="true"] .menu-lines span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 991.98px) {
    .mobile-menu-button {
        display: inline-flex;
        margin-right: auto;
    }

    #mainNavigation {
        width: 100%;
        margin-top: 12px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: #ffffff;
        box-shadow: 0 14px 35px rgba(29, 41, 57, .1);
    }

    #mainNavigation .navbar-nav {
        width: 100%;
        margin: 0 !important;
    }

    #mainNavigation .nav-item {
        width: 100%;
    }

    #mainNavigation .nav-link {
        width: 100%;
        margin: 2px 0;
        padding: 12px 14px !important;
        text-align: right;
    }

    #mainNavigation .login-area {
        width: 100%;
        margin: 10px 0 0 !important;
        padding-top: 10px;
    }
}

@media (min-width: 992px) {
    .mobile-menu-button {
        display: none !important;
    }
}

/* CRM operational pages */
.workspace-page{padding-top:2rem;padding-bottom:4rem}.page-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.4rem}.page-title h1{font-size:1.7rem;margin:.35rem 0}.crm-grid{display:grid;grid-template-columns:minmax(300px, .75fr) minmax(440px,1.25fr);gap:1.2rem;align-items:start}.crm-form{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.crm-form label{display:flex;flex-direction:column;gap:.4rem;color:#334155;font-size:.9rem}.crm-form input,.crm-form select,.crm-form textarea,.inline-search input,.status-form input,.status-form select{border:1px solid #d8e2e8;border-radius:10px;padding:.7rem .8rem;background:#fff}.crm-form textarea{min-height:90px;resize:vertical}.crm-form .full{grid-column:1/-1}.primary-button,.inline-search button,.status-form button{border:0;border-radius:10px;background:#0f766e;color:#fff;padding:.72rem 1rem}.inline-search{display:flex;gap:.6rem;margin-bottom:1rem}.inline-search input{flex:1}.table-wrap{overflow:auto}.crm-table{width:100%;border-collapse:collapse}.crm-table th,.crm-table td{padding:.85rem;border-bottom:1px solid #edf1f3;text-align:right;white-space:nowrap}.crm-table th{color:#64748b;font-size:.82rem}.case-list{display:flex;flex-direction:column;gap:.75rem}.case-card{display:flex;justify-content:space-between;gap:1rem;border:1px solid #e5ecef;border-radius:14px;padding:1rem;background:#fff}.case-card>div{display:flex;flex-direction:column;gap:.35rem}.case-card span,.case-card small,.muted{color:#64748b}.case-card p{margin:.35rem 0}.status-form{display:flex;gap:.4rem;flex-wrap:wrap;align-items:center}.status-form input,.status-form select{max-width:150px;padding:.45rem}.status-form button{padding:.48rem .75rem}.empty-state{text-align:center;color:#94a3b8;padding:2rem}.panel h2{font-size:1.15rem;margin-bottom:1rem}
@media(max-width:1050px){.operations-grid{grid-template-columns:1fr 1fr}.operations-grid>section:last-child{grid-column:1/-1}}
@media(max-width:900px){.crm-grid,.operations-grid{grid-template-columns:1fr}.operations-grid>section:last-child{grid-column:auto}.crm-form{grid-template-columns:1fr}.crm-form .full{grid-column:auto}.case-card{flex-direction:column}.renewal-overview{grid-template-columns:repeat(2,1fr)}}
@media(max-width:520px){.renewal-overview{grid-template-columns:1fr}}

/* Renewal range filters and insurance breakdown */
.renewal-filter-panel{margin-bottom:1.2rem}.panel-header{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1rem}.panel-header h2,.panel-header p{margin:0}.result-count{display:flex;align-items:baseline;gap:.4rem;padding:.65rem 1rem;border-radius:12px;background:var(--primary-soft);color:var(--primary-dark);white-space:nowrap}.result-count strong{font-size:1.35rem}.renewal-filter-form{display:grid;grid-template-columns:repeat(4,minmax(140px,1fr)) auto auto;gap:.75rem;align-items:end}.renewal-filter-form label{display:flex;flex-direction:column;gap:.4rem;color:#334155;font-size:.85rem}.renewal-filter-form input,.renewal-filter-form select{width:100%;padding:.7rem .8rem;border:1px solid #d8e2e8;border-radius:10px;background:#fff}.secondary-button{display:inline-flex;align-items:center;justify-content:center;padding:.72rem 1rem;border:1px solid var(--border);border-radius:10px;color:var(--text);background:#fff;font-weight:700}.insurance-summary-grid{display:grid;grid-template-columns:repeat(6,minmax(110px,1fr));gap:.7rem;margin-top:1rem}.insurance-summary-card{display:flex;align-items:center;justify-content:space-between;gap:.6rem;padding:.8rem 1rem;border:1px solid var(--border);border-radius:12px;color:var(--text);background:#fff;transition:.15s ease}.insurance-summary-card:hover,.insurance-summary-card.active{border-color:var(--primary);background:var(--primary-soft);color:var(--primary-dark);transform:translateY(-1px)}.insurance-summary-card strong{font-size:1.25rem}.insurance-summary-card span{font-size:.82rem;font-weight:700}
.date-input-wrap{position:relative;display:flex;gap:.35rem}.date-input-wrap input{direction:ltr;text-align:center;font-variant-numeric:tabular-nums}.open-persian-calendar,.clear-date{flex:0 0 2.2rem;border:1px solid #d8e2e8;border-radius:9px;background:#edf8f6;color:#0f766e;cursor:pointer;font-size:1.05rem}.clear-date{background:#f3f6f7;color:#64748b}.open-persian-calendar:hover,.clear-date:hover{border-color:#0f766e;background:#d8f2ed}.text-danger{color:#b91c1c;font-size:.78rem}.alert-danger{background:#fef2f2;border:1px solid #fecaca;color:#991b1b}
.persian-calendar{position:absolute;z-index:5000;width:320px;padding:.8rem;border:1px solid #cbd9de;border-radius:16px;background:#fff;box-shadow:0 18px 45px rgba(15,23,42,.2);direction:rtl}.pc-head,.pc-week,.pc-days,.pc-foot{display:grid;grid-template-columns:repeat(7,1fr);gap:.25rem;align-items:center}.pc-head{grid-template-columns:40px 1fr 40px;margin-bottom:.65rem}.pc-month-year{display:grid;grid-template-columns:1.35fr .9fr;gap:.35rem}.pc-month-year select{min-width:0;padding:.42rem .35rem;border:1px solid #cbd9de;border-radius:9px;background:#fff;color:#134e4a;font-weight:700;text-align:center;cursor:pointer}.pc-head button,.pc-days button,.pc-foot button{border:0;border-radius:9px;background:transparent;padding:.48rem;color:#334155;cursor:pointer}.pc-head button:hover,.pc-days button:hover{background:#dff5f1;color:#0f766e}.pc-week span{text-align:center;font-size:.75rem;color:#64748b;padding:.3rem}.pc-days i{display:block}.pc-days button.today{outline:1px solid #14b8a6}.pc-days button.selected{background:#0f766e;color:#fff}.pc-foot{grid-template-columns:1fr 1fr;margin-top:.55rem;border-top:1px solid #edf2f4;padding-top:.5rem}.pc-foot button{color:#0f766e;font-weight:700}.validation-summary:empty,.validation-summary-valid{display:none}.stage-actions{margin-top:1.2rem}.stage-buttons{display:grid;grid-template-columns:repeat(3,1fr);gap:.7rem}.stage-buttons button{border:1px solid #cfe3e0;border-radius:12px;padding:.8rem;background:#f1faf8;color:#115e59;font-weight:700}.stage-buttons button:hover{background:#dff5f1;border-color:#0f766e}.stage-buttons .success-action{background:#e8f7ee;color:#166534;border-color:#bbdfc7}.notification-list{display:flex;flex-direction:column;gap:.75rem;margin-top:1rem}.notification-item{display:flex;justify-content:space-between;gap:1rem;padding:1rem;border:1px solid #e2e8f0;border-radius:14px;background:#fff}.notification-item.unread{border-right:5px solid #0f766e;background:#f1faf8}.notification-item>div:first-child{display:flex;flex-direction:column;gap:.35rem}.notification-item p{margin:0;color:#475569}.action-row{display:flex;align-items:center;gap:.5rem}
@media(max-width:700px){.stage-buttons{grid-template-columns:1fr 1fr}.notification-item{flex-direction:column}.persian-calendar{position:fixed!important;left:50%!important;top:50%!important;transform:translate(-50%,-50%);width:min(92vw,330px)}}
@media(max-width:1100px){.renewal-filter-form{grid-template-columns:repeat(2,minmax(180px,1fr))}.insurance-summary-grid{grid-template-columns:repeat(3,1fr)}}@media(max-width:600px){.panel-header{align-items:flex-start;flex-direction:column}.renewal-filter-form{grid-template-columns:1fr}.insurance-summary-grid{grid-template-columns:repeat(2,1fr)}.result-count{width:100%;justify-content:center}}

/* Unified glass notifications */
.app-toast-region{position:fixed;z-index:10000;top:88px;right:24px;width:min(420px,calc(100vw - 32px));pointer-events:none;direction:rtl}
.app-toast{display:grid;grid-template-columns:36px minmax(0,1fr) auto 28px;align-items:center;gap:.7rem;padding:.85rem 1rem;border:1px solid rgba(15,118,110,.2);border-radius:16px;background:rgba(239,253,250,.88);color:#115e59;box-shadow:0 16px 45px rgba(15,23,42,.14);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);opacity:0;transform:translateY(-12px);transition:opacity .2s ease,transform .2s ease;pointer-events:auto;text-align:right}
.app-toast.is-visible{opacity:1;transform:translateY(0)}
.app-toast-icon{display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:rgba(13,148,136,.14);font-size:1.15rem;font-weight:900}
.app-toast-message{font-weight:700;line-height:1.8}
.app-toast-action:empty{display:none}
.app-toast-action a{display:inline-flex;padding:.35rem .55rem;border:1px solid currentColor;border-radius:8px;color:inherit;font-size:.76rem;font-weight:900;white-space:nowrap}
.app-toast button{border:0;background:transparent;color:inherit;font-size:1.3rem;cursor:pointer;padding:0}
.app-toast-error{border-color:rgba(220,38,38,.28);background:rgba(254,242,242,.92);color:#991b1b}
.app-toast-error .app-toast-icon{background:rgba(220,38,38,.13)}
.app-toast-progress{border-color:rgba(2,132,199,.25);background:rgba(240,249,255,.9);color:#075985}
.app-toast-progress .app-toast-icon{background:rgba(2,132,199,.13)}
@media(max-width:600px){.app-toast-region{top:76px;right:16px}.app-toast{grid-template-columns:32px minmax(0,1fr) 24px;padding:.75rem}.app-toast-action{grid-column:2}.app-toast>button{grid-column:3;grid-row:1}}

/* Guided renewal workflow */
.renewal-workspace{max-width:1320px}
.workflow-progress-panel{margin-bottom:1.2rem;overflow:hidden}
.workflow-progress-heading{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1.25rem}
.workflow-progress-heading h2{margin:.2rem 0 0;font-size:1.2rem}
.workflow-kicker{display:block;color:var(--primary);font-size:.78rem;font-weight:800}
.workflow-counter{padding:.55rem .85rem;border-radius:999px;color:var(--primary-dark);background:var(--primary-soft);font-weight:800;white-space:nowrap}
.workflow-steps{display:grid;grid-template-columns:repeat(7,minmax(120px,1fr));gap:.55rem;margin:0;padding:0;list-style:none;overflow-x:auto}
.workflow-steps li{position:relative;display:flex;align-items:center;gap:.55rem;min-height:64px;padding:.65rem;border:1px solid var(--border);border-radius:13px;background:#fff}
.workflow-steps li:not(:last-child)::after{content:"";position:absolute;left:-.56rem;top:50%;width:.56rem;height:2px;background:#d9e2e7}
.step-number{display:grid;place-items:center;flex:0 0 30px;width:30px;height:30px;border-radius:50%;color:#64748b;background:#eef2f6;font-weight:900}
.step-copy{min-width:0}
.step-copy strong,.step-copy small{display:block}
.step-copy strong{font-size:.78rem;line-height:1.5}
.step-copy small{margin-top:.15rem;color:#94a3b8;font-size:.68rem}
.workflow-steps .is-done{border-color:#b9dfd8;background:#f1faf8}
.workflow-steps .is-done .step-number{color:#fff;background:var(--primary)}
.workflow-steps .is-current{border:2px solid var(--primary);background:var(--primary-soft);box-shadow:0 8px 20px rgba(15,118,110,.1)}
.workflow-steps .is-current .step-number{color:#fff;background:var(--primary)}
.workflow-steps .is-current .step-copy small{color:var(--primary-dark);font-weight:800}
.workflow-steps .is-pending{opacity:.66}
.next-action-card{display:grid;grid-template-columns:1fr minmax(310px,.52fr);align-items:center;gap:1.5rem;margin-bottom:1.2rem;padding:1.45rem;border:1px solid rgba(15,118,110,.22);background:linear-gradient(125deg,#fff,#effbf8);box-shadow:0 16px 38px rgba(15,118,110,.1)}
.next-action-copy h2{margin:.35rem 0 .5rem;font-size:1.35rem}
.next-action-copy p{margin:0;color:#526273;line-height:1.9}
.next-action-form{margin:0}
.next-action-button{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;min-height:82px;padding:1rem 1.25rem;border:0;border-radius:15px;color:#fff;background:linear-gradient(135deg,var(--primary),#0d9488);box-shadow:0 12px 28px rgba(15,118,110,.24);cursor:pointer;transition:transform .18s ease,box-shadow .18s ease}
.next-action-button:hover{transform:translateY(-2px);box-shadow:0 16px 34px rgba(15,118,110,.3)}
.next-action-button span{font-size:1rem;font-weight:900}
.next-action-button small{margin-top:.3rem;color:#d8f7f1}
.workflow-result{display:flex;align-items:center;gap:1rem;margin-bottom:1.2rem;border:1px solid}
.workflow-result-icon{display:grid;place-items:center;flex:0 0 48px;width:48px;height:48px;border-radius:50%;font-size:1.5rem;font-weight:900}
.workflow-result h2,.workflow-result p{margin:0}
.workflow-result p{margin-top:.35rem;line-height:1.8}
.workflow-result-success{border-color:#bbdfc7;background:#f0fdf4;color:#166534}
.workflow-result-success .workflow-result-icon{color:#fff;background:#16a34a}
.workflow-result-cancelled{border-color:#fecaca;background:#fff7f7;color:#991b1b}
.workflow-result-cancelled .workflow-result-icon{color:#fff;background:#dc2626}
.workflow-more{margin:1.2rem 0}
.workflow-more>summary{display:flex;align-items:center;justify-content:space-between;gap:1rem;cursor:pointer;list-style:none}
.workflow-more>summary::-webkit-details-marker{display:none}
.workflow-more>summary strong,.workflow-more>summary small{display:block}
.workflow-more>summary small{margin-top:.35rem;color:var(--muted);font-weight:400}
.details-chevron{display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:var(--primary-soft);color:var(--primary);font-size:1.25rem;transition:transform .2s ease}
.workflow-more[open] .details-chevron{transform:rotate(180deg)}
.workflow-more-content{display:grid;grid-template-columns:1fr 1fr;gap:1.4rem;margin-top:1.3rem;padding-top:1.3rem;border-top:1px solid var(--border)}
.workflow-more-content>section+section{padding-right:1.4rem;border-right:1px solid var(--border)}
.renewal-record-grid{grid-template-columns:1.25fr .75fr}
@media(max-width:900px){.next-action-card,.workflow-more-content,.renewal-record-grid{grid-template-columns:1fr}.workflow-more-content>section+section{padding-right:0;border-right:0;border-top:1px solid var(--border);padding-top:1.2rem}.workflow-progress-heading{align-items:flex-start}.workflow-steps{grid-template-columns:repeat(7,155px)}}
@media(max-width:600px){.next-action-card{padding:1rem}.workflow-progress-panel{padding:1rem}.workflow-progress-heading{flex-direction:column}.workflow-counter{width:100%;text-align:center}.page-title{align-items:flex-start;gap:.8rem}.page-title .secondary-button{padding:.65rem .75rem;font-size:.78rem}}

/* Operational stage forms and audit trail */
.stage-action-card{grid-template-columns:minmax(240px,.7fr) minmax(500px,1.5fr);align-items:start}
.stage-action-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;padding:1.25rem;border:1px solid #cfe9e6;border-radius:18px;background:rgba(255,255,255,.78)}
.stage-action-form label{display:grid;gap:.45rem;color:#243248;font-weight:750}
.stage-action-form label small{color:#718096;font-weight:400}
.stage-action-form input,.stage-action-form select,.stage-action-form textarea{width:100%;min-height:46px;padding:.65rem .75rem;border:1px solid #cad8df;border-radius:11px;background:#fff}
.stage-action-form textarea{min-height:88px;resize:vertical}
.stage-action-form .full{grid-column:1/-1}
.stage-form-heading{display:grid;gap:.25rem;padding-bottom:.2rem}
.stage-form-heading strong{color:var(--primary);font-size:1.02rem}
.stage-form-heading span{color:#607080}
.stage-confirm{grid-template-columns:24px 1fr!important;align-items:center;padding:.75rem .9rem;border-radius:11px;background:#effaf8}
.stage-confirm input{width:20px;min-height:20px}
.stage-action-form .next-action-button{grid-column:1/-1}
.danger-outline{color:#b42318!important;border-color:#f2b8b5!important;background:#fff8f7!important}
.back-stage-section{grid-column:1/-1;padding-top:1.2rem;border-top:1px solid var(--border)}
.workflow-audit-panel{margin-top:1.2rem}
.workflow-audit-list{display:grid;gap:.75rem}
.workflow-audit-list article{display:grid;gap:.45rem;padding:.9rem 1rem;border:1px solid #deeaed;border-radius:13px;background:#fbfdfd}
.workflow-audit-list article>div{display:flex;justify-content:space-between;gap:1rem}
.workflow-audit-list span,.workflow-audit-list small{color:#6b7886}
.workflow-audit-list p{margin:0}
@media(max-width:900px){.stage-action-card,.stage-action-form{grid-template-columns:1fr}.stage-action-form .full,.stage-action-form .next-action-button{grid-column:auto}.workflow-audit-list article>div{display:grid}}

/* v20: primary case actions stay directly below progress and below the sticky app header */
.case-shortcuts{display:grid;grid-template-columns:1.1fr repeat(4,1fr);gap:.65rem;margin:1rem 0 1.2rem;padding:.8rem;position:sticky;top:76px;z-index:40;box-shadow:0 12px 32px rgba(15,23,42,.08)}
.shortcut-status,.case-shortcut{display:flex;align-items:center;gap:.65rem;min-height:64px;padding:.7rem .8rem;border-radius:13px}
.shortcut-status{flex-direction:column;align-items:flex-start;justify-content:center;background:#f1f5f9;color:#475569}
.shortcut-status span{font-size:.75rem}.shortcut-status strong{color:#0f172a}
.case-shortcut{border:1px solid #dbe7ea;background:#fff;color:#243248;text-align:right;cursor:pointer;transition:.18s ease}
.case-shortcut:hover{transform:translateY(-2px);box-shadow:0 8px 20px rgba(15,23,42,.09)}
.case-shortcut>span:last-child{display:flex;flex-direction:column;gap:.2rem}
.case-shortcut small{color:#718096;font-size:.72rem}
.shortcut-icon{display:grid;place-items:center;flex:0 0 34px;width:34px;height:34px;border-radius:10px;font-size:1rem}
.document-shortcut .shortcut-icon{background:#e0f2fe;color:#0369a1}
.communication-shortcut .shortcut-icon{background:#fef3c7;color:#a16207}
.stage-shortcut .shortcut-icon{background:#dcfce7;color:#15803d}
.issue-shortcut .shortcut-icon{background:#ede9fe;color:#6d28d9}
.operation-card{scroll-margin-top:180px}.stage-action-card{scroll-margin-top:180px}
.workflow-audit-list article{border-right-width:5px}
.workflow-audit-list article.audit-advance{border-right-color:#22c55e;background:#f4fdf7}
.workflow-audit-list article.audit-log{border-right-color:#eab308;background:#fffdf2}
.workflow-audit-list article.audit-assign{border-right-color:#3b82f6;background:#f4f8ff}
.workflow-audit-list article.audit-back{border-right-color:#ef4444;background:#fff7f7}
.audit-state{font-weight:750}
@media(max-width:1100px){.case-shortcuts{grid-template-columns:repeat(2,1fr);position:static}.shortcut-status{grid-column:1/-1}}
@media(max-width:600px){.case-shortcuts{grid-template-columns:1fr}.shortcut-status{grid-column:auto}.case-shortcut{min-height:58px}}

/* پرونده عملیاتی تطبیقی */
.case-operation-hub{margin:1.2rem 0;padding:1.25rem;border:1px solid #cfe3e0;border-radius:20px;background:linear-gradient(145deg,#f8fffe,#edf8f6)}
.operation-hub-heading{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1rem}
.operation-hub-heading h2,.operation-hub-heading p{margin:.2rem 0}
.operation-hub-heading p{color:var(--muted)}
.route-badge{padding:.55rem .8rem;border-radius:999px;background:#fff;color:var(--primary-dark);font-size:.8rem;font-weight:800;border:1px solid #cfe3e0}
.operation-tabs{display:grid;gap:.75rem}
.operation-card{overflow:hidden;border:1px solid #d7e5e6;border-radius:15px;background:#fff}
.operation-card>summary{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.1rem;cursor:pointer;list-style:none}
.operation-card>summary::-webkit-details-marker{display:none}
.operation-card>summary span{color:var(--muted);font-size:.8rem}
.operation-card[open]>summary{color:var(--primary-dark);background:var(--primary-soft);border-bottom:1px solid #d7e5e6}
.operation-card .compact-form{margin:0;padding:1rem}
.queue-warning{padding:.75rem .9rem;border-radius:11px;background:#fff7df;color:#7a5400;font-size:.84rem;line-height:1.8}
.quick-issue-card{border-color:#b9dfc4}
.quick-issue-card>p{margin:1rem 1rem 0}
.success-button{background:#15803d!important}
.document-open-link{display:inline-flex;margin-top:.55rem;color:var(--primary);font-weight:800;font-size:.82rem}
.communication-history-panel{margin-top:1.2rem}
.communication-list{display:grid;gap:.7rem}
.communication-list article{max-width:82%;padding:.85rem 1rem;border:1px solid #dce7ea;border-radius:15px;background:#f8fafc}
.communication-list article.outgoing{margin-right:auto;background:#eaf8f5;border-color:#c6e5de}
.communication-list article.incoming{margin-left:auto;background:#f8fafc}
.communication-list article>div{display:flex;align-items:center;justify-content:space-between;gap:1rem}
.communication-list p{margin:.5rem 0;white-space:pre-wrap;line-height:1.8}
.communication-list small,.delivery-status{color:var(--muted);font-size:.76rem}
@media(max-width:700px){.operation-hub-heading{align-items:flex-start;flex-direction:column}.route-badge{width:100%;text-align:center}.communication-list article{max-width:100%}}

/* v18: guided case health and document completeness */
.action-reason{display:grid;gap:.25rem;margin-top:1rem;padding:.8rem .9rem;border:1px solid;border-radius:12px;font-size:.82rem;line-height:1.75}
.action-reason span{color:#526273}
.desk-waiting{border-color:#bae6fd!important;background:#f0f9ff!important}
.desk-review{border-color:#bfdbfe!important;background:#eff6ff!important}
.desk-followup{border-color:#fde68a!important;background:#fffbeb!important}
.desk-done{border-color:#bbf7d0!important;background:#f0fdf4!important}
.shortcut-status small{color:#64748b;font-size:.68rem}
.document-checklist{margin:1rem 1rem 0;padding:1rem;border:1px solid #d7e5e6;border-radius:14px;background:#fbfefd}
.checklist-heading{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:.8rem}
.checklist-heading span{padding:.35rem .65rem;border-radius:999px;background:var(--primary-soft);color:var(--primary-dark);font-size:.74rem;font-weight:800}
.checklist-items{display:grid;grid-template-columns:repeat(3,1fr);gap:.6rem}
.checklist-items>div{display:grid;grid-template-columns:28px 1fr;align-items:center;gap:.1rem .55rem;padding:.65rem .7rem;border:1px solid;border-radius:11px}
.checklist-items small{grid-column:2;color:#64748b;font-size:.7rem}
.check-state{display:grid;grid-row:1/3;place-items:center;width:28px;height:28px;border-radius:50%;font-weight:900}
.checklist-items .is-complete{border-color:#bbdfc7;background:#f0fdf4}.checklist-items .is-complete .check-state{color:#fff;background:#16a34a}
.checklist-items .is-missing{border-color:#fde68a;background:#fffbeb}.checklist-items .is-missing .check-state{color:#854d0e;background:#facc15}
.document-checklist>p{margin:.8rem 0 0;color:#64748b;font-size:.76rem;line-height:1.8}
@media(max-width:850px){.checklist-items{grid-template-columns:1fr}.checklist-heading{align-items:flex-start;flex-direction:column}}

/* v19: one clear command center and less duplicated work */
.stage-action-card{grid-template-columns:minmax(260px,.78fr) minmax(420px,1.22fr)}
.stage-action-disclosure{overflow:hidden;border:1px solid #cfe9e6;border-radius:18px;background:rgba(255,255,255,.82)}
.stage-action-disclosure>summary{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.15rem;cursor:pointer;list-style:none}
.stage-action-disclosure>summary::-webkit-details-marker{display:none}
.stage-action-disclosure>summary span:first-child{display:grid;gap:.25rem}
.stage-action-disclosure>summary strong{color:var(--primary-dark)}
.stage-action-disclosure>summary small{color:#64748b;font-weight:400;line-height:1.7}
.stage-action-disclosure[open]>summary{border-bottom:1px solid #d7e5e6;background:var(--primary-soft)}
.stage-action-disclosure[open] .details-chevron{transform:rotate(180deg)}
.stage-action-disclosure .stage-action-form{border:0;border-radius:0;background:transparent}
.workflow-more-content{grid-template-columns:1fr}
.workflow-more-content>section+section{padding-right:0;border-right:0;border-top:1px solid var(--border);padding-top:1.2rem}
@media(max-width:900px){.stage-action-card{grid-template-columns:1fr}}

/* Current SQL-backed view bindings inside the authoritative V24 presentation. */
.nav-link.disabled { opacity: .48; cursor: not-allowed; }
.readonly-badge { display:inline-flex;align-items:center;padding:.55rem .85rem;border:1px solid #cfe3e0;border-radius:999px;color:var(--primary-dark);background:var(--primary-soft);font-size:.78rem;font-weight:800;white-space:nowrap; }
.dashboard-alert { margin:1.2rem 0 0; }
.activity-text-value { font-size:1rem!important; }
.customer-workspace-grid { grid-template-columns:minmax(270px,.58fr) minmax(0,1.42fr); }
.customer-guide-panel p,.readonly-copy { color:var(--muted);line-height:1.9; }
.workspace-summary { display:grid;gap:.7rem;margin:1.2rem 0; }
.workspace-summary div { display:flex;align-items:center;justify-content:space-between;padding:.8rem 0;border-bottom:1px solid var(--border); }
.workspace-summary dt,.workspace-summary dd { margin:0; }
.workspace-summary dt { color:var(--muted); }
.workspace-summary dd { color:var(--primary-dark);font-weight:900; }
.guide-note { padding:1rem;border-right:3px solid var(--primary);border-radius:10px;background:var(--primary-soft);color:#3d5b61;line-height:1.9; }
.customer-inline-search { align-items:stretch; }
.customer-inline-search select { width:76px;padding:.65rem;border:1px solid var(--border);border-radius:10px;background:#fff; }
.list-result-heading { margin-top:.4rem; }
.cell-note { display:block;margin-top:.3rem;color:var(--muted);font-size:.75rem; }
.ltr-value { direction:ltr;unicode-bidi:isolate;display:inline-block; }
.table-action a,.detail-link { color:var(--primary);font-weight:800;white-space:nowrap; }
.detail-grid { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.7rem;margin:0; }
.detail-grid div { padding:.85rem;border:1px solid var(--border);border-radius:11px;background:#fbfdfd; }
.detail-grid dt { color:var(--muted);font-size:.75rem; }
.detail-grid dd { margin:.3rem 0 0;font-weight:800; }
.dossier-index-panel .case-card { align-items:center; }
.dossier-section { margin-top:1.2rem; }
.queue-case-card { display:grid;grid-template-columns:minmax(0,1fr) minmax(180px,auto);align-items:start; }
.queue-operation-card { display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,.42fr);align-items:start; }
.queue-case-main,.queue-case-meta,.queue-case-card>div,.queue-operation-card>div { min-width:0; }
.queue-case-main { width:100%; }
.queue-case-meta { width:100%;max-width:320px;text-align:right; }
.queue-case-title { display:flex!important;align-items:center;flex-wrap:wrap;gap:.4rem .6rem;min-width:0; }
.queue-case-title .badge { margin:0; }
.queue-case-main>*,.queue-case-meta>*,.queue-case-card>div>*,.queue-record-summary>* { max-width:100%;overflow-wrap:anywhere;word-break:break-word; }
.activity-timeline { grid-template-columns:repeat(2,minmax(0,1fr)); }
.current-renewal-filter { grid-template-columns:1.35fr 1fr 1fr 1fr 80px auto auto; }
.renewal-results-panel { margin-top:1.2rem; }
.queue-filter-form { grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); }
.queue-guide-list li { gap:.75rem; }
.queue-guide-list .message-icon { flex:0 0 38px;width:38px;height:38px;border-radius:11px; }
.queue-editor { grid-column:1/-1;width:100%;max-width:100%;min-width:0;padding:1rem;overflow:visible;box-sizing:border-box;border:1px solid #d7e5e6;border-radius:14px;background:#f8fcfb; }
.queue-editor.is-enabled { border-color:#b9ddd8;background:#f5fbfa; }
.queue-editor-heading { display:flex;align-items:center;justify-content:space-between;gap:.8rem;margin-bottom:.8rem; }
.queue-editor-heading strong { color:var(--primary-dark); }
.queue-editor-heading small,.queue-editor-disabled { color:var(--muted); }
.queue-editor-disabled { margin:0 0 .8rem;padding:.65rem .8rem;border-radius:9px;background:#eef2f4;line-height:1.7; }
.queue-editor-grid { display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:.75rem;align-items:stretch;min-width:0; }
.queue-editor-form,.queue-editor-form fieldset { min-width:0;height:100%;margin:0; }
.queue-editor-form fieldset { display:flex;flex-direction:column;gap:.55rem;padding:.7rem;border:1px solid var(--border);border-radius:11px;background:#fff; }
.queue-editor-form fieldset:disabled { opacity:.68;cursor:not-allowed; }
.queue-editor-form label { display:grid;min-width:0;gap:.35rem;color:#52616d;font-size:.76rem;font-weight:800; }
.queue-editor-form select,.queue-editor-form input,.queue-editor-form textarea { width:100%;min-width:0;padding:.58rem .65rem;border:1px solid #d8e2e8;border-radius:9px;background:#fff;color:var(--text);font:inherit; }
.queue-editor-form textarea { resize:vertical;line-height:1.7; }
.queue-editor-form button { margin-top:auto; }
.queue-clear-form fieldset { justify-content:center; }
.queue-clear-form span { color:var(--muted);font-size:.76rem;line-height:1.7; }
.danger-outline { color:#9f2f38!important;border-color:#efc9cd!important;background:#fff8f8!important; }
.renewal-queue-operations { margin-top:1.2rem; }
.renewal-queue-list { display:grid;gap:.9rem;margin-top:1rem; }
.renewal-queue-card { display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem; }
.queue-record-summary { display:flex;flex-wrap:wrap;gap:.5rem 1rem;color:var(--muted); }
.queue-followup-value { color:var(--primary-dark)!important;font-weight:800;direction:rtl;unicode-bidi:plaintext; }
.queue-operation-card.followup-overdue { border-color:#efb5ba;box-shadow:inset -4px 0 0 var(--danger); }
.queue-operation-card.followup-today { border-color:#f2d18f;box-shadow:inset -4px 0 0 #d88a09; }

.dashboard-followups { margin:1.2rem 0;padding:1.2rem;border:1px solid var(--border);border-radius:18px;background:var(--surface); }
.dashboard-followups .panel-header { margin-bottom:1rem; }
.followup-counter-grid { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.8rem; }
.followup-counter { display:block;min-width:0;padding:1rem;border:1px solid var(--border);border-radius:14px;color:var(--text);background:#fff;transition:.18s ease; }
.followup-counter:hover { color:var(--text);transform:translateY(-1px);box-shadow:0 7px 20px rgba(15,118,110,.08); }
.followup-counter span,.followup-counter small { display:block;color:var(--muted); }
.followup-counter strong { display:block;margin:.45rem 0;font-size:1.7rem; }
.followup-counter.overdue { border-top:4px solid var(--danger); }
.followup-counter.today { border-top:4px solid #d88a09; }
.followup-counter.future { border-top:4px solid var(--primary); }
.office-followup-links { display:flex;flex-wrap:wrap;gap:.45rem 1rem;margin-top:.9rem;padding-top:.9rem;border-top:1px solid var(--border);color:var(--muted);font-size:.82rem; }
.office-followup-links a { color:var(--primary);font-weight:800; }

.followup-workspace { max-width:1280px; }
.followup-tabs { display:flex;flex-wrap:wrap;gap:.55rem;margin-bottom:1rem; }
.followup-tabs a { padding:.65rem 1rem;border:1px solid var(--border);border-radius:999px;color:#52616d;background:#fff;font-weight:800; }
.followup-tabs a.active { color:#fff;border-color:var(--primary);background:var(--primary); }
.followup-tabs a.overdue.active { border-color:var(--danger);background:var(--danger); }
.followup-tabs a.today.active { border-color:#c77800;background:#c77800; }
.followup-filter-panel { margin-bottom:1rem; }
.followup-filter-form { grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); }
.followup-results-panel { min-width:0; }
.followup-list { display:grid;gap:1rem; }
.followup-card { min-width:0;padding:1rem;border:1px solid var(--border);border-radius:16px;background:#fff;overflow-wrap:anywhere;word-break:break-word; }
.followup-card.followup-overdue { border-color:#efb5ba;box-shadow:inset -4px 0 0 var(--danger); }
.followup-card.followup-today { border-color:#f2d18f;box-shadow:inset -4px 0 0 #d88a09; }
.followup-card.followup-future { border-color:#cfe3e0;box-shadow:inset -4px 0 0 var(--primary); }
.followup-card-heading { display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;min-width:0; }
.followup-card-heading h3 { margin:.35rem 0 0;font-size:1.05rem; }
.followup-state { display:inline-flex;padding:.3rem .55rem;border-radius:8px;color:var(--primary-dark);background:var(--primary-soft);font-size:.72rem;font-weight:900; }
.followup-overdue .followup-state { color:#991b1b;background:#fee2e2; }
.followup-today .followup-state { color:#8a4b00;background:#fff1d6; }
.followup-time { flex:0 0 auto;text-align:left; }
.followup-time strong,.followup-time small { display:block; }
.followup-time strong { color:var(--primary-dark);font-size:1rem; }
.followup-time small { margin-top:.3rem;color:var(--muted); }
.followup-card-grid { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.65rem;margin-top:1rem; }
.followup-card-grid>div { min-width:0;padding:.65rem;border-radius:10px;background:#f7fafb; }
.followup-card-grid span,.followup-action-copy span,.followup-notes span { display:block;color:var(--muted);font-size:.72rem; }
.followup-card-grid strong { display:block;margin-top:.3rem; }
.followup-action-copy,.followup-notes { margin-top:.8rem;padding:.75rem;border-right:3px solid var(--primary);border-radius:9px;background:#f8fcfb; }
.followup-action-copy p,.followup-notes p { margin:.3rem 0 0;line-height:1.8; }
.followup-notes { border-right-color:#94a3b8;background:#f8fafc; }
.followup-context { display:block;margin-top:.75rem;color:var(--muted);line-height:1.8; }
.followup-links { display:flex;flex-wrap:wrap;gap:.55rem;margin-top:.9rem; }
.followup-links a { text-align:center; }

.dashboard-bale-link { display:block;margin-top:.8rem;text-align:center; }
.bale-inbox-workspace,.bale-detail-workspace { max-width:1280px; }
.bale-search-form { align-items:stretch;margin:0; }
.bale-search-form select { width:84px;padding:.65rem;border:1px solid var(--border);border-radius:10px;background:#fff; }
.bale-thread-list { display:grid;gap:.85rem; }
.bale-thread-card { display:grid;grid-template-columns:48px minmax(0,1fr) minmax(145px,auto) auto;gap:.9rem;align-items:center;min-width:0;padding:1rem;border:1px solid var(--border);border-radius:16px;background:#fff; }
.bale-thread-avatar { display:grid;place-items:center;width:48px;height:48px;border-radius:15px;color:var(--primary);background:var(--primary-soft);font-weight:900; }
.bale-thread-main,.bale-thread-main>* { min-width:0;max-width:100%; }
.bale-thread-title { display:flex;align-items:center;flex-wrap:wrap;gap:.45rem .7rem; }
.bale-thread-title h3 { margin:0;font-size:1rem;overflow-wrap:anywhere; }
.bale-thread-status { color:#52616d;font-size:.72rem;font-weight:800; }
.bale-thread-main p { margin:.45rem 0;color:#334155;line-height:1.7;overflow-wrap:anywhere;word-break:break-word; }
.bale-thread-main small { display:block;margin-top:.25rem;color:var(--muted);overflow-wrap:anywhere; }
.bale-correlation-warning { color:#9a5b00!important; }
.bale-thread-meta { display:grid;gap:.3rem;text-align:left;white-space:nowrap; }
.bale-thread-meta time,.bale-thread-meta small { color:var(--muted);font-size:.76rem; }
.bale-thread-actions { display:grid;gap:.45rem; }
.bale-thread-actions a { min-width:132px;text-align:center; }
.bale-thread-summary { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.75rem;margin-bottom:1rem; }
.bale-thread-summary>div { min-width:0;padding:.85rem;border:1px solid var(--border);border-radius:12px;background:#fff; }
.bale-thread-summary span,.bale-thread-summary strong { display:block;overflow-wrap:anywhere; }
.bale-thread-summary span { color:var(--muted);font-size:.75rem; }
.bale-thread-summary strong { margin-top:.35rem; }
.bale-detail-grid { align-items:start; }
.bale-conversation-panel { min-width:0;overflow:visible; }
.bale-conversation-shell { position:relative;min-width:0; }
.bale-conversation-viewport { max-height:min(68vh,760px);min-height:280px;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:.25rem .35rem .75rem; }
.customer-bale-messenger .bale-conversation-viewport { height:min(550px,68vh); }
.bale-conversation { display:grid;gap:.6rem;min-width:0;padding:.25rem;direction:rtl; }
.bale-outbox-list { display:grid;gap:.6rem;min-width:0;padding:.35rem .25rem .25rem;direction:rtl; }
.bale-message-row { display:flex;min-width:0;justify-content:flex-start; }
.bale-message-row.is-outbound { justify-content:flex-end; }
.bale-message-bubble { width:min(78%,720px);min-width:0;padding:.8rem .9rem;border:1px solid #cae4e0;border-radius:16px 16px 5px 16px;background:#edf9f7;box-shadow:0 3px 10px rgba(15,118,110,.04); }
.bale-message-row.is-outbound .bale-message-bubble { border-color:#d7e0f2;border-radius:16px 16px 16px 5px;background:#f1f5ff; }
.bale-message-row.is-human-outbound .bale-message-bubble { border-color:hsl(var(--bale-human-hue,210) 38% 79%);background:hsl(var(--bale-human-hue,210) 58% 97%);box-shadow:inset 3px 0 0 hsl(var(--bale-human-hue,210) 44% 68%),0 3px 10px rgba(15,23,42,.035); }
.bale-message-row.is-human-outbound .bale-message-heading strong { color:hsl(var(--bale-human-hue,210) 42% 32%); }
.bale-conversation-participants { display:flex;align-items:flex-start;gap:.7rem;margin:-.15rem 0 .7rem;padding:.65rem .75rem;border:1px solid #e2e8f0;border-radius:12px;background:#fbfdff;direction:rtl; }
.bale-conversation-participants[hidden] { display:none; }
.bale-participants-title { flex:0 0 auto;padding-top:.28rem;color:#64748b;font-size:.72rem;font-weight:800; }
.bale-participants-list { display:flex;flex-wrap:wrap;gap:.45rem;min-width:0; }
.bale-participant-chip { display:inline-flex;align-items:center;gap:.4rem;padding:.3rem .55rem;border:1px solid hsl(var(--bale-human-hue,210) 36% 80%);border-radius:999px;background:hsl(var(--bale-human-hue,210) 55% 97%);white-space:nowrap; }
.bale-participant-chip strong { color:hsl(var(--bale-human-hue,210) 42% 31%);font-size:.72rem; }
.bale-participant-chip small { color:#64748b;font-size:.62rem; }
.bale-outbox-row.is-queued .bale-message-bubble { border-style:dashed; }
.bale-outbox-row.is-sent .bale-message-bubble { border-color:#99d7c9;background:#ecfdf8; }
.bale-outbox-row.is-failed .bale-message-bubble { border-color:#fecaca;background:#fff5f5; }
.bale-outbox-row.is-failed .bale-outbox-status { color:#b91c1c;font-weight:800; }
.bale-message-heading { display:flex;align-items:center;justify-content:space-between;gap:.75rem;margin-bottom:.45rem; }
.bale-message-heading strong { color:var(--primary-dark);font-size:.8rem; }
.bale-message-heading span { color:var(--muted);font-size:.68rem; }
.bale-message-bubble p { margin:0;line-height:1.9;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word; }
.bale-message-meta { display:flex;align-items:center;flex-wrap:wrap;gap:.35rem .75rem;margin-top:.55rem;padding-top:.45rem;border-top:1px solid rgba(100,116,139,.14);color:var(--muted);font-size:.68rem; }
.bale-message-meta a { margin-right:auto;color:var(--primary);font-weight:800; }
.bale-attachment-card { display:flex;align-items:center;gap:.65rem;margin-top:.55rem;padding:.65rem;border:1px dashed #a9c7c3;border-radius:11px;background:rgba(255,255,255,.58); }
.bale-attachment-card>span:last-child { min-width:0; }
.bale-attachment-card strong,.bale-attachment-card small { display:block;overflow-wrap:anywhere; }
.bale-attachment-card small { margin-top:.25rem;color:var(--muted);font-size:.7rem; }
.bale-attachment-icon { display:grid;place-items:center;flex:0 0 34px;width:34px;height:34px;border-radius:10px;color:var(--primary);background:#dff3ef;font-weight:900; }
.bale-new-message-jump { position:absolute;z-index:4;right:50%;bottom:2.1rem;transform:translateX(50%);padding:.55rem .9rem;border:0;border-radius:999px;color:#fff;background:var(--primary);box-shadow:0 8px 24px rgba(15,118,110,.28);font:inherit;font-size:.78rem;font-weight:900;cursor:pointer; }
.bale-new-message-jump[hidden] { display:none; }
.bale-live-state { display:block;margin-top:.45rem;color:var(--muted);font-size:.7rem;text-align:center; }
.bale-composer { position:relative;display:grid;gap:.65rem;min-width:0;margin-top:.85rem;padding:.8rem;border:1px solid #d8e2e8;border-radius:15px;background:#f8fbfb;direction:rtl; }
.bale-composer-controls { display:grid;grid-template-columns:42px minmax(0,1fr) auto;gap:.55rem;align-items:end;min-width:0; }
.bale-composer textarea { width:100%;min-width:0;max-height:180px;resize:vertical;padding:.7rem .8rem;border:1px solid #cbd9de;border-radius:11px;background:#fff;font:inherit;line-height:1.75; }
.bale-composer textarea:focus { border-color:var(--primary);outline:0;box-shadow:0 0 0 3px rgba(15,118,110,.1); }
.bale-attach-button { display:grid;place-items:center;width:42px;height:42px;border:1px solid #cbd9de;border-radius:11px;background:#fff;cursor:pointer;font-size:1.15rem; }
.bale-send-button { min-height:42px;border:0;cursor:pointer; }
.bale-send-button:disabled { cursor:wait;opacity:.62; }
.bale-composer-help { color:var(--muted);font-size:.7rem;overflow-wrap:anywhere; }
.bale-composer-feedback { padding:.55rem .7rem;border-radius:9px;color:#075985;background:#e0f2fe;font-size:.78rem; }
.bale-composer-feedback.is-error { color:#991b1b;background:#fee2e2; }
.bale-selected-file { display:flex;align-items:center;gap:.65rem;min-width:0;padding:.6rem;border:1px dashed #a9c7c3;border-radius:11px;background:#fff; }
.bale-selected-file img { flex:0 0 54px;width:54px;height:54px;border-radius:9px;object-fit:cover; }
.bale-selected-file-icon { display:grid;place-items:center;flex:0 0 38px;width:38px;height:38px;border-radius:9px;color:var(--primary);background:#dff3ef;font-weight:900; }
.bale-selected-file-copy { min-width:0;flex:1; }
.bale-selected-file-copy strong,.bale-selected-file-copy small { display:block;overflow-wrap:anywhere;word-break:break-word; }
.bale-selected-file-copy small { margin-top:.2rem;color:var(--muted);font-size:.7rem; }
.bale-file-remove { flex:0 0 34px;width:34px;height:34px;border:0;border-radius:9px;color:#991b1b;background:#fee2e2;cursor:pointer;font-size:1.25rem; }
.bale-drop-overlay { position:absolute;z-index:12;inset:0;display:grid;place-items:center;border:2px dashed var(--primary);border-radius:15px;color:var(--primary-dark);background:rgba(236,253,248,.94);pointer-events:none; }
.bale-drop-overlay[hidden],.bale-selected-file[hidden],.bale-composer-feedback[hidden] { display:none; }
.bale-composer-disabled { margin-top:.85rem;padding:.75rem;border:1px dashed #cbd5e1;border-radius:12px;color:var(--muted);background:#f8fafc;line-height:1.8;overflow-wrap:anywhere; }
.bale-nav-link { display:inline-flex!important;align-items:center;gap:.4rem; }
.bale-nav-badge { display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 .3rem;border-radius:999px;color:#fff;background:#dc2626;font-size:.67rem;font-weight:900;line-height:1; }
.bale-nav-badge[hidden] { display:none; }

.pager { display:flex;align-items:center;justify-content:center;gap:.7rem;margin-top:1.25rem; }
.pager-link { min-width:74px;padding:.6rem .8rem;border:1px solid var(--border);border-radius:10px;background:#fff;text-align:center;font-weight:700; }
.pager-link:hover { color:#fff;background:var(--primary);border-color:var(--primary); }
.pager-link.disabled { color:#9aa4b2;background:#f5f7f9;pointer-events:none; }
.pager-status { color:var(--muted);font-size:.82rem; }

/* Current single Jalali picker, visually matched to V24 date controls. */
.jalali-date-control { position:relative;display:grid;grid-template-columns:minmax(0,1fr) 36px 34px;gap:.3rem; }
.jalali-date-control.no-clear { grid-template-columns:minmax(0,1fr) 36px; }
.jalali-date-control input { min-width:0;text-align:center;font-variant-numeric:tabular-nums; }
.jalali-date-trigger,.jalali-date-clear { border:1px solid #d8e2e8;border-radius:9px;background:#edf8f6;color:var(--primary);cursor:pointer;font-size:1.1rem;display:grid;place-items:center;min-width:34px;min-height:38px;line-height:1; }
.customer-action-dialog,.customer-action-form { overflow:visible; }
.jalali-date-clear { color:#64748b;background:#f3f6f7; }
.jalali-date-trigger:hover,.jalali-date-clear:hover,.jalali-date-control.is-calendar-open .jalali-date-trigger { border-color:var(--primary);background:#d8f2ed; }
.jalali-calendar[hidden] { display:none; }
.jalali-calendar { position:fixed;z-index:10000;width:320px;max-width:calc(100vw - 16px);max-height:calc(100vh - 16px);margin:0;padding:.8rem;overflow-y:auto;border:1px solid #cbd9de;border-radius:16px;background:#fff;box-shadow:0 18px 45px rgba(15,23,42,.2);direction:rtl;box-sizing:border-box; }
.jalali-calendar-header { display:grid;grid-template-columns:36px 1fr 36px 32px;gap:.3rem;align-items:center;margin-bottom:.65rem; }
.jalali-calendar-month-year { display:grid;grid-template-columns:1.35fr .9fr;gap:.35rem; }
.jalali-calendar-month-year select { min-width:0;padding:.42rem .35rem;border:1px solid #cbd9de;border-radius:9px;background:#fff;color:#134e4a;font-weight:700;text-align:center; }
.jalali-calendar-nav,.jalali-calendar-close { border:0;border-radius:9px;background:transparent;padding:.45rem;color:#334155;cursor:pointer; }
.jalali-calendar-weekdays,.jalali-calendar-days { display:grid;grid-template-columns:repeat(7,1fr);gap:.25rem; }
.jalali-calendar-weekdays span { padding:.3rem;text-align:center;color:#64748b;font-size:.75rem; }
.jalali-calendar-day { border:0;border-radius:9px;background:transparent;padding:.48rem;color:#334155;cursor:pointer; }
.jalali-calendar-day:hover { color:var(--primary);background:#dff5f1; }
.jalali-calendar-day.is-today { outline:1px solid #14b8a6; }
.jalali-calendar-day.is-selected { color:#fff;background:var(--primary); }
.jalali-calendar-footer { display:grid;grid-template-columns:1fr 1fr;gap:.35rem;margin-top:.55rem;padding-top:.5rem;border-top:1px solid #edf2f4; }
.jalali-calendar-footer button { border:0;border-radius:9px;padding:.48rem;color:var(--primary);background:transparent;font-weight:700; }
.jalali-followup-fields { display:grid;grid-template-columns:minmax(0,1fr) minmax(58px,68px) minmax(58px,68px);gap:.45rem;align-items:end;min-width:0; }
.jalali-followup-date { min-width:0; }
.jalali-followup-current { color:var(--muted);line-height:1.7; }
.jalali-followup-current span { display:inline-block;font-variant-numeric:tabular-nums; }

/* Login keeps Identity behavior and uses the V24 glass/surface language. */
.bimnet-login-page { display:grid;place-items:center;min-height:calc(100vh - 148px);padding:2.5rem 1rem;background:radial-gradient(circle at 20% 15%,rgba(45,212,191,.18),transparent 28%),linear-gradient(135deg,#123a52,#0f766e); }
.bimnet-login-card { width:min(100%,450px);padding:2rem;border:1px solid rgba(255,255,255,.42);border-radius:22px;background:rgba(255,255,255,.97);box-shadow:0 24px 60px rgba(5,44,48,.28); }
.bimnet-login-header { display:flex;align-items:center;gap:1rem;margin-bottom:1.5rem; }
.bimnet-login-logo { display:grid;place-items:center;flex:0 0 52px;width:52px;height:52px;border-radius:16px;color:#fff;background:linear-gradient(145deg,var(--primary),#14b8a6);font-size:1.45rem;font-weight:900; }
.login-eyebrow { color:var(--primary);font-size:.76rem;font-weight:800; }
.bimnet-login-header h1 { margin:.25rem 0;font-size:1.5rem;font-weight:900; }
.bimnet-login-header p,.bimnet-login-help { margin:0;color:var(--muted);font-size:.82rem; }
.bimnet-login-form,.bimnet-field { display:grid;gap:.65rem; }
.bimnet-login-form { gap:1rem; }
.bimnet-field label { font-weight:700; }
.bimnet-field input { width:100%;padding:.78rem .9rem;border:1px solid #d8e2e8;border-radius:11px;outline:0; }
.bimnet-field input:focus { border-color:var(--primary);box-shadow:0 0 0 3px rgba(15,118,110,.12); }
.bimnet-validation:not(:empty) { padding:.75rem;border:1px solid #fecaca;border-radius:10px;color:#991b1b;background:#fef2f2; }
.bimnet-remember { display:flex;align-items:center;gap:.55rem;color:var(--muted);font-size:.82rem; }
.bimnet-remember input { width:18px;height:18px;accent-color:var(--primary); }
.bimnet-login-button { padding:.8rem 1rem;border:0;border-radius:11px;color:#fff;background:var(--primary);font-weight:800; }
.bimnet-login-help { margin-top:1.2rem;padding-top:1rem;border-top:1px solid var(--border);text-align:center; }

@media(max-width:1100px) {
    .current-renewal-filter,.queue-filter-form { grid-template-columns:repeat(2,minmax(180px,1fr)); }
}
@media(max-width:900px) {
    .customer-workspace-grid { grid-template-columns:1fr; }
    .activity-timeline { grid-template-columns:1fr; }
    .queue-case-card,.queue-operation-card { grid-template-columns:minmax(0,1fr); }
    .queue-case-meta { max-width:none; }
    .followup-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .bale-thread-card { grid-template-columns:48px minmax(0,1fr);align-items:start; }
    .bale-thread-meta,.bale-thread-actions { grid-column:2;justify-self:stretch;text-align:right; }
    .bale-thread-actions { grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); }
}
@media(max-width:700px) {
    .jalali-calendar { position:fixed!important;left:50%!important;top:50%!important;transform:translate(-50%,-50%);width:min(92vw,330px); }
    .crm-table thead { display:none; }
    .crm-table,.crm-table tbody,.crm-table tr,.crm-table td { display:block;width:100%; }
    .crm-table tr { padding:.65rem 0;border-bottom:1px solid var(--border); }
    .crm-table td { display:grid;grid-template-columns:minmax(90px,.42fr) 1fr;gap:.75rem;padding:.55rem .25rem!important;border:0!important;white-space:normal!important; }
    .crm-table td::before { content:attr(data-label);color:var(--muted);font-size:.75rem;font-weight:700; }
    .crm-table td[colspan] { display:block; }
    .table-action a { white-space:normal; }
    .queue-case-meta { min-width:0; }
}
@media(max-width:600px) {
    .current-renewal-filter,.queue-filter-form { grid-template-columns:1fr; }
    .customer-inline-search { flex-wrap:wrap; }
    .customer-inline-search input { flex-basis:100%; }
    .detail-grid { grid-template-columns:1fr; }
    .page-title { align-items:flex-start;flex-direction:column; }
    .readonly-badge { align-self:flex-start; }
    .pager { flex-wrap:wrap; }
    .followup-counter-grid,.followup-card-grid { grid-template-columns:1fr; }
    .followup-card-heading { flex-direction:column; }
    .followup-time { text-align:right; }
    .followup-links a { width:100%; }
    .bale-search-form { flex-wrap:wrap; }
    .bale-search-form input { flex-basis:100%; }
    .bale-thread-card { grid-template-columns:1fr; }
    .bale-thread-avatar,.bale-thread-meta,.bale-thread-actions { grid-column:1; }
    .bale-thread-meta { white-space:normal; }
    .bale-thread-summary { grid-template-columns:1fr; }
    .bale-message-bubble { width:92%; }
    .bale-conversation-viewport { max-height:64vh;min-height:240px;padding-inline:0; }
    .bale-composer-controls { grid-template-columns:42px minmax(0,1fr); }
    .bale-send-button { grid-column:1/-1;width:100%; }
    .bale-selected-file { align-items:flex-start; }
}
@media(max-width:1100px) { .queue-editor-grid { grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); } }
@media(max-width:600px) {
    .queue-editor-grid { grid-template-columns:1fr; }
    .queue-editor-heading { align-items:flex-start;flex-direction:column; }
    .jalali-followup-fields { grid-template-columns:minmax(0,1fr) 68px 68px; }
}

/* Read-only adaptation of the recovered V21-V25 RenewalDetails workspace. */
.page-title-actions { display:flex;flex-wrap:wrap;gap:.55rem; }
.stage-source { display:block;margin-top:.35rem;color:var(--muted); }
.workflow-steps .is-unresolved { border-style:dashed;background:#f8fafc;color:#64748b; }
.workflow-steps .is-unresolved .step-number { background:#e2e8f0;color:#64748b; }
.readonly-operation { margin:0;border:0;opacity:.72; }
.readonly-operation:disabled,.readonly-operation[disabled] { cursor:not-allowed; }
.readonly-operation .next-action-button,.readonly-operation .primary-button { box-shadow:none;cursor:not-allowed;filter:grayscale(.3); }
.checklist-items .is-unresolved { border-color:#cbd5e1;background:#f8fafc; }
.checklist-items .is-unresolved .check-state { color:#475569;background:#e2e8f0; }
.renewals-table .table-action { display:flex;flex-wrap:wrap;gap:.45rem; }
@media(max-width:600px) { .page-title-actions { width:100%; }.page-title-actions a { flex:1;text-align:center; } }


/* V39 customer operations */
.customer-operation-stats{grid-template-columns:repeat(auto-fit,minmax(180px,1fr))}.customer-quick-actions{margin-bottom:1rem}.customer-quick-action-grid{display:flex;flex-wrap:wrap;gap:.55rem}.customer-action-dialog{width:min(92vw,620px);padding:0;border:0;border-radius:18px;background:transparent}.customer-action-dialog::backdrop{background:rgba(15,23,42,.45)}.customer-action-form{display:grid;gap:.8rem;padding:1rem;border-radius:18px;background:#fff;direction:rtl}.customer-action-form label{display:grid;gap:.35rem;font-weight:700}.customer-action-form input,.customer-action-form select,.customer-action-form textarea{width:100%;padding:.65rem .75rem;border:1px solid #cbd9de;border-radius:10px;background:#fff;font:inherit}.customer-action-buttons{display:flex;justify-content:flex-end;gap:.5rem}.bale-customer-conversation-summary{display:flex;flex-wrap:wrap;align-items:center;gap:.65rem;margin-bottom:.75rem;padding:.65rem;border-radius:10px;background:#f8fafc}.customer-unified-timeline{max-height:680px;overflow:auto}@media(max-width:600px){.customer-quick-action-grid>*{width:100%;text-align:center}.customer-action-buttons{display:grid;grid-template-columns:1fr 1fr}}

/* V38 Bale customer file */
.bale-customer-file{display:grid;gap:.8rem}.bale-customer-identity{display:grid;gap:.3rem;padding:.75rem;border:1px solid #ccfbf1;border-radius:12px;background:#f0fdfa}.bale-customer-identity>strong{font-size:1rem}.bale-customer-identity small{color:var(--muted)}.bale-policy-list{display:grid;gap:.45rem;margin-top:.7rem}.bale-policy-list article{display:grid;gap:.25rem;padding:.6rem .7rem;border:1px solid var(--border);border-radius:10px;background:#fff}.bale-policy-list small{color:var(--muted)}.bale-customer-followup{display:grid;gap:.3rem;margin-top:.7rem;padding:.65rem;border-radius:10px;background:#f8fafc}.bale-customer-followup p{margin:0;color:var(--muted);line-height:1.7}.bale-customer-actions{display:flex;flex-wrap:wrap;gap:.45rem;align-items:center;margin-top:.75rem}.bale-customer-actions p{flex-basis:100%;margin:0;color:#92400e}.bale-customer-search{display:grid;gap:.55rem;padding-top:.75rem;border-top:1px solid var(--border)}.bale-customer-search[hidden]{display:none}.bale-customer-search>label{font-size:.78rem;font-weight:800}.bale-customer-search>div:first-of-type{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.45rem}.bale-customer-search input{min-width:0;padding:.65rem .75rem;border:1px solid #cbd9de;border-radius:10px;font:inherit}.bale-customer-search p[data-bale-customer-feedback]{margin:0;padding:.5rem;border-radius:8px;color:#075985;background:#e0f2fe}.bale-customer-search p.is-error{color:#991b1b;background:#fee2e2}.bale-customer-results{display:grid;gap:.4rem;max-height:360px;overflow:auto}.bale-customer-result{display:grid;gap:.25rem;width:100%;padding:.65rem;border:1px solid var(--border);border-radius:10px;background:#fff;text-align:right;cursor:pointer;font:inherit}.bale-customer-result:hover{border-color:var(--primary);background:#f0fdfa}.bale-customer-result small{color:var(--muted);line-height:1.5}@media(max-width:600px){.bale-customer-search>div:first-of-type{grid-template-columns:1fr}.bale-customer-actions>*{width:100%;text-align:center}}

/* V37 human takeover + quick replies */
.bale-crm-tools{position:relative;margin-top:.85rem}.bale-bot-control{display:flex;align-items:center;gap:.7rem;padding:.7rem .8rem;border:1px solid #bbf7d0;border-radius:13px;background:#f0fdf4}.bale-bot-control.is-paused{border-color:#fde68a;background:#fffbeb}.bale-bot-control>div{min-width:0;flex:1}.bale-bot-control strong,.bale-bot-control small{display:block}.bale-bot-control small{margin-top:.15rem;color:var(--muted);line-height:1.7}.bale-bot-dot{flex:0 0 10px;width:10px;height:10px;border-radius:50%;background:#16a34a;box-shadow:0 0 0 4px rgba(22,163,74,.12)}.bale-bot-control.is-paused .bale-bot-dot{background:#d97706;box-shadow:0 0 0 4px rgba(217,119,6,.12)}.bale-resume-bot[hidden]{display:none}.bale-quick-add-button{display:grid;place-items:center;width:42px;height:42px;border:1px solid #cbd9de;border-radius:11px;background:#fff;color:var(--primary);cursor:pointer;font-size:1.45rem;font-weight:800}.bale-composer-controls{grid-template-columns:42px 42px minmax(0,1fr) auto}.bale-quick-menu{position:absolute;z-index:30;right:0;bottom:.2rem;width:min(100%,620px);max-height:360px;overflow:auto;border:1px solid #cbd9de;border-radius:14px;background:#fff;box-shadow:0 18px 45px rgba(15,23,42,.18)}.bale-quick-menu[hidden]{display:none}.bale-quick-menu-header{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.7rem .8rem;border-bottom:1px solid #edf2f4;background:#fff}.bale-quick-manage,.bale-quick-edit{border:0;border-radius:8px;padding:.4rem .55rem;color:var(--primary);background:#edf8f6;cursor:pointer;font:inherit;font-size:.75rem;font-weight:800}.bale-quick-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.45rem;align-items:stretch;padding:.35rem;border-bottom:1px solid #f1f5f9}.bale-quick-use{display:grid;grid-template-columns:auto minmax(0,1fr);gap:.65rem;width:100%;padding:.55rem;border:0;border-radius:9px;background:#fff;cursor:pointer;text-align:right;font:inherit}.bale-quick-use:hover{background:#f8fafc}.bale-quick-shortcut{direction:ltr;align-self:start;padding:.18rem .38rem;border-radius:6px;color:#0f766e;background:#ecfdf8;font-size:.72rem;font-weight:900}.bale-quick-copy{min-width:0}.bale-quick-copy strong,.bale-quick-copy small{display:block}.bale-quick-copy small{margin-top:.2rem;color:var(--muted);line-height:1.6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.bale-quick-empty{padding:1rem;color:var(--muted);text-align:center}.bale-quick-dialog{width:min(92vw,620px);padding:0;border:0;border-radius:18px;background:transparent}.bale-quick-dialog::backdrop{background:rgba(15,23,42,.45);backdrop-filter:blur(2px)}.bale-quick-dialog-card{display:grid;gap:.8rem;padding:1rem;border-radius:18px;background:#fff;box-shadow:0 24px 70px rgba(15,23,42,.3);direction:rtl}.bale-quick-dialog-header{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}.bale-quick-dialog-header h3{margin:.2rem 0 0}.bale-quick-close{width:36px;height:36px;border:0;border-radius:9px;background:#f1f5f9;cursor:pointer;font-size:1.4rem}.bale-quick-dialog-card label{display:grid;gap:.35rem;font-weight:700}.bale-quick-dialog-card input,.bale-quick-dialog-card textarea{width:100%;padding:.65rem .75rem;border:1px solid #cbd9de;border-radius:10px;background:#fff;font:inherit}.bale-quick-editor-grid{display:grid;grid-template-columns:1fr 120px;gap:.65rem}.bale-quick-active{display:flex!important;align-items:center;justify-content:flex-start}.bale-quick-active input{width:18px;height:18px;accent-color:var(--primary)}.bale-quick-dialog-actions{display:grid;grid-template-columns:auto 1fr auto auto;gap:.5rem;align-items:center}.bale-quick-editor-feedback{padding:.55rem .7rem;border-radius:9px;color:#075985;background:#e0f2fe;font-size:.78rem}.bale-quick-editor-feedback.is-error{color:#991b1b;background:#fee2e2}.bale-quick-editor-feedback[hidden]{display:none}.danger-button{border:0;border-radius:9px;padding:.6rem .8rem;color:#991b1b;background:#fee2e2;cursor:pointer;font:inherit;font-weight:800}@media(max-width:600px){.bale-bot-control{align-items:flex-start;flex-wrap:wrap}.bale-resume-bot{width:100%}.bale-composer-controls{grid-template-columns:42px 42px minmax(0,1fr)}.bale-send-button{grid-column:1/-1}.bale-quick-editor-grid{grid-template-columns:1fr}.bale-quick-dialog-actions{grid-template-columns:1fr 1fr}.bale-quick-dialog-actions span{display:none}}

/* V41 operational workdesk */
.operational-counter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.operational-counter {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--border-color, #dfe7e4);
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    background: #fff;
}

.operational-counter strong {
    font-size: 1.65rem;
}

.operational-counter.urgent {
    border-color: #fecaca;
    background: #fff7f7;
}

.operational-counter.warning {
    border-color: #fde68a;
    background: #fffdf3;
}

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

.operational-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--border-color, #dfe7e4);
    border-radius: 14px;
    background: #fff;
}

.operational-item.is-overdue {
    border-inline-start: 4px solid #dc2626;
}

.operational-item.is-today {
    border-inline-start: 4px solid #d97706;
}

.operational-item-main {
    display: grid;
    gap: 5px;
}

.operational-item-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.operational-item-actions,
.queue-state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.queue-state-actions {
    grid-column: 1 / -1;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color, #dfe7e4);
}

.queue-state-actions form {
    margin: 0;
}

.queue-complete-button {
    min-width: 112px;
}

@media (max-width: 800px) {
    .operational-counter-grid {
        grid-template-columns: 1fr;
    }

    .operational-item {
        grid-template-columns: 1fr;
    }

    .operational-item-actions {
        width: 100%;
    }

    .operational-item-actions a {
        flex: 1 1 auto;
        text-align: center;
    }
}


/* PASS4C29_1_19_4_MEDIA_PREVIEW */
.bale-media-preview{margin-top:.55rem;overflow:hidden;border:1px solid #cfe0df;border-radius:12px;background:rgba(255,255,255,.72)}
.bale-media-preview-button{display:block;width:100%;padding:0;border:0;background:#eef5f4;cursor:pointer;overflow:hidden}
.bale-media-thumbnail{display:block;width:100%;max-width:360px;max-height:300px;margin:0 auto;object-fit:contain;background:#eef5f4}
.bale-pdf-thumbnail{display:grid;place-items:center;gap:.45rem;min-height:145px;padding:1rem;color:#475569;background:#f8fafc}
.bale-pdf-badge{display:grid;place-items:center;width:58px;height:58px;border-radius:12px;background:#fff;border:1px solid #d8e2e8;font-weight:900;font-size:.95rem}
.bale-media-preview-footer{display:flex;align-items:center;justify-content:space-between;gap:.8rem;padding:.58rem .7rem;font-size:.74rem}
.bale-media-preview-footer strong{min-width:0;overflow-wrap:anywhere}
.bale-media-preview-footer a{flex:0 0 auto;color:var(--primary);font-weight:800}
.bale-media-viewer{width:min(96vw,1100px);height:min(92vh,900px);padding:0;border:0;border-radius:16px;background:#fff;box-shadow:0 24px 70px rgba(15,23,42,.35)}
.bale-media-viewer::backdrop{background:rgba(15,23,42,.72)}
.bale-media-viewer-card{display:grid;grid-template-rows:auto minmax(0,1fr);height:100%}
.bale-media-viewer-head{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.7rem .9rem;border-bottom:1px solid #e2e8f0}
.bale-media-viewer-head strong{min-width:0;overflow-wrap:anywhere}
.bale-media-viewer-head>div{display:flex;align-items:center;gap:.7rem;flex:0 0 auto}
.bale-media-viewer-head a{color:var(--primary);font-size:.78rem;font-weight:800}
.bale-media-viewer-head button{display:grid;place-items:center;width:34px;height:34px;border:0;border-radius:9px;background:#eef2f7;cursor:pointer;font-size:1.35rem}
.bale-media-viewer-body{display:grid;place-items:center;min-height:0;overflow:auto;background:#111827}
.bale-media-viewer-image{display:block;max-width:100%;max-height:calc(92vh - 58px);object-fit:contain}
.bale-media-viewer-pdf{display:block;width:100%;height:100%;min-height:70vh;border:0;background:#fff}
@media(max-width:640px){
  .bale-media-thumbnail{max-width:100%;max-height:250px}
  .bale-media-viewer{width:100vw;height:100vh;max-width:none;max-height:none;border-radius:0}
  .bale-media-viewer-head{align-items:flex-start}
  .bale-media-viewer-head>div a{display:none}
}
/* PASS4C29_1_19_6_GALLERY_DOWNLOAD */
.bale-media-viewer-title-wrap{display:flex;align-items:center;gap:.65rem;min-width:0}.bale-media-viewer-title-wrap strong{min-width:0;overflow-wrap:anywhere}.bale-media-viewer-title-wrap span{flex:0 0 auto;font-size:.72rem;color:#64748b}.bale-media-viewer-actions{display:flex;align-items:center;gap:.4rem;flex:0 0 auto}.bale-media-action{display:grid;place-items:center;min-width:34px;height:34px;padding:0 .55rem;border:1px solid #dbe4ea;border-radius:9px;background:#f8fafc;color:#0f172a;cursor:pointer;text-decoration:none;font:inherit;font-size:.85rem}.bale-media-action:hover{background:#eef2f7}.bale-media-action.is-text{font-size:.72rem;font-weight:800;white-space:nowrap}.bale-media-action.is-close{font-size:1.3rem}.bale-media-action[hidden]{display:none!important}@media(max-width:760px){.bale-media-viewer-head{flex-direction:column;align-items:stretch}.bale-media-viewer-actions{flex-wrap:wrap}.bale-media-action.is-text{flex:1 1 auto}}
/* PASS4C30_1_RED_DOT */
.bale-attention-filter{display:flex;align-items:center;gap:.45rem;margin-bottom:.8rem}
.bale-attention-filter button{border:1px solid var(--border);border-radius:999px;background:#fff;color:#52616d;padding:.5rem .8rem;font:inherit;font-size:.78rem;font-weight:800;cursor:pointer}
.bale-attention-filter button.is-active{border-color:#0f766e;background:#edf9f7;color:#0f766e}
.bale-attention-filter [data-bale-attention-count]{display:inline-grid;place-items:center;min-width:20px;height:20px;margin-right:.25rem;padding:0 .3rem;border-radius:999px;background:#dc2626;color:#fff;font-size:.68rem}
.bale-thread-card.needs-human-reply{border-color:#fecaca;box-shadow:inset -4px 0 0 #dc2626,0 3px 12px rgba(220,38,38,.05)}
.bale-attention-dot{display:inline-block;flex:0 0 10px;width:10px;height:10px;border-radius:50%;background:#dc2626;box-shadow:0 0 0 4px #fee2e2}

/* PASS4D17_1_CHAT_UX_BEGIN */
.pass4d17-bold{font-weight:900}
.pass4d17-copy-number{
  display:inline;
  direction:ltr;
  unicode-bidi:isolate;
  padding:0 .12rem;
  border:0;
  border-radius:5px;
  background:transparent;
  color:inherit;
  font:inherit;
  font-variant-numeric:tabular-nums;
  cursor:pointer;
  text-decoration:underline dotted rgba(15,118,110,.55);
  text-underline-offset:3px
}
.pass4d17-copy-number:hover{background:rgba(15,118,110,.09);color:#0f766e}
.pass4d17-media-tools{
  position:fixed;
  z-index:2147483646;
  left:50%;
  bottom:24px;
  transform:translateX(-50%);
  display:flex;
  gap:.45rem;
  padding:.5rem;
  border:1px solid rgba(255,255,255,.25);
  border-radius:14px;
  background:rgba(15,23,42,.82);
  box-shadow:0 10px 32px rgba(0,0,0,.28);
  backdrop-filter:blur(10px)
}
.pass4d17-media-tools button{
  min-width:42px;
  height:38px;
  padding:0 .65rem;
  border:1px solid rgba(255,255,255,.2);
  border-radius:9px;
  background:rgba(255,255,255,.1);
  color:#fff;
  font:inherit;
  font-weight:800;
  cursor:pointer
}
.pass4d17-media-tools button:hover{background:rgba(255,255,255,.22)}
dialog img[data-pass4d17-transform="1"]{max-width:min(92vw,1400px);max-height:82vh;cursor:zoom-in}
/* PASS4D17_1_CHAT_UX_END */

/* PASS4D17_2_OPENCHAT_NOTIFY_BEGIN */
.pass4d17-openchat-notify{
  position:fixed;z-index:2147483645;right:18px;bottom:18px;
  width:min(360px,calc(100vw - 36px));display:flex;align-items:center;gap:.7rem;
  padding:.8rem .85rem;border:1px solid #b8ddd8;border-radius:14px;background:#fff;
  box-shadow:0 14px 38px rgba(15,23,42,.18);direction:rtl;opacity:0;
  transform:translateY(12px);transition:opacity .18s ease,transform .18s ease
}
.pass4d17-openchat-notify.is-visible{opacity:1;transform:translateY(0)}
.pass4d17-openchat-notify-icon{width:38px;height:38px;display:grid;place-items:center;flex:0 0 auto;border-radius:50%;background:#ecfdf5;font-size:20px}
.pass4d17-openchat-notify-copy{min-width:0;display:flex;flex-direction:column;gap:.18rem}
.pass4d17-openchat-notify-copy strong{font-size:.88rem;color:#134e4a}
.pass4d17-openchat-notify-copy span{font-size:.8rem;color:#475569;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pass4d17-openchat-notify>button{margin-right:auto;border:0;background:transparent;color:#64748b;font:inherit;font-size:1.1rem;cursor:pointer;padding:.1rem .35rem}
@media(max-width:650px){.pass4d17-openchat-notify{right:10px;bottom:10px;width:calc(100vw - 20px)}}
/* PASS4D17_2_OPENCHAT_NOTIFY_END */


/* PASS4D17_3_TELEGRAM_NOTIFY_BEGIN */
.pass4d17-telegram-notify{position:fixed;right:18px;z-index:2147483646;width:min(390px,calc(100vw - 36px));display:flex;align-items:center;gap:.75rem;padding:.85rem .9rem;border:1px solid #d8e3e7;border-radius:16px;background:rgba(255,255,255,.97);box-shadow:0 16px 42px rgba(15,23,42,.20);direction:rtl;text-align:right;font:inherit;cursor:pointer;opacity:0;transform:translateX(18px);transition:opacity .18s ease,transform .18s ease;backdrop-filter:blur(12px)}
.pass4d17-telegram-notify.is-visible{opacity:1;transform:translateX(0)}
.pass4d17-telegram-notify.is-open-chat{bottom:18px}
.pass4d17-telegram-notify.is-aggregate{bottom:104px}
.pass4d17-telegram-icon{width:42px;height:42px;display:grid;place-items:center;flex:0 0 auto;border-radius:50%;background:#e6fffb;font-size:20px}
.pass4d17-telegram-body{display:flex;flex-direction:column;gap:.2rem;min-width:0;flex:1}
.pass4d17-telegram-body strong{color:#0f172a;font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pass4d17-telegram-preview{color:#475569;font-size:.82rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pass4d17-telegram-badge{min-width:26px;height:26px;padding:0 .45rem;display:grid;place-items:center;border-radius:999px;background:#0f766e;color:#fff;font-size:.76rem;font-weight:800}
@media(max-width:650px){.pass4d17-telegram-notify{right:10px;width:calc(100vw - 20px)}.pass4d17-telegram-notify.is-open-chat{bottom:10px}.pass4d17-telegram-notify.is-aggregate{bottom:96px}}
/* PASS4D17_3_TELEGRAM_NOTIFY_END */


/* PASS4D17_4_NATIVE_RICH_NOTIFY_BEGIN */
.pass4d17-native-enable{position:fixed;left:18px;bottom:18px;z-index:2147483645;border:0;border-radius:12px;padding:.75rem 1rem;background:#0f766e;color:white;font:inherit;font-weight:800;box-shadow:0 12px 28px rgba(15,23,42,.22);cursor:pointer}
.pass4d17-native-enable:hover{filter:brightness(.96)}
@media(max-width:650px){.pass4d17-native-enable{left:10px;bottom:10px;max-width:calc(100vw - 20px)}}
/* PASS4D17_4_NATIVE_RICH_NOTIFY_END */

/* PASS4D19_2_EXISTING_UI */
.bale-bot-duration{display:flex;align-items:center;gap:.45rem;margin-inline-start:auto;flex-wrap:wrap}
.bale-bot-duration select{min-width:155px;max-width:245px;border:1px solid var(--border);border-radius:10px;background:#fff;color:var(--text);padding:.48rem .65rem;font:inherit;outline:none}
.bale-bot-duration select:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(15,118,110,.10)}
@media (max-width:720px){.bale-bot-duration{width:100%;margin-inline-start:0}.bale-bot-duration select{flex:1;min-width:0}.bale-bot-duration .secondary-button{white-space:nowrap}}

/* PASS4D20_1_LABEL_UNREAD_BEGIN */
.bale-thread-extra-filter{display:flex;align-items:center;gap:.55rem;flex-wrap:wrap;margin:.2rem 0 .8rem}
.bale-thread-extra-filter button{border:1px solid var(--border);border-radius:999px;background:#fff;color:#52616d;padding:.5rem .8rem;font:inherit;font-size:.78rem;font-weight:800;cursor:pointer}
.bale-thread-extra-filter button.is-active{border-color:#0f766e;background:#edf9f7;color:#0f766e}
.bale-thread-extra-filter select{min-height:38px;border:1px solid var(--border);border-radius:10px;background:#fff;padding:.35rem .65rem;font:inherit}
.bale-thread-card.is-unread{border-color:#86c8c1;background:linear-gradient(90deg,#f0fdfa 0,#fff 28%)}
.bale-thread-card.is-unread .bale-thread-main>p{font-weight:700;color:var(--text)}
.bale-unread-chip{display:inline-flex;align-items:center;border-radius:999px;padding:.2rem .5rem;background:#0f766e;color:#fff;font-size:.7rem;font-weight:800;white-space:nowrap}
.bale-unread-filter-hidden,.bale-label-filter-hidden{display:none!important}
.bale-thread-labels,.bale-current-labels{display:flex;align-items:center;gap:.35rem;flex-wrap:wrap;margin:.28rem 0}
.bale-label-chip{display:inline-flex;align-items:center;border-radius:999px;padding:.22rem .55rem;font-size:.72rem;font-weight:800;border:1px solid transparent}
.bale-label-red{background:#fee2e2;color:#991b1b;border-color:#fecaca}.bale-label-amber{background:#fef3c7;color:#92400e;border-color:#fde68a}
.bale-label-blue{background:#dbeafe;color:#1e40af;border-color:#bfdbfe}.bale-label-purple{background:#ede9fe;color:#5b21b6;border-color:#ddd6fe}
.bale-label-teal{background:#ccfbf1;color:#115e59;border-color:#99f6e4}.bale-label-gold{background:#fef9c3;color:#854d0e;border-color:#fde047}
.bale-label-green{background:#dcfce7;color:#166534;border-color:#bbf7d0}.bale-label-gray{background:#f1f5f9;color:#475569;border-color:#e2e8f0}
.bale-thread-admin{display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex-wrap:wrap;margin:0 0 1rem;padding:.8rem 1rem;border:1px solid var(--border);border-radius:14px;background:#fff}
.bale-thread-admin-main,.bale-thread-admin-actions{display:flex;align-items:center;gap:.55rem;flex-wrap:wrap}
.bale-thread-read-state{display:inline-flex;border-radius:999px;padding:.25rem .6rem;background:#ecfdf5;color:#047857;font-size:.75rem;font-weight:900}
.bale-thread-read-state.is-unread{background:#fee2e2;color:#b91c1c}.bale-thread-admin-actions button.is-active{outline:2px solid #99d8d1}
.bale-label-dialog{border:0;padding:0;background:transparent;max-width:min(720px,94vw);width:100%}.bale-label-dialog::backdrop{background:rgba(15,23,42,.42)}
.bale-label-dialog-card{background:#fff;border-radius:18px;padding:1rem;box-shadow:0 24px 70px rgba(15,23,42,.24)}
.bale-label-dialog-header,.bale-label-row,.bale-label-dialog-actions{display:flex;align-items:center;justify-content:space-between;gap:.7rem}
.bale-label-list{display:grid;gap:.45rem;max-height:280px;overflow:auto;padding:.25rem}.bale-label-row{border:1px solid var(--border);border-radius:12px;padding:.55rem .65rem}
.bale-label-row label{display:flex;align-items:center;gap:.55rem;cursor:pointer}.bale-label-editor{display:grid;grid-template-columns:1fr 170px auto auto;gap:.5rem;align-items:end;margin-top:1rem;padding-top:1rem;border-top:1px solid var(--border)}
.bale-label-editor label{display:grid;gap:.25rem;font-size:.78rem;font-weight:700}.bale-label-editor input,.bale-label-editor select{min-height:40px;border:1px solid var(--border);border-radius:10px;padding:.45rem .6rem;font:inherit}
.bale-label-dialog-actions{margin-top:1rem}.bale-label-feedback{margin-top:.65rem;padding:.55rem .7rem;border-radius:10px;background:#ecfdf5;color:#047857;font-size:.8rem}.bale-label-feedback.is-error{background:#fef2f2;color:#b91c1c}
@media(max-width:720px){.bale-label-editor{grid-template-columns:1fr 1fr}.bale-thread-admin{align-items:flex-start}}
/* PASS4D20_1_LABEL_UNREAD_END */



/* PASS4D22_4_CHAT_OPERATIONS_BEGIN */
.bale-clear-labels-button{
  display:inline-flex;align-items:center;justify-content:center;gap:.35rem;
  padding:.6rem .78rem;border:1px solid #a7c9c1;border-radius:10px;
  background:#f2faf8;color:#17665f;font:inherit;font-size:.78rem;font-weight:800;cursor:pointer
}
.bale-clear-labels-button:hover{background:#e3f5f1;border-color:#5aa99d}
.bale-clear-labels-button:disabled{opacity:.55;cursor:wait}
.bale-failed-actions{display:flex;align-items:center;gap:.45rem;flex-wrap:wrap;margin-top:.55rem;padding-top:.5rem;border-top:1px dashed rgba(153,27,27,.2)}
.bale-retry-failed,.bale-delete-failed{border:0;border-radius:8px;padding:.42rem .65rem;font:inherit;font-size:.75rem;font-weight:800;cursor:pointer}
.bale-retry-failed{background:#fff7ed;color:#9a3412;border:1px solid #fed7aa}
.bale-retry-failed:hover{background:#ffedd5}
.bale-delete-failed{background:#fef2f2;color:#991b1b;border:1px solid #fecaca}
.bale-delete-failed:hover{background:#fee2e2}
.bale-retry-failed:disabled,.bale-delete-failed:disabled{opacity:.55;cursor:wait}
.bale-message-bubble>p{unicode-bidi:plaintext}
@media(max-width:700px){.bale-clear-labels-button{width:100%}.bale-failed-actions>*{flex:1 1 auto}}
/* PASS4D22_4_CHAT_OPERATIONS_END */

/* PASS4D22_4_7_SINGLE_SCROLL_CHAT_BEGIN
   Desktop Bale Details behaves like a messenger:
   the browser page stays fixed, chat messages are the primary scroll area,
   and the customer/context column scrolls only when its own content needs it. */
@media (min-width: 901px){
  body.bale-chat-page{
    overflow:hidden;
  }

  body.bale-chat-page .bale-detail-workspace{
    height:calc(100dvh - 74px);
    max-height:calc(100dvh - 74px);
    box-sizing:border-box;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    padding-top:.65rem;
    padding-bottom:.65rem;
  }

  body.bale-chat-page .bale-detail-workspace>.page-title{
    flex:0 0 auto;
    margin-bottom:.55rem;
  }

  body.bale-chat-page .bale-detail-workspace>.page-title h1{
    margin:.15rem 0;
    font-size:1.28rem;
  }

  body.bale-chat-page .bale-thread-summary{
    flex:0 0 auto;
    grid-template-columns:repeat(6,minmax(0,1fr));
    gap:.45rem;
    margin-bottom:.55rem;
  }

  body.bale-chat-page .bale-thread-summary>div{
    padding:.48rem .58rem;
    border-radius:10px;
  }

  body.bale-chat-page .bale-thread-summary span{
    font-size:.67rem;
  }

  body.bale-chat-page .bale-thread-summary strong{
    margin-top:.18rem;
    font-size:.78rem;
  }

  body.bale-chat-page .bale-thread-admin{
    flex:0 0 auto;
    margin-bottom:.55rem;
    padding:.52rem .7rem;
  }

  body.bale-chat-page .bale-detail-grid{
    flex:1 1 auto;
    min-height:0;
    height:auto;
    align-items:stretch;
    overflow:hidden;
  }

  body.bale-chat-page .bale-conversation-panel{
    height:100%;
    min-height:0;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    padding:14px;
  }

  body.bale-chat-page .bale-conversation-panel>.panel-header,
  body.bale-chat-page .bale-conversation-participants{
    flex:0 0 auto;
  }

  body.bale-chat-page .bale-conversation-panel>.panel-header{
    margin-bottom:.55rem;
  }

  body.bale-chat-page .bale-conversation-participants{
    margin-bottom:.5rem;
  }

  body.bale-chat-page .bale-conversation-shell{
    flex:1 1 auto;
    min-height:0;
    display:flex;
    flex-direction:column;
    overflow:hidden;
  }

  body.bale-chat-page .bale-conversation-viewport{
    flex:1 1 auto;
    min-height:0;
    max-height:none;
    height:auto;
    overflow-y:auto;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
  }

  body.bale-chat-page .bale-live-state{
    flex:0 0 auto;
  }

  body.bale-chat-page .bale-crm-tools,
  body.bale-chat-page .bale-composer,
  body.bale-chat-page .bale-composer-disabled,
  body.bale-chat-page .bale-conversation-panel>.pager{
    flex:0 0 auto;
  }

  body.bale-chat-page .bale-crm-tools{
    margin-top:.5rem;
  }

  body.bale-chat-page .bale-bot-control{
    padding:.52rem .65rem;
  }

  body.bale-chat-page .bale-composer{
    margin-top:.5rem;
    padding:.6rem;
    gap:.5rem;
  }

  body.bale-chat-page .bale-composer-identity{
    margin-bottom:5px!important;
    padding:6px 9px!important;
  }

  body.bale-chat-page .bale-composer-help{
    line-height:1.35;
  }

  body.bale-chat-page .bale-detail-grid>.side-column{
    height:100%;
    min-height:0;
    overflow-y:auto;
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
    padding-left:.2rem;
  }

  body.bale-chat-page .bale-detail-grid>.side-column>.panel{
    padding:14px;
  }

  body.bale-chat-page .bale-label-dialog{
    max-height:calc(100dvh - 40px);
  }

  body.bale-chat-page .bale-label-dialog-card{
    max-height:calc(100dvh - 40px);
    overflow:auto;
  }
}
/* PASS4D22_4_7_SINGLE_SCROLL_CHAT_END */

/* PASS4D22_4_8_CHAT_FOCUS_BEGIN
   Focus mode turns the conversation panel into a full-browser-workspace messenger.
   The regular management view remains available when focus mode is off. */
body.bale-chat-page.bale-chat-focus-mode{
  overflow:hidden!important;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus{
  position:fixed!important;
  inset:8px!important;
  z-index:12000!important;
  width:auto!important;
  height:auto!important;
  max-width:none!important;
  min-height:0!important;
  margin:0!important;
  padding:12px 14px!important;
  display:flex!important;
  flex-direction:column!important;
  overflow:hidden!important;
  border:1px solid #cfe3e0!important;
  border-radius:18px!important;
  background:#fff!important;
  box-shadow:0 24px 80px rgba(15,23,42,.28)!important;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus>.panel-header{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
  margin-bottom:.45rem;
  padding:.1rem .15rem .5rem;
  border-bottom:1px solid #edf2f4;
}

body.bale-chat-page .bale-chat-focus-toggle{
  flex:0 0 auto;
  min-height:36px;
  padding:.45rem .75rem;
  cursor:pointer;
  white-space:nowrap;
}

body.bale-chat-page .bale-chat-focus-title{
  cursor:pointer;
}

body.bale-chat-page .bale-chat-focus-title:hover{
  color:var(--primary);
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-conversation-participants{
  flex:0 0 auto;
  margin:0 0 .4rem;
  padding:.45rem .6rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-conversation-shell{
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-conversation-viewport{
  flex:1 1 auto;
  min-height:0;
  height:auto!important;
  max-height:none!important;
  overflow-y:auto!important;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  padding:.35rem .45rem .75rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-crm-tools{
  flex:0 0 auto;
  margin-top:.35rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-bot-control{
  padding:.42rem .6rem;
  gap:.5rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-bot-control small{
  display:none;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer{
  flex:0 0 auto;
  margin-top:.35rem;
  padding:.5rem .6rem;
  gap:.42rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer-identity{
  margin-bottom:3px!important;
  padding:5px 8px!important;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer-identity small{
  display:none;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer textarea{
  max-height:120px;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer-help{
  display:none;
}

@media(max-width:900px){
  body.bale-chat-page .bale-chat-focus-toggle{display:none!important}
  body.bale-chat-page .bale-chat-focus-title{cursor:default}
}
/* PASS4D22_4_8_CHAT_FOCUS_END */

/* PASS4D22_4_9_CHAT_DENSITY_AND_COMPOSER_RESIZE_BEGIN */

body.bale-chat-page .pass4d17-native-enable{
  padding:.42rem .65rem;
  border-radius:999px;
  font-size:.72rem;
  line-height:1.2;
}
body.bale-chat-page.bale-chat-focus-mode .pass4d17-native-enable{
  display:none!important;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus{
  inset:4px!important;
  padding:7px 10px!important;
  border-radius:14px!important;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus>.panel-header{
  min-height:34px;
  margin-bottom:.2rem;
  padding:0 .1rem .25rem;
  gap:.45rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus>.panel-header h2{
  margin:0;
  font-size:1.05rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-chat-focus-toggle{
  min-height:30px;
  padding:.3rem .58rem;
  font-size:.78rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-conversation-participants{
  min-height:34px;
  margin:0 0 .2rem;
  padding:.25rem .45rem;
  gap:.35rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-conversation-viewport{
  padding:.2rem .35rem .45rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-live-state{
  margin-top:.15rem;
  line-height:1.2;
  font-size:.62rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-crm-tools{
  margin-top:.18rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-bot-control{
  min-height:38px;
  padding:.28rem .45rem!important;
  gap:.35rem!important;
  border-radius:11px;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-bot-control strong{
  font-size:.8rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-bot-control button,
body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-bot-control select{
  min-height:30px!important;
  height:30px;
  padding:.18rem .5rem!important;
  font-size:.76rem!important;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-bot-duration{
  gap:.3rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer{
  margin-top:.18rem!important;
  padding:.32rem .42rem!important;
  gap:.28rem!important;
  border-radius:11px!important;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer-identity{
  margin-bottom:1px!important;
  padding:3px 6px!important;
  min-height:32px;
  border-radius:8px!important;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer-identity label,
body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer-identity select{
  font-size:.76rem!important;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer-controls{
  gap:.35rem;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer textarea{
  min-height:58px!important;
  height:58px;
  max-height:min(48vh,460px)!important;
  resize:none!important;
  line-height:1.55;
  padding:.55rem .7rem;
}

.bale-composer-resize-wrap{
  position:relative;
  min-width:0;
  width:100%;
}

.bale-composer-resize-wrap>textarea{
  display:block;
  width:100%;
}

.bale-composer-resize-grip{
  position:absolute;
  z-index:6;
  width:18px;
  height:18px;
  touch-action:none;
  user-select:none;
  opacity:.62;
}

.bale-composer-resize-grip::after{
  content:"";
  position:absolute;
  width:8px;
  height:8px;
  border-color:#6b8f8b;
  border-style:solid;
}

.bale-composer-resize-grip.is-tl{top:-3px;left:-3px;cursor:nwse-resize}
.bale-composer-resize-grip.is-tr{top:-3px;right:-3px;cursor:nesw-resize}
.bale-composer-resize-grip.is-bl{bottom:-3px;left:-3px;cursor:nesw-resize}
.bale-composer-resize-grip.is-br{bottom:-3px;right:-3px;cursor:nwse-resize}

.bale-composer-resize-grip.is-tl::after{left:3px;top:3px;border-width:2px 0 0 2px}
.bale-composer-resize-grip.is-tr::after{right:3px;top:3px;border-width:2px 2px 0 0}
.bale-composer-resize-grip.is-bl::after{left:3px;bottom:3px;border-width:0 0 2px 2px}
.bale-composer-resize-grip.is-br::after{right:3px;bottom:3px;border-width:0 2px 2px 0}

.bale-composer-resize-grip:hover{opacity:1}

@media(max-width:900px){
  .bale-composer-resize-grip{display:none}
  .bale-composer textarea{resize:vertical}
}

/* PASS4D22_4_9_CHAT_DENSITY_AND_COMPOSER_RESIZE_END */

/* PASS4D23_1_REPLY_QUICK_MEDIA_BEGIN */

.bale-reply-message{
  border:0;
  background:transparent;
  color:var(--primary);
  padding:.08rem .2rem;
  font:inherit;
  font-size:.72rem;
  cursor:pointer;
  white-space:nowrap;
}
.bale-reply-message:hover{text-decoration:underline}

.bale-reply-composer-preview{
  display:flex;
  align-items:center;
  gap:.55rem;
  margin:0 0 .35rem;
  padding:.45rem .6rem;
  border:1px solid #cfe3df;
  border-right:4px solid var(--primary);
  border-radius:10px;
  background:#f4fbf9;
}
.bale-reply-composer-preview>span{
  flex:0 0 auto;
  font-size:1rem;
  color:var(--primary);
}
.bale-reply-composer-preview>div{
  min-width:0;
  flex:1 1 auto;
}
.bale-reply-composer-preview strong,
.bale-reply-composer-preview small{
  display:block;
}
.bale-reply-composer-preview small{
  margin-top:.1rem;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--muted);
}
.bale-reply-composer-preview button{
  border:0;
  background:transparent;
  color:#64748b;
  font-size:1.25rem;
  cursor:pointer;
}

.bale-quick-media-button{
  flex:0 0 auto;
  min-height:38px;
  padding:.4rem .6rem;
  border:1px solid #bddbd6;
  border-radius:10px;
  background:#ecf8f5;
  color:#0f766e;
  font-weight:800;
  cursor:pointer;
  white-space:nowrap;
}

.bale-quick-media-dialog{
  width:min(760px,calc(100vw - 24px));
  max-width:760px;
  padding:0;
  border:0;
  border-radius:16px;
  background:transparent;
}
.bale-quick-media-dialog::backdrop{background:rgba(15,23,42,.52)}
.bale-quick-media-card{
  max-height:min(82vh,760px);
  overflow:auto;
  padding:1rem;
  border-radius:16px;
  background:#fff;
  box-shadow:0 24px 70px rgba(15,23,42,.28);
}
.bale-quick-media-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
  padding-bottom:.7rem;
  border-bottom:1px solid #e8efee;
}
.bale-quick-media-header h3{margin:.08rem 0 0}
.bale-quick-media-upload{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:.5rem;
  align-items:center;
  margin:.8rem 0;
  padding:.7rem;
  border:1px dashed #bddbd6;
  border-radius:12px;
  background:#f8fcfb;
}
.bale-quick-media-upload small{grid-column:1/-1;color:var(--muted)}
.bale-quick-media-feedback{
  margin:.5rem 0;
  padding:.55rem .65rem;
  border-radius:10px;
  background:#ecfdf5;
  color:#166534;
}
.bale-quick-media-feedback.is-error{
  background:#fef2f2;
  color:#991b1b;
}
.bale-quick-media-list{
  display:grid;
  gap:.45rem;
}
.bale-quick-media-row{
  display:flex;
  align-items:center;
  gap:.6rem;
  padding:.55rem .6rem;
  border:1px solid #e1ebe9;
  border-radius:11px;
  background:#fff;
}
.bale-quick-media-info{
  display:flex;
  align-items:center;
  gap:.55rem;
  min-width:0;
  flex:1 1 auto;
}
.bale-quick-media-icon{
  display:grid;
  place-items:center;
  flex:0 0 38px;
  width:38px;
  height:38px;
  border-radius:10px;
  background:#e9f6f3;
  color:#0f766e;
  font-size:.78rem;
  font-weight:900;
}
.bale-quick-media-copy{min-width:0}
.bale-quick-media-copy strong,
.bale-quick-media-copy small{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.bale-quick-media-copy small{margin-top:.12rem;color:var(--muted)}
.bale-quick-media-empty{
  padding:1rem;
  text-align:center;
  color:var(--muted);
  border:1px dashed #d7e4e2;
  border-radius:11px;
}

body.bale-chat-page.bale-chat-focus-mode .bale-reply-composer-preview{
  margin-bottom:.18rem;
  padding:.32rem .5rem;
}

@media(max-width:700px){
  .bale-quick-media-upload{grid-template-columns:1fr}
  .bale-quick-media-upload small{grid-column:auto}
  .bale-quick-media-row{align-items:flex-start}
}

/* PASS4D23_1_REPLY_QUICK_MEDIA_END */

/* PASS4D23_1_1_REPLY_RENDER_QUICK_MEDIA_FIX_BEGIN */

.bale-composer-controls{
  grid-template-columns:42px 42px 42px minmax(0,1fr) auto!important;
  gap:.45rem!important;
  align-items:end!important;
}

.bale-quick-media-button,
.bale-quick-add-button,
.bale-attach-button{
  width:42px!important;
  min-width:42px!important;
  height:42px!important;
  min-height:42px!important;
  padding:0!important;
  display:grid!important;
  place-items:center!important;
  border-radius:11px!important;
  line-height:1!important;
}

.bale-quick-media-button{
  font-size:1.1rem!important;
  white-space:nowrap;
}

.bale-message-reply-reference{
  display:flex;
  align-items:flex-start;
  gap:.45rem;
  margin:.15rem 0 .45rem;
  padding:.42rem .55rem;
  border-inline-start:3px solid #0f766e;
  border-radius:8px;
  background:rgba(15,118,110,.07);
  color:#334155;
  cursor:pointer;
  overflow:hidden;
}

.bale-message-reply-reference>span{
  flex:0 0 auto;
  color:#0f766e;
  font-weight:900;
}

.bale-message-reply-reference>div{
  min-width:0;
  display:grid;
  gap:.08rem;
}

.bale-message-reply-reference strong,
.bale-message-reply-reference small{
  display:block;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.bale-message-reply-reference strong{
  color:#0f766e;
  font-size:.72rem;
}

.bale-message-reply-reference small{
  color:#64748b;
  font-size:.72rem;
}

.bale-reply-target-flash .bale-message-bubble{
  animation:baleReplyTargetFlash 1.6s ease;
}

@keyframes baleReplyTargetFlash{
  0%,100%{box-shadow:inherit}
  20%,70%{box-shadow:0 0 0 4px rgba(15,118,110,.18)}
}

.bale-quick-media-upload input[type="file"]{
  direction:rtl;
  width:100%;
  min-width:0;
  max-width:100%;
  padding:.4rem;
  border:1px solid #d8e2e8;
  border-radius:9px;
  background:#fff;
  font:inherit;
}

body.bale-chat-page.bale-chat-focus-mode .bale-conversation-panel.is-chat-focus .bale-composer-controls{
  grid-template-columns:42px 42px 42px minmax(0,1fr) auto!important;
}

@media(max-width:900px){
  .bale-composer-controls{
    grid-template-columns:42px 42px 42px minmax(0,1fr)!important;
  }
  .bale-send-button{
    grid-column:1/-1;
  }
}

/* PASS4D23_1_1_REPLY_RENDER_QUICK_MEDIA_FIX_END */

/* PASS4D23_1_6_REPLY_INBOUND_QUICK_MEDIA_MANAGE_BEGIN */
.bale-quick-media-upload{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  gap:.55rem!important;
  align-items:center!important;
}

.bale-quick-media-upload [data-bale-quick-media-title]{
  grid-column:1/-1;
  width:100%;
  min-width:0;
  padding:.62rem .75rem;
  border:1px solid #d8e2e8;
  border-radius:10px;
  background:#fff;
  font:inherit;
  direction:rtl;
}

.bale-quick-media-upload small{
  grid-column:1/-1;
}

.bale-quick-media-row{
  gap:.7rem!important;
}

.bale-quick-media-actions{
  display:flex;
  flex:0 0 auto;
  gap:.35rem;
  align-items:center;
}

.bale-quick-media-actions button{
  min-height:38px;
  padding:.42rem .7rem;
  white-space:nowrap;
}

.bale-quick-media-delete{
  color:#b42318!important;
  border-color:#f2b8b5!important;
  background:#fff7f6!important;
}

.bale-quick-media-copy strong{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.bale-quick-media-copy small{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  direction:auto;
}

@media(max-width:760px){
  .bale-quick-media-upload{
    grid-template-columns:1fr!important;
  }
  .bale-quick-media-actions{
    width:100%;
    justify-content:flex-start;
    flex-wrap:wrap;
  }
}
/* PASS4D23_1_6_REPLY_INBOUND_QUICK_MEDIA_MANAGE_END */

/* PASS4D23_1_8_COPY_BIDI_BEGIN */
.bale-copy-select-wrap{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-inline:.1rem;
}
.bale-copy-select-wrap input{
  width:15px;
  height:15px;
  margin:0;
  accent-color:#0f766e;
  cursor:pointer;
}
.bale-copy-message,
.bale-copy-selected{
  min-height:27px;
  padding:.18rem .5rem;
  border:1px solid #cbd5e1;
  border-radius:8px;
  background:#fff;
  color:#0f766e;
  font:inherit;
  cursor:pointer;
  white-space:nowrap;
}
.bale-copy-message:hover,
.bale-copy-selected:hover{
  background:#f0fdfa;
  border-color:#5eead4;
}
.bale-copy-selected{
  margin:.25rem .4rem;
}
.bale-copy-token{
  direction:ltr!important;
  unicode-bidi:isolate!important;
  display:inline;
  cursor:pointer;
  border-radius:4px;
  padding:0 .08rem;
}
.bale-copy-token:hover{
  background:rgba(15,118,110,.10);
  outline:1px dashed rgba(15,118,110,.35);
}
.bale-copy-url{
  overflow-wrap:anywhere;
  word-break:break-word;
  text-decoration:underline;
  text-underline-offset:2px;
}
.bale-copy-amount{
  display:inline-block;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
[data-bale-message-body]{
  unicode-bidi:plaintext;
}
/* PASS4D23_1_8_COPY_BIDI_END */

/* PASS4D23_1_9_COPY_BIDI_BULK_BEGIN */
.bale-copy-token{
  direction:ltr!important;
  unicode-bidi:isolate-override!important;
  cursor:pointer!important;
  border-radius:4px;
  padding:0 .08rem;
}
.bale-copy-url{
  display:inline-block!important;
  direction:ltr!important;
  unicode-bidi:isolate-override!important;
  max-width:100%;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  word-break:break-all!important;
  text-align:left!important;
  text-decoration:underline;
  text-underline-offset:2px;
}
.bale-copy-amount{
  display:inline-block!important;
  direction:ltr!important;
  unicode-bidi:isolate-override!important;
  white-space:nowrap!important;
  font-variant-numeric:tabular-nums;
  text-align:left!important;
  border-bottom:1px dotted rgba(15,118,110,.45);
}
.bale-copy-token:hover,
.bale-copy-token:focus{
  background:rgba(15,118,110,.11)!important;
  outline:1px dashed rgba(15,118,110,.45)!important;
}
.bale-copy-bulk-bar{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:.5rem;
  padding:.48rem .62rem;
  margin:.35rem .35rem .15rem;
  border:1px solid #99f6e4;
  border-radius:11px;
  background:#f0fdfa;
  position:relative;
  z-index:8;
}
.bale-copy-bulk-bar[hidden]{
  display:none!important;
}
.bale-copy-bulk-bar strong{
  margin-inline-end:auto;
  color:#115e59;
  font-size:.82rem;
}
.bale-copy-bulk-bar button{
  min-height:34px;
  padding:.35rem .65rem;
}
[data-bale-message-body]{
  unicode-bidi:plaintext!important;
  white-space:pre-wrap;
}
/* PASS4D23_1_9_COPY_BIDI_BULK_END */

/* PASS4D23_1_10_PERFORMANCE_GUARD_BEGIN */
.bale-copy-bulk-bar{
  position:static!important;
  z-index:auto!important;
}
.bale-copy-url{
  display:inline!important;
  direction:ltr!important;
  unicode-bidi:isolate!important;
  white-space:normal!important;
  word-break:break-all!important;
}
.bale-copy-amount{
  display:inline-block!important;
  direction:ltr!important;
  unicode-bidi:isolate!important;
  white-space:nowrap!important;
}
/* PASS4D23_1_10_PERFORMANCE_GUARD_END */

/* PASS4D24_1_3_RESPONSIVE_BEGIN */
.bale-media-card{display:block;max-width:min(520px,100%);overflow:hidden}.bale-media-image,.bale-media-video{display:block;max-width:100%;width:auto;max-height:420px;border-radius:12px;object-fit:contain;background:#0f172a}.bale-media-video{width:100%}.bale-audio-player{width:min(440px,100%)}.bale-audio-player audio{display:block;width:100%;max-width:100%}.bale-speed-controls{display:flex;gap:.35rem;flex-wrap:wrap;margin-top:.35rem}.bale-speed-controls button{border:1px solid #cbd5e1;border-radius:999px;background:#fff;padding:.25rem .6rem;cursor:pointer}.bale-speed-controls button.active{background:#0f766e;color:#fff;border-color:#0f766e}.bale-file-preview-link{display:inline-flex;align-items:center;min-height:38px}.bale-media-name{font-size:.78rem;color:#64748b;margin-top:.35rem;overflow-wrap:anywhere}.bale-voice-button{min-width:44px;min-height:44px;border:1px solid #b7d9d2;border-radius:12px;background:#f0fdfa;cursor:pointer}.bale-voice-button.is-recording{background:#fee2e2;border-color:#ef4444;animation:baleVoicePulse 1s infinite}@keyframes baleVoicePulse{50%{opacity:.62}}
.bale-renewal-templates{direction:rtl}.renewal-stage-tabs{display:flex;gap:.5rem;overflow-x:auto;padding:.25rem 0 .75rem}.renewal-stage-tab{flex:0 0 auto;min-width:112px;border:1px solid #cbd5e1;background:#fff;border-radius:12px;padding:.55rem}.renewal-stage-tab.active{border-color:#0f766e;background:#ecfdf5;color:#0f766e}.renewal-stage-tab span{display:block;font-size:.78rem;margin-top:.2rem}.renewal-stage-panel{display:none}.renewal-stage-panel.active{display:block}.renewal-template-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(280px,.65fr);gap:1rem}.renewal-template-text{min-height:340px;resize:vertical}.renewal-template-preview{white-space:pre-wrap;direction:rtl;text-align:right;line-height:2;min-height:340px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:1rem;overflow-wrap:anywhere}
@media(max-width:991.98px){.renewal-template-grid{grid-template-columns:1fr}.renewal-template-preview{min-height:220px}.bale-media-image,.bale-media-video{max-height:52vh}}
@media(max-width:575.98px){.bale-renewal-templates{padding-left:.5rem!important;padding-right:.5rem!important}.renewal-template-text{min-height:300px;font-size:16px}.bale-media-card{max-width:100%}.bale-message-bubble{max-width:94vw!important;overflow-wrap:anywhere}.bale-speed-controls button{min-height:44px}}
@media(pointer:coarse){.renewal-stage-tab,.bale-speed-controls button,.bale-voice-button{min-height:44px}}
/* PASS4D24_1_3_RESPONSIVE_END */

/* PASS4D24_1_3_5_MEDIA_VOICE_LAYOUT_BEGIN */

/* Four action icons + wide message box + send button.
   Previous grid still expected only three action icons, so adding voice wrapped the composer. */
.bale-composer-controls{
  grid-template-columns:42px 42px 42px 42px minmax(240px,1fr) auto!important;
  align-items:end!important;
  gap:.45rem!important;
}
.bale-voice-button{
  width:42px!important;
  min-width:42px!important;
  height:42px!important;
  min-height:42px!important;
  padding:0!important;
  display:grid!important;
  place-items:center!important;
  border-radius:11px!important;
  line-height:1!important;
  font-size:1.05rem!important;
}
.bale-composer-controls textarea{
  min-height:42px!important;
  width:100%!important;
}

.bale-voice-preview{
  display:grid;
  gap:.55rem;
  width:100%;
  padding:.7rem;
  border:1px solid #b7d9d2;
  border-radius:12px;
  background:#f0fdfa;
}
.bale-voice-preview[hidden]{display:none!important}
.bale-voice-preview-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.7rem;
}
.bale-voice-preview-head>div{min-width:0}
.bale-voice-preview-head strong,
.bale-voice-preview-head small{display:block}
.bale-voice-preview-head small{margin-top:.15rem;color:#64748b;font-size:.72rem}
.bale-voice-timer{
  flex:0 0 auto;
  min-width:54px;
  padding:.3rem .45rem;
  border-radius:999px;
  background:#fff;
  color:#0f766e;
  text-align:center;
  font-weight:800;
}
.bale-voice-preview audio{
  width:100%;
  max-width:100%;
}
.bale-voice-preview-actions{
  display:flex;
  flex-wrap:wrap;
  gap:.5rem;
  justify-content:flex-start;
}
.bale-voice-preview-actions button{min-height:42px}

.bale-pdf-preview{
  display:grid;
  gap:.45rem;
  width:min(520px,100%);
}
.bale-pdf-preview iframe{
  display:block;
  width:100%;
  height:360px;
  border:1px solid #d8e2e8;
  border-radius:10px;
  background:#fff;
}

@media(max-width:900px){
  .bale-composer-controls{
    grid-template-columns:42px 42px 42px 42px minmax(0,1fr)!important;
  }
  .bale-composer-controls textarea{
    grid-column:1/-1!important;
    grid-row:auto!important;
    min-height:64px!important;
  }
  .bale-composer-controls .bale-send-button{
    grid-column:1/-1!important;
    width:100%!important;
  }
  .bale-pdf-preview iframe{height:46vh;min-height:260px}
}

@media(max-width:575.98px){
  .bale-composer{padding:.55rem!important;gap:.5rem!important}
  .bale-composer-controls{
    grid-template-columns:repeat(4,44px) minmax(0,1fr)!important;
    gap:.4rem!important;
  }
  .bale-quick-add-button,
  .bale-quick-media-button,
  .bale-voice-button,
  .bale-attach-button{
    width:44px!important;
    min-width:44px!important;
    height:44px!important;
    min-height:44px!important;
  }
  .bale-voice-preview-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
  }
  .bale-pdf-preview iframe{height:42vh;min-height:230px}
}

/* PASS4D24_1_3_5_MEDIA_VOICE_LAYOUT_END */
/* PASS5B2_FIX1_CHAT_MEDIA_FINAL_BEGIN */
/* Keep the long Bale conversation stable: the message viewport owns scrolling;
   composer/bot controls must never force the chat panel wider than its column. */
body.bale-chat-page .bale-conversation-panel,
body.bale-chat-page .bale-conversation-shell,
body.bale-chat-page .bale-conversation-viewport,
body.bale-chat-page .bale-composer,
body.bale-chat-page .bale-composer-controls{
  min-width:0!important;
}
body.bale-chat-page .bale-composer-controls{
  width:100%!important;
  grid-template-columns:42px 42px 42px 42px minmax(0,1fr) minmax(72px,auto)!important;
  gap:.4rem!important;
  align-items:end!important;
}
body.bale-chat-page .bale-composer-controls textarea{
  min-width:0!important;
  width:100%!important;
}
body.bale-chat-page .bale-send-button{
  min-width:72px;
  white-space:nowrap;
}
body.bale-chat-page .bale-bot-control{
  min-width:0;
  flex-wrap:wrap;
}
body.bale-chat-page .bale-bot-control>div{
  min-width:180px;
}
body.bale-chat-page .bale-bot-duration{
  min-width:0;
  max-width:100%;
  display:flex;
  align-items:center;
  gap:.35rem;
  flex-wrap:wrap;
}
body.bale-chat-page .bale-bot-duration select{
  min-width:0;
  max-width:100%;
}
@media (min-width:901px){
  body.bale-chat-page .bale-detail-grid,
  body.bale-chat-page .bale-conversation-panel,
  body.bale-chat-page .bale-conversation-shell{
    min-height:0!important;
  }
  body.bale-chat-page .bale-conversation-viewport{
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
  }
}
@media (max-width:1180px) and (min-width:901px){
  body.bale-chat-page .bale-composer-controls{
    grid-template-columns:38px 38px 38px 38px minmax(0,1fr) minmax(68px,auto)!important;
  }
  body.bale-chat-page .bale-quick-add-button,
  body.bale-chat-page .bale-quick-media-button,
  body.bale-chat-page .bale-voice-button,
  body.bale-chat-page .bale-attach-button{
    width:38px!important;min-width:38px!important;height:40px!important;min-height:40px!important;
  }
}
@media (max-width:900px){
  body.bale-chat-page .bale-composer-controls{
    grid-template-columns:repeat(4,42px) minmax(0,1fr)!important;
  }
  body.bale-chat-page .bale-composer-controls textarea{
    grid-column:1/-1!important;
  }
  body.bale-chat-page .bale-composer-controls .bale-send-button{
    grid-column:1/-1!important;
    width:100%!important;
  }
}

/* Unified media preview: image/PDF gallery, zoom, rotate, download, arrows and Esc. */
.pass5b2-media-viewer{
  width:min(96vw,1280px);
  height:min(94vh,940px);
  max-width:none;
  max-height:none;
  padding:0;
  border:0;
  border-radius:16px;
  background:#0f172a;
  color:#fff;
  box-shadow:0 28px 90px rgba(0,0,0,.45);
  overflow:hidden;
}
.pass5b2-media-viewer::backdrop{background:rgba(2,6,23,.82);backdrop-filter:blur(2px)}
.pass5b2-media-card{height:100%;display:grid;grid-template-rows:auto minmax(0,1fr);min-height:0}
.pass5b2-media-head{
  display:flex;align-items:center;gap:.5rem;min-width:0;padding:.55rem .65rem;
  background:#fff;color:#0f172a;border-bottom:1px solid #dbe4ea;direction:rtl
}
.pass5b2-media-title{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:800}
.pass5b2-media-counter{flex:0 0 auto;color:#64748b;font-size:.75rem;direction:ltr}
.pass5b2-media-actions{display:flex;align-items:center;gap:.35rem;flex-wrap:wrap}
.pass5b2-media-actions button,.pass5b2-media-actions a{
  display:grid;place-items:center;min-width:36px;height:36px;padding:0 .55rem;
  border:1px solid #dbe4ea;border-radius:9px;background:#f8fafc;color:#0f172a;
  text-decoration:none;cursor:pointer;font:inherit;font-size:.82rem;font-weight:800
}
.pass5b2-media-actions button:hover,.pass5b2-media-actions a:hover{background:#eef2f7}
.pass5b2-media-actions button:disabled{opacity:.4;cursor:not-allowed}
.pass5b2-media-body{
  min-height:0;overflow:auto;display:grid;place-items:center;position:relative;background:#111827
}
.pass5b2-media-image{
  display:block;max-width:100%;max-height:100%;object-fit:contain;transform-origin:center center;
  transition:transform .12s ease;user-select:none;-webkit-user-drag:none
}
.pass5b2-media-pdf{display:block;width:100%;height:100%;min-height:70vh;border:0;background:#fff}
@media(max-width:700px){
  .pass5b2-media-viewer{width:100vw;height:100vh;border-radius:0}
  .pass5b2-media-head{align-items:flex-start;flex-wrap:wrap}
  .pass5b2-media-title{flex-basis:100%}
  .pass5b2-media-actions{width:100%}
}
/* PASS5B2_FIX1_CHAT_MEDIA_FINAL_END */
/* PASS5B2_FIX2_COMPOSER_FLEX_BEGIN */
/* Final composer layout: robust flex row on desktop, predictable stacked layout on narrow widths.
   This intentionally overrides the accumulated grid rules from older passes. */
body.bale-chat-page .bale-composer-controls{
  display:flex!important;
  flex-direction:row!important;
  flex-wrap:nowrap!important;
  align-items:flex-end!important;
  gap:.45rem!important;
  width:100%!important;
  min-width:0!important;
  direction:rtl!important;
}

body.bale-chat-page .bale-composer-controls .bale-quick-add-button,
body.bale-chat-page .bale-composer-controls .bale-quick-media-button,
body.bale-chat-page .bale-composer-controls .bale-voice-button,
body.bale-chat-page .bale-composer-controls .bale-attach-button{
  flex:0 0 42px!important;
  width:42px!important;
  min-width:42px!important;
  height:42px!important;
  min-height:42px!important;
  margin:0!important;
}

body.bale-chat-page .bale-composer-controls textarea{
  flex:1 1 auto!important;
  width:auto!important;
  min-width:160px!important;
  max-width:none!important;
  margin:0!important;
  align-self:stretch!important;
  direction:rtl!important;
  text-align:right!important;
}

body.bale-chat-page .bale-composer-controls .bale-send-button{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:76px!important;
  height:42px!important;
  min-height:42px!important;
  margin:0!important;
  grid-column:auto!important;
  align-self:flex-end!important;
  white-space:nowrap!important;
}

body.bale-chat-page .bale-composer{
  width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
}

body.bale-chat-page .bale-composer-identity{
  width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
}
body.bale-chat-page .bale-composer-identity select{
  min-width:0!important;
  max-width:100%!important;
}

/* Focus mode keeps the same stable composer row. */
body.bale-chat-page.bale-chat-focus-mode
.bale-conversation-panel.is-chat-focus
.bale-composer-controls{
  display:flex!important;
  flex-direction:row!important;
  flex-wrap:nowrap!important;
  gap:.4rem!important;
}

/* Tablet/mobile: tools row first, message box full width, send full width. */
@media(max-width:900px){
  body.bale-chat-page .bale-composer-controls{
    display:grid!important;
    grid-template-columns:repeat(4,42px) minmax(0,1fr)!important;
    gap:.45rem!important;
    align-items:end!important;
    direction:rtl!important;
  }
  body.bale-chat-page .bale-composer-controls .bale-quick-add-button,
  body.bale-chat-page .bale-composer-controls .bale-quick-media-button,
  body.bale-chat-page .bale-composer-controls .bale-voice-button,
  body.bale-chat-page .bale-composer-controls .bale-attach-button{
    width:42px!important;
    min-width:42px!important;
    height:42px!important;
    min-height:42px!important;
  }
  body.bale-chat-page .bale-composer-controls textarea{
    grid-column:1/-1!important;
    width:100%!important;
    min-width:0!important;
    min-height:64px!important;
  }
  body.bale-chat-page .bale-composer-controls .bale-send-button{
    grid-column:1/-1!important;
    width:100%!important;
    min-width:0!important;
  }
}
/* PASS5B2_FIX2_COMPOSER_FLEX_END */
/* PASS5B2_FIX3_COMPOSER_RESIZE_BEGIN */
/*
  Root cause of FIX2 regression:
  the textarea is wrapped by .bale-composer-resize-wrap.
  FIX2 made the textarea flexible, but the actual flex item is the wrapper.
  This final override makes the WRAPPER the flexible full-width item and restores
  the four-corner resize grips in both normal and focus chat.
*/

body.bale-chat-page .bale-composer-controls{
  display:flex!important;
  flex-direction:row!important;
  flex-wrap:nowrap!important;
  align-items:flex-end!important;
  gap:.45rem!important;
  width:100%!important;
  min-width:0!important;
  direction:rtl!important;
}

body.bale-chat-page .bale-composer-controls .bale-quick-add-button,
body.bale-chat-page .bale-composer-controls .bale-quick-media-button,
body.bale-chat-page .bale-composer-controls .bale-voice-button,
body.bale-chat-page .bale-composer-controls .bale-attach-button{
  flex:0 0 42px!important;
  width:42px!important;
  min-width:42px!important;
  height:42px!important;
  min-height:42px!important;
  margin:0!important;
}

/* IMPORTANT: the wrapper, not the textarea, is the flex child. */
body.bale-chat-page .bale-composer-controls .bale-composer-resize-wrap{
  position:relative!important;
  flex:1 1 auto!important;
  width:auto!important;
  min-width:220px!important;
  max-width:none!important;
  margin:0!important;
  align-self:stretch!important;
}

body.bale-chat-page .bale-composer-controls .bale-composer-resize-wrap > textarea{
  display:block!important;
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  min-height:58px!important;
  height:58px;
  max-height:min(48vh,460px)!important;
  box-sizing:border-box!important;
  resize:none!important;
  direction:rtl!important;
  text-align:right!important;
}

/* Four visible corner grips in both compact and focus desktop chat. */
body.bale-chat-page .bale-composer-resize-grip{
  display:block!important;
  position:absolute!important;
  z-index:20!important;
  width:20px!important;
  height:20px!important;
  touch-action:none!important;
  user-select:none!important;
  opacity:.78!important;
}
body.bale-chat-page .bale-composer-resize-grip:hover{opacity:1!important}
body.bale-chat-page .bale-composer-resize-grip.is-tl{top:-4px!important;left:-4px!important;cursor:nwse-resize!important}
body.bale-chat-page .bale-composer-resize-grip.is-tr{top:-4px!important;right:-4px!important;cursor:nesw-resize!important}
body.bale-chat-page .bale-composer-resize-grip.is-bl{bottom:-4px!important;left:-4px!important;cursor:nesw-resize!important}
body.bale-chat-page .bale-composer-resize-grip.is-br{bottom:-4px!important;right:-4px!important;cursor:nwse-resize!important}

body.bale-chat-page .bale-composer-controls .bale-send-button{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:76px!important;
  height:42px!important;
  min-height:42px!important;
  margin:0!important;
  align-self:flex-end!important;
  white-space:nowrap!important;
}

/* Same geometry in full-screen focus mode. */
body.bale-chat-page.bale-chat-focus-mode
.bale-conversation-panel.is-chat-focus
.bale-composer-controls{
  display:flex!important;
  flex-direction:row!important;
  flex-wrap:nowrap!important;
  align-items:flex-end!important;
  gap:.4rem!important;
}
body.bale-chat-page.bale-chat-focus-mode
.bale-conversation-panel.is-chat-focus
.bale-composer-controls .bale-composer-resize-wrap{
  flex:1 1 auto!important;
  width:auto!important;
  min-width:220px!important;
  max-width:none!important;
}

/* If JS has not wrapped the textarea yet, keep the raw textarea stretched too. */
body.bale-chat-page .bale-composer-controls > textarea{
  flex:1 1 auto!important;
  width:auto!important;
  min-width:220px!important;
  max-width:none!important;
}

/* Narrow/mobile screens: do not allow horizontal overflow; native vertical resize is enough. */
@media(max-width:900px){
  body.bale-chat-page .bale-composer-controls{
    display:grid!important;
    grid-template-columns:repeat(4,42px) minmax(0,1fr)!important;
    gap:.45rem!important;
    align-items:end!important;
  }

  body.bale-chat-page .bale-composer-controls .bale-composer-resize-wrap{
    grid-column:1/-1!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
  }

  body.bale-chat-page .bale-composer-controls .bale-composer-resize-wrap > textarea,
  body.bale-chat-page .bale-composer-controls > textarea{
    width:100%!important;
    min-width:0!important;
    min-height:64px!important;
    resize:vertical!important;
  }

  body.bale-chat-page .bale-composer-resize-grip{
    display:none!important;
  }

  body.bale-chat-page .bale-composer-controls .bale-send-button{
    grid-column:1/-1!important;
    width:100%!important;
    min-width:0!important;
  }
}
/* PASS5B2_FIX3_COMPOSER_RESIZE_END */

/* BALE_INBOX_PHASE1: layouts and continuous browsing */
.bale-phase1-toolbar{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin:.65rem 0}
.bale-phase1-toolbar button,.bale-phase1-toolbar select{padding:.45rem .7rem;border:1px solid #cbd5e1;border-radius:9px;background:#fff;color:#164e43;cursor:pointer}
.bale-phase1-toolbar button.is-active{background:#116b55;color:#fff}
.bale-phase1-toolbar small{color:#64748b}
.bale-thread-card.bale-category-hidden{display:none!important}
.bale-load-more{text-align:center;padding:1rem;color:#64748b}
.bale-thread-actions select{max-width:160px;font-size:.75rem;border:1px solid #ddd;border-radius:7px}
.bale-thread-list[data-layout="compact"] .bale-thread-card{padding:.55rem .7rem;grid-template-columns:32px minmax(0,1fr) minmax(100px,auto) auto;gap:.45rem}
.bale-thread-list[data-layout="compact"] .bale-thread-avatar{width:30px;height:30px}
.bale-thread-list[data-layout="compact"] .bale-thread-main>small{display:none}
.bale-thread-list[data-layout="line"] .bale-thread-card{padding:.32rem .55rem;border-radius:7px;grid-template-columns:minmax(0,2fr) minmax(0,1fr) auto;gap:.35rem}
.bale-thread-list[data-layout="line"] .bale-thread-avatar,.bale-thread-list[data-layout="line"] .bale-thread-main>small,.bale-thread-list[data-layout="line"] .bale-thread-main>p{display:none}
.bale-thread-list[data-layout="line"] .bale-thread-title{flex-wrap:nowrap}
.bale-thread-list[data-layout="grid"]{grid-template-columns:repeat(auto-fill,minmax(235px,1fr));gap:.55rem}
.bale-thread-list[data-layout="grid"] .bale-thread-card{display:flex;flex-direction:column;align-items:stretch;gap:.3rem;padding:.7rem;min-width:0}
.bale-thread-list[data-layout="grid"] .bale-thread-avatar{display:none}
.bale-thread-list[data-layout="grid"] .bale-thread-meta,.bale-thread-list[data-layout="grid"] .bale-thread-actions{display:flex;flex-wrap:wrap;gap:.35rem;align-items:center;justify-content:space-between}
.bale-thread-list[data-layout="grid"] .bale-thread-main>small{display:none}
@media(max-width:650px){.bale-thread-list[data-layout="compact"] .bale-thread-card,.bale-thread-list[data-layout="line"] .bale-thread-card{grid-template-columns:1fr}.bale-thread-list[data-layout="grid"]{grid-template-columns:repeat(auto-fill,minmax(165px,1fr))}}

/* BALE_INBOX_PHASE1_LAYOUT_V2_BEGIN: full mode uses legacy CRM cards untouched. */
.bale-thread-list[data-layout="compact"]{display:grid;grid-template-columns:1fr;gap:.38rem}
.bale-thread-list[data-layout="compact"] .bale-thread-card{display:grid;grid-template-columns:32px minmax(0,1fr) auto;grid-template-rows:auto auto;gap:.14rem .55rem;align-items:center;padding:.5rem .65rem;min-height:66px}
.bale-thread-list[data-layout="compact"] .bale-thread-avatar{grid-column:1;grid-row:1/3}
.bale-thread-list[data-layout="compact"] .bale-thread-main{grid-column:2;grid-row:1/3;min-width:0}
.bale-thread-list[data-layout="compact"] .bale-thread-title{display:flex;align-items:center;gap:.4rem;flex-wrap:nowrap;min-width:0}
.bale-thread-list[data-layout="compact"] .bale-thread-title h3{font-size:.92rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bale-thread-list[data-layout="compact"] .bale-thread-main p{font-size:.78rem;line-height:1.35;margin:.15rem 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bale-thread-list[data-layout="compact"] .bale-thread-meta{grid-column:3;grid-row:1;text-align:left;display:flex;gap:.4rem;align-items:center;font-size:.74rem}
.bale-thread-list[data-layout="compact"] .bale-thread-meta .ltr-value{display:none}
.bale-thread-list[data-layout="compact"] .bale-thread-actions{grid-column:3;grid-row:2;display:flex;align-items:center;gap:.25rem}
.bale-thread-list[data-layout="compact"] .bale-thread-actions .secondary-button{display:none}
.bale-thread-list[data-layout="compact"] .bale-thread-actions .primary-button{font-size:.74rem;padding:.25rem .5rem}
.bale-thread-list[data-layout="line"]{display:grid;grid-template-columns:1fr;gap:3px}
.bale-thread-list[data-layout="line"] .bale-thread-card{display:grid;grid-template-columns:minmax(170px,1.6fr) minmax(120px,1fr) minmax(105px,.65fr) minmax(110px,.75fr);align-items:center;gap:.5rem;min-height:39px;padding:.28rem .65rem;border-radius:5px}
.bale-thread-list[data-layout="line"] .bale-thread-main{grid-column:1;min-width:0}
.bale-thread-list[data-layout="line"] .bale-thread-title h3{font-size:.82rem;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}
.bale-thread-list[data-layout="line"] .bale-thread-title .badge,.bale-thread-list[data-layout="line"] .bale-thread-title .bale-thread-status{display:none}
.bale-thread-list[data-layout="line"] .bale-thread-main p,.bale-thread-list[data-layout="line"] .bale-thread-main small,.bale-thread-list[data-layout="line"] .bale-thread-avatar{display:none!important}
.bale-thread-list[data-layout="line"] .bale-thread-meta{grid-column:2;display:flex;justify-content:flex-start;gap:.5rem;align-items:center;overflow:hidden;white-space:nowrap;font-size:.73rem}
.bale-thread-list[data-layout="line"] .bale-thread-meta .ltr-value{display:none}
.bale-thread-list[data-layout="line"] .bale-thread-actions{grid-column:3 / 5;display:flex;flex-wrap:nowrap;align-items:center;gap:.35rem;justify-content:flex-end;min-width:0}
.bale-thread-list[data-layout="line"] .bale-thread-actions select{max-width:130px;min-width:0}
.bale-thread-list[data-layout="line"] .bale-thread-actions .secondary-button{display:none}
.bale-thread-list[data-layout="line"] .bale-thread-actions .primary-button{font-size:.72rem;padding:.22rem .42rem;white-space:nowrap}
.bale-thread-list[data-layout="grid"]{display:grid;grid-template-columns:repeat(auto-fill,minmax(175px,1fr));gap:.45rem}
.bale-thread-list[data-layout="grid"] .bale-thread-card{display:flex;flex-direction:column;align-items:stretch;gap:.25rem;min-width:0;min-height:125px;padding:.6rem;border-radius:11px}
.bale-thread-list[data-layout="grid"] .bale-thread-title h3{font-size:.82rem;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.bale-thread-list[data-layout="grid"] .bale-thread-title .badge{font-size:.64rem}
.bale-thread-list[data-layout="grid"] .bale-thread-main p{font-size:.7rem;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:.1rem 0}
.bale-thread-list[data-layout="grid"] .bale-thread-main>small{display:none!important}
.bale-thread-list[data-layout="grid"] .bale-thread-meta{display:flex;gap:.4rem;justify-content:space-between;font-size:.7rem;white-space:nowrap}
.bale-thread-list[data-layout="grid"] .bale-thread-meta .ltr-value{display:none}
.bale-thread-list[data-layout="grid"] .bale-thread-actions{display:flex;flex-wrap:wrap;gap:.3rem;align-items:center;margin-top:auto}
.bale-thread-list[data-layout="grid"] .bale-thread-actions .secondary-button{display:none}
.bale-thread-list[data-layout="grid"] .bale-thread-actions .primary-button{padding:.25rem .35rem;font-size:.69rem}
.bale-thread-list[data-layout="grid"] .bale-thread-actions select{max-width:100%;font-size:.7rem}
@media(max-width:760px){
 .bale-thread-list[data-layout="compact"] .bale-thread-card{grid-template-columns:30px minmax(0,1fr);grid-template-rows:auto auto}
 .bale-thread-list[data-layout="compact"] .bale-thread-meta{grid-column:2;grid-row:2;justify-content:flex-start}
 .bale-thread-list[data-layout="compact"] .bale-thread-actions{grid-column:2;grid-row:3}
 .bale-thread-list[data-layout="line"] .bale-thread-card{grid-template-columns:minmax(0,1fr) auto;min-height:43px}
 .bale-thread-list[data-layout="line"] .bale-thread-meta{grid-column:2}
 .bale-thread-list[data-layout="line"] .bale-thread-actions{display:none}
 .bale-thread-list[data-layout="grid"]{grid-template-columns:repeat(auto-fill,minmax(145px,1fr))}
}
/* BALE_INBOX_PHASE1_LAYOUT_V2_END */
