/* ProChat — sistema visual. Tokens, temas, layout y componentes. */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f6;
  --line: #e5e8f0;
  --line-strong: #d5d9e6;
  --text: #1b2233;
  --text-2: #5a6478;
  --text-3: #8b94a8;
  --brand: #6366f1;
  --brand-dark: #4f46e5;
  --brand-soft: #eef2ff;
  --brand-text: #4f46e5;
  --side: #131a2b;
  --side-2: #1b2438;
  --side-text: #cbd3e6;
  --side-muted: #8590aa;
  --side-line: #29344c;
  --green: #10b981;
  --green-soft: #ecfdf5;
  --amber: #f59e0b;
  --amber-soft: #fffbeb;
  --red: #ef4444;
  --red-soft: #fef2f2;
  --blue: #3b82f6;
  --blue-soft: #eff6ff;
  --purple: #8b5cf6;
  --purple-soft: #f5f3ff;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 20px rgba(16,24,40,.05);
  --shadow-lg: 0 20px 50px rgba(16,24,40,.16);
  --radius: 14px;
  --radius-sm: 9px;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0d111b;
  --surface: #161c2b;
  --surface-2: #1b2233;
  --surface-3: #242d42;
  --line: #2a3348;
  --line-strong: #39445f;
  --text: #e9edf7;
  --text-2: #a8b2c8;
  --text-3: #76819a;
  --brand: #818cf8;
  --brand-dark: #6366f1;
  --brand-soft: #232a49;
  --brand-text: #a5b4fc;
  --green-soft: #102b25;
  --amber-soft: #2e2513;
  --red-soft: #2f1a1d;
  --blue-soft: #172340;
  --purple-soft: #251d3b;
  --shadow: 0 1px 2px rgba(0,0,0,.2), 0 6px 20px rgba(0,0,0,.22);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.ico { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 15px; height: 15px; }
.ico.lg { width: 22px; height: 22px; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 252px; flex: 0 0 252px; height: 100vh; position: sticky; top: 0;
  background: var(--side); color: var(--side-text); display: flex; flex-direction: column;
  z-index: 40;
}
.sidebar-brand { height: 68px; display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--side-line); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #818cf8, #6366f1); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 16px rgba(99,102,241,.35); }
.brand-mark .ico { width: 19px; height: 19px; }
.brand-text { display: flex; align-items: baseline; gap: 6px; }
.brand-text strong { color: #fff; font-size: 17px; letter-spacing: -.4px; }
.brand-text small { color: #a5b4fc; font-size: 10px; font-weight: 800; letter-spacing: 1.2px; border: 1px solid #4f46e5; padding: 1px 5px; border-radius: 5px; }
.sidebar .sidebar-close { display: none; margin-left: auto; color: var(--side-muted); }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 14px 12px 8px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 8px 11px;
  border-radius: 9px; color: var(--side-text); font-size: 13.2px; font-weight: 500;
  border: 0; background: transparent; width: 100%; text-align: left; transition: .15s;
}
.nav-item .ico { color: var(--side-muted); width: 17px; height: 17px; }
.nav-item:hover { background: var(--side-2); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(99,102,241,.28), rgba(99,102,241,.08)); color: #fff; font-weight: 650; box-shadow: inset 3px 0 0 #818cf8; }
.nav-item.active .ico { color: #a5b4fc; }
.nav-item span:nth-of-type(1) { flex: 1; }
.nav-badge { flex: 0 0 auto !important; background: #ef4444; color: #fff; font-size: 10px; font-weight: 800; min-width: 19px; text-align: center; border-radius: 10px; padding: 1px 5px; }
.nav-badge:empty, .nav-badge[data-zero="true"] { display: none; }
.nav-separator { margin: 18px 11px 8px; font-size: 10px; font-weight: 700; letter-spacing: 1.1px; color: var(--side-muted); }
.nav-toggle .chev { width: 15px; height: 15px; transition: transform .18s; }
.nav-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.nav-more { margin-top: 2px; }
.lock-dot { flex: 0 0 auto !important; color: #f59e0b; display: grid; place-items: center; }
.lock-dot .ico { width: 13px; height: 13px; color: #f59e0b; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--side-line); }
.trial-card { background: linear-gradient(145deg, #263156, #1d2540); border: 1px solid #354267; border-radius: 11px; padding: 12px; }
.trial-top { display: flex; align-items: center; gap: 7px; color: #fbbf24; font-size: 12px; font-weight: 700; }
.trial-top .ico { width: 15px; height: 15px; }
.trial-card p { margin: 6px 0 8px; font-size: 11.5px; color: #a9b4d0; line-height: 1.45; }
.trial-card p strong { color: #fff; }
.trial-link { display: inline-flex; align-items: center; gap: 4px; color: #a5b4fc; font-size: 11.5px; font-weight: 700; }
.trial-link .ico { width: 13px; height: 13px; }
.side-user { display: flex; align-items: center; gap: 9px; padding: 12px 5px 2px; }
.side-user div { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.side-user strong { color: #fff; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: var(--side-muted); font-size: 10.5px; }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #818cf8, #4f46e5); color: #fff; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; flex: 0 0 auto; letter-spacing: .3px; }
.avatar-sm { width: 30px; height: 30px; font-size: 10.5px; }
.avatar-lg { width: 44px; height: 44px; font-size: 14px; }
.avatar-green { background: linear-gradient(135deg, #34d399, #059669); }
.avatar-amber { background: linear-gradient(135deg, #fbbf24, #d97706); }
.avatar-purple { background: linear-gradient(135deg, #c084fc, #7c3aed); }
.avatar-blue { background: linear-gradient(135deg, #60a5fa, #2563eb); }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 68px; flex: 0 0 68px; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.menu-btn { display: none; }
.search-trigger {
  display: flex; align-items: center; gap: 9px; width: min(420px, 42vw); height: 36px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text-3); padding: 0 10px; font-size: 12.5px; text-align: left;
}
.search-trigger .ico { width: 16px; height: 16px; }
.search-trigger span { flex: 1; }
kbd { font-family: var(--sans); font-size: 10px; font-weight: 700; color: var(--text-3); border: 1px solid var(--line-strong); background: var(--surface); border-radius: 5px; padding: 2px 5px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent; background: transparent; display: grid; place-items: center; color: var(--text-2); position: relative; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.dot { position: absolute; width: 7px; height: 7px; background: #ef4444; border-radius: 50%; top: 7px; right: 8px; border: 1.5px solid var(--surface); }
.top-user { display: flex; align-items: center; gap: 5px; background: transparent; border: 0; padding: 3px; border-radius: 9px; }
.top-user:hover { background: var(--surface-3); }
.top-user .chev { width: 14px; height: 14px; color: var(--text-3); }
.quick-wrap { position: relative; }
.quick-menu, .user-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60;
}
.quick-menu button, .user-menu a, .user-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0;
  background: transparent; border-radius: 7px; font-size: 12.5px; color: var(--text); text-align: left;
}
.quick-menu button:hover, .user-menu a:hover, .user-menu button:hover { background: var(--surface-3); }
.quick-menu .ico, .user-menu .ico { width: 16px; height: 16px; color: var(--brand); }
.user-menu { right: 0; top: 46px; }
.user-menu-head { padding: 9px 10px 11px; border-bottom: 1px solid var(--line); margin-bottom: 5px; display: flex; flex-direction: column; }
.user-menu-head strong { font-size: 12.5px; }
.user-menu-head small { color: var(--text-3); font-size: 11px; }
.user-menu [data-action="salir"] { color: var(--red); }
.user-menu [data-action="salir"] .ico { color: var(--red); }
.sidebar-overlay { display: none; }

.main { flex: 1; padding: 26px 28px 48px; min-width: 0; }
.view { max-width: 1440px; margin: 0 auto; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ---------- Tipografía y layout ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; letter-spacing: -.7px; margin: 0 0 4px; font-weight: 750; }
.page-head p { margin: 0; color: var(--text-2); font-size: 13px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.eyebrow { font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px; color: var(--brand-text); text-transform: uppercase; }
.section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; letter-spacing: -.2px; display: flex; align-items: center; gap: 8px; }
.section-title .ico { width: 17px; height: 17px; color: var(--brand); }
.section-sub { color: var(--text-2); font-size: 12px; margin: -6px 0 14px; }
.muted { color: var(--text-2); }
.tiny { font-size: 11px; color: var(--text-3); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 650; white-space: nowrap;
  transition: .15s;
}
.btn .ico { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-3); border-color: var(--brand); }
.btn-primary { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; box-shadow: 0 4px 12px rgba(99,102,241,.22); }
.btn-primary:hover { background: #4338ca; border-color: #4338ca; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--red); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 11.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--brand-text); font-size: 12px; font-weight: 650; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 700; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.kpi { display: flex; flex-direction: column; gap: 7px; padding: 16px 18px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { color: var(--text-2); font-size: 11.5px; font-weight: 600; }
.kpi-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); }
.kpi-icon .ico { width: 16px; height: 16px; }
.kpi-icon.green { background: var(--green-soft); color: var(--green); }
.kpi-icon.amber { background: var(--amber-soft); color: var(--amber); }
.kpi-icon.red { background: var(--red-soft); color: var(--red); }
.kpi-icon.blue { background: var(--blue-soft); color: var(--blue); }
.kpi-icon.purple { background: var(--purple-soft); color: var(--purple); }
.kpi-value { font-size: 25px; font-weight: 780; letter-spacing: -.8px; line-height: 1.1; }
.kpi-foot { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.trend { color: var(--green); font-weight: 700; }
.trend.down { color: var(--red); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: #b45309; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.brand { background: var(--brand-soft); color: var(--brand-text); }
.badge .dotmini { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; min-width: 0; }
.field label { font-size: 11.5px; font-weight: 650; color: var(--text-2); }
.field .hint { font-size: 10.5px; color: var(--text-3); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="time"], input[type="number"], input[type="tel"], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; font-size: 12.5px; color: var(--text); outline: none; transition: .15s;
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.check-row:last-child { border-bottom: 0; }
.check-row input[type="checkbox"], input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--brand); flex: 0 0 auto; }
.check-row label { flex: 1; cursor: pointer; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 9px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; border-radius: 7px; padding: 6px 11px; font-size: 11.5px; font-weight: 650; color: var(--text-2); }
.segmented button.active { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow); }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.search-input { position: relative; flex: 1; min-width: 190px; max-width: 320px; }
.search-input .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); }
.search-input input { padding-left: 32px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.2px; }
.data-table th { text-align: left; padding: 11px 13px; font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 11px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.data-table .cell-main { display: flex; align-items: center; gap: 9px; }
.cell-main strong { font-weight: 650; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.icon-action { width: 28px; height: 28px; border-radius: 7px; border: 0; background: transparent; color: var(--text-3); display: grid; place-items: center; }
.icon-action:hover { background: var(--surface-3); color: var(--brand); }
.icon-action.danger:hover { color: var(--red); background: var(--red-soft); }
.icon-action .ico { width: 15px; height: 15px; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-3); font-size: 12.5px; }
.empty .ico { width: 30px; height: 30px; display: block; margin: 0 auto 10px; color: var(--line-strong); }

/* ---------- Banners ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 12px; font-size: 12.5px; margin-bottom: 14px; }
.banner .ico { width: 18px; height: 18px; flex: 0 0 auto; }
.banner > div { flex: 1; }
.banner strong { display: block; font-size: 12.5px; margin-bottom: 1px; }
.banner.warn { background: var(--amber-soft); border: 1px solid #fde68a; color: #92400e; }
.banner.info { background: var(--brand-soft); border: 1px solid #c7d2fe; color: var(--brand-text); }
.banner.success { background: var(--green-soft); border: 1px solid #a7f3d0; color: #065f46; }
[data-theme="dark"] .banner.warn { border-color: #7c5e1a; color: #fbbf24; }
[data-theme="dark"] .banner.info { border-color: #3b4779; color: #a5b4fc; }
[data-theme="dark"] .banner.success { border-color: #1f6b54; color: #6ee7b7; }
.locked-banner { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 26px; max-width: 560px; margin: 30px auto; text-align: left; }
.locked-icon { width: 48px; height: 48px; border-radius: 13px; background: var(--amber-soft); color: var(--amber); display: grid; place-items: center; }
.locked-icon .ico { width: 24px; height: 24px; }
.locked-banner h3 { margin: 0; font-size: 17px; }
.locked-banner p { margin: 0; color: var(--text-2); font-size: 12.5px; }

/* ---------- Chats ---------- */
.chat-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100vh - 68px - 26px - 48px); min-height: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-list-head { padding: 14px; border-bottom: 1px solid var(--line); }
.chat-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 9px; }
.chat-filters select { font-size: 11px; padding: 6px 8px; }
.chat-items { overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.chat-item-body { min-width: 0; flex: 1; }
.chat-item-line { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-item-line strong { font-size: 12.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-line time { font-size: 10px; color: var(--text-3); flex: 0 0 auto; }
.chat-item-preview { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.unread { background: var(--brand-dark); color: #fff; font-size: 10px; font-weight: 800; border-radius: 10px; min-width: 18px; text-align: center; padding: 1px 5px; }
.chat-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-panel-head { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-panel-head .info { flex: 1; min-width: 0; }
.chat-panel-head strong { display: block; font-size: 13px; }
.chat-panel-head small { color: var(--text-3); font-size: 10.5px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px; background: var(--surface-2); display: flex; flex-direction: column; gap: 9px; }
.msg { max-width: 72%; padding: 9px 12px; border-radius: 13px; font-size: 12.5px; line-height: 1.45; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.mine { align-self: flex-end; background: #e0e7ff; border-color: #c7d2fe; color: #1e2a5a; border-bottom-left-radius: 13px; border-bottom-right-radius: 4px; }
[data-theme="dark"] .msg.mine { background: #2b3468; border-color: #3b4785; color: #e0e7ff; }
.msg.ia { background: var(--purple-soft); border-color: #ddd6fe; border-bottom-left-radius: 4px; }
.msg small { display: block; font-size: 9.5px; opacity: .65; margin-top: 4px; text-align: right; }
.msg .msg-tag { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; opacity: .7; }
.msg.note { background: var(--amber-soft); border-color: #fde68a; align-self: center; max-width: 85%; font-style: italic; }
.chat-compose { border-top: 1px solid var(--line); padding: 12px 14px; }
.chat-compose textarea { min-height: 58px; max-height: 130px; border: 0; background: var(--surface-2); padding: 9px; }
.chat-compose-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.chat-compose-row .spacer { flex: 1; }

/* ---------- Calendario / turnos ---------- */
.week-grid { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 8px; overflow-x: auto; }
.day-col { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; min-height: 300px; overflow: hidden; }
.day-head { padding: 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); text-align: center; }
.day-head strong { display: block; font-size: 11.5px; text-transform: capitalize; }
.day-head small { font-size: 10px; color: var(--text-3); }
.day-body { padding: 7px; display: flex; flex-direction: column; gap: 6px; }
.turn-chip { border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 8px; padding: 8px; background: var(--surface); cursor: pointer; font-size: 11px; }
.turn-chip:hover { box-shadow: var(--shadow); }
.turn-chip.confirmo { border-left-color: var(--green); }
.turn-chip.esperando { border-left-color: var(--amber); }
.turn-chip.sin-respuesta { border-left-color: var(--text-3); }
.turn-chip.cancelo { border-left-color: var(--red); opacity: .7; }
.turn-chip strong { display: block; font-size: 11.5px; }
.turn-chip .badge { margin-top: 5px; }
.slot-empty { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 9px; text-align: center; color: var(--text-3); font-size: 10.5px; cursor: pointer; background: transparent; width: 100%; }
.slot-empty:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

/* ---------- Gráficos ---------- */
.chart-box { width: 100%; overflow: hidden; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 11px; color: var(--text-2); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; }

/* ---------- Modales y paleta ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11,16,30,.55); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 18px; animation: fadeIn .16s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: min(88vh, 820px); display: flex; flex-direction: column; border: 1px solid var(--line); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; letter-spacing: -.3px; }
.modal-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--text-2); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.palette { width: min(610px, 100%); align-self: flex-start; margin-top: 8vh; }
.palette input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 15px 18px; font-size: 14px; }
.palette input:focus { box-shadow: none; border-color: var(--brand); }
.palette-list { max-height: 400px; overflow-y: auto; padding: 8px; }
.palette-item { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: transparent; text-align: left; padding: 9px 11px; border-radius: 8px; font-size: 12.5px; }
.palette-item:hover, .palette-item.selected { background: var(--brand-soft); }
.palette-item .ico { color: var(--brand); width: 16px; height: 16px; }
.palette-item small { margin-left: auto; color: var(--text-3); font-size: 10px; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--green); box-shadow: var(--shadow-lg); border-radius: 10px; padding: 11px 14px; font-size: 12.3px; min-width: 240px; max-width: 360px; pointer-events: auto; animation: slideIn .2s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.toast .ico { color: var(--green); width: 17px; height: 17px; }
.toast.error { border-left-color: var(--red); }
.toast.error .ico { color: var(--red); }
.toast.info { border-left-color: var(--brand); }
.toast.info .ico { color: var(--brand); }
.toast.out { animation: slideOut .2s ease forwards; }
@keyframes slideOut { to { opacity: 0; transform: translateX(14px); } }

/* ---------- Fetch / captación ---------- */
.share-grid { display: grid; grid-template-columns: 1fr 220px; gap: 18px; align-items: start; }
.qr-box { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; display: grid; place-items: center; }
.qr-box svg { width: 170px; height: 170px; }
.code-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px dashed var(--line-strong); padding: 10px 12px; border-radius: 9px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; word-break: break-all; }
.code-box span { flex: 1; }
.copy-input { display: flex; gap: 6px; }

/* ---------- Varios ---------- */
.progress-track { height: 7px; background: var(--surface-3); border-radius: 10px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #818cf8, #4f46e5); border-radius: 10px; transition: width .35s ease; }
.step-item { display: flex; gap: 13px; padding: 15px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.step-item:last-child { border-bottom: 0; }
.step-num { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--text-2); flex: 0 0 auto; }
.step-item.done .step-num { background: var(--green-soft); color: var(--green); }
.step-body { flex: 1; }
.step-body strong { font-size: 13px; display: block; }
.step-body p { margin: 3px 0 9px; font-size: 11.7px; color: var(--text-2); }
.accordion-item { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.accordion-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 0; background: var(--surface); text-align: left; font-size: 12.5px; font-weight: 650; }
.accordion-head:hover { background: var(--surface-2); }
.accordion-head .chev { margin-left: auto; transition: transform .18s; width: 15px; height: 15px; }
.accordion-item.open .accordion-head .chev { transform: rotate(90deg); }
.accordion-body { padding: 0 14px 14px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--line); }
.accordion-body[hidden] { display: none; }
.pill-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.pill-tabs button { border: 0; background: none; padding: 9px 13px; font-size: 12px; font-weight: 650; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.pill-tabs button.active { color: var(--brand-text); border-color: var(--brand); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row strong { font-size: 12.3px; }
.list-row small { display: block; color: var(--text-3); font-size: 10.8px; }
.color-swatch { width: 13px; height: 13px; border-radius: 4px; display: inline-block; flex: 0 0 auto; }
.mini-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--surface-2); border-radius: 9px; }
.mini-stat strong { font-size: 17px; }
.mini-stat small { color: var(--text-3); font-size: 10px; }
.command-result { padding: 12px 14px; border-radius: 10px; background: var(--brand-soft); border: 1px solid #c7d2fe; color: var(--brand-text); font-size: 12.5px; margin-top: 12px; }
[data-theme="dark"] .command-result { border-color: #3b4779; }
.example-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 20px; padding: 6px 11px; font-size: 11px; color: var(--text-2); }
.chip:hover { border-color: var(--brand); color: var(--brand-text); background: var(--brand-soft); }
.greeting-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.greeting-hero h1 { font-size: 23px; margin: 0 0 3px; letter-spacing: -.6px; }
.greeting-hero p { margin: 0; color: var(--text-2); font-size: 12.5px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick-action { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); text-align: left; font-size: 11.8px; font-weight: 600; }
.quick-action:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.quick-action .ico { color: var(--brand); width: 17px; height: 17px; }
.selection-bar { background: var(--brand-soft); border: 1px solid #c7d2fe; border-radius: 10px; padding: 10px 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; margin-bottom: 12px; }
[data-theme="dark"] .selection-bar { border-color: #3b4779; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
  .share-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .24s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(8,13,25,.5); z-index: 35; }
  .sidebar-overlay[hidden] { display: none; }
  .sidebar .sidebar-close { display: grid; }
  .menu-btn { display: grid; }
  .main { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
  .search-trigger { width: auto; flex: 1; }
  .search-trigger kbd { display: none; }
  .chat-layout { grid-template-columns: 260px minmax(0, 1fr); height: calc(100vh - 68px - 20px - 40px); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .g2, .g3, .g4, .quick-grid, .form-grid, .week-grid { grid-template-columns: 1fr; }
  .chat-layout { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .chat-list { height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .chat-panel { height: 520px; }
  .search-trigger span { display: none; }
  .search-trigger { flex: 0 0 40px; justify-content: center; }
  .page-head h1 { font-size: 20px; }
  .top-user .chev { display: none; }
  .btn span { display: inline; }
  .main { padding: 16px 12px 32px; }
}

/* Alineación con DESIGN.md: tokens canónicos y ajustes finales */
:root {
  --bg-app: #F5F6FA; --bg-surface: #FFFFFF; --bg-surface-subtle: #F8F9FC;
  --bg-sidebar: #1E293B; --text-primary: #111827; --text-secondary: #475569;
  --border-default: #E2E5ED; --primary-600: #4F46E5; --secondary-600: #7C3AED;
  --chart-1: #4F46E5; --chart-2: #7C3AED; --chart-3: #0EA5E9; --chart-4: #059669;
  --side: #1E293B; --side-2: #334155; --side-line: #334155;
  --focus-ring: 0 0 0 3px rgba(79,70,229,.22);
}
[data-theme="dark"] {
  --bg-app: #0F172A; --bg: #0F172A; --surface: #1E293B; --surface-2: #172033;
  --surface-3: #273449; --line: #273449; --line-strong: #475569;
  --text: #F1F5F9; --text-2: #CBD5E1; --text-3: #94A3B8;
  --text-primary: #F1F5F9; --text-secondary: #CBD5E1;
  --border-default: #334155; --primary-600: #6366F1; --secondary-600: #8B5CF6;
  --focus-ring: 0 0 0 3px rgba(129,140,248,.35);
}
.kpi-value, .data-table td.num, .mini-stat strong, .chart-box text { font-variant-numeric: tabular-nums; }
.ico { stroke-width: 1.75; }
input:focus, select:focus, textarea:focus { box-shadow: var(--focus-ring); }
.nav-item:focus-visible { outline: 2px solid #A5B4FC; outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- ProChat: login ---------- */
.login-screen { position: fixed; inset: 0; z-index: 300; display: grid; grid-template-columns: 40% 60%; background: var(--bg-app); }
.login-screen[hidden] { display: none; }
.login-brand { background: var(--side); color: #fff; padding: 32px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-brand::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, transparent 0 18px, #fff 18px 19px); opacity: .04; pointer-events: none; }
.login-brand-top, .login-brand-center, .login-brand-foot { position: relative; z-index: 1; }
.login-brand-top { display: flex; align-items: center; gap: 10px; }
.login-brand-top .ico { color: #A5B4FC; width: 32px; height: 32px; }
.login-wordmark { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.login-wordmark strong { color: #A5B4FC; }
.login-main .login-wordmark strong { color: var(--primary-600, var(--brand-text)); }
.login-brand-center h2 { font-size: 28px; line-height: 1.25; letter-spacing: -.8px; margin: 0 0 12px; max-width: 420px; }
.login-brand-center p { color: #CBD5E1; font-size: 13px; margin: 0; }
.login-brand-foot { color: var(--side-muted); font-size: 11px; }
.login-main { display: grid; place-items: center; padding: 32px; }
.login-card { width: 400px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 32px; }
.login-card-brand { display: none; align-items: center; gap: 8px; margin-bottom: 22px; }
.login-card-brand .ico { color: var(--brand); }
.login-card h1 { font-size: 20px; letter-spacing: -.5px; margin: 0; }
.login-sub { color: var(--text-3); font-size: 12px; margin: 4px 0 24px; }
.login-error { display: flex; align-items: center; gap: 8px; padding: 10px 11px; border-radius: 9px; font-size: 11.5px; margin-bottom: 16px; background: var(--red-soft); border: 1px solid var(--red); color: var(--red); }
.login-error[hidden] { display: none; }
.login-error.warning { background: var(--amber-soft); border-color: var(--amber); color: #b45309; }
.login-error .ico { width: 15px; height: 15px; flex: 0 0 auto; }
.login-field { margin-bottom: 16px; gap: 6px; }
.login-input-wrap { display: flex; align-items: center; gap: 8px; height: 40px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 0 10px; background: var(--surface); }
.login-input-wrap > .ico { color: var(--text-3); }
.login-input-wrap input { border: 0; padding: 0; height: 100%; background: transparent; box-shadow: none; }
.login-input-wrap:focus-within { border-color: var(--brand); box-shadow: var(--focus-ring); }
.login-input-wrap .icon-btn { width: 28px; height: 28px; margin-right: -6px; }
.field-error { color: var(--red); font-size: 11px; }
.field-error[hidden] { display: none; }
.login-field.invalid .login-input-wrap { border-color: var(--red); }
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-remember { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.login-remember input { width: 16px; height: 16px; accent-color: var(--brand); }
.login-submit { height: 40px; margin-top: 24px; }
.login-submit:disabled { opacity: .7; }
.login-foot { text-align: center; color: var(--text-3); font-size: 11.5px; margin: 16px 0 0; }
.login-demo-hint { text-align: center; color: var(--text-3); font-size: 10px; margin: 10px 0 0; opacity: .85; }
@media (max-width: 1023px) {
  .login-screen { grid-template-columns: 1fr; align-content: start; overflow-y: auto; }
  .login-brand { min-height: 160px; padding: 22px 24px; }
  .login-brand-center h2 { font-size: 20px; }
  .login-brand-center p { display: none; }
  .login-brand-foot { display: none; }
  .login-main { padding: 24px 16px 40px; }
}
@media (max-width: 767px) {
  .login-card { padding: 24px; margin-top: 8px; }
  .login-card-brand { display: flex; }
  .login-brand { display: none; }
  .login-main { padding-top: 48px; }
}

/* ---------- ProChat: calendario semanal ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-range { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; margin-left: 4px; }
.cal-scroll { position: relative; overflow: auto; height: calc(100vh - 300px); min-height: 480px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cal-header-grid, .cal-body-grid { display: grid; grid-template-columns: 64px repeat(7, minmax(160px, 1fr)); min-width: 1184px; }
.cal-header-grid { position: sticky; top: 0; z-index: 6; background: var(--surface); border-bottom: 1px solid var(--line); }
.cal-corner { background: var(--surface-2); border-right: 1px solid var(--line); }
.cal-day-head { height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 1px solid var(--line); background: var(--surface-2); }
.cal-day-head strong { font-size: 10.5px; letter-spacing: .7px; color: var(--text-2); }
.cal-day-head span { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.cal-day-head.today { background: var(--brand-soft); }
.cal-day-head.today span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-dark); color: #fff; }
.cal-day-head.quiet strong, .cal-day-head.quiet span { color: var(--text-3); }
.cal-time-col { position: sticky; left: 0; z-index: 5; background: var(--surface-2); border-right: 1px solid var(--line); }
.cal-hour { height: 64px; display: flex; align-items: flex-start; justify-content: flex-end; padding: 3px 8px 0 0; font-size: 10px; color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; border-bottom: 1px dashed var(--line); box-sizing: border-box; }
.cal-lane { position: relative; border-right: 1px solid var(--line); background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px); background-size: 100% 64px; min-height: 768px; }
.cal-lane.today { background-color: var(--brand-soft); }
.cal-slot { position: absolute; left: 0; right: 0; height: 32px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: transparent; z-index: 1; }
.cal-slot:hover, .cal-slot:focus-visible { color: var(--brand); background: rgba(99,102,241,.08); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-slot .ico { width: 14px; height: 14px; }
.cal-turn { position: absolute; z-index: 2; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); padding: 6px 8px; text-align: left; overflow: hidden; cursor: pointer; min-height: 56px; }
.cal-turn:hover { box-shadow: var(--shadow-md); border-color: var(--brand); }
.cal-turn.confirmo { border-left-color: var(--green); }
.cal-turn.esperando { border-left-color: var(--amber); }
.cal-turn.sinrespuesta { border-left-color: var(--info-solid, var(--blue)); }
.cal-turn.cancelo { border-left-color: var(--red); opacity: .72; }
.cal-turn .t-hora { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.cal-turn .t-cliente { font-size: 11.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-turn .t-servicio { font-size: 10px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-turn.cancelo .t-servicio { text-decoration: line-through; }
.cal-turn .badge { margin-top: 0; font-size: 8.5px; padding: 1px 5px; flex: 0 0 auto; max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
.cal-more { position: absolute; z-index: 3; background: var(--brand-soft); color: var(--brand-text); border: 1px solid var(--brand); border-radius: 8px; font-size: 10px; font-weight: 700; padding: 4px 6px; cursor: pointer; }
.cal-empty-day { position: absolute; top: 46%; left: 0; right: 0; text-align: center; font-size: 10.5px; color: var(--text-3); pointer-events: none; }
.cal-nowline { position: absolute; left: 64px; right: 0; height: 2px; background: var(--brand); z-index: 4; pointer-events: none; }
.cal-nowline::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.cal-nowline span { position: absolute; left: 6px; top: -18px; font-size: 9px; font-weight: 700; color: var(--brand-text); background: var(--brand-soft); padding: 1px 6px; border-radius: 6px; }
.cal-day-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-day-chips button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 18px; padding: 6px 11px; font-size: 11px; font-weight: 650; }
.cal-day-chips button.active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.cal-list-head th { position: sticky; top: 0; }
@media (max-width: 1279px) {
  .cal-header-grid, .cal-body-grid { min-width: 1184px; }
}
@media (max-width: 1023px) {
  .cal-scroll { height: calc(100vh - 260px); }
}
@media (max-width: 767px) {
  .cal-scroll { height: auto; max-height: none; min-height: 0; overflow: visible; }
  .cal-header-grid, .cal-body-grid { min-width: 0; grid-template-columns: 56px minmax(140px, 1fr); }
  .cal-toolbar { position: sticky; bottom: 0; background: var(--surface); padding: 8px 0; border-top: 1px solid var(--line); }
  .cal-turn { min-height: 64px; }
}

