:root {
    color-scheme: light;
    --navy: #c90016;
    --navy-soft: #a80012;
    --teal: #b80014;
    --teal-soft: #fff0f2;
    --ink: #25252b;
    --muted: #66616a;
    --line: #eadfe2;
    --surface: #fff;
    --canvas: #faf7f8;
    --success: #147a4b;
    --success-soft: #e9f7ef;
    --warning: #9a5a08;
    --warning-soft: #fff4df;
    --danger: #b42318;
    --shadow: 0 20px 60px rgba(7, 28, 43, .10);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }

.login-layout { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 10%, rgba(29,123,145,.20), transparent 34%), linear-gradient(145deg, #061925 0%, #0c2f41 48%, #eef4f6 48%, #f7f9fa 100%); }
.login-card { width: min(100%, 440px); padding: 40px; border: 1px solid rgba(255,255,255,.65); border-radius: 24px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: linear-gradient(145deg, var(--teal), var(--navy)); font-size: 24px; font-weight: 800; box-shadow: 0 10px 24px rgba(201,0,22,.12); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 19px; }
.eyebrow { margin: 0 0 6px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .11em; }
.login-card .eyebrow { margin-top: 24px; }
.login-card h1 { margin: 0; font-size: clamp(28px, 5vw, 36px); letter-spacing: -.03em; }
.login-description { margin: 12px 0 28px; color: var(--muted); line-height: 1.65; }
label { display: block; margin: 17px 0 7px; font-size: 13px; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; outline: none; transition: border-color .2s, box-shadow .2s; }
input { height: 48px; padding: 0 14px; }
textarea { min-height: 48px; max-height: 140px; resize: none; padding: 13px 14px; line-height: 1.45; }
input:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(201,0,22,.12); }
.primary-button, .ghost-button, .resolve-button, .icon-button, .attach-button, .filter-button { border: 0; border-radius: 11px; font-weight: 750; }
.primary-button { min-height: 44px; padding: 0 18px; color: #fff; background: var(--navy); }
.primary-button:hover { background: var(--navy-soft); }
.primary-button.full-width { width: 100%; margin-top: 22px; }
.primary-button.compact { min-height: 38px; padding: 0 13px; font-size: 13px; white-space: nowrap; }
.ghost-button { padding: 10px 14px; color: var(--navy); background: #fff0f2; }
.form-message { min-height: 20px; margin: 13px 0 0; color: var(--danger); font-size: 13px; line-height: 1.45; }

.portal { min-height: 100vh; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); position: sticky; top: 0; z-index: 20; }
.topbar-brand, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-brand strong, .topbar-brand span { display: block; }
.topbar-brand strong { font-size: 15px; }
.topbar-brand span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.membership-badge { padding: 7px 10px; border-radius: 999px; color: var(--success); background: var(--success-soft); font-size: 12px; font-weight: 700; }
.workspace { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.case-sidebar { border-right: 1px solid var(--line); padding: 24px 18px; background: #f9fbfc; overflow-y: auto; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sidebar-heading h2 { margin: 0; font-size: 19px; }
.case-filters { display: flex; gap: 6px; margin: 20px 0 14px; }
.filter-button { padding: 8px 11px; color: var(--muted); background: transparent; font-size: 12px; }
.filter-button.active { color: var(--navy); background: var(--teal-soft); }
.case-list { display: grid; gap: 9px; }
.case-item { width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 14px; text-align: left; background: var(--surface); transition: border-color .2s, transform .2s, box-shadow .2s; }
.case-item:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(7,28,43,.07); }
.case-item.active { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(201,0,22,.10); }
.case-item-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.case-number { color: var(--ink); font-size: 13px; font-weight: 800; }
.case-count { margin-top: 9px; color: var(--muted); font-size: 11px; }
.status-chip { padding: 4px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.status-open { color: var(--success); background: var(--success-soft); }
.status-resolved { color: #285ea8; background: #eaf1fc; }
.status-closed, .status-legacy_closed { color: #5d6670; background: #edf0f2; }
.empty-list { padding: 24px 14px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.5; }

.conversation-panel { min-width: 0; display: flex; flex-direction: column; height: calc(100vh - 72px); background: var(--surface); }
.conversation-header { min-height: 94px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 30px; border-bottom: 1px solid var(--line); }
.conversation-header h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.conversation-meta { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.resolve-button { min-height: 40px; padding: 0 14px; color: var(--success); background: var(--success-soft); white-space: nowrap; }
.portal-notice { margin: 14px 30px 0; padding: 11px 13px; border-radius: 10px; color: var(--warning); background: var(--warning-soft); font-size: 13px; }
.portal-notice.error { color: var(--danger); background: #fff0ee; }
.chat-messages { flex: 1; overflow-y: auto; padding: 28px 30px; display: flex; flex-direction: column; gap: 16px; scroll-behavior: auto; }
.message-row { display: flex; flex-direction: column; max-width: min(76%, 720px); }
.message-row.user { align-self: flex-end; align-items: flex-end; }
.message-row.assistant { align-self: flex-start; align-items: flex-start; }
.message-bubble { padding: 13px 15px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 14px; }
.message-row.user .message-bubble { color: #fff; background: var(--navy); border-bottom-right-radius: 5px; }
.message-row.assistant .message-bubble { color: var(--ink); background: #faf7f8; border-bottom-left-radius: 5px; }
.message-attachment-link { display: block; width: min(360px, 100%); margin-top: 7px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.message-attachment-image { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #f7f9fa; }
.message-time { margin-top: 5px; color: var(--muted); font-size: 10px; }
.welcome-state { margin: auto; max-width: 560px; padding: 28px; text-align: center; }
.welcome-icon { width: 60px; height: 60px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 18px; background: var(--teal-soft); font-size: 28px; }
.welcome-state h2 { margin: 0; font-size: 24px; }
.welcome-state p { margin: 10px 0 0; color: var(--muted); line-height: 1.65; }
.closed-case-notice { margin: 0 30px 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #f7f9fa; }
.closed-case-notice strong, .closed-case-notice span { display: block; }
.closed-case-notice span { margin: 4px 0 12px; color: var(--muted); font-size: 12px; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 18px 30px 24px; border-top: 1px solid var(--line); background: #fff; }
.composer-field { flex: 1; min-width: 0; }
.attach-button { width: 48px; height: 48px; flex: 0 0 48px; color: var(--navy); background: #fff0f2; font-size: 19px; }
.send-button { height: 48px; }
.selected-image { margin-top: 7px; color: var(--teal); font-size: 11px; font-weight: 700; }
.composer-hint { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.mobile-only { display: none; }

@media (max-width: 820px) {
    .topbar { padding: 0 14px; }
    .membership-badge { display: none; }
    .mobile-only { display: inline-grid; place-items: center; }
    .icon-button { width: 38px; height: 38px; background: #fff0f2; }
    .workspace { display: block; }
    .case-sidebar { position: fixed; inset: 72px auto 0 0; width: min(88vw, 340px); z-index: 15; transform: translateX(-105%); transition: transform .22s; box-shadow: var(--shadow); }
    .case-sidebar.open { transform: translateX(0); }
    .conversation-panel { height: calc(100vh - 72px); }
    .conversation-header { min-height: 84px; padding: 16px; }
    .conversation-header h1 { font-size: 18px; }
    .resolve-button { font-size: 0; width: 40px; padding: 0; }
    .resolve-button::after { content: "✓"; font-size: 18px; }
    .chat-messages { padding: 20px 16px; }
    .message-row { max-width: 88%; }
    .composer { padding: 12px 12px max(14px, env(safe-area-inset-bottom)); }
    .closed-case-notice, .portal-notice { margin-left: 16px; margin-right: 16px; }
}
@media (max-width: 480px) {
    .login-layout { padding: 12px; background: var(--canvas); }
    .login-card { padding: 28px 22px; border-radius: 19px; }
    .topbar-brand span, .membership-badge { display: none; }
    .topbar-actions { gap: 6px; }
    .ghost-button { padding: 9px 10px; }
    .conversation-meta { max-width: 230px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .attach-button { width: 44px; height: 46px; flex-basis: 44px; }
    .send-button { min-width: 74px; padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

/* VINPIN red / white identity, v61 */
.login-layout{background:radial-gradient(ellipse at top left,#ffe1e6,transparent 60%),#faf7f8}
.login-card{border:1px solid var(--line);border-top:4px solid var(--navy);box-shadow:0 20px 60px #55001012}
.brand-mark.brand-wordmark{width:150px;height:49px;background:transparent;border-radius:0;box-shadow:none}
.brand-mark.small.brand-wordmark{width:110px;height:36px}
.brand-wordmark img{display:block;width:100%;height:100%;object-fit:contain}
.topbar{border-top:3px solid var(--navy)}
@media(max-width:600px){.topbar{padding:0 12px;gap:8px}.topbar-brand{gap:8px;min-width:0}.brand-mark.small.brand-wordmark{width:80px;height:27px;flex-shrink:0}.topbar-brand strong{font-size:12px}.topbar-actions{gap:6px}.ghost-button{padding:9px 10px}}

.language-picker { display:inline-flex; align-items:center; gap:.35rem; margin:.5rem; font-size:.9rem; }
.language-picker select { max-width:9rem; padding:.35rem .5rem; border:1px solid #ddd; border-radius:.4rem; background:#fff; color:#222; font:inherit; }
.chat__header { flex-wrap:wrap; }
