:root {
    --radius: 24px;
    --shadow: 0 24px 60px rgba(8, 4, 20, 0.35);
}

/* ── Simulation page ──────────────────────────────────────────────────── */
.sim-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.sim-config {
    display: flex;
    flex-direction: column;
}

.sim-chat {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
}

.sim-chat .message-stack {
    flex: 1;
    overflow-y: auto;
    min-height: 240px;
}

.sim-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.sim-textarea {
    min-height: 56px;
    max-height: 130px;
    resize: none;
}

.sim-send-btn {
    height: 56px;
    padding: 0 22px;
    white-space: nowrap;
}

.sim-note {
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 0.84rem;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px dashed var(--border);
    white-space: pre-wrap;
}

.sim-log {
    background: rgba(0,0,0,0.28);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    font-family: Consolas, "Cascadia Code", monospace;
    font-size: 0.78rem;
    color: var(--muted);
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.theme-light .sim-log {
    background: rgba(255,255,255,0.6);
}

.sim-log__line {
    line-height: 1.4;
    word-break: break-all;
}

.sim-feedback {
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-weight: 600;
}

.sim-feedback--error {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(255, 122, 217, 0.24);
}

/* ── Comandita View game monitor ──────────────────────────────────────── */
.comandita-view-intro {
    max-width: 720px;
    margin: 8px 0 0;
    line-height: 1.5;
}

.comandita-view-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.comandita-game-panel {
    min-width: 0;
}

.comandita-game-toolbar {
    min-height: 72px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    background: linear-gradient(180deg, var(--surface-strong), var(--surface));
}

.comandita-game-frame {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 18px 18px;
    background: #162532;
    box-shadow: var(--shadow);
}

.comandita-game-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 360px;
}

.comandita-game-container canvas {
    display: block;
}

.comandita-embed-layout {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: transparent;
}

.comandita-compact-container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: transparent;
}

.comandita-compact-container canvas {
    display: block;
}

html:has(.comandita-embed-layout),
body:has(.comandita-embed-layout),
.app-root:has(.comandita-embed-layout) {
    min-height: 0;
    overflow: hidden;
    background: transparent;
}

.comandita-control-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comandita-state-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.comandita-state-btn {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 12px;
    text-align: left;
}

.comandita-demo-btn {
    width: 100%;
}

.comandita-state-pill.state-idle,
.comandita-state-btn.state-idle.active {
    color: var(--accent);
}

.comandita-state-pill.state-order,
.comandita-state-btn.state-order.active,
.comandita-state-pill.state-review,
.comandita-state-btn.state-review.active,
.comandita-state-pill.state-speaking,
.comandita-state-btn.state-speaking.active {
    color: #ffd35a;
}

.comandita-state-pill.state-printing,
.comandita-state-btn.state-printing.active {
    color: #77d1ff;
}

.comandita-state-pill.state-success,
.comandita-state-btn.state-success.active {
    color: var(--ok);
}

.comandita-state-pill.state-error,
.comandita-state-btn.state-error.active {
    color: var(--danger);
}

.comandita-state-pill.state-offline,
.comandita-state-btn.state-offline.active {
    color: var(--muted);
}

.comandita-state-pill.state-after-hours,
.comandita-state-btn.state-after-hours.active {
    color: #8fb2ff;
}

.comandita-snapshot {
    padding-top: 2px;
}

@media (max-width: 1100px) {
    .comandita-view-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .comandita-game-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .comandita-game-container {
        min-height: 240px;
    }

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

    .comandita-state-btn {
        justify-content: center;
        text-align: center;
    }
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: 0.18s ease;
    color: var(--muted);
}

.radio-option input[type="radio"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.radio-option--active {
    background: linear-gradient(135deg, var(--accent-soft), var(--accent-soft-2));
    border-color: var(--border-strong);
    color: var(--ink);
}


* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: "Bahnschrift", "Segoe UI Variable Text", "Trebuchet MS", sans-serif;
    background: #070110;
}

body {
    color: #f6efff;
}

a {
    color: inherit;
    text-decoration: none;
}

input,
select,
textarea,
button {
    font: inherit;
}

.app-root {
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, var(--flare-a), transparent 34%),
        radial-gradient(circle at top right, var(--flare-b), transparent 28%),
        radial-gradient(circle at 20% 80%, var(--flare-c), transparent 26%),
        linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.theme-dark {
    --bg-top: #070110;
    --bg-bottom: #14041f;
    --flare-a: rgba(85, 32, 255, 0.28);
    --flare-b: rgba(34, 196, 255, 0.22);
    --flare-c: rgba(190, 35, 255, 0.18);
    --ink: #f7efff;
    --muted: #a79fc7;
    --surface: rgba(16, 10, 33, 0.78);
    --surface-strong: rgba(24, 14, 49, 0.95);
    --surface-soft: rgba(255, 255, 255, 0.04);
    --border: rgba(135, 93, 255, 0.24);
    --border-strong: rgba(61, 223, 255, 0.32);
    --accent: #34d8ff;
    --accent-strong: #a63dff;
    --accent-soft: rgba(52, 216, 255, 0.12);
    --accent-soft-2: rgba(166, 61, 255, 0.14);
    --ok: #78ffbf;
    --ok-soft: rgba(120, 255, 191, 0.12);
    --danger: #ff7ad9;
    --danger-soft: rgba(255, 122, 217, 0.12);
    --sidebar-ink: #f7efff;
    --sidebar-muted: rgba(247, 239, 255, 0.7);
    --brand-bg: linear-gradient(135deg, #3410a6, #1ee2ff 55%, #a63dff);
    --brand-ink: #ffffff;
    --hero-glow: 0 0 0 1px rgba(52, 216, 255, 0.15), 0 0 28px rgba(166, 61, 255, 0.24);
}

.theme-light {
    --bg-top: #f4efff;
    --bg-bottom: #e9f4ff;
    --flare-a: rgba(131, 52, 255, 0.14);
    --flare-b: rgba(52, 216, 255, 0.14);
    --flare-c: rgba(166, 61, 255, 0.10);
    --ink: #22153b;
    --muted: #695f89;
    --surface: rgba(255, 255, 255, 0.84);
    --surface-strong: rgba(255, 255, 255, 0.94);
    --surface-soft: rgba(103, 62, 170, 0.05);
    --border: rgba(110, 88, 180, 0.18);
    --border-strong: rgba(52, 216, 255, 0.22);
    --accent: #0a9dff;
    --accent-strong: #7b29ff;
    --accent-soft: rgba(10, 157, 255, 0.10);
    --accent-soft-2: rgba(123, 41, 255, 0.10);
    --ok: #118958;
    --ok-soft: rgba(17, 137, 88, 0.12);
    --danger: #d32987;
    --danger-soft: rgba(211, 41, 135, 0.10);
    --sidebar-ink: #f6f0ff;
    --sidebar-muted: rgba(246, 240, 255, 0.72);
    --brand-bg: linear-gradient(135deg, #7b29ff, #0a9dff 58%, #b742ff);
    --brand-ink: #ffffff;
    --hero-glow: 0 0 0 1px rgba(123, 41, 255, 0.08), 0 10px 40px rgba(67, 33, 140, 0.12);
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 290px 1fr;
}

.sidebar-shell {
    padding: 28px 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background:
        linear-gradient(180deg, rgba(8, 5, 22, 0.95), rgba(22, 9, 44, 0.95)),
        linear-gradient(180deg, #090214, #170426);
    color: var(--sidebar-ink);
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: inset -1px 0 0 rgba(52, 216, 255, 0.08);
}

.theme-light .sidebar-shell {
    background:
        linear-gradient(180deg, rgba(39, 18, 78, 0.95), rgba(68, 23, 124, 0.94)),
        linear-gradient(180deg, #2a124d, #4d2081);
}

.main-shell {
    padding: 16px 26px;
}

.top-shell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    position: relative;
}

.top-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.chat-comandita-embed {
    position: absolute;
    left: 0;
    top: -10px;
    width: 300px;
    height: 176px;
    border: 0;
    background: transparent;
    pointer-events: none;
    overflow: hidden;
    z-index: 3;
}

.top-badge,
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-soft), var(--accent-soft-2));
    color: var(--accent);
    border: 1px solid var(--border-strong);
    font-size: 0.85rem;
    font-weight: 700;
}

.pill.neutral {
    background: var(--surface-soft);
    color: var(--muted);
    border-color: var(--border);
}

.pill.warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffc107;
    font-size: 0.78rem;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
}

.toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.theme-switch {
    border: 1px solid var(--border-strong);
    background: linear-gradient(135deg, var(--surface-soft), rgba(255, 255, 255, 0.02));
    color: var(--ink);
    border-radius: 16px;
    padding: 11px 14px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.theme-switch:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(52, 216, 255, 0.16);
}

.content-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--brand-bg);
    color: var(--brand-ink);
    font-weight: 900;
    box-shadow: 0 0 24px rgba(52, 216, 255, 0.22);
}

.brand-title {
    font-size: 1.4rem;
    font-weight: 800;
}

.brand-subtitle,
.muted,
.sidebar-note,
.field-hint,
.empty-copy,
.stat-label,
label,
.message-meta,
.info-grid dt,
.data-table th {
    color: var(--muted);
}

.sidebar-note {
    margin-top: 24px;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--sidebar-muted);
}

.menu-stack {
    display: grid;
    gap: 10px;
}

.logout-form {
    margin-top: 18px;
}

.sidebar-btn {
    width: 100%;
    color: var(--sidebar-ink);
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
}

.menu-link {
    padding: 14px 16px;
    border-radius: 16px;
    color: rgba(247, 239, 255, 0.86);
    transition: 0.2s ease;
    font-weight: 600;
    border: 1px solid transparent;
}

.menu-link:hover,
.menu-link.active {
    background: linear-gradient(135deg, rgba(52, 216, 255, 0.10), rgba(166, 61, 255, 0.16));
    border-color: rgba(52, 216, 255, 0.16);
    color: #fff;
    transform: translateX(4px);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 8px;
}

h1,
h2 {
    margin: 0;
    line-height: 1.05;
}

h1 {
    font-size: clamp(2rem, 3vw, 3.1rem);
    letter-spacing: -0.04em;
}

h2 {
    font-size: 1.2rem;
}

.hero-card,
.panel-card,
.stat-card,
.login-card {
    background: linear-gradient(180deg, var(--surface-strong), var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero-card {
    padding: 28px;
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    box-shadow: var(--shadow), var(--hero-glow);
}

.panel-card,
.stat-card {
    padding: 22px;
}

.stats-grid,
.panel-grid {
    display: grid;
    gap: 18px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-value {
    margin-top: 12px;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--ink);
}

.page-header,
.panel-header,
.button-row,
.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header,
.panel-header {
    justify-content: space-between;
}

.page-header.compact {
    margin-bottom: 10px;
}

.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(320px, 0.95fr);
    gap: 18px;
}

.chat-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
}

.chat-layout.has-actions-panel {
    grid-template-columns: 280px minmax(0, 1fr) minmax(260px, 320px);
}

.side-panel,
.contacts-panel,
.conversation-panel,
.chat-actions-panel {
    min-height: 540px;
}

.contacts-panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
    overflow: hidden;
}

.contacts-panel .panel-header {
    flex-shrink: 0;
}

.contacts-panel .contacts-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-gutter: stable;
}

.conversation-panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
}

.conversation-panel .panel-header {
    flex-shrink: 0;
}

.conversation-panel .message-stack {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.conversation-panel .detail-stack {
    flex-shrink: 0;
}

.conversation-panel .feedback {
    flex-shrink: 0;
}

.chat-actions-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

.chat-actions-panel .contact-registration-panel {
    margin: 0;
    padding: 12px;
}

.chat-actions-panel .contact-registration-header,
.chat-actions-panel .contact-registration-grid {
    align-items: stretch;
    flex-direction: column;
}

.chat-actions-panel .contact-registration-kind {
    flex-wrap: wrap;
    justify-content: flex-start;
}

.chat-actions-panel .contact-registration-grid > div {
    width: 100%;
    min-width: 0;
}

.chat-actions-panel .compact-action,
.manual-reply-panel .btn-solid {
    width: 100%;
}

.manual-reply-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contacts-list,
.message-stack,
.detail-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.table-wrap {
    overflow: auto;
    margin-top: 16px;
}

.faq-table-wrap {
    max-height: 430px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.025);
    scrollbar-gutter: stable;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: top;
}

.theme-light .data-table th,
.theme-light .data-table td {
    border-bottom-color: rgba(79, 53, 134, 0.12);
}

.data-table tbody tr {
    cursor: pointer;
    transition: background 0.18s ease;
}

.data-table tbody tr:hover,
.selected-row {
    background: linear-gradient(135deg, var(--accent-soft), var(--accent-soft-2));
}

.faq-table {
    min-width: 860px;
    table-layout: fixed;
}

.faq-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-strong);
}

.faq-table th:nth-child(1),
.faq-table td:nth-child(1) {
    width: 34%;
}

.faq-table th:nth-child(2),
.faq-table td:nth-child(2) {
    width: 50%;
}

.faq-table th:nth-child(3),
.faq-table td:nth-child(3) {
    width: 140px;
}

.faq-table tbody tr {
    cursor: default;
}

.faq-cell-input {
    min-height: 72px;
    resize: vertical;
    line-height: 1.4;
}

.faq-actions-cell {
    vertical-align: middle;
    text-align: right;
}

.empty-cell,
.empty-copy {
    padding: 18px 0;
}

.contact-chip,
.btn-chip,
.btn-solid,
.btn-outline {
    border-radius: 16px;
    padding: 12px 16px;
    cursor: pointer;
    transition: 0.18s ease;
}

.contact-chip,
.btn-chip,
.btn-outline {
    border: 1px solid var(--border);
    background: linear-gradient(135deg, var(--surface-soft), rgba(255, 255, 255, 0.02));
    color: var(--ink);
}

.contact-chip {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    text-align: left;
}

.contact-chip__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.contact-chip__title {
    font-weight: 700;
}

.contact-status-icons {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.contact-status-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid var(--border);
    border-radius: 999px;
}

.contact-status-icon.unread {
    background: rgba(52, 216, 255, 0.14);
    border-color: rgba(52, 216, 255, 0.42);
    box-shadow: 0 0 0 4px rgba(52, 216, 255, 0.08);
}

.contact-status-icon.unread::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(52, 216, 255, 0.7);
}

.contact-status-icon.manual {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.contact-status-icon.manual::before,
.contact-status-icon.manual::after {
    content: "";
    width: 3px;
    height: 12px;
    border-radius: 999px;
    background: currentColor;
}

.contact-status-icon.manual::after {
    margin-left: 3px;
}

.status-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.message-type-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
}

.message-type-badge.audio-skipped {
    border-color: #ffc107;
    background: #fff3cd;
    color: #856404;
}

.message-model-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0;
}

.contact-chip__meta,
.contact-header,
.contact-header__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.contact-chip__meta {
    font-size: 0.82rem;
    color: var(--muted);
}

.contact-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    border: 1px solid transparent;
}

.contact-badge.cliente {
    background: var(--ok-soft);
    color: var(--ok);
    border-color: rgba(120, 255, 191, 0.18);
}

.contact-badge.proveedor {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(255, 122, 217, 0.18);
}

.contact-badge.humano {
    background: rgba(114, 159, 255, 0.14);
    color: #9cb9ff;
    border-color: rgba(114, 159, 255, 0.22);
}

.contact-badge.unsaved {
    background: var(--surface-soft);
    color: var(--muted);
    border-color: var(--border);
}

.contact-chip.active,
.btn-chip.active,
.btn-outline:hover {
    background: linear-gradient(135deg, var(--accent-soft), var(--accent-soft-2));
    border-color: var(--border-strong);
}

.contact-chip.has-unread {
    border-color: rgba(52, 216, 255, 0.46);
}

.contact-chip.has-unread .contact-chip__title {
    color: var(--accent);
}

.btn-solid {
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: white;
    box-shadow: 0 14px 28px rgba(54, 22, 112, 0.26);
}

.btn-solid:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 24px rgba(52, 216, 255, 0.20);
}

.btn-solid.danger,
.btn-outline.danger {
    color: var(--danger);
}

.btn-outline.danger {
    border-color: rgba(255, 122, 217, 0.28);
}

.btn-solid:disabled,
.btn-outline:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.field,
.readonly-box {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    padding: 13px 14px;
    color: var(--ink);
}

.theme-light .field,
.theme-light .readonly-box {
    background: rgba(255, 255, 255, 0.72);
}

.field:focus,
.theme-switch:focus {
    outline: 2px solid rgba(52, 216, 255, 0.18);
    border-color: var(--border-strong);
}

.field-textarea {
    min-height: 130px;
    resize: vertical;
}

.field-textarea.manual-reply-textarea {
    min-height: 86px;
}

.field-textarea.tall {
    min-height: 220px;
}

.readonly-box.multiline {
    white-space: pre-wrap;
}

.readonly-box.mono,
.mono {
    font-family: Consolas, "Cascadia Code", "Courier New", monospace;
    font-size: 0.92rem;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 700;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

input[type="checkbox"] {
    accent-color: var(--accent-strong);
}

.message-card {
    border-radius: 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
}

.message-card.incoming {
    background: rgba(255, 255, 255, 0.03);
}

.message-card.outgoing {
    background: linear-gradient(135deg, var(--accent-soft), var(--accent-soft-2));
}

.theme-light .message-card.incoming {
    background: rgba(255, 255, 255, 0.64);
}

.audio-player {
    width: 100%;
    margin-top: 10px;
    filter: saturate(1.2);
}

.chat-media-image {
    max-width: 280px;
    max-height: 300px;
    border-radius: 12px;
    object-fit: cover;
    cursor: pointer;
    display: block;
}

.chat-media-image-button {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-top: 8px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: zoom-in;
}

.chat-media-image-button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.manual-image-attachment {
    display: grid;
    gap: 10px;
}

.manual-image-preview-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.manual-image-preview {
    width: 68px;
    height: 68px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.image-viewer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4, 8, 16, 0.82);
}

.image-viewer {
    width: min(1040px, 100%);
    max-height: calc(100vh - 48px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

.image-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.image-viewer-header > div {
    display: grid;
    gap: 2px;
}

.image-viewer-image {
    max-width: 100%;
    max-height: calc(100vh - 180px);
    justify-self: center;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
}

.image-viewer-caption {
    max-height: 96px;
    overflow: auto;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    white-space: pre-wrap;
}

.chat-media-video {
    max-width: 320px;
    border-radius: 12px;
    margin-top: 8px;
}

.chat-media-link {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: var(--accent);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    transition: background 0.18s;
}

.chat-media-link:hover {
    background: var(--accent-soft);
}

.message-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 0.82rem;
}

.date-filter-buttons {
    display: flex;
    gap: 6px;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.compact-action {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.86rem;
    line-height: 1.1;
}

.date-filter-btn {
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.86rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.18s;
}

.date-filter-btn:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.date-filter-btn.active {
    background: var(--accent);
    color: var(--surface);
    border-color: var(--accent);
}

.date-range-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px 18px;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
}

.date-range-inputs label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
    display: block;
}

.date-range-inputs .field {
    width: 100%;
}

.contact-registration-panel {
    display: grid;
    gap: 12px;
    margin: 12px 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.contact-registration-header,
.contact-registration-kind,
.contact-registration-grid {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-registration-header {
    justify-content: space-between;
}

.contact-registration-title {
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 800;
}

.contact-registration-phone {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.82rem;
}

.contact-registration-kind label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.contact-registration-kind input[type="radio"] {
    accent-color: var(--accent);
}

.contact-registration-grid {
    align-items: end;
}

.contact-registration-grid > div {
    flex: 1;
    min-width: 180px;
}

.contact-registration-grid .field {
    width: 100%;
}

.suggested-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.review-question-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.review-question-panel__title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.review-question-panel .field-textarea {
    min-height: 92px;
}

.manual-order-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 10, 24, 0.58);
    backdrop-filter: blur(8px);
}

.manual-order-modal {
    width: min(1080px, 100%);
    max-height: min(760px, calc(100vh - 48px));
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(3, 8, 24, 0.38);
}

.manual-order-header,
.manual-order-lines-header,
.manual-order-footer,
.manual-order-mode {
    display: flex;
    align-items: center;
    gap: 12px;
}

.manual-order-header,
.manual-order-lines-header,
.manual-order-footer {
    justify-content: space-between;
}

.manual-order-header h2,
.manual-order-lines-header h3 {
    margin: 0;
}

.manual-order-subtitle {
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88rem;
}

.manual-order-errors {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 122, 217, 0.24);
    border-radius: 12px;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 0.9rem;
}

.manual-order-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.45fr);
    gap: 14px;
}

.manual-order-mode {
    min-height: 46px;
    padding: 0 2px;
}

.manual-order-mode label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.manual-order-lines {
    display: grid;
    gap: 10px;
}

.manual-order-line {
    display: grid;
    grid-template-columns: minmax(180px, 1.5fr) minmax(90px, 0.45fr) minmax(90px, 0.45fr) minmax(90px, 0.45fr) minmax(150px, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}

.manual-order-line label,
.manual-order-grid label {
    font-size: 0.78rem;
}

.manual-order-notes {
    min-height: 76px;
}

.manual-order-footer {
    padding-top: 4px;
}

.suggested-product-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(110px, 0.45fr) minmax(120px, 0.45fr) auto;
    gap: 10px;
    align-items: end;
}

@media (max-width: 900px) {
    .manual-order-backdrop {
        align-items: stretch;
        padding: 12px;
    }

    .manual-order-modal {
        max-height: calc(100vh - 24px);
    }

    .manual-order-grid,
    .manual-order-line {
        grid-template-columns: 1fr;
    }

    .manual-order-header,
    .manual-order-lines-header,
    .manual-order-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .suggested-product-form {
        grid-template-columns: 1fr;
    }
}

.suggested-reply-btn {
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
    transition: all 0.18s;
}

.suggested-reply-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.suggested-reply-btn.confirm {
    background: var(--ok-soft);
    border-color: rgba(120, 255, 191, 0.3);
    color: var(--ok);
}

.suggested-reply-btn.confirm:hover {
    background: var(--ok);
    color: var(--surface);
}

.suggested-reply-btn.deny {
    background: var(--danger-soft);
    border-color: rgba(255, 122, 217, 0.3);
    color: var(--danger);
}

.suggested-reply-btn.deny:hover {
    background: var(--danger);
    color: var(--surface);
}

.campaign-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.campaign-layout {
    display: grid;
    grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.6fr);
    gap: 18px;
    align-items: start;
}

.campaign-list-panel,
.campaign-editor-panel {
    min-width: 0;
}

.campaign-table {
    min-width: 620px;
}

.campaign-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.54fr);
    gap: 18px;
    align-items: start;
}

.campaign-form-main,
.campaign-preview-panel,
.campaign-preview-block {
    min-width: 0;
}

.campaign-preview-panel {
    display: grid;
    gap: 14px;
}

.campaign-preview-block {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-soft);
}

.campaign-step {
    display: grid;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.campaign-step:last-of-type {
    border-bottom: 0;
    padding-bottom: 0;
}

.campaign-step-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.campaign-step-number {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-soft), var(--accent-soft-2));
    color: var(--accent);
    border: 1px solid var(--border-strong);
}

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

.campaign-message-field {
    min-height: 210px;
}

.placeholder-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.placeholder-chip {
    padding: 8px 10px;
    border-radius: 999px;
    font-family: Consolas, "Cascadia Code", monospace;
    font-size: 0.82rem;
}

.campaign-image-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.campaign-image-editor-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 0.82fr);
    gap: 14px;
    align-items: start;
}

.campaign-image-editor {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-strong);
    touch-action: none;
}

.campaign-image-editor-image {
    display: block;
    width: 100%;
    height: auto;
}

.campaign-text-box {
    position: absolute;
    display: grid;
    place-items: center;
    min-width: 42px;
    min-height: 34px;
    padding: 6px;
    border: 2px solid rgba(255, 255, 255, 0.92);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.16);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.32), 0 10px 28px rgba(0, 0, 0, 0.25);
    cursor: move;
    overflow: hidden;
}

.campaign-text-box span:first-child {
    display: block;
    width: 100%;
    font-weight: 700;
    line-height: 1;
    overflow-wrap: anywhere;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.campaign-text-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    border-top: 2px solid rgba(255, 255, 255, 0.9);
    border-left: 2px solid rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.34);
    cursor: nwse-resize;
}

.campaign-image-text-controls {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.campaign-image-text-field {
    min-height: 92px;
}

.campaign-image-control-grid,
.campaign-position-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.campaign-position-grid label {
    display: grid;
    gap: 6px;
}

.field-color {
    min-height: 44px;
    padding: 6px;
}

.campaign-audience-list,
.campaign-recipient-log {
    display: grid;
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
}

.campaign-audience-item,
.campaign-recipient-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
}

.campaign-audience-item {
    flex-direction: column;
    align-items: flex-start;
}

.campaign-recipient-row > span:first-child {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.campaign-phone-preview {
    display: grid;
    gap: 10px;
    padding: 16px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(17, 35, 40, 0.92), rgba(11, 18, 28, 0.95)),
        var(--surface-strong);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.campaign-preview-image-frame {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.04);
}

.campaign-preview-image {
    display: block;
    width: 100%;
    height: auto;
}

.campaign-preview-text-box {
    position: absolute;
    display: grid;
    place-items: center;
    min-width: 18px;
    min-height: 16px;
    padding: 2px;
    overflow: hidden;
    pointer-events: none;
}

.campaign-preview-text-box span {
    display: block;
    width: 100%;
    font-weight: 700;
    line-height: 1;
    overflow-wrap: anywhere;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.campaign-phone-bubble {
    justify-self: start;
    max-width: 100%;
    padding: 12px 14px;
    border-radius: 0 16px 16px 16px;
    background: #f4fff7;
    color: #163225;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.45;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.custom-reply-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
    align-items: center;
}

.custom-reply-field {
    min-height: 40px;
    font-size: 0.88rem;
    padding: 8px 14px;
}

.custom-reply-send {
    height: 40px;
    padding: 0 18px;
    white-space: nowrap;
    font-size: 0.88rem;
}

.custom-reply-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0 0;
}

.info-grid dt {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.info-grid dd {
    margin: 8px 0 0;
    font-weight: 700;
}

.feedback {
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--ok-soft);
    color: var(--ok);
    border: 1px solid rgba(120, 255, 191, 0.18);
}

.feedback.error {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(255, 122, 217, 0.18);
}

.feedback-panel {
    grid-column: 1 / -1;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
    padding-bottom: 80px;
}

.login-card {
    width: min(460px, 100%);
    padding: 28px;
}

.public-shell {
    min-height: 100vh;
    padding: 28px 24px 40px;
    color: #2f2418;
    background:
        radial-gradient(circle at top left, rgba(231, 199, 154, 0.35), transparent 28%),
        linear-gradient(180deg, #fbf7f1 0%, #f3ede3 100%);
}

.public-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 0 auto 24px;
    max-width: 1360px;
}

.public-shell .eyebrow {
    color: #9a6a2f;
}

.public-shell .top-title {
    color: #312417;
}

.public-tagline {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: #fffaf3;
    border: 1px solid #e2d1bc;
    color: #7a5a35;
    font-weight: 700;
}

.public-content {
    max-width: 1360px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.portal-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 28px;
    border-radius: 24px;
    border: 1px solid #e4d5c3;
    background: linear-gradient(135deg, #fffdf8, #f6efe6);
    box-shadow: 0 18px 34px rgba(109, 81, 41, 0.10);
}

.portal-copy {
    max-width: 640px;
    line-height: 1.7;
    margin: 12px 0 0;
    color: #6d5a45;
}

.portal-hero-actions,
.portal-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.portal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.95fr);
    gap: 18px;
}

.portal-products,
.portal-summary {
    min-height: 640px;
}

.portal-card {
    padding: 22px;
    border-radius: 24px;
    border: 1px solid #e4d5c3;
    background: rgba(255, 252, 247, 0.96);
    box-shadow: 0 18px 34px rgba(109, 81, 41, 0.08);
}

.public-shell .panel-header h2,
.public-shell strong,
.public-shell label {
    color: #3c2d1c;
}

.public-shell .muted,
.public-shell .field-hint,
.public-shell .empty-copy,
.public-shell .portal-cart-main span,
.public-shell .pill.neutral {
    color: #7f6b55;
}

.public-shell .pill,
.public-shell .pill.neutral {
    background: #f7efe4;
    border-color: #eadbc8;
}

.public-shell .pill {
    color: #8b5f28;
}

.public-shell .field,
.public-shell .readonly-box {
    background: #fffdfa;
    border-color: #dcc9b3;
    color: #2f2418;
}

.public-shell .field::placeholder {
    color: #a08a72;
}

.public-shell .btn-outline,
.public-shell .btn-chip {
    background: #fffaf3;
    border-color: #d8c3ab;
    color: #6f5231;
}

.public-shell .btn-outline:hover,
.public-shell .btn-chip:hover,
.public-shell .btn-chip.active {
    background: #f4e7d5;
    border-color: #c9ab84;
}

.public-shell .btn-solid {
    background: linear-gradient(135deg, #c8843f, #9f6023);
    border-color: #9f6023;
    box-shadow: 0 12px 24px rgba(159, 96, 35, 0.18);
}

.public-shell .btn-solid:hover {
    box-shadow: 0 14px 28px rgba(159, 96, 35, 0.24);
}

.portal-product-list,
.portal-cart-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.portal-product-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.portal-mobile-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 32px 20px;
    border-radius: 20px;
    border: 2px dashed #e2d1bc;
    background: #fffdf8;
    color: #6d5a45;
    grid-column: 1 / -1;
}

.portal-mobile-hint-icon {
    font-size: 2rem;
}

.portal-mobile-hint strong {
    font-size: 1.05rem;
    color: #3c2d1c;
}

.portal-mobile-hint span {
    font-size: 0.88rem;
    line-height: 1.5;
    color: #7f6b55;
}

.portal-product-card,
.portal-cart-item {
    border-radius: 20px;
    border: 1px solid #eadcc9;
    background: #fff;
    padding: 16px;
}

.portal-product-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
}

.portal-product-card h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.portal-cart-item {
    display: grid;
    gap: 12px;
}

.portal-cart-main {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}

.portal-qty-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.portal-qty-input {
    max-width: 120px;
    text-align: center;
}

.portal-cart-footer,
.portal-total-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.portal-line-total {
    font-weight: 800;
    color: #3c2d1c;
}

.portal-total-row {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e6d8c6;
    font-size: 1.05rem;
}

.public-shell .feedback {
    background: #eef8ef;
    color: #2f7d35;
    border-color: #c8e0ca;
}

.public-shell .feedback.error {
    background: #fff1ef;
    color: #b24a3e;
    border-color: #ebc4be;
}

/* ── Mobile step bar ── */

.m-step-bar {
    display: none;
}

.m-hidden {
    display: none !important;
}

.m-fab-cart {
    display: none;
}

.m-human-btn {
    display: none;
}

/* ── Floating "Hablar con un humano" button ── */

.fab-human {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 55;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    border-radius: 999px;
    border: 1px solid #e4d5c3;
    background: #fffdf8;
    color: #6f5231;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(109, 81, 41, 0.18);
    transition: transform 0.15s, box-shadow 0.15s;
}

.fab-human:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(109, 81, 41, 0.26);
}

#blazor-error-ui {
    position: fixed;
    inset: auto 20px 20px 20px;
    background: #75195b;
    color: #fff;
    padding: 14px 18px;
    border-radius: 16px;
    display: none;
    box-shadow: 0 18px 32px rgba(117, 25, 91, 0.32);
}

#blazor-error-ui .reload {
    color: #fff;
    text-decoration: underline;
    margin-left: 10px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    margin-left: 12px;
}

@media (max-width: 1100px) {
    .shell,
    .split-layout,
    .chat-layout,
    .chat-layout.has-actions-panel,
    .campaign-layout,
    .campaign-form-grid,
    .campaign-image-editor-grid,
    .panel-grid,
    .stats-grid,
    .portal-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid,
    .campaign-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar-shell {
        position: relative;
        height: auto;
    }

    .side-panel,
    .contacts-panel,
    .conversation-panel,
    .chat-actions-panel {
        min-height: auto;
    }

    .portal-products,
    .portal-summary {
        min-height: auto;
    }
}

@media (max-width: 720px) {
    .main-shell,
    .sidebar-shell {
        padding: 14px;
    }

    h1 {
        font-size: 1.4rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .campaign-stats,
    .campaign-fields-grid,
    .campaign-image-control-grid,
    .campaign-position-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 1.6rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .page-header .button-row {
        justify-content: stretch;
    }

    .page-header .button-row > * {
        flex: 1;
        text-align: center;
    }

    .hero-card {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
    }

    .top-shell {
        flex-direction: column;
        align-items: start;
    }

    .panel-card {
        padding: 16px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .filter-row {
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 8px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .filter-row .btn-chip {
        flex-shrink: 0;
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .data-table {
        min-width: 540px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
        font-size: 0.88rem;
    }

    .btn-solid,
    .btn-outline,
    .btn-chip {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .contacts-list {
        max-height: 200px;
        overflow-y: auto;
    }

    .message-stack {
        max-height: 50vh;
    }

    .public-topbar,
    .portal-hero {
        flex-direction: column;
        align-items: start;
    }

    .public-shell {
        padding: 16px 12px 28px;
    }

    .portal-card {
        padding: 16px;
    }

    .portal-hero {
        padding: 20px;
    }

    .portal-hero h1 {
        font-size: 1.4rem;
    }

    .portal-hero-actions {
        width: 100%;
    }

    .portal-hero-actions .btn-solid,
    .portal-hero-actions .btn-outline {
        flex: 1;
        text-align: center;
    }

    .portal-product-list {
        grid-template-columns: 1fr;
    }

    .portal-product-card {
        flex-direction: column;
        gap: 10px;
    }

    .portal-product-card .btn-chip {
        align-self: flex-start;
    }

    .portal-actions {
        flex-direction: column;
    }

    .portal-actions .btn-solid,
    .portal-actions .btn-outline {
        width: 100%;
        text-align: center;
    }

    .data-table {
        min-width: 640px;
    }

    .gdlsoft-footer {
        flex-direction: column;
    }

    /* ── Mobile e-commerce flow ── */

    .portal-copy-desktop,
    .portal-hero-actions-desktop {
        display: none;
    }

    .portal-hero {
        padding: 16px 20px;
    }

    .portal-hero h1 {
        font-size: 1.25rem;
        margin: 0;
    }

    .m-step-bar {
        display: flex;
        gap: 0;
        background: #fffaf3;
        border: 1px solid #e4d5c3;
        border-radius: 16px;
        overflow: hidden;
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .m-step-tab {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 14px 12px;
        border: none;
        background: transparent;
        color: #7f6b55;
        font-size: 0.92rem;
        font-weight: 600;
        cursor: pointer;
        transition: background 0.2s, color 0.2s;
        position: relative;
    }

    .m-step-tab.active {
        background: linear-gradient(135deg, #c8843f, #9f6023);
        color: #fff;
    }

    .m-step-icon {
        font-size: 1.1rem;
    }

    .m-step-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        border-radius: 999px;
        background: #fff;
        color: #9f6023;
        font-size: 0.72rem;
        font-weight: 800;
        line-height: 1;
    }

    .m-step-tab.active .m-step-badge {
        background: rgba(255,255,255,0.3);
        color: #fff;
    }

    .m-fab-cart {
        display: flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        bottom: 72px;
        left: 16px;
        right: 16px;
        z-index: 60;
        padding: 16px 20px;
        border: none;
        border-radius: 18px;
        background: linear-gradient(135deg, #c8843f, #9f6023);
        color: #fff;
        font-size: 1rem;
        font-weight: 700;
        cursor: pointer;
        box-shadow: 0 12px 32px rgba(159, 96, 35, 0.35);
        transition: transform 0.15s, box-shadow 0.15s;
    }

    .m-fab-cart:active {
        transform: scale(0.97);
    }

    .m-fab-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 24px;
        height: 24px;
        padding: 0 7px;
        border-radius: 999px;
        background: rgba(255,255,255,0.3);
        font-size: 0.82rem;
        font-weight: 800;
    }

    .m-fab-total {
        margin-left: auto;
        font-size: 1.05rem;
    }

    .portal-card {
        border-radius: 18px;
    }

    .portal-summary {
        padding-bottom: 24px;
    }
}

/* ── GDLSOFT Footer ── */

.gdlsoft-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 20px 24px;
    margin-top: 32px;
    font-size: 0.82rem;
    color: var(--muted, #a79fc7);
    text-align: center;
    border-top: 1px solid var(--border, rgba(135, 93, 255, 0.24));
}

.gdlsoft-footer-heart {
    font-size: 1rem;
}

.gdlsoft-footer-link {
    font-weight: 800;
    color: var(--accent, #34d8ff);
    text-decoration: none;
    transition: color 0.2s ease;
}

.gdlsoft-footer-link:hover {
    color: var(--accent-strong, #a63dff);
    text-decoration: underline;
}

.gdlsoft-footer-slogan {
    display: block;
    width: 100%;
    font-size: 0.75rem;
    font-style: italic;
    color: var(--muted, #a79fc7);
    opacity: 0.8;
    margin-top: 2px;
}

.gdlsoft-footer-login {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin-top: 0;
    border-top: none;
}

/* Public portal footer overrides */

.gdlsoft-footer-public {
    color: #7a5a35;
    border-top-color: #e2d1bc;
}

.gdlsoft-footer-link-public {
    color: #9a6a2f;
}

.gdlsoft-footer-link-public:hover {
    color: #6d4520;
}

.gdlsoft-footer-slogan-public {
    color: #9a7b52;
}

.privacy-shell {
    min-height: 100vh;
    padding: 32px 20px 80px;
    background:
        radial-gradient(circle at top left, rgba(52, 216, 255, 0.10), transparent 26%),
        radial-gradient(circle at top right, rgba(166, 61, 255, 0.10), transparent 22%),
        linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.privacy-main {
    max-width: 920px;
    margin: 0 auto;
}

.privacy-card {
    padding: 32px;
    border-radius: 28px;
    background: linear-gradient(180deg, var(--surface-strong), var(--surface));
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.privacy-lead {
    margin-top: 14px;
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--muted);
}

.privacy-section {
    margin-top: 24px;
}

.privacy-section h2 {
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.privacy-section p,
.privacy-list {
    margin: 0;
    line-height: 1.75;
    color: var(--ink);
}

.privacy-list {
    padding-left: 22px;
}

.privacy-updated,
.privacy-footer {
    color: var(--muted);
}

.privacy-updated {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 0.92rem;
}

.privacy-footer {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 18px 20px 28px;
    font-size: 0.86rem;
}

@media (max-width: 720px) {
    .privacy-shell {
        padding: 16px 12px 48px;
    }

    .privacy-card {
        padding: 20px;
        border-radius: 22px;
    }
}
