:root {
    --gold-dark: #8a641d;
    --gold: #bd8d28;
    --gold-shine: #edc94f;
    --gold-soft: #fff3c7;
    --ink: #14161a;
    --muted: #6f7480;
    --bg: #f4f6f8;
    --panel: #ffffff;
    --sidebar: #111827;
    --sidebar-2: #1f2937;
    --line: #e3e7ee;
    --line-strong: #cbd3df;
    --green: #0e8f6e;
    --blue: #2364aa;
    --purple: #7457c7;
    --orange: #c46a20;
    --danger: #bd3b2e;
    --shadow: 0 22px 54px rgba(17, 24, 39, .1);
    --soft-shadow: 0 10px 28px rgba(17, 24, 39, .07);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.45;
    perspective: 1600px;
}

body.chat-page {
    height: 100vh;
    overflow: hidden;
}

a { color: inherit; text-decoration: none; }

.app {
    display: grid;
    grid-template-columns: 304px minmax(0, 1fr);
    min-height: 100vh;
}

.chat-page .app {
    height: 100vh;
    min-height: 0;
}

.sidebar {
    position: sticky;
    top: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(237,201,79,.11), rgba(255,255,255,0) 260px),
        linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
    color: #f8f2df;
    padding: 28px 20px;
    border-right: 1px solid rgba(255,255,255,.08);
    box-shadow: 18px 0 44px rgba(17, 24, 39, .12);
}

.chat-page .sidebar {
    height: 100vh;
    min-height: 0;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 58px;
    margin-bottom: 28px;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--gold-shine), #d8a735);
    color: #17110a;
    box-shadow: 0 12px 26px rgba(237, 201, 79, .18);
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 46px;
    border-radius: 12px;
    padding: 11px 14px 11px 20px;
    color: #e9e1cb;
    font-weight: 700;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav a::before {
    content: "";
    position: absolute;
    left: 9px;
    width: 3px;
    height: 18px;
    border-radius: 3px;
    background: transparent;
}

.nav a:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    transform: translateX(2px);
}

.nav a.active {
    background: rgba(255, 255, 255, .11);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(237, 201, 79, .18), 0 14px 26px rgba(0, 0, 0, .14);
}

.nav a.active::before { background: var(--gold-shine); }

.main {
    min-width: 0;
    padding: 34px 32px 48px;
    max-width: 1680px;
}

.chat-page .main {
    height: 100vh;
    max-width: none;
    padding: 0;
    overflow: hidden;
}

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

h1, h2, h3 { margin: 0 0 12px; letter-spacing: 0; }

h1 {
    margin-bottom: 6px;
    font-size: 40px;
    line-height: 1.08;
    font-weight: 900;
}

h2 {
    font-size: 24px;
    line-height: 1.2;
    font-weight: 900;
}

.muted { color: var(--muted); }

.grid {
    display: grid;
    gap: 20px;
}

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

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

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

.dashboard-tables { margin-top: 22px; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 22px;
    box-shadow: var(--soft-shadow);
    transform-style: preserve-3d;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.card:hover {
    border-color: #c9d3e2;
    box-shadow: 0 26px 62px rgba(17, 24, 39, .14);
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
    padding: 24px 26px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background:
        linear-gradient(135deg, #ffffff 0%, #ffffff 58%, #eef4fb 100%);
    box-shadow: var(--soft-shadow);
    position: relative;
    overflow: hidden;
}

.dashboard-hero::after {
    content: "";
    position: absolute;
    right: -80px;
    top: -120px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(35,100,170,.18), rgba(35,100,170,0) 68%);
    pointer-events: none;
}

.dashboard-hero h2 {
    margin-bottom: 8px;
    font-size: 30px;
}

.dashboard-hero p {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.eyebrow {
    display: inline-flex;
    margin-bottom: 8px;
    color: var(--gold-dark);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.metric {
    position: relative;
    min-height: 152px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-top: 4px solid var(--gold);
    background:
        linear-gradient(145deg, rgba(255,255,255,.98), rgba(248,250,252,.92));
}

.metric:hover {
    transform: translateY(-7px) rotateX(4deg) rotateY(-3deg);
    box-shadow: var(--shadow);
}

.metric:hover .metric-icon {
    transform: translateZ(22px) scale(1.06);
}

.metric-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.metric-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #f8f1df;
    color: var(--gold-dark);
    font-size: 12px;
    font-weight: 900;
    transition: transform .22s ease;
}

.metric-label {
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    color: #5d6674;
}

.metric strong {
    display: block;
    margin-top: 16px;
    font-size: 36px;
    line-height: 1;
    color: var(--gold-dark);
    letter-spacing: 0;
}

.metric-hint {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.tone-green { border-top-color: var(--green); }
.tone-green .metric-icon { background: #e7f7f0; color: var(--green); }
.tone-green strong { color: var(--green); }

.tone-blue { border-top-color: var(--blue); }
.tone-blue .metric-icon { background: #e8f0fb; color: var(--blue); }
.tone-blue strong { color: var(--blue); }

.tone-red { border-top-color: var(--danger); }
.tone-red .metric-icon { background: #fdece9; color: var(--danger); }
.tone-red strong { color: var(--danger); }

.tone-orange { border-top-color: var(--orange); }
.tone-orange .metric-icon { background: #fff0e3; color: var(--orange); }
.tone-orange strong { color: var(--orange); }

.tone-purple { border-top-color: var(--purple); }
.tone-purple .metric-icon { background: #f0ecff; color: var(--purple); }
.tone-purple strong { color: var(--purple); }

.table-card {
    min-height: 280px;
    box-shadow: var(--shadow);
}

.table-card:hover {
    transform: translateY(-4px);
}

.analytics-panel {
    display: grid;
    grid-template-columns: minmax(260px, .9fr) minmax(0, 1.4fr);
    gap: 22px;
    align-items: stretch;
    margin-top: 22px;
}

.analytics-copy,
.chart-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--soft-shadow);
}

.analytics-copy {
    padding: 26px;
    background:
        linear-gradient(145deg, #111827, #243044);
    color: #fff;
    transform-style: preserve-3d;
    transition: transform .22s ease, box-shadow .22s ease;
}

.analytics-copy:hover {
    transform: translateY(-5px) rotateX(3deg);
    box-shadow: 0 28px 70px rgba(17, 24, 39, .22);
}

.analytics-copy .eyebrow { color: var(--gold-shine); }

.analytics-copy h2 {
    margin-bottom: 10px;
    font-size: 30px;
}

.analytics-copy p {
    margin: 0;
    color: #d8dee8;
    font-weight: 600;
}

.chart-card {
    min-height: 260px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    padding: 24px 26px 22px;
    align-items: end;
    transform-style: preserve-3d;
    transition: transform .22s ease, box-shadow .22s ease;
}

.chart-card:hover {
    transform: translateY(-6px) rotateX(3deg) rotateY(1deg);
    box-shadow: 0 30px 72px rgba(17, 24, 39, .14);
}

.chart-column {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
    height: 210px;
}

.chart-value {
    color: var(--ink);
    font-size: 18px;
    font-weight: 900;
    text-align: center;
}

.chart-track {
    position: relative;
    display: flex;
    align-items: end;
    justify-content: center;
    min-height: 140px;
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(238,244,251,.55), rgba(238,244,251,.95));
    overflow: hidden;
}

.chart-track::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to top,
        transparent 0,
        transparent 31px,
        rgba(93,102,116,.12) 32px
    );
}

.chart-bar {
    position: relative;
    z-index: 1;
    width: min(48px, 62%);
    border-radius: 12px 12px 0 0;
    background: linear-gradient(180deg, var(--gold-shine), var(--gold));
    box-shadow: 0 14px 28px rgba(189, 141, 40, .24);
    transform-origin: bottom;
    animation: bar-rise .7s ease both;
    transition: transform .2s ease, filter .2s ease;
}

.chart-column:hover .chart-bar {
    transform: scaleY(1.05) translateY(-3px);
    filter: saturate(1.18);
}

.chart-bar.tone-green { background: linear-gradient(180deg, #39c89d, var(--green)); box-shadow: 0 14px 28px rgba(14, 143, 110, .2); }
.chart-bar.tone-blue { background: linear-gradient(180deg, #5f9ee3, var(--blue)); box-shadow: 0 14px 28px rgba(35, 100, 170, .2); }
.chart-bar.tone-purple { background: linear-gradient(180deg, #a38af0, var(--purple)); box-shadow: 0 14px 28px rgba(116, 87, 199, .2); }

.chart-label {
    color: #5d6674;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
}

@keyframes bar-rise {
    from { transform: scaleY(.18); opacity: .45; }
    to { transform: scaleY(1); opacity: 1; }
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--blue);
    background: #f8fafc;
    font-size: 13px;
    font-weight: 800;
}

.link-btn:hover {
    border-color: #b8c6d8;
    background: #eef4fb;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 10px;
    min-height: 40px;
    padding: 9px 14px;
    background: var(--gold);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(189, 141, 40, .18);
}

.btn:hover { background: #a97821; }
.btn.secondary { background: var(--gold-soft); color: var(--gold-dark); box-shadow: none; }
.btn.danger { background: var(--danger); }
.btn.small { min-height: 32px; padding: 6px 10px; font-size: 13px; }

.inline-form {
    display: inline-flex;
    margin: 0 8px 8px 0;
    vertical-align: top;
}

code {
    overflow-wrap: anywhere;
    word-break: break-word;
}

input, select, textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 11px;
    font: inherit;
    background: #fff;
    color: var(--ink);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(189, 141, 40, .14);
}

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

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

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

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

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    border-bottom: 1px solid var(--line);
    padding: 14px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 11px;
    color: #5d6674;
    text-transform: uppercase;
    letter-spacing: 0;
}

td { font-weight: 600; color: #171717; }

tbody tr:hover { background: #fbfaf7; }

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef4fb;
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
}

.empty-state {
    min-height: 86px;
    display: grid;
    place-items: center;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    background: #f8fafc;
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-weight: 700;
}

.flash.success { background: #e7f7ee; color: #116b38; }
.flash.error { background: #ffe8e3; color: #9a3025; }

.toast-stack {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 100;
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.toast {
    min-width: 260px;
    max-width: 420px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #111b21;
    color: #fff;
    box-shadow: 0 18px 48px rgba(11, 20, 26, .22);
    font-weight: 800;
    opacity: .98;
    transform: translateY(0);
    transition: opacity .25s ease, transform .25s ease;
}

.toast.success { background: #008069; }
.toast.error { background: #b42318; }
.toast.hide {
    opacity: 0;
    transform: translateY(-8px);
}

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card { width: min(440px, 100%); }

.chat-workspace {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(520px, 1fr) minmax(260px, 320px);
    height: calc(100vh - 190px);
    min-height: 720px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(17, 24, 39, .12);
}

.chat-list {
    border-right: 1px solid var(--line);
    background: #fbfcfe;
    overflow: auto;
}

.chat-list-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(251, 252, 254, .94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.chat-list-head strong {
    display: block;
    font-size: 20px;
    line-height: 1.1;
}

.chat-list-head span {
    min-width: 30px;
    min-height: 30px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #e7f7f0;
    color: var(--green);
    font-weight: 900;
}

.chat-search {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: #fbfcfe;
}

.chat-search input {
    min-height: 44px;
    border-radius: 14px;
    background: #fff;
}

.chat-item {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
    transition: background .18s ease;
}

.chat-item:hover,
.chat-item.active {
    background: #eef5ff;
}

.chat-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 16px;
    bottom: 16px;
    width: 4px;
    border-radius: 0 999px 999px 0;
    background: var(--gold-shine);
}

.chat-summary {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.chat-summary small,
.chat-summary em {
    color: var(--muted);
    font-size: 13px;
    font-style: normal;
}

.chat-dot {
    width: 10px;
    height: 10px;
    margin-left: auto;
    margin-top: 8px;
    border-radius: 50%;
    background: #d1d9e6;
}

.chat-item.active .chat-dot { background: var(--green); }

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--gold-soft);
    display: grid;
    place-items: center;
    font-weight: 900;
    color: var(--gold-dark);
    flex: 0 0 auto;
}

.chat-window {
    background:
        linear-gradient(135deg, rgba(255,255,255,.7), rgba(255,255,255,0) 35%),
        radial-gradient(circle at 10% 10%, rgba(189,141,40,.08), transparent 32%),
        #f0ede6;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 26px;
    border-bottom: 1px solid rgba(203, 211, 223, .82);
    background: rgba(255,255,255,.86);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.chat-header h2 { margin-bottom: 6px; }

.contact-title {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.contact-title h2 {
    font-size: 28px;
    line-height: 1.1;
}

.contact-title p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.contact-title p span {
    margin-left: 8px;
    color: var(--gold-dark);
}

.assign-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-width: 340px;
}

.message-stream {
    flex: 1;
    padding: 26px 28px;
    overflow: auto;
}

.bubble {
    max-width: min(68%, 680px);
    padding: 13px 15px;
    border-radius: 18px 18px 18px 6px;
    margin: 10px 0;
    background: #fff;
    box-shadow: 0 14px 34px rgba(17, 24, 39, .09);
}

.bubble.out {
    margin-left: auto;
    border-radius: 18px 18px 6px 18px;
    background: #d9f8c8;
}

.bubble.status-failed {
    background: #ffe6e1;
    border: 1px solid #ffc9bd;
}

.message-body {
    font-size: 15px;
    font-weight: 650;
}

.message-meta {
    display: flex;
    gap: 8px;
    margin-top: 7px;
    font-weight: 700;
}

.message-meta span {
    color: var(--green);
    text-transform: capitalize;
}

.status-failed .message-meta span { color: var(--danger); }
.status-delivered .message-meta span { color: var(--blue); }

.message-media {
    display: block;
    max-width: min(360px, 100%);
    max-height: 280px;
    border-radius: 10px;
    margin-bottom: 8px;
    object-fit: cover;
}

.attachment-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: #eef4fb;
    color: var(--blue);
    font-weight: 900;
}

.composer {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 14px 18px 16px;
    border-top: 1px solid rgba(203, 211, 223, .82);
    background: rgba(255,255,255,.88);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.composer textarea {
    min-height: 48px;
    max-height: 130px;
    border-radius: 14px;
}

.quick-replies {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.quick-replies button {
    border: 1px solid #dbe4ef;
    border-radius: 999px;
    background: #fff;
    color: var(--blue);
    min-height: 34px;
    padding: 7px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.quick-replies button:hover {
    background: #eef5ff;
    border-color: #b8c6d8;
}

.composer input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.icon-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--gold-soft);
    color: var(--gold-dark);
    font-size: 26px;
    font-weight: 900;
    cursor: pointer;
}

.attachment-name {
    grid-column: 2 / -1;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.customer-panel {
    border-left: 1px solid var(--line);
    background: #fbfcfe;
    padding: 20px;
    overflow: auto;
}

.profile-card {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 22px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--soft-shadow);
    text-align: center;
}

.profile-card h3 {
    margin: 8px 0 0;
    font-size: 22px;
}

.profile-card p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.avatar.large {
    width: 58px;
    height: 58px;
    font-size: 20px;
}

.insight-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
}

.insight-grid div,
.customer-notes {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.insight-grid strong {
    display: block;
    font-size: 24px;
    color: var(--ink);
}

.insight-grid span,
.customer-notes p {
    color: var(--muted);
    font-weight: 700;
}

.customer-notes {
    margin-top: 14px;
}

.customer-notes p {
    margin: 0;
}

.wa-shell {
    position: relative;
    display: grid;
    grid-template-columns: 64px minmax(330px, 520px) minmax(0, 1fr);
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    border: 1px solid #d9dee6;
    border-radius: 0;
    background: #fff;
    box-shadow: 0 24px 72px rgba(17, 24, 39, .12);
}

.wa-rail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    padding: 14px 10px;
    background: #f0f2f5;
    border-right: 1px solid #d9dee6;
}

.wa-rail a {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #54656f;
    font-weight: 900;
}

.wa-shell svg {
    width: 22px;
    height: 22px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wa-rail a.active,
.wa-rail a:hover {
    background: #d9fdd3;
    color: #075e54;
}

.wa-list {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-right: 1px solid #d9dee6;
    background: #fff;
    min-height: 0;
}

.wa-list-title {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 26px 12px;
}

.wa-list-title h2 {
    margin: 0;
    font-size: 28px;
}

.wa-title-actions,
.wa-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wa-title-actions button,
.wa-head-actions > button {
    min-width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #3b4a54;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.wa-title-actions button:hover,
.wa-head-actions > button:hover {
    background: #f0f2f5;
}

.wa-search {
    padding: 8px 24px;
}

.wa-search input,
.wa-message-search input {
    min-height: 48px;
    border: 0;
    border-radius: 999px;
    background: #f0f2f5;
    padding-left: 18px;
}

.wa-filters {
    display: flex;
    gap: 8px;
    padding: 2px 24px 12px;
    overflow-x: auto;
}

.wa-filters button {
    border: 1px solid #d7dce3;
    border-radius: 999px;
    min-height: 34px;
    padding: 6px 14px;
    background: #fff;
    color: #3b4a54;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.wa-filters button.active {
    border-color: #d9fdd3;
    background: #d9fdd3;
    color: #075e54;
}

.wa-chat-list {
    overflow: auto;
    min-height: 0;
    padding-bottom: 18px;
}

.wa-chat-row {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 84px;
    padding: 12px 22px;
    border-bottom: 1px solid #edf0f3;
}

.wa-chat-row:hover,
.wa-chat-row.active {
    background: #f0f2f5;
}

.wa-avatar {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #ffd6e5;
    color: #d82d6b;
    font-weight: 900;
}

.wa-avatar.xl {
    width: 86px;
    height: 86px;
    font-size: 28px;
}

.wa-chat-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.wa-chat-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
}

.wa-chat-copy small,
.wa-chat-meta small {
    overflow: hidden;
    color: #667781;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wa-chat-meta {
    display: grid;
    justify-items: end;
    gap: 7px;
}

.wa-chat-meta em {
    min-width: 28px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e7f7f0;
    color: #008069;
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
}

.wa-chat {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background:
        linear-gradient(rgba(239, 234, 226, .92), rgba(239, 234, 226, .92)),
        repeating-linear-gradient(45deg, transparent 0 18px, rgba(0,0,0,.025) 18px 19px),
        #efeae2;
}

.wa-chat-head {
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 76px;
    padding: 10px 18px;
    background: #f0f2f5;
    border-bottom: 1px solid #d9dee6;
}

.wa-contact-button {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.wa-contact-button strong {
    display: block;
    font-size: 18px;
}

.wa-contact-button small {
    color: #667781;
}

.wa-message-search {
    display: none;
    padding: 10px 18px;
    background: #fff;
    border-bottom: 1px solid #d9dee6;
}

.wa-message-search.open { display: block; }

.wa-messages {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 24px 6.5%;
}

.wa-bubble {
    position: relative;
    width: fit-content;
    max-width: min(62%, 720px);
    margin: 6px 0;
    padding: 8px 10px 6px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 1px rgba(11, 20, 26, .16);
    color: #111b21;
}

.wa-bubble.out {
    margin-left: auto;
    background: #d9fdd3;
}

.wa-bubble.status-failed {
    background: #ffe7e3;
}

.wa-bubble small {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 3px;
    color: #667781;
    font-size: 11px;
}

.wa-bubble small span {
    text-transform: capitalize;
}

.wa-media {
    display: block;
    max-width: min(360px, 100%);
    max-height: 300px;
    border-radius: 7px;
    object-fit: cover;
    margin-bottom: 6px;
}

.wa-doc {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: rgba(255,255,255,.75);
    color: #0b62a3;
    font-weight: 900;
}

.wa-composer {
    position: relative;
    display: grid;
    grid-template-columns: 48px 48px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 10px 14px;
    background: #f0f2f5;
    border-top: 1px solid #d9dee6;
}

.wa-composer input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.wa-plus,
.wa-emoji,
.wa-send {
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
}

.wa-plus,
.wa-emoji {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: transparent;
    color: #54656f;
    display: grid;
    place-items: center;
}

.wa-plus:hover,
.wa-emoji:hover {
    background: #e3e7eb;
}

.wa-composer textarea {
    min-height: 50px;
    max-height: 118px;
    border: 0;
    border-radius: 25px;
    background: #fff;
    padding: 14px 18px;
    resize: none;
    box-shadow: 0 1px 2px rgba(11, 20, 26, .08);
}

.wa-send {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    background: #008069;
    color: #fff;
}

.attachment-name {
    grid-column: 3 / -1;
    color: #667781;
    font-size: 12px;
    font-weight: 700;
    min-height: 0;
}

.attachment-name:empty {
    display: none;
}

.wa-menu,
.wa-attach-menu {
    display: none;
    position: absolute;
    z-index: 20;
    min-width: 230px;
    padding: 8px;
    border: 1px solid #d9dee6;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 46px rgba(11, 20, 26, .18);
}

.wa-menu.open,
.wa-attach-menu.open { display: grid; }

.wa-menu {
    top: 54px;
    right: 18px;
}

.wa-menu.right {
    top: 58px;
    right: 14px;
}

.wa-attach-menu {
    left: 14px;
    bottom: 76px;
}

.wa-emoji-panel {
    display: none;
    position: absolute;
    z-index: 22;
    left: 70px;
    bottom: 74px;
    width: min(420px, calc(100vw - 40px));
    max-height: 340px;
    overflow: hidden;
    border: 1px solid #d9dee6;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 46px rgba(11, 20, 26, .2);
}

.wa-composer-panel {
    display: none;
    position: absolute;
    z-index: 23;
    left: 70px;
    bottom: 74px;
    width: min(380px, calc(100vw - 40px));
    max-height: 430px;
    overflow: auto;
    border: 1px solid #d9dee6;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 46px rgba(11, 20, 26, .2);
}

.wa-composer-panel.open {
    display: grid;
}

.wa-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #edf0f3;
}

.wa-panel-head button {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: #f0f2f5;
    font: inherit;
    font-size: 20px;
    cursor: pointer;
}

.wa-composer-panel > button {
    border: 0;
    border-bottom: 1px solid #edf0f3;
    background: #fff;
    color: #111b21;
    min-height: 48px;
    padding: 12px 16px;
    text-align: left;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.wa-composer-panel > button:hover {
    background: #f0f2f5;
}

.wa-panel-editor {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid #edf0f3;
    background: #fbfcfe;
}

.wa-panel-editor label {
    display: grid;
    gap: 8px;
    color: #3b4a54;
    font-size: 12px;
    font-weight: 900;
}

.wa-panel-editor textarea {
    width: 100%;
    min-height: 112px;
    max-height: 180px;
    resize: vertical;
    border: 1px solid #d9dee6;
    border-radius: 12px;
    background: #fff;
    color: #111b21;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
}

.wa-panel-editor textarea:focus {
    border-color: #00a884;
    box-shadow: 0 0 0 3px rgba(0, 168, 132, .12);
    outline: none;
}

.wa-panel-editor button {
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    background: #008069;
    color: #fff;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.wa-panel-editor button:hover {
    background: #026f5d;
}

.wa-emoji-panel.open {
    display: grid;
    grid-template-rows: auto 1fr;
}

.wa-emoji-tabs {
    display: flex;
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid #edf0f3;
    overflow-x: auto;
}

.wa-emoji-tabs button {
    border: 0;
    border-radius: 999px;
    background: #f0f2f5;
    color: #3b4a54;
    min-height: 32px;
    padding: 6px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.wa-emoji-tabs button.active {
    background: #d9fdd3;
    color: #075e54;
}

.wa-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 10px;
    overflow-y: auto;
    max-height: 278px;
}

.wa-emoji-grid button {
    display: grid;
    place-items: center;
    min-width: 0;
    width: 100%;
    aspect-ratio: 1;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
}

.wa-emoji-grid button:hover {
    background: #f0f2f5;
}

.wa-menu a,
.wa-menu button,
.wa-attach-menu button {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #111b21;
    padding: 12px 14px;
    text-align: left;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.wa-menu a:hover,
.wa-menu button:hover,
.wa-attach-menu button:hover {
    background: #f0f2f5;
}

.danger-text { color: var(--danger) !important; }

.wa-info {
    position: absolute;
    z-index: 15;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(380px, 38vw);
    display: none;
    grid-template-rows: 76px minmax(0, 1fr);
    overflow: hidden;
    border-left: 1px solid #d9dee6;
    background: #fff;
    box-shadow: -18px 0 46px rgba(11, 20, 26, .12);
}

.wa-info.open { display: grid; }

.wa-info-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 76px;
    padding: 0 20px;
    background: #f0f2f5;
}

.wa-info-body {
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 18px;
}

.wa-info-head button {
    border: 0;
    background: transparent;
    font-size: 26px;
    cursor: pointer;
}

.wa-info-profile,
.wa-info-form,
.wa-info-stats,
.wa-info-note {
    margin: 14px;
    padding: 18px;
    border: 1px solid #edf0f3;
    border-radius: 14px;
    background: #fff;
}

.wa-info-profile {
    display: grid;
    justify-items: center;
    text-align: center;
}

.wa-info-profile h3 { margin: 12px 0 2px; }
.wa-info-profile p { margin: 0 0 10px; color: #667781; }
.wa-info-profile span { color: #008069; font-weight: 900; }

.wa-info-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.wa-info-stats div {
    display: grid;
    gap: 4px;
    text-align: center;
}

.wa-info-stats strong { font-size: 20px; }
.wa-info-stats span,
.wa-info-note p { color: #667781; font-weight: 700; }

.wa-empty {
    display: grid;
    place-items: center;
    min-height: 100%;
    color: #667781;
    font-weight: 800;
}

.bottom-nav { display: none; }

.catalog-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.96), rgba(238,244,251,.9)),
        linear-gradient(90deg, rgba(14,143,110,.1), rgba(35,100,170,.08));
    box-shadow: var(--soft-shadow);
}

.catalog-hero h2 {
    margin: 0 0 8px;
    font-size: 34px;
}

.catalog-hero p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.catalog-shell {
    display: grid;
    grid-template-columns: minmax(360px, .9fr) minmax(0, 1.35fr);
    gap: 22px;
    align-items: start;
}

.catalog-list-panel,
.catalog-editor-panel {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.catalog-list-panel {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
}

.catalog-panel-head,
.catalog-editor-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 26px;
    border-bottom: 1px solid var(--line);
    background: #fbfcfe;
}

.catalog-panel-head {
    display: grid;
}

.catalog-panel-head h2,
.catalog-editor-head h2 {
    margin: 0 0 4px;
}

.catalog-panel-head span,
.catalog-editor-head span {
    color: var(--muted);
    font-weight: 800;
}

.catalog-search {
    margin-top: 12px;
    border-radius: 999px;
    background: #f0f2f5;
}

.catalog-products {
    min-height: 0;
    overflow: auto;
}

.catalog-product {
    display: grid;
    grid-template-columns: 66px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #edf0f3;
    transition: background .18s ease, transform .18s ease;
}

.catalog-product:hover,
.catalog-product.active {
    background: #f4f8fc;
}

.catalog-product:hover {
    transform: translateX(3px);
}

.catalog-thumb {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(135deg, #ffe7f0, #dff8ef);
    color: #d82d6b;
    font-weight: 900;
}

.catalog-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.catalog-product-main {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.catalog-product-main strong,
.catalog-product-main small,
.catalog-product-main em {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-product-main small,
.catalog-product-main em {
    color: #667781;
    font-style: normal;
    font-weight: 700;
}

.catalog-price {
    color: var(--green);
    font-weight: 900;
}

.catalog-editor-panel {
    min-width: 0;
}

.smart-fill {
    margin: 24px 26px 0;
    padding: 18px;
    border: 1px solid #dce6f2;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(231,247,240,.72), rgba(238,244,251,.92));
}

.smart-fill textarea {
    min-height: 130px;
    background: rgba(255,255,255,.9);
}

.smart-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.smart-ai-btn {
    min-width: 220px;
}

.smart-hint {
    color: #5f6b78;
    font-weight: 700;
    font-size: .9rem;
}

.catalog-form {
    display: grid;
    gap: 22px;
    padding: 24px 26px 28px;
}

.catalog-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field-with-button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.field-with-button button {
    min-width: 68px;
    border: 0;
    border-radius: 10px;
    background: #e7f7f0;
    color: var(--green);
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.media-studio {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.media-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--soft-shadow);
}

.media-card strong {
    display: block;
    font-size: 18px;
}

.media-card span {
    color: #667781;
    font-weight: 700;
}

.hero-media-card {
    grid-template-columns: minmax(190px, 1fr) minmax(160px, 220px) minmax(220px, 1fr);
    align-items: center;
}

.current-cover {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid #dce6f2;
}

.drop-zone {
    min-height: 128px;
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 18px;
    border: 2px dashed #bfd0e2;
    border-radius: 16px;
    background: #f8fafc;
    color: var(--ink);
    text-align: center;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.drop-zone:hover {
    border-color: var(--green);
    background: #eefaf4;
    transform: translateY(-2px);
}

.drop-zone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.drop-zone span {
    color: var(--green);
    font-size: 18px;
    font-weight: 900;
}

.drop-zone small {
    color: #667781;
    font-weight: 700;
}

.media-preview,
.existing-media,
.existing-videos {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-item {
    width: 128px;
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid #edf0f3;
    border-radius: 12px;
    background: #fbfcfe;
}

.preview-item img,
.preview-item video,
.existing-media img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
}

.preview-item span {
    overflow: hidden;
    color: #3b4a54;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 800;
}

.existing-media img {
    width: 74px;
    border: 1px solid #dce6f2;
}

.existing-videos a {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef4fb;
    color: var(--blue);
    font-size: 13px;
    font-weight: 900;
}

.catalog-save {
    min-height: 48px;
    font-size: 16px;
}

.ai-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding: 26px;
    border: 1px solid #dce6f2;
    border-radius: 18px;
    background:
        linear-gradient(135deg, #111827, #243044 58%, #0d7664);
    color: #fff;
    box-shadow: var(--shadow);
}

.ai-hero h2 {
    margin: 0 0 8px;
    font-size: 34px;
}

.ai-hero p {
    max-width: 820px;
    margin: 0;
    color: #d8dee8;
    font-weight: 700;
}

.ai-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
}

.ai-hero-actions form {
    margin: 0;
}

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

.ai-status-grid div {
    position: relative;
    display: grid;
    gap: 5px;
    padding: 18px 18px 18px 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--soft-shadow);
    overflow: hidden;
}

.ai-status-grid div::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--danger);
}

.ai-status-grid div.ready::before {
    background: var(--green);
}

.ai-status-grid strong {
    font-size: 16px;
}

.ai-status-grid span {
    color: #667781;
    font-weight: 900;
}

.ai-status-grid small {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

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

.ai-stats div {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--soft-shadow);
}

.ai-stats strong {
    display: block;
    color: var(--green);
    font-size: 30px;
    line-height: 1;
    font-weight: 900;
}

.ai-stats span {
    display: block;
    margin-top: 6px;
    color: #667781;
    font-weight: 800;
}

.ai-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}

.ai-panel {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    padding: 22px;
    box-shadow: var(--soft-shadow);
}

.ai-panel .section-head p {
    margin: 0;
}

.kb-form {
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid #edf0f3;
    border-radius: 14px;
    background: #fbfcfe;
}

.ai-model-list {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid #dce6f2;
    border-radius: 14px;
    background: #f8fafc;
}

.ai-model-list div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-model-list code {
    padding: 6px 9px;
    border-radius: 999px;
    background: #eef4fb;
    color: var(--blue);
    font-weight: 900;
}

.vision-help {
    display: grid;
    gap: 6px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #f3d4a9;
    border-radius: 14px;
    background: #fff8ea;
}

.vision-help strong {
    color: var(--gold-dark);
}

.vision-help span {
    color: #6f5a2b;
    font-weight: 800;
}

.knowledge-list {
    display: grid;
    gap: 12px;
    max-height: 520px;
    overflow: auto;
}

.knowledge-card {
    display: grid;
    gap: 10px;
    padding: 15px;
    border: 1px solid #edf0f3;
    border-radius: 14px;
    background: #fff;
}

.knowledge-card div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.knowledge-card strong {
    font-size: 16px;
}

.knowledge-card span {
    color: var(--green);
    font-size: 12px;
    font-weight: 900;
}

.knowledge-card p {
    margin: 0;
    color: #667781;
    font-weight: 700;
}

.kb-edit {
    border-top: 1px solid #edf0f3;
    padding-top: 10px;
}

.kb-edit summary {
    color: var(--blue);
    font-weight: 900;
    cursor: pointer;
}

.kb-edit form {
    margin-top: 10px;
}

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

.analyze-inline input {
    width: 96px;
}

.insight-table {
    overflow: auto;
}

.insight-table table {
    min-width: 840px;
}

@media (min-width: 1200px) {
    .main { padding-left: 36px; padding-right: 36px; }
    .dashboard-stats { gap: 20px; }
}

@media (max-width: 1100px) {
    .app { grid-template-columns: 250px minmax(0, 1fr); }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two { grid-template-columns: 1fr; }
    .catalog-shell { grid-template-columns: 1fr; }
    .ai-grid { grid-template-columns: 1fr; }
    .ai-stats,
    .ai-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .catalog-list-panel {
        position: static;
        max-height: 460px;
    }
    .hero-media-card {
        grid-template-columns: 1fr;
    }
    .analytics-panel { grid-template-columns: 1fr; }
    .chat-workspace {
        grid-template-columns: 320px minmax(0, 1fr);
    }
    .customer-panel { display: none; }
    .wa-shell {
        grid-template-columns: 54px minmax(280px, 360px) minmax(0, 1fr);
    }
    .wa-info { width: min(360px, 48vw); }
}

@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        min-height: 0;
        padding: 18px 16px;
    }
    .brand { margin-bottom: 16px; }
    .stats, .two, .three, .form-grid { grid-template-columns: 1fr; }
    .catalog-hero,
    .ai-hero,
    .catalog-panel-head,
    .catalog-editor-head {
        display: grid;
    }
    .ai-stats,
    .ai-status-grid { grid-template-columns: 1fr; }
    .ai-hero-actions {
        justify-content: stretch;
    }
    .ai-hero-actions .btn {
        width: 100%;
    }
    .analyze-inline {
        display: grid;
        width: 100%;
    }
    .analyze-inline input {
        width: 100%;
    }
    .catalog-fields,
    .catalog-product {
        grid-template-columns: 1fr;
    }
    .catalog-price {
        justify-self: start;
    }
    .main { padding: 18px; padding-bottom: 80px; }
    .topbar { align-items: flex-start; }
    .dashboard-hero {
        flex-direction: column;
        align-items: stretch;
    }
    .hero-actions { flex-wrap: wrap; }
    h1 { font-size: 34px; }
    .chart-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chat-workspace {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }
    .chat-list {
        max-height: 330px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .chat-header,
    .assign-form {
        display: grid;
        grid-template-columns: 1fr;
        min-width: 0;
    }
    .bubble { max-width: 92%; }
    .composer { grid-template-columns: 44px minmax(0, 1fr); }
    .composer .btn { grid-column: 1 / -1; }
    .wa-shell {
        grid-template-columns: 1fr;
        height: 100vh;
        min-height: 0;
    }
    .wa-rail { display: none; }
    .wa-list {
        max-height: 360px;
        border-right: 0;
        border-bottom: 1px solid #d9dee6;
    }
    .wa-chat { min-height: 0; }
    .wa-bubble { max-width: 88%; }
    .wa-composer {
        grid-template-columns: 44px 44px minmax(0, 1fr);
    }
    .wa-send { grid-column: 1 / -1; }
    .wa-info {
        width: 100%;
    }
    table { display: block; overflow-x: auto; }
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid var(--line);
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        z-index: 20;
    }
    .bottom-nav a {
        padding: 10px 4px;
        text-align: center;
        font-size: 12px;
        color: var(--gold-dark);
    }
}

/* =============================================
   DT CRM IMPROVEMENTS — v20260513
   ============================================= */

/* --- Google Font fallback already set in header --- */

/* Nav Icons */
.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    opacity: .75;
    transition: opacity .18s ease, transform .18s ease;
}
.nav a:hover .nav-icon,
.nav a.active .nav-icon { opacity: 1; }
.nav a.active .nav-icon { transform: scale(1.1); }

.nav-label { flex: 1; }

.nav a {
    gap: 12px;
}

/* Brand Tagline */
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-name { font-size: 18px; font-weight: 900; line-height: 1.15; color: #fff; }
.brand-tagline { font-size: 11px; font-weight: 700; color: rgba(237,201,79,.65); letter-spacing: .04em; text-transform: uppercase; }

/* Sidebar Footer / User Profile */
.sidebar-footer {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,.06);
    transition: background .18s ease;
}
.sidebar-user:hover { background: rgba(255,255,255,.1); }
.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-shine), var(--gold));
    color: #17110a;
    font-weight: 900;
    font-size: 14px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    display: block;
    font-size: 11px;
    color: rgba(237,201,79,.65);
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.logout-btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: rgba(255,255,255,.5);
    flex: 0 0 auto;
    transition: color .18s ease, background .18s ease;
}
.logout-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

/* Sidebar = flex column so footer stays at bottom */
.sidebar {
    display: flex;
    flex-direction: column;
}
.nav { flex: 1; }

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,.55);
    z-index: 30;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* Mobile Topbar */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.mobile-brand { font-size: 17px; font-weight: 900; }
.hamburger {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    color: var(--ink);
}

/* Topbar sub-line + clock */
.topbar-sub {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-clock {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    background: var(--bg);
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

/* Flash icons */
.flash {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Status Pills (colored) */
.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    text-transform: capitalize;
    white-space: nowrap;
}
.status-pending   { background: #fff0e3; color: var(--orange); }
.status-confirmed { background: #e8f0fb; color: var(--blue); }
.status-packed    { background: #f0ecff; color: var(--purple); }
.status-shipped   { background: #dbeafe; color: #1d4ed8; }
.status-delivered { background: #e7f7f0; color: var(--green); }
.status-paid      { background: #e7f7f0; color: var(--green); }
.status-cancelled { background: #fdece9; color: var(--danger); }
.status-returned  { background: #fdece9; color: var(--danger); }
.status-failed    { background: #fdece9; color: var(--danger); }
.status-refunded  { background: #fff0e3; color: var(--orange); }
.status-draft     { background: #f1f5f9; color: #64748b; }

/* Customer Type Pills */
.pill-customer   { background: #e8f0fb; color: var(--blue); }
.pill-reseller   { background: #f0ecff; color: var(--purple); }
.pill-retailer   { background: #e7f7f0; color: var(--green); }
.pill-wholesaler { background: #fff0e3; color: var(--orange); }

/* Table Avatar */
.row-with-avatar {
    display: flex;
    align-items: center;
    gap: 10px;
}
.table-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gold-soft);
    color: var(--gold-dark);
    font-size: 13px;
    font-weight: 900;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}
.table-avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.table-avatar.tone-green  { background: #e7f7f0; color: var(--green); }
.table-avatar.tone-blue   { background: #e8f0fb; color: var(--blue); }
.table-avatar.tone-purple { background: #f0ecff; color: var(--purple); }
.table-avatar.tone-orange { background: #fff0e3; color: var(--orange); }

/* WhatsApp Link */
.wa-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--green);
    font-weight: 700;
    font-size: 13px;
    transition: opacity .18s ease;
}
.wa-link:hover { opacity: .75; }

/* Metric card as link */
.card.metric {
    text-decoration: none;
    display: flex;
    position: relative;
    cursor: pointer;
}
.metric-arrow {
    position: absolute;
    bottom: 14px;
    right: 14px;
    opacity: .35;
    transition: opacity .18s ease, transform .18s ease;
}
.card.metric:hover .metric-arrow { opacity: .8; transform: translateX(3px); }

/* Page Toolbar */
.page-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Search Bar */
.search-bar {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 420px;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 12px;
    color: var(--muted);
    pointer-events: none;
    display: flex;
}
.search-input {
    padding-left: 38px !important;
    padding-right: 36px !important;
    border-radius: 12px !important;
    width: 100%;
}
.search-clear {
    position: absolute;
    right: 10px;
    font-size: 18px;
    color: var(--muted);
    line-height: 1;
    transition: color .15s;
}
.search-clear:hover { color: var(--danger); }

/* Filter Pills */
.filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}
.filter-pill {
    height: 34px;
    padding: 5px 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .18s ease;
}
.filter-pill:hover { border-color: var(--gold); color: var(--gold-dark); }
.filter-pill.active { background: var(--gold); border-color: var(--gold); color: #fff; }

/* Count Badge */
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--gold-soft);
    color: var(--gold-dark);
    font-size: 12px;
    font-weight: 900;
    margin-left: 8px;
    vertical-align: middle;
}

/* Tracking Badge */
.tracking-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    color: var(--blue);
    background: #e8f0fb;
    padding: 3px 9px;
    border-radius: 6px;
}

/* Table layout helpers */
.text-right { text-align: right !important; }
.text-sm { font-size: 12px !important; }
.action-group { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.table-scroll { overflow-x: auto; }
.amount { color: var(--green); }
.order-num { color: var(--blue); }

/* Form Actions row */
.form-actions { display: flex; gap: 10px; align-items: center; }

/* Analytics sub-stats */
.analytics-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 22px;
}
.analytics-stat { text-align: center; }
.analytics-stat-val {
    display: block;
    font-size: 24px;
    font-weight: 900;
    color: #fff;
    line-height: 1.1;
}
.analytics-stat-key {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,.55);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: 3px;
}

/* Chart title */
.chart-title {
    grid-column: 1 / -1;
    padding-bottom: 6px;
}

/* Empty state with icon */
.empty-state {
    flex-direction: column;
    gap: 10px;
    padding: 32px 24px;
}
.empty-state a { color: var(--blue); font-weight: 700; }

/* Dashboard layout helpers */
.customers-layout,
.orders-layout {
    align-items: start;
}
.customers-table-card,
.orders-table-card { grid-column: 1; }

/* Btn outline variant */
.btn.outline {
    background: transparent;
    border: 1.5px solid var(--gold);
    color: var(--gold-dark);
    box-shadow: none;
}
.btn.outline:hover { background: var(--gold-soft); }

/* Inline form fixes */
.inline-form { margin: 0 !important; }

/* =============================================
   RESPONSIVE — Mobile
   ============================================= */
@media (max-width: 860px) {
    /* Show mobile topbar, hide sidebar by default */
    .mobile-topbar { display: flex; }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 40;
        width: 280px;
        transform: translateX(-100%);
        transition: transform .25s ease;
        min-height: 0;
        height: 100vh;
    }
    .sidebar.open { transform: translateX(0); }

    /* Single column layout */
    .app { grid-template-columns: 1fr; }
    .main { padding: 16px 14px 48px; }

    .grid.stats { grid-template-columns: repeat(2, 1fr); }
    .grid.two,
    .grid.three { grid-template-columns: 1fr; }
    .analytics-panel { grid-template-columns: 1fr; }
    .analytics-stats { grid-template-columns: repeat(3, 1fr); }

    .page-toolbar { flex-direction: column; align-items: stretch; }
    .search-bar { max-width: 100%; }
    .filter-pills { justify-content: flex-start; }

    h1 { font-size: 26px; }
    h2 { font-size: 20px; }

    .dashboard-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .hero-actions { flex-wrap: wrap; }

    .topbar { display: none; }
}

@media (max-width: 520px) {
    .grid.stats { grid-template-columns: 1fr; }
    .analytics-stats { grid-template-columns: 1fr; gap: 6px; }
}
