:root {
  color-scheme: light;
  --wine:#741522;
  --wine-dark:#471018;
  --wine-soft:#f8ecee;
  --ink:#171318;
  --muted:#746b70;
  --subtle:#9d9599;
  --canvas:#f5f3f1;
  --surface:#fff;
  --surface-soft:#faf8f6;
  --line:#e6e0dc;
  --line-strong:#d5ccc7;
  --success:#7b0f19;
  --success-soft:#f8ecee;
  --warning:#a36a12;
  --warning-soft:#fff5df;
  --danger:#a52a38;
  --danger-soft:#fae9eb;
  --sidebar:#21181c;
  --shadow:0 18px 60px rgba(35,22,27,.08);
  --radius:18px;
}

* { box-sizing:border-box; }
[hidden] { display:none !important; }
html { min-width:320px; background:var(--canvas); }
body { margin:0; min-height:100vh; background:var(--canvas); color:var(--ink); font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; -webkit-font-smoothing:antialiased; }
button,input,select,textarea { font:inherit; }
button,a,input,select,textarea { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible { outline:3px solid rgba(116,21,34,.2); outline-offset:2px; }

.eyebrow,.page-kicker,.nav-caption { margin:0 0 8px; color:var(--wine); font-size:10px; font-weight:750; letter-spacing:.14em; text-transform:uppercase; }
h1,h2,h3,p { margin-top:0; }
h1,h2,h3 { letter-spacing:-.025em; }
.button { display:inline-flex; min-height:42px; align-items:center; justify-content:center; gap:8px; border:1px solid transparent; border-radius:11px; padding:10px 16px; font-size:13px; font-weight:700; text-decoration:none; transition:background .18s ease,border-color .18s ease,transform .18s ease,opacity .18s ease; }
.button:hover:not(:disabled) { transform:translateY(-1px); }
.button.primary { background:var(--wine); color:#fff; }
.button.primary:hover:not(:disabled) { background:var(--wine-dark); }
.button.secondary { border-color:var(--line-strong); background:#fff; color:var(--ink); }
.button.ghost { border-color:var(--line); background:transparent; color:var(--ink); }
.button.danger { background:var(--danger); color:#fff; }
.button.compact { min-height:36px; padding:8px 13px; font-size:12px; }
.button.wide { width:100%; }
.button:disabled { cursor:not-allowed; opacity:.48; transform:none; }

/* Authentication */
.auth-shell { min-height:100vh; display:grid; grid-template-columns:minmax(360px,.88fr) minmax(440px,1.12fr); }
.auth-brand { position:relative; overflow:hidden; display:grid; grid-template-columns:auto 1fr; align-content:start; gap:0 15px; min-height:100vh; padding:52px clamp(36px,6vw,92px); background:var(--sidebar); color:#fff; }
.auth-brand::before { content:""; position:absolute; width:520px; height:520px; right:-300px; bottom:-240px; border:1px solid rgba(255,255,255,.11); border-radius:50%; box-shadow:0 0 0 90px rgba(255,255,255,.025),0 0 0 180px rgba(255,255,255,.018); }
.brand-mark,.sidebar-logo { display:grid; place-items:center; flex:0 0 auto; border:1px solid currentColor; border-radius:50%; font-family:Georgia,serif; font-style:italic; }
.brand-mark { width:46px; height:46px; color:#eed6d8; font-size:25px; }
.brand-name { margin:3px 0 2px; font-size:15px; font-weight:800; letter-spacing:.06em; }
.brand-caption { margin:0; color:rgba(255,255,255,.52); font-size:9px; letter-spacing:.15em; }
.auth-brand-copy { position:relative; z-index:1; grid-column:1 / -1; align-self:center; max-width:620px; margin-top:15vh; }
.auth-brand-copy .eyebrow { color:#d99ba3; }
.auth-brand-copy h1 { margin:0 0 28px; font-family:Georgia,serif; font-size:clamp(52px,6vw,88px); font-weight:400; line-height:.96; letter-spacing:-.045em; }
.auth-brand-copy > p:last-child { max-width:480px; color:rgba(255,255,255,.66); font-size:16px; line-height:1.65; }
.auth-security { position:absolute; left:clamp(36px,6vw,92px); bottom:38px; margin:0; color:rgba(255,255,255,.4); font-size:11px; }
.auth-card { align-self:center; width:min(480px,calc(100% - 64px)); margin:0 auto; padding:46px; border:1px solid var(--line); border-radius:24px; background:#fff; box-shadow:var(--shadow); }
.auth-card-head h2 { margin:0 0 10px; font-size:34px; }
.auth-card-head > p:last-child,.auth-help { color:var(--muted); font-size:13px; line-height:1.55; }
.auth-form { display:grid; gap:18px; margin-top:34px; }
.auth-help { margin:24px 0 0; padding-top:20px; border-top:1px solid var(--line); }

/* Main shell */
.crm-layout { min-height:100vh; display:grid; grid-template-columns:250px minmax(0,1fr); }
.crm-sidebar { position:sticky; top:0; z-index:20; display:flex; flex-direction:column; height:100vh; padding:26px 18px 20px; background:var(--sidebar); color:#fff; }
.sidebar-brand { display:flex; align-items:center; gap:12px; margin:0 8px 38px; color:#fff; text-decoration:none; }
.sidebar-logo { width:40px; height:40px; color:#e7b9bf; font-size:21px; }
.sidebar-brand b { display:block; font-size:13px; letter-spacing:.05em; }
.sidebar-brand small { display:block; margin-top:3px; color:rgba(255,255,255,.4); font-size:8px; letter-spacing:.13em; }
.sidebar-nav { display:grid; gap:4px; }
.nav-caption { margin:0 12px 12px; color:rgba(255,255,255,.34); font-size:8px; }
.nav-item { display:flex; width:100%; align-items:center; justify-content:space-between; border:0; border-radius:10px; padding:11px 13px; background:transparent; color:rgba(255,255,255,.65); font-size:13px; text-align:left; transition:background .18s,color .18s; }
.nav-item small { color:rgba(255,255,255,.24); font-size:9px; }
.nav-item:hover { background:rgba(255,255,255,.055); color:#fff; }
.nav-item.active { background:#fff; color:var(--wine-dark); font-weight:750; box-shadow:0 8px 24px rgba(0,0,0,.14); }
.nav-item.active small { color:var(--wine); }
.sidebar-footer { display:flex; align-items:center; gap:9px; margin-top:auto; padding:18px 8px 0; border-top:1px solid rgba(255,255,255,.1); }
.sidebar-user { display:flex; min-width:0; flex:1; align-items:center; gap:9px; }
.user-avatar { display:grid; width:34px; height:34px; place-items:center; flex:0 0 auto; border-radius:50%; background:rgba(255,255,255,.12); color:#e7b9bf; font:italic 17px Georgia,serif; }
.sidebar-user b,.sidebar-user small { display:block; overflow:hidden; max-width:115px; text-overflow:ellipsis; white-space:nowrap; }
.sidebar-user b { font-size:11px; }
.sidebar-user small { margin-top:3px; color:rgba(255,255,255,.42); font-size:9px; text-transform:uppercase; }
.sidebar-logout { border:0; padding:7px; background:transparent; color:rgba(255,255,255,.48); font-size:10px; }
.sidebar-logout:hover { color:#fff; }
.crm-workspace { min-width:0; padding:34px clamp(26px,4vw,64px) 80px; }
.crm-topbar { display:flex; align-items:flex-start; justify-content:space-between; gap:28px; margin-bottom:20px; }
.crm-topbar h1 { margin:0; font-size:clamp(30px,4vw,45px); font-weight:720; }
.section-subtitle { margin:8px 0 0; color:var(--muted); font-size:13px; }
.topbar-actions { display:flex; align-items:center; gap:12px; padding-top:6px; }
.topbar-clock { color:var(--muted); font-size:12px; white-space:nowrap; }
.crm-event-timer { display:grid; min-width:190px; max-width:280px; gap:3px; border:1px solid var(--line); border-radius:11px; padding:8px 12px; background:#fff; color:var(--ink); text-align:left; box-shadow:0 4px 18px rgba(35,22,27,.04); }
.crm-event-timer span { overflow:hidden; color:var(--muted); font-size:8px; font-weight:800; letter-spacing:.08em; text-overflow:ellipsis; white-space:nowrap; }
.crm-event-timer b { overflow:hidden; font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.crm-event-timer.live { border-color:#d7aeb4; background:var(--wine-soft); color:var(--wine); }
.crm-event-timer.live span { color:var(--wine); }
.crm-event-timer.empty { background:var(--surface-soft); color:var(--muted); }
.system-banner { display:flex; align-items:center; min-height:48px; margin:0 0 24px; padding:11px 15px; border:1px solid #efcfad; border-radius:12px; background:var(--warning-soft); color:#6f470c; font-size:12px; line-height:1.5; }
.system-banner.ready { border-color:#d7aeb4; background:var(--success-soft); color:var(--wine); }
.tab-panel { animation:panel-in .18s ease both; }
@keyframes panel-in { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }

/* Shared workspace components */
.page-actions { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin:8px 0 24px; }
.page-actions h2 { margin:0 0 7px; font-size:29px; }
.page-actions p:not(.page-kicker) { margin:0; color:var(--muted); font-size:13px; }
.page-kicker { color:var(--subtle); }
.action-row,.filters { display:flex; flex-wrap:wrap; align-items:center; gap:9px; }
.filters input,.filters select { width:auto; min-width:180px; }
.workspace-card { min-width:0; padding:24px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); box-shadow:0 5px 24px rgba(35,22,27,.035); }
.workspace-card.flat { border-radius:13px; box-shadow:none; }
.workspace-card h2 { margin:0; font-size:20px; }
.card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin-bottom:20px; }
.text-button { border:0; padding:5px 0; background:transparent; color:var(--wine); font-size:11px; font-weight:700; }
.dashboard-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.span-two { grid-column:span 2; }
.two-column { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; align-items:start; }
.two-column.wide-left { grid-template-columns:1.12fr .88fr; }
.separated { margin-top:24px; padding-top:24px; border-top:1px solid var(--line); }
.helper-copy { margin:0 0 20px; color:var(--muted); font-size:12px; line-height:1.55; }
.message { min-height:18px; margin:8px 0 0; color:var(--wine); font-size:12px; line-height:1.45; }
.invite-result { margin-top:18px; padding:18px; border:1px solid #d7aeb4; border-radius:13px; background:var(--wine-soft); }
.invite-result label { margin-bottom:12px; color:var(--wine-dark); }
.invite-result input[readonly] { background:#fff; color:var(--ink); }
.invite-result .helper-copy { margin:0; }
.empty-state { padding:36px 20px; border:1px dashed var(--line-strong); border-radius:14px; text-align:center; }
.empty-state b { display:block; margin-bottom:7px; font-size:15px; }
.empty-state p { margin:0; color:var(--muted); font-size:12px; }

/* Dashboard */
.quick-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.quick-action { display:flex; min-height:88px; align-items:center; gap:14px; border:1px solid var(--line); border-radius:15px; padding:15px 17px; background:#fff; color:var(--ink); text-align:left; box-shadow:0 4px 16px rgba(35,22,27,.025); }
.quick-action:hover { border-color:#d5b8bd; background:#fffdfc; }
.quick-action.accent { border-color:var(--wine); background:var(--wine); color:#fff; }
.quick-icon { display:grid; width:34px; height:34px; place-items:center; flex:0 0 auto; border-radius:10px; background:var(--wine-soft); color:var(--wine); font-size:17px; }
.quick-action.accent .quick-icon { background:rgba(255,255,255,.14); color:#fff; }
.quick-action b,.quick-action small { display:block; }
.quick-action b { margin-bottom:5px; font-size:13px; }
.quick-action small { color:var(--muted); font-size:10px; }
.quick-action.accent small { color:rgba(255,255,255,.65); }
.metric-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:0 0 16px; }
.metric { position:relative; min-height:112px; overflow:hidden; padding:18px; border:1px solid var(--line); border-radius:15px; background:#fff; }
.metric::after { content:""; position:absolute; width:66px; height:66px; right:-25px; bottom:-31px; border:12px solid var(--wine-soft); border-radius:50%; }
.metric span { display:block; color:var(--muted); font-size:10px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; }
.metric b { display:block; margin-top:23px; color:var(--ink); font-size:28px; letter-spacing:-.04em; }
.metric small { display:block; margin-top:5px; color:var(--success); font-size:9px; }
.compact-list { display:grid; gap:10px; }
.compact-item { display:flex; align-items:center; justify-content:space-between; gap:15px; padding:14px 0; border-bottom:1px solid var(--line); }
.compact-item:last-child { border-bottom:0; }
.compact-item-main { min-width:0; }
.compact-item b { display:block; overflow:hidden; margin-bottom:5px; font-size:13px; text-overflow:ellipsis; white-space:nowrap; }
.compact-item p { margin:0; color:var(--muted); font-size:10px; line-height:1.45; }
.compact-item-actions { display:flex; align-items:center; gap:8px; flex:0 0 auto; }
.status-list { display:grid; gap:13px; }
.status-row { display:flex; align-items:center; justify-content:space-between; gap:12px; font-size:11px; }
.status-row span:first-child { display:flex; align-items:center; gap:8px; color:var(--muted); }
.status-row b { font-size:10px; }
.status-dot { width:8px; height:8px; flex:0 0 auto; border-radius:50%; background:var(--subtle); box-shadow:0 0 0 4px rgba(157,149,153,.12); }
.status-dot.ready { background:var(--success); box-shadow:0 0 0 4px rgba(116,21,34,.11); }
.status-dot.warning { background:var(--warning); box-shadow:0 0 0 4px rgba(163,106,18,.11); }
.status-dot.danger { background:var(--danger); box-shadow:0 0 0 4px rgba(165,42,56,.11); }

/* Tables and forms */
.table-card { padding:8px 20px 20px; }
.table-wrap { overflow:auto; }
table { width:100%; border-collapse:collapse; font-size:12px; }
th,td { padding:15px 10px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
th { position:sticky; top:0; background:#fff; color:var(--muted); font-size:9px; font-weight:750; letter-spacing:.08em; text-transform:uppercase; }
td strong,td small { display:block; }
td small { margin-top:4px; color:var(--muted); line-height:1.4; }
td .lead-question { max-width:420px; color:var(--ink); white-space:normal; }
td .lead-consents { color:var(--wine); }
td select { min-width:145px; padding:8px; }
label { display:grid; gap:7px; margin:0 0 16px; color:var(--muted); font-size:10px; font-weight:700; letter-spacing:.065em; text-transform:uppercase; }
label small { color:var(--subtle); font-size:10px; font-weight:500; letter-spacing:0; line-height:1.45; text-transform:none; }
input,select,textarea { width:100%; min-height:42px; border:1px solid var(--line-strong); border-radius:10px; padding:10px 12px; background:#fff; color:var(--ink); font-size:13px; font-weight:500; letter-spacing:normal; text-transform:none; transition:border-color .18s,box-shadow .18s; }
textarea { min-height:90px; resize:vertical; }
input:focus,select:focus,textarea:focus { border-color:#b77b83; box-shadow:0 0 0 3px rgba(116,21,34,.07); outline:0; }
.crm-form h3 { margin:0 0 18px; font-size:16px; }
.form-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.checkbox { display:flex; align-items:flex-start; gap:9px; font-size:11px; font-weight:500; letter-spacing:0; line-height:1.45; text-transform:none; }
.checkbox input { width:auto; min-height:0; margin-top:2px; }
.form-section { display:flex; align-items:flex-start; gap:12px; margin:28px 0 18px; padding-top:22px; border-top:1px solid var(--line); }
.form-section:first-child { margin-top:0; padding-top:0; border-top:0; }
.form-section > span { display:grid; width:30px; height:30px; place-items:center; border-radius:9px; background:var(--wine-soft); color:var(--wine); font-size:10px; font-weight:800; }
.form-section h3 { margin:0 0 3px; }
.form-section p { margin:0; color:var(--muted); font-size:10px; }

/* Events and live rooms */
.event-grid,.room-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.event-card,.room-card { position:relative; min-width:0; border:1px solid var(--line); border-radius:17px; background:#fff; box-shadow:0 5px 24px rgba(35,22,27,.035); }
.event-card { padding:21px; }
.event-card-top,.room-card-top { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.event-card h3,.room-card h3 { margin:10px 0 8px; font-size:18px; }
.event-meta { display:flex; flex-wrap:wrap; gap:7px 14px; margin:0; color:var(--muted); font-size:10px; line-height:1.5; }
.event-room-state { display:flex; align-items:center; gap:8px; margin:18px 0 0; padding:11px 12px; border-radius:10px; background:var(--surface-soft); color:var(--muted); font-size:10px; }
.event-actions,.room-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:16px; padding-top:16px; border-top:1px solid var(--line); }
.status-badge { display:inline-flex; min-height:24px; align-items:center; border-radius:999px; padding:5px 9px; background:#eee9e6; color:#655c60; font-size:9px; font-weight:750; letter-spacing:.04em; text-transform:uppercase; }
.status-badge.open,.status-badge.live { background:var(--success-soft); color:var(--success); }
.status-badge.live::before { content:""; width:6px; height:6px; margin-right:6px; border-radius:50%; background:currentColor; animation:pulse 1.5s ease infinite; }
.status-badge.waitlist,.status-badge.full { background:var(--warning-soft); color:var(--warning); }
.status-badge.cancelled,.status-badge.completed { background:#f0edeb; color:#7c7377; }
@keyframes pulse { 50% { opacity:.35; } }
.live-notice { display:flex; align-items:flex-start; gap:13px; margin-bottom:16px; padding:15px 17px; border:1px solid #ecd8b3; border-radius:13px; background:var(--warning-soft); }
.live-notice b { display:block; margin-bottom:5px; font-size:12px; }
.live-notice p { margin:0; color:#7e5b21; font-size:10px; line-height:1.5; }
.room-card { overflow:hidden; }
.room-card.live-room { border-color:#d7aeb4; box-shadow:0 8px 30px rgba(116,21,34,.11); }
.room-card-top { padding:20px 20px 16px; }
.room-card-body { padding:0 20px 20px; }
.room-date { margin:0; color:var(--muted); font-size:10px; }
.room-readiness { display:grid; gap:9px; margin:14px 0; padding:13px; border-radius:11px; background:var(--surface-soft); }
.readiness-step { display:flex; align-items:center; justify-content:space-between; gap:12px; color:var(--muted); font-size:10px; }
.readiness-step b { color:var(--ink); font-size:9px; }
.room-links { display:flex; flex-wrap:wrap; gap:8px; }
.room-links a { display:inline-flex; min-height:35px; align-items:center; border-radius:9px; padding:8px 11px; background:var(--wine); color:#fff; font-size:10px; font-weight:700; text-decoration:none; }
.room-links a.secondary-link { border:1px solid var(--line); background:#fff; color:var(--ink); }
.live-start-action,.live-end-action { min-width:148px; justify-content:center; }
.live-end-action { box-shadow:0 8px 20px rgba(116,21,34,.16); }
.live-end-action:hover { background:var(--wine-dark); }
.live-room-metrics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin:0 0 14px; }
.live-room-metric { min-width:0; padding:13px; border:1px solid #e3c9cd; border-radius:11px; background:linear-gradient(145deg,#fff8f5,#f5e6e3); }
.live-room-metric span { display:block; color:var(--muted); font-size:8px; font-weight:750; letter-spacing:.07em; text-transform:uppercase; }
.live-room-metric b { display:block; margin-top:8px; color:var(--wine); font:400 23px/1 Georgia,serif; }

/* Mailbox, mailings, analytics and advanced panels */
.mailbox-layout { display:grid; grid-template-columns:180px minmax(260px,.78fr) minmax(340px,1.22fr); min-height:570px; overflow:hidden; border:1px solid var(--line); border-radius:17px; background:#fff; box-shadow:0 5px 24px rgba(35,22,27,.035); }
.mailbox-folders { display:grid; align-content:start; gap:5px; padding:16px; border-right:1px solid var(--line); background:var(--surface-soft); }
.mailbox-folder { display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; border:0; border-radius:10px; padding:11px 12px; background:transparent; color:var(--muted); font-size:12px; text-align:left; }
.mailbox-folder:hover,.mailbox-folder.active { background:#fff; color:var(--wine); box-shadow:0 4px 14px rgba(35,22,27,.055); }
.mailbox-folder b { display:grid; min-width:24px; height:22px; place-items:center; border-radius:999px; padding:0 6px; background:#eee9e6; color:var(--muted); font-size:9px; }
.mailbox-folder.active b { background:var(--wine-soft); color:var(--wine); }
.mailbox-list-pane { min-width:0; border-right:1px solid var(--line); }
.mailbox-search { display:flex; gap:8px; padding:14px; border-bottom:1px solid var(--line); }
.mailbox-search input { min-width:0; }
.mailbox-list { max-height:620px; overflow:auto; }
.mailbox-item { display:grid; width:100%; gap:6px; border:0; border-bottom:1px solid var(--line); padding:16px; background:#fff; color:var(--ink); text-align:left; }
.mailbox-item:hover,.mailbox-item.active { background:#fff9f7; }
.mailbox-item.unread { box-shadow:inset 3px 0 var(--wine); }
.mailbox-item-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.mailbox-item-head b { overflow:hidden; font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.mailbox-item time { flex:0 0 auto; color:var(--subtle); font-size:9px; }
.mailbox-item-subject { overflow:hidden; margin:0; font-size:11px; font-weight:700; text-overflow:ellipsis; white-space:nowrap; }
.mailbox-item-preview { display:-webkit-box; overflow:hidden; margin:0; color:var(--muted); font-size:10px; line-height:1.45; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
.mailbox-item-state { color:var(--wine); font-size:9px; font-weight:750; }
.mailbox-reader { min-width:0; padding:26px; }
.mailbox-reader-empty { display:grid; min-height:440px; place-content:center; color:var(--muted); text-align:center; }
.mailbox-reader-empty span { color:var(--subtle); font-size:9px; font-weight:800; letter-spacing:.12em; }
.mailbox-reader-empty h3 { margin:12px 0 7px; color:var(--ink); font-size:22px; }
.mailbox-reader-empty p { max-width:300px; margin:0; font-size:11px; line-height:1.55; }
.mailbox-reader-head { padding-bottom:20px; border-bottom:1px solid var(--line); }
.mailbox-reader-head h3 { margin:12px 0 10px; font-size:25px; }
.mailbox-address { margin:0; color:var(--muted); font-size:11px; line-height:1.55; white-space:pre-line; overflow-wrap:anywhere; }
.mailbox-reader-body { min-height:230px; padding:24px 0; color:#2c2528; font-size:13px; line-height:1.72; white-space:pre-wrap; overflow-wrap:anywhere; }
.mailbox-reader-actions { display:flex; flex-wrap:wrap; gap:8px; padding-top:18px; border-top:1px solid var(--line); }
.mail-compose-dialog { width:min(700px,calc(100% - 32px)); }
.mail-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:16px; }
.mail-metrics article { min-height:90px; padding:15px; border:1px solid var(--line); border-radius:13px; background:#fff; }
.mail-metrics span { color:var(--muted); font-size:9px; font-weight:700; text-transform:uppercase; }
.mail-metrics b { display:block; margin-top:17px; font-size:24px; }
.alert-box { margin:0 0 16px; padding:14px 16px; border-radius:12px; font-size:11px; line-height:1.55; }
.alert-box.danger { border:1px solid #efc7cc; background:var(--danger-soft); color:#7d1f2a; }
.advanced-panel { margin-top:18px; border:1px solid var(--line); border-radius:15px; background:#fff; }
.advanced-panel summary { padding:18px 20px; color:var(--ink); font-size:12px; font-weight:750; cursor:pointer; }
.advanced-content { padding:0 20px 20px; }
.emergency-control { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; padding:14px; border-radius:11px; background:var(--danger-soft); color:#7d1f2a; font-size:10px; }
.funnel-view { display:grid; gap:12px; }
.funnel-row { display:grid; grid-template-columns:150px minmax(120px,1fr) 70px; align-items:center; gap:15px; }
.funnel-label { color:var(--muted); font-size:11px; }
.funnel-progress { appearance:none; width:100%; height:10px; overflow:hidden; border:0; border-radius:999px; background:#eee9e6; }
.funnel-progress::-webkit-progress-bar { border-radius:999px; background:#eee9e6; }
.funnel-progress::-webkit-progress-value { border-radius:999px; background:linear-gradient(90deg,var(--wine),#bf6773); }
.funnel-progress::-moz-progress-bar { border-radius:999px; background:linear-gradient(90deg,var(--wine),#bf6773); }
.funnel-value { font-size:11px; font-weight:750; text-align:right; }

/* Dialog and toast */
.crm-dialog { width:min(760px,calc(100% - 32px)); max-height:calc(100vh - 32px); margin:auto; border:0; border-radius:22px; padding:0; background:#fff; color:var(--ink); box-shadow:0 30px 100px rgba(24,13,18,.28); }
.crm-dialog::backdrop { background:rgba(20,12,15,.58); backdrop-filter:blur(4px); }
.dialog-head { position:sticky; top:0; z-index:2; display:flex; align-items:flex-start; justify-content:space-between; gap:20px; padding:24px 28px 20px; border-bottom:1px solid var(--line); background:#fff; }
.dialog-head h2 { margin:0 0 6px; font-size:25px; }
.dialog-head p:last-child { margin:0; color:var(--muted); font-size:11px; }
.icon-button { display:grid; width:36px; height:36px; place-items:center; flex:0 0 auto; border:1px solid var(--line); border-radius:10px; background:#fff; color:var(--muted); font-size:22px; }
.dialog-form { padding:25px 28px 30px; }
.dialog-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:24px; padding-top:20px; border-top:1px solid var(--line); }
.toast-region { position:fixed; z-index:100; right:24px; bottom:24px; display:grid; width:min(360px,calc(100% - 48px)); gap:10px; pointer-events:none; }
.toast { padding:14px 16px; border:1px solid #c8dfd1; border-radius:12px; background:#fff; color:var(--ink); font-size:11px; line-height:1.45; box-shadow:var(--shadow); animation:toast-in .22s ease both; }
.toast.error { border-color:#efc7cc; }
@keyframes toast-in { from { opacity:0; transform:translateY(8px); } }

@media (max-width:1100px) {
  .crm-layout { grid-template-columns:220px minmax(0,1fr); }
  .crm-workspace { padding-inline:26px; }
  .dashboard-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .span-two { grid-column:span 2; }
  .quick-actions { grid-template-columns:1fr; }
  .metric-grid,.mail-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .two-column,.two-column.wide-left { grid-template-columns:1fr; }
  .mailbox-layout { grid-template-columns:150px minmax(240px,.8fr) minmax(300px,1.2fr); }
}

@media (max-width:800px) {
  .auth-shell { grid-template-columns:1fr; align-content:center; padding:24px; background:var(--canvas); }
  .auth-brand { display:none; }
  .auth-card { width:min(480px,100%); padding:32px; }
  .crm-layout { display:block; }
  .crm-sidebar { position:sticky; top:0; width:100%; height:auto; padding:11px 14px; }
  .sidebar-brand { margin:0; }
  .sidebar-logo { width:34px; height:34px; }
  .sidebar-nav { display:flex; overflow-x:auto; margin-top:10px; padding-bottom:3px; scrollbar-width:none; }
  .sidebar-nav::-webkit-scrollbar { display:none; }
  .nav-caption,.nav-item small { display:none; }
  .nav-item { width:auto; flex:0 0 auto; padding:9px 12px; white-space:nowrap; }
  .sidebar-footer { position:absolute; top:12px; right:14px; margin:0; padding:0; border:0; }
  .sidebar-user { display:none; }
  .sidebar-logout { color:rgba(255,255,255,.72); }
  .crm-workspace { padding:26px 18px 70px; }
  .crm-topbar,.page-actions { align-items:flex-start; flex-direction:column; }
  .topbar-actions { width:100%; justify-content:space-between; }
  .crm-event-timer { min-width:0; flex:1; }
  .event-grid,.room-grid { grid-template-columns:1fr; }
  .mailbox-layout { grid-template-columns:1fr; }
  .mailbox-folders { grid-auto-flow:column; grid-auto-columns:max-content; overflow-x:auto; border-right:0; border-bottom:1px solid var(--line); }
  .mailbox-list-pane { border-right:0; border-bottom:1px solid var(--line); }
  .mailbox-list { max-height:330px; }
  .mailbox-reader { min-height:360px; }
}

@media (max-width:560px) {
  .auth-shell { padding:12px; }
  .auth-card { padding:25px 20px; border-radius:18px; }
  .crm-workspace { padding-inline:12px; }
  .crm-topbar h1 { font-size:31px; }
  .quick-action { min-height:78px; }
  .metric-grid,.mail-metrics,.dashboard-grid,.form-row { grid-template-columns:1fr; }
  .span-two { grid-column:auto; }
  .workspace-card { padding:18px; border-radius:14px; }
  .filters,.action-row { width:100%; }
  .filters input,.filters select,.filters .button,.action-row .button { width:100%; }
  .dialog-head,.dialog-form { padding-left:18px; padding-right:18px; }
  .funnel-row { grid-template-columns:90px 1fr 50px; gap:9px; }
  .emergency-control { align-items:flex-start; flex-direction:column; }
  .table-card { padding:4px 10px 14px; }
  .live-room-metrics { grid-template-columns:1fr; }
  .topbar-actions { flex-wrap:wrap; }
  .crm-event-timer { flex-basis:100%; max-width:none; }
  .mailbox-reader { padding:19px; }
  .mailbox-search { flex-direction:column; }
}

@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
}
