/* ═══ Calendar + Appointments (port of GIO's GHL-like CRM calendar) ═══
   Companion of calendar-gio.js. Every class is prefixed gcal-.
   Tokens: dark (default) derive from the calculator palette; light
   ([data-theme="light"] on <html> or <body>) uses GHL's measured values,
   like GIO does. Load AFTER style.css. */

/* ── Tokens ─────────────────────────────────────────────────────────── */
.gcal-root {
  --gc-bg: var(--paper-2, #131b30);
  --gc-line: rgba(148, 163, 184, 0.17);
  --gc-axis: #94a3b8;
  --gc-past: #64748b;
  --gc-today: var(--accent, #06b6d4);
  --gc-text: var(--text, #e5e7eb);
  --gc-strong: #f1f5f9;
  --gc-muted: var(--muted, #9ca3af);
  --gc-sub: #cbd5e1;
  --gc-border: var(--border, rgba(148, 163, 184, 0.3));
  --gc-hover: rgba(255, 255, 255, 0.05);
  --gc-soft: rgba(255, 255, 255, 0.03);
  --gc-box: rgba(6, 182, 212, 0.07);
  --gc-chip-bg: rgba(6, 182, 212, 0.14);
  --gc-chip-text: #67e8f9;
  --gc-link: var(--accent, #06b6d4);
  --gc-now: #ff3b3b;
  --gc-primary: var(--accent, #06b6d4);
  --gc-primary-ink: var(--accent-ink, #001018);
  --gc-focus: var(--accent, #06b6d4);
  --gc-focus-ring: rgba(6, 182, 212, 0.22);
  --gc-input-bg: #0b1223;
  --gc-placeholder: #64748b;
  --gc-veil: rgba(15, 23, 42, 0.62);
  --gc-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  --gc-check-off: rgba(148, 163, 184, 0.6);
  --gc-switch-off: rgba(148, 163, 184, 0.35);
  --gc-kpi-bg: rgba(148, 163, 184, 0.06);
  --gc-dayhead-bg: #182239;
  --gc-warn-text: #fcd34d;
  --gc-green: #4ade80;
  --gc-sky: #38bdf8;
  --gc-purple: #c084fc;
  --gc-red: #f87171;
  color-scheme: dark;
  font-family: var(--font-sans, "Inter Tight", Inter, system-ui, -apple-system, "Segoe UI", sans-serif);
  color: var(--gc-text);
}
[data-theme="light"] .gcal-root {
  --gc-bg: #ffffff;
  --gc-line: #dddddd;
  --gc-axis: #607179;
  --gc-past: #98a2b3;
  --gc-today: #155eef;
  --gc-text: #344054;
  --gc-strong: #101828;
  --gc-muted: #667085;
  --gc-sub: #475467;
  --gc-border: #d0d5dd;
  --gc-hover: #f9fafb;
  --gc-soft: #f9fafb;
  --gc-box: #f5f8ff;
  --gc-chip-bg: #eff8ff;
  --gc-chip-text: #175cd3;
  --gc-link: #155eef;
  --gc-now: #ff0000;
  --gc-primary: var(--accent, #b5172a);
  --gc-primary-ink: #ffffff;
  --gc-focus: #84adff;
  --gc-focus-ring: rgba(21, 94, 239, 0.15);
  --gc-input-bg: #ffffff;
  --gc-placeholder: #98a2b3;
  --gc-veil: rgba(255, 255, 255, 0.7);
  --gc-shadow: 0 16px 40px rgba(16, 24, 40, 0.18);
  --gc-check-off: rgba(0, 0, 0, 0.5);
  --gc-switch-off: rgba(0, 0, 0, 0.14);
  --gc-kpi-bg: #ffffff;
  --gc-dayhead-bg: #f2f4f7;
  --gc-warn-text: #92400e;
  --gc-green: #15803d;
  --gc-sky: #0369a1;
  --gc-purple: #7e22ce;
  --gc-red: #b91c1c;
  color-scheme: light;
}

/* ── Resets against the calculator's global element styles ──────────
   (button / label / select / input / textarea are styled globally).
   :where() keeps these at class-level specificity so components win. */
.gcal-root :where(button) {
  font: inherit; font-size: inherit; font-weight: inherit; letter-spacing: inherit; text-transform: none;
  color: inherit; background: none; border: 0; border-radius: 0; padding: 0; margin: 0;
  box-shadow: none; transition: none; cursor: pointer; text-align: inherit; line-height: inherit;
}
.gcal-root :where(button:disabled) { cursor: default; }
.gcal-root :where(label) { display: block; margin: 0; font-size: inherit; color: inherit; }
.gcal-root :where(a) { color: var(--gc-link); text-decoration: none; }
.gcal-root :where(a:hover) { text-decoration: underline; }
.gcal-root :where(ul, ol) { list-style: none; margin: 0; padding: 0; }
.gcal-root :where(h3) { margin: 0; }
.gcal-root [hidden] { display: none !important; }
.gcal-ic { display: inline-block; flex-shrink: 0; vertical-align: middle; }
.gcal-scroll { scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, 0.45) transparent; }
[data-theme="light"] .gcal-scroll { scrollbar-color: #c1c1c1 transparent; }
.gcal-muted { color: var(--gc-muted); }
.gcal-pre { white-space: pre-wrap; }
.is-struck { text-decoration: line-through; }

/* ── Shell bodies (inside the .quote-history-overlay dashboard shell) ── */
.quote-history-modal__body.gcal-cal-body {
  padding: 12px 16px 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.quote-history-modal__body.gcal-al-body { padding: 16px 24px 28px; }

/* ── Calendar card + toolbar (GHL) ─────────────────────────────────── */
.gcal-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--gc-line);
  border-radius: 8px;
  background: var(--gc-bg);
}
.gcal-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 12px;
}
.gcal-tb-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gcal-btn {
  height: 30px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 11px;
  border: 1px solid var(--gc-border);
  border-radius: 8px;
  background: var(--gc-bg);
  color: var(--gc-text);
  font-size: 12.5px; font-weight: 600; line-height: 1;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  white-space: nowrap;
  cursor: pointer;
}
.gcal-btn:hover { background: var(--gc-hover); }
.gcal-btn.is-on,
.gcal-viewsel-btn.is-open { border-color: var(--gc-focus); box-shadow: 0 0 0 2px var(--gc-focus-ring); }
.gcal-btn-primary,
.gcal-btn-primary:hover { background: var(--gc-primary); border-color: var(--gc-primary); color: var(--gc-primary-ink); }
.gcal-btn-primary:hover { filter: brightness(1.08); }
.gcal-btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }
.gcal-nav { gap: 0; padding: 0; }
.gcal-nav > button { height: 100%; display: flex; align-items: center; padding: 0 8px; color: inherit; }
.gcal-nav > button:hover { color: var(--gc-strong); }
.gcal-range-title { min-width: 130px; padding: 0 2px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--gc-strong); }
.gcal-viewsel { position: relative; }
.gcal-viewsel-btn { width: 104px; justify-content: space-between; padding: 0 9px; font-weight: 500; }
.gcal-viewsel-btn .gcal-ic { color: var(--gc-muted); }
.gcal-viewsel-menu {
  position: absolute; left: 0; top: 34px; z-index: 60;
  width: 104px; padding: 4px 0;
  border: 1px solid var(--gc-line); border-radius: 8px;
  background: var(--gc-bg); box-shadow: var(--gc-shadow);
  overflow: hidden;
}
.gcal-viewsel-opt {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  padding: 5px 9px; font-size: 12.5px; color: var(--gc-text); text-align: left;
}
.gcal-viewsel-opt:hover { background: var(--gc-hover); }
.gcal-viewsel-opt.is-on { color: var(--gc-today); }

.gcal-alert {
  margin: 0 12px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(245, 158, 11, 0.45); border-radius: 8px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--gc-warn-text);
  font-size: 13px;
}
.gcal-al > .gcal-alert, #gcalDrNotes .gcal-alert { margin: 0 0 12px; }
.gcal-alert-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.gcal-alert-actions button { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }

/* ── Stage: grid + Manage view panel ───────────────────────────────── */
.gcal-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; border-top: 1px solid var(--gc-line); }
.gcal-gridwrap { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.gcal-tg, .gcal-mg { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; background: var(--gc-bg); }

.gcal-loading {
  position: absolute; inset: 0; z-index: 45; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--gc-veil);
  font-size: 14px; color: var(--gc-sub);
}
.gcal-spinner {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%; border: 3px solid var(--gc-primary); border-top-color: transparent;
  animation: gcal-spin 0.8s linear infinite;
}
.gcal-spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes gcal-spin { to { transform: rotate(360deg); } }

/* ── Week / day time grid ──────────────────────────────────────────── */
.gcal-tg-inner { position: relative; }
.gcal-tg-head { position: sticky; top: 0; z-index: 30; background: var(--gc-bg); }
.gcal-tg-hrow { display: flex; min-height: 39px; border-bottom: 1px solid var(--gc-line); }
.gcal-tg-corner {
  position: sticky; left: 0; z-index: 10; flex-shrink: 0; width: 53px;
  display: flex; flex-direction: column; align-items: center; padding-top: 4px;
  text-align: center; font-size: 10px; font-weight: 500; line-height: 13px;
  color: var(--gc-axis); background: var(--gc-bg);
}
.gcal-tg-corner span { display: block; width: 100%; }
.gcal-tg-colhead {
  flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 6px 4px; text-align: center;
  border-left: 1px solid var(--gc-line);
}
.gcal-colhead-day { font-size: 14px; font-weight: 600; white-space: nowrap; }
.gcal-colhead-cal {
  font-size: 14px; font-weight: 600; line-height: 20px; color: var(--gc-sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.gcal-tg-adrow { display: flex; height: 43px; border-bottom: 1px solid var(--gc-line); }
.gcal-tg-adlabel {
  position: sticky; left: 0; z-index: 10; flex-shrink: 0; width: 53px;
  display: flex; align-items: center; justify-content: flex-end; padding: 0 4px;
  font-size: 14px; color: var(--gc-axis); background: var(--gc-bg); white-space: nowrap;
}
.gcal-tg-adcell { flex: 1 1 0; border-left: 1px solid var(--gc-line); }
.gcal-tg-body { position: relative; display: flex; }
.gcal-tg-axis { position: sticky; left: 0; z-index: 20; flex-shrink: 0; width: 53px; background: var(--gc-bg); }
.gcal-tg-hour { height: 72px; border-top: 1px solid var(--gc-line); text-align: right; font-size: 14px; line-height: 1; }
.gcal-tg-hour.is-first { border-top-color: transparent; }
.gcal-tg-hlabel { height: 36px; display: flex; align-items: center; justify-content: flex-end; padding: 0 4px; white-space: nowrap; color: var(--gc-axis); }
.gcal-tg-cols {
  position: relative; flex: 1 1 auto; display: flex;
  background-image: repeating-linear-gradient(to bottom, var(--gc-line) 0, var(--gc-line) 1px, transparent 1px, transparent 72px);
}
.gcal-col { position: relative; flex: 1 1 0; min-width: 0; border-left: 1px solid var(--gc-line); }
.gcal-col.is-click { cursor: pointer; }
.gcal-tev {
  position: absolute; z-index: 5; display: block; overflow: hidden; text-align: left;
  border-radius: 4px; box-shadow: 0 0 0 1px var(--gc-bg);
}
.gcal-tev:hover { z-index: 6; filter: brightness(1.06); }
.gcal-tev:focus-visible { outline: 2px solid var(--gc-focus); outline-offset: 1px; }
.gcal-tev-box { display: block; width: 100%; height: 100%; overflow: hidden; padding: 4px 6px; font-size: 12px; line-height: 16px; }
.gcal-tev-inner { display: flex; flex-direction: column; overflow-wrap: anywhere; }
.gcal-tev-title, .gcal-tev-time { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gcal-tev-title { font-weight: 600; }
.gcal-buffer {
  position: absolute; z-index: 4; pointer-events: none; border-radius: 4px;
  background: repeating-linear-gradient(135deg, rgba(152, 162, 179, 0.35) 0 4px, rgba(152, 162, 179, 0.12) 4px 8px);
}
.gcal-now-line { position: absolute; left: 0; right: 0; z-index: 10; pointer-events: none; border-top: 1px solid var(--gc-now); }
.gcal-now-arrow {
  position: absolute; left: 0; pointer-events: none;
  border-style: solid; border-width: 5px 0 5px 6px;
  border-color: transparent transparent transparent var(--gc-now);
}

/* ── Month grid ────────────────────────────────────────────────────── */
.gcal-mg-inner { min-width: 560px; min-height: 100%; display: flex; flex-direction: column; }
.gcal-mg-head {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--gc-line); background: var(--gc-bg);
}
.gcal-mg-dow { padding: 6px 2px; text-align: center; font-size: 18px; font-weight: 600; line-height: 27px; color: var(--gc-axis); }
.gcal-mg-dow + .gcal-mg-dow { border-left: 1px solid var(--gc-line); }
.gcal-mg-weeks { flex: 1 1 auto; display: flex; flex-direction: column; }
.gcal-mg-week {
  flex: 1 0 auto; min-height: 96px;
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--gc-line);
}
.gcal-mg-cell { min-width: 0; padding-bottom: 2px; }
.gcal-mg-cell + .gcal-mg-cell { border-left: 1px solid var(--gc-line); }
.gcal-mg-cell.is-click { cursor: pointer; }
.gcal-mg-cell.is-click:hover { background: var(--gc-hover); }
.gcal-mg-num { display: flex; justify-content: flex-end; }
.gcal-mg-num span { padding: 4px; font-size: 14px; line-height: 21px; }
.gcal-mg-cell.is-today .gcal-mg-num span { font-weight: 700; }
.gcal-mg-evs { min-height: 28px; }
.gcal-mchip { display: block; width: calc(100% - 4px); margin: 1px 2px 0; text-align: left; }
.gcal-mchip:focus-visible { outline: 2px solid var(--gc-focus); outline-offset: 1px; }
.gcal-mchip-box {
  display: flex; align-items: center; height: 20px; margin-bottom: 4px;
  padding: 0 6px; overflow: hidden; font-size: 12px; line-height: 16px;
}
.gcal-mchip:hover .gcal-mchip-box { filter: brightness(1.06); }
.gcal-mchip-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.gcal-mchip-time { font-weight: 500; opacity: 0.85; }
.gcal-more {
  display: block; margin: 0 4px 2px; padding: 1px 4px; border-radius: 4px;
  font-size: 12px; font-weight: 600; color: var(--gc-sub); text-align: left;
}
.gcal-more:hover { background: var(--gc-hover); color: var(--gc-strong); }
.gcal-pop {
  position: absolute; z-index: 55;
  display: flex; flex-direction: column; max-height: 70%;
  border: 1px solid var(--gc-border); border-radius: 8px;
  background: var(--gc-bg); box-shadow: var(--gc-shadow);
}
.gcal-pop-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid var(--gc-line);
  font-size: 13px; font-weight: 600; color: var(--gc-strong);
}
.gcal-pop-head button { display: flex; color: var(--gc-muted); }
.gcal-pop-body { overflow-y: auto; padding: 4px 2px 2px; }

/* ── Manage view panel ─────────────────────────────────────────────── */
.gcal-manage {
  width: 256px; flex-shrink: 0; min-height: 0;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--gc-line); background: var(--gc-bg);
}
.gcal-mv-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 6px; font-size: 14px; font-weight: 600; color: var(--gc-strong);
}
.gcal-mv-head button { display: flex; color: var(--gc-muted); }
.gcal-mv-head button:hover { color: var(--gc-strong); }
.gcal-mv-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 12px 12px; }
.gcal-mv-box { margin-top: 2px; display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 8px; background: var(--gc-box); }
.gcal-mv-label { margin-bottom: 6px; font-size: 12.5px; font-weight: 500; color: var(--gc-strong); }
.gcal-mv-radios { display: flex; flex-direction: column; gap: 2px; }
.gcal-radio { display: flex; align-items: center; height: 20px; font-size: 12.5px; color: var(--gc-text); text-align: left; }
.gcal-radio-dot {
  width: 15px; height: 15px; flex-shrink: 0; margin-right: 6px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--gc-border); border-radius: 50%; background: var(--gc-bg);
}
.gcal-radio.is-on .gcal-radio-dot { border-color: var(--gc-today); background: var(--gc-chip-bg); }
.gcal-radio.is-on .gcal-radio-dot::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gc-today); }
.gcal-mv-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gcal-switch { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--gc-strong); text-align: left; }
.gcal-switch-track { position: relative; width: 28px; height: 16px; flex-shrink: 0; border-radius: 8px; background: var(--gc-switch-off); transition: background 0.15s; }
.gcal-switch.is-on .gcal-switch-track { background: var(--gc-today); }
.gcal-switch-knob {
  position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: left 0.15s;
}
.gcal-switch.is-on .gcal-switch-knob { left: 14px; }
.gcal-tip { position: relative; display: flex; color: var(--gc-sub); cursor: help; outline: none; }
.gcal-tip-text {
  display: none; position: absolute; bottom: 22px; right: -8px; z-index: 70; width: 236px;
  padding: 8px 12px; border-radius: 8px; background: #101828; color: #ffffff;
  font-size: 12px; font-weight: 500; line-height: 18px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}
.gcal-tip:hover .gcal-tip-text, .gcal-tip:focus .gcal-tip-text { display: block; }
.gcal-mv-filters {
  margin-top: 12px; display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; font-weight: 500; color: var(--gc-strong);
}
.gcal-mv-filters button { display: flex; align-items: center; gap: 3px; color: var(--gc-link); font-weight: 500; }
.gcal-mv-searchwrap {
  margin-top: 8px; height: 30px; display: flex; align-items: center; gap: 6px;
  padding: 0 8px; border: 1px solid var(--gc-border); border-radius: 8px; color: var(--gc-muted);
}
.gcal-root .gcal-mv-search {
  flex: 1 1 auto; min-width: 0; width: auto; height: 28px; padding: 0; margin: 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none;
  font: inherit; font-size: 12.5px; color: var(--gc-text);
}
.gcal-root .gcal-mv-search:focus { border: 0; box-shadow: none; }
.gcal-root .gcal-mv-search::placeholder { color: var(--gc-placeholder); }
.gcal-mv-section {
  display: flex; width: 100%; align-items: center; gap: 5px; padding: 8px 0;
  font-size: 12.5px; font-weight: 500; color: var(--gc-text); text-align: left;
}
.gcal-count {
  display: inline-block; padding: 0 7px; border-radius: 999px;
  font-size: 11px; font-weight: 500; line-height: 16px; letter-spacing: 0; text-transform: none;
  background: var(--gc-chip-bg); color: var(--gc-chip-text);
}
.gcal-mv-list { margin-bottom: 8px; }
.gcal-mv-item {
  display: flex; width: 100%; align-items: center; gap: 6px; padding: 3px 0;
  font-size: 12.5px; color: var(--gc-muted); text-align: left;
}
.gcal-mv-item:hover { color: var(--gc-strong); }
.gcal-mv-item > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcal-ccheck {
  width: 14px; height: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid; border-radius: 4px;
}
.gcal-mv-divider { border-top: 1px solid var(--gc-line); }
.gcal-mv-empty { padding: 3px 0; font-size: 12px; color: var(--gc-muted); }

/* ── "View details" drawer ─────────────────────────────────────────── */
.gcal-drawer-layer { position: fixed; inset: 0; z-index: 9400; }
.gcal-drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.3); opacity: 0; transition: opacity 0.18s ease; }
.gcal-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 500px; max-width: 100%;
  display: flex; background: var(--gc-bg); color: var(--gc-text);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
  transform: translateX(24px); opacity: 0; transition: transform 0.2s ease, opacity 0.2s ease;
}
.gcal-drawer-layer.is-open .gcal-drawer { transform: none; opacity: 1; }
.gcal-drawer-layer.is-open .gcal-drawer-backdrop { opacity: 1; }
.gcal-drawer-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.gcal-drawer-head {
  height: 56px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; border-bottom: 1px solid var(--gc-line);
}
.gcal-drawer-htitle { font-size: 16px; font-weight: 500; color: var(--gc-strong); }
.gcal-drawer-actions { display: flex; align-items: center; gap: 12px; color: var(--gc-muted); }
.gcal-drawer-actions button { display: flex; padding: 4px; border-radius: 6px; }
.gcal-drawer-actions button:hover { color: var(--gc-strong); background: var(--gc-hover); }
.gcal-drawer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; }
.gcal-chip {
  display: inline-block; padding: 2px 10px; border-radius: 16px;
  font-size: 14px; font-weight: 500; background: var(--gc-chip-bg); color: var(--gc-chip-text);
}
.gcal-drawer-title { margin-top: 14px; font-size: 18px; font-weight: 500; color: var(--gc-strong); overflow-wrap: anywhere; }
.gcal-drawer-sub { margin-top: 2px; font-size: 14px; color: var(--gc-muted); }
.gcal-sep { margin: 14px 0; border-top: 1px solid var(--gc-line); }
.gcal-dr-row { display: flex; gap: 12px; padding: 8px 0; }
.gcal-dr-ic { margin-top: 4px; flex-shrink: 0; display: flex; color: var(--gc-muted); }
.gcal-dr-rowmain { min-width: 0; }
.gcal-dr-label { font-size: 13px; color: var(--gc-muted); }
.gcal-dr-value { font-size: 14px; color: var(--gc-strong); overflow-wrap: anywhere; }
.gcal-dr-small { font-size: 12px; color: var(--gc-muted); }
.gcal-dr-maplink { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; font-size: 12.5px; font-weight: 600; }
.gcal-link-text { color: var(--gc-link); }
.gcal-dot { display: inline-block; width: 10px; height: 10px; flex-shrink: 0; margin-right: 6px; border-radius: 50%; vertical-align: -1px; }
.gcal-drawer-foot {
  height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 12px;
  padding: 0 20px; border-top: 1px solid var(--gc-line);
}
.gcal-foot-label { font-size: 14px; color: var(--gc-text); }
.gcal-status-wrap {
  display: flex; align-items: center; gap: 8px; height: 36px;
  padding: 0 10px; border: 1px solid var(--gc-border); border-radius: 8px; color: var(--gc-muted);
}
.gcal-root .gcal-status-select {
  width: auto; min-width: 128px; height: 34px; padding: 0 4px 0 0; margin: 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none;
  font: inherit; font-size: 14px; color: var(--gc-text); cursor: pointer;
}
.gcal-root .gcal-status-select:focus { border: 0; box-shadow: none; }
.gcal-root .gcal-status-select:disabled { cursor: default; opacity: 0.6; }
.gcal-root .gcal-status-select option { background: var(--gc-bg); color: var(--gc-text); }
.gcal-drawer-rail {
  width: 44px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 20px;
  padding-top: 64px; border-left: 1px solid var(--gc-line);
}
.gcal-drawer-rail button { display: flex; padding: 2px 10px 2px 0; border-right: 2px solid transparent; color: var(--gc-muted); }
.gcal-drawer-rail button.is-on { color: var(--gc-link); border-right-color: var(--gc-link); }

/* Notes section */
.gcal-dr-h {
  margin: 20px 0 8px; display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gc-strong);
}
#gcalDrNotes > .gcal-dr-h:first-child { margin-top: 0; }
.gcal-dr-pad { padding: 2px 0 4px; font-size: 13px; }
.gcal-dr-loading { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 13px; color: var(--gc-muted); }
.gcal-kv { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; font-size: 13px; }
.gcal-kv span { margin-right: 4px; color: var(--gc-muted); }
.gcal-kv b { font-weight: 600; color: var(--gc-strong); }
.gcal-note-block { margin-bottom: 10px; padding: 2px 0 2px 10px; border-left: 3px solid var(--gc-line); }
.gcal-note-label { margin-bottom: 2px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gc-muted); }
.gcal-note-text { font-size: 13.5px; line-height: 1.45; color: var(--gc-strong); overflow-wrap: anywhere; }
.gcal-answers { display: grid; gap: 8px; }
.gcal-answer { padding: 8px 10px; border: 1px solid var(--gc-line); border-radius: 8px; }
.gcal-answer-q { font-size: 12px; color: var(--gc-muted); }
.gcal-answer-a { font-size: 13.5px; font-weight: 500; color: var(--gc-strong); overflow-wrap: anywhere; }
.gcal-tl { position: relative; padding-left: 20px; }
.gcal-tl::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 10px; width: 2px; background: var(--gc-line); }
.gcal-tl-item { position: relative; padding-bottom: 12px; }
.gcal-tl-dot { position: absolute; left: -19px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 2px var(--gc-bg); }
.gcal-tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--gc-text); }
.gcal-tl-date { font-weight: 600; color: var(--gc-strong); }
.gcal-tl-meta { font-size: 12px; color: var(--gc-muted); }
.gcal-tl-notes {
  margin-top: 4px; padding: 6px 8px; border-radius: 6px; background: var(--gc-soft);
  font-size: 13px; line-height: 1.45; color: var(--gc-strong); overflow-wrap: anywhere;
}
.gcal-res {
  display: inline-block; padding: 1px 8px; border-radius: 999px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; background: rgba(148, 163, 184, 0.16); color: var(--gc-muted);
}
.gcal-res--agendada, .gcal-res--reagendado { background: rgba(22, 163, 74, 0.16); color: var(--gc-green); }
.gcal-res--contesto, .gcal-res--contesto_chat, .gcal-res--vendedor { background: rgba(14, 165, 233, 0.16); color: var(--gc-sky); }
.gcal-res--call_back { background: rgba(168, 85, 247, 0.16); color: var(--gc-purple); }
.gcal-res--no_interesado, .gcal-res--no_califica, .gcal-res--numero_malo,
.gcal-res--numero_desconectado, .gcal-res--dnc { background: rgba(239, 68, 68, 0.14); color: var(--gc-red); }
.gcal-res-dot--agendada, .gcal-res-dot--reagendado { background: #16a34a; }
.gcal-res-dot--contesto, .gcal-res-dot--contesto_chat, .gcal-res-dot--vendedor { background: #0ea5e9; }
.gcal-res-dot--call_back { background: #a855f7; }
.gcal-res-dot--no_interesado, .gcal-res-dot--no_califica, .gcal-res-dot--numero_malo,
.gcal-res-dot--numero_desconectado, .gcal-res-dot--dnc { background: #ef4444; }
.gcal-note-form { margin-bottom: 10px; }
.gcal-note-form-foot { display: flex; justify-content: flex-end; margin-top: 6px; }
.gcal-crm-notes { display: flex; flex-direction: column; gap: 8px; }
.gcal-crm-note { padding: 8px 10px; border: 1px solid var(--gc-line); border-radius: 8px; background: var(--gc-soft); }
.gcal-crm-note-title { margin-bottom: 2px; font-size: 13px; font-weight: 700; color: var(--gc-strong); }
.gcal-crm-note-text { font-size: 13.5px; line-height: 1.45; color: var(--gc-strong); overflow-wrap: anywhere; }
.gcal-crm-note-meta { margin-top: 4px; font-size: 12px; color: var(--gc-muted); }
.gcal-others { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.gcal-other {
  display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--gc-line); border-radius: 8px; font-size: 13px; color: var(--gc-text); text-align: left;
}
.gcal-other:hover { background: var(--gc-hover); border-color: var(--gc-border); }
.gcal-other.is-busy { opacity: 0.6; }
.gcal-other-when { font-weight: 600; color: var(--gc-strong); white-space: nowrap; }
.gcal-other-cal { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gc-muted); }
.gcal-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  font-size: 11px; font-weight: 600; line-height: 16px; color: #ffffff;
}

/* ── Create / Edit modals ──────────────────────────────────────────── */
.gcal-modal-layer { position: fixed; inset: 0; z-index: 9500; display: flex; align-items: center; justify-content: center; padding: 16px; }
.gcal-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.gcal-modal {
  position: relative; width: 100%; max-width: 520px; max-height: 90vh; max-height: 90dvh;
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--gc-border); border-radius: 12px;
  background: var(--gc-bg); color: var(--gc-text); box-shadow: var(--gc-shadow);
}
.gcal-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--gc-line); }
.gcal-modal-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--gc-strong); }
.gcal-modal-x { display: flex; padding: 3px; border-radius: 6px; color: var(--gc-muted); }
.gcal-modal-x:hover { color: var(--gc-strong); background: var(--gc-hover); }
.gcal-modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.gcal-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--gc-line); }
.gcal-modal-foot .gcal-btn { height: 34px; padding: 0 16px; font-size: 13px; }
.gcal-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.gcal-flabel { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gc-muted); }
.gcal-frow { display: grid; gap: 12px; }
.gcal-frow-3 { grid-template-columns: 2fr 1fr; }
.gcal-frow-2 { grid-template-columns: 1fr 1fr; }
.gcal-root .gcal-input {
  width: 100%; height: 38px; padding: 0 11px; margin: 0;
  border: 1px solid var(--gc-border); border-radius: 8px;
  background: var(--gc-input-bg); color: var(--gc-strong);
  font: inherit; font-size: 14px; line-height: normal; box-shadow: none; outline: none;
}
.gcal-root textarea.gcal-input { height: auto; min-height: 76px; padding: 9px 11px; line-height: 1.45; resize: vertical; }
.gcal-root .gcal-input:focus { border-color: var(--gc-focus); box-shadow: 0 0 0 3px var(--gc-focus-ring); }
.gcal-root .gcal-input::placeholder { color: var(--gc-placeholder); }
.gcal-root .gcal-input:disabled { opacity: 0.6; }
.gcal-root select.gcal-input option { background: var(--gc-bg); color: var(--gc-strong); }
.gcal-ferr { font-size: 13px; color: var(--gc-red); }
.gcal-edit-who { font-size: 15px; font-weight: 600; color: var(--gc-strong); }
.gcal-lead { position: relative; }
.gcal-lead-picked {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 11px; border: 1px solid var(--gc-border); border-radius: 8px; background: var(--gc-input-bg);
}
.gcal-lead-picked-main { min-width: 0; display: flex; flex-direction: column; }
.gcal-lead-name { font-size: 14px; font-weight: 600; color: var(--gc-strong); }
.gcal-lead-meta { font-size: 12px; color: var(--gc-muted); }
.gcal-linkbtn { flex-shrink: 0; font-size: 12.5px; font-weight: 600; color: var(--gc-link); }
.gcal-lead-search { position: relative; }
.gcal-lead-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10;
  max-height: 240px; overflow-y: auto;
  border: 1px solid var(--gc-border); border-radius: 8px; background: var(--gc-bg); box-shadow: var(--gc-shadow);
}
.gcal-lead-opt { display: flex; flex-direction: column; width: 100%; padding: 8px 11px; text-align: left; }
.gcal-lead-opt + .gcal-lead-opt { border-top: 1px solid var(--gc-line); }
.gcal-lead-opt:hover, .gcal-lead-opt:focus { background: var(--gc-hover); outline: none; }
.gcal-lead-opt-name { font-size: 14px; color: var(--gc-strong); }
.gcal-lead-opt-meta { font-size: 12px; color: var(--gc-muted); }
.gcal-lead-status { padding: 10px 11px; font-size: 13px; color: var(--gc-muted); }
.gcal-lead-err { color: var(--gc-red); }

/* ── Appointments list ─────────────────────────────────────────────── */
.gcal-filters .gcal-al-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.gcal-al-month { min-width: 150px; text-align: center; font-size: 15px; color: var(--text, #e5e7eb); }
.gcal-filters .gcal-al-arrow { padding: 7px 9px; }
.gcal-filters .qh-btn.gcal-is-on { border-color: var(--accent, #06b6d4); color: var(--accent, #06b6d4); background: rgba(6, 182, 212, 0.1); }
[data-theme="light"] .gcal-filters .qh-btn.gcal-is-on { background: rgba(181, 23, 42, 0.06); }
.gcal-al-count { align-self: center; margin-left: auto; font-size: 12px; color: var(--muted, #9ca3af); }
.gcal-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.gcal-kpi {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--gc-line); border-top: 3px solid var(--gc-k, #94a3b8);
  background: var(--gc-kpi-bg); transition: background 0.15s, box-shadow 0.15s;
}
.gcal-kpi:hover { background: var(--gc-hover); }
.gcal-kpi.is-on { box-shadow: inset 0 0 0 1px var(--gc-k, #94a3b8); border-color: var(--gc-k, #94a3b8); }
.gcal-kpi:focus-visible { outline: 2px solid var(--gc-focus); outline-offset: 2px; }
.gcal-kpi-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gc-muted); }
.gcal-kpi-value { margin-top: 2px; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gc-strong); }
.gcal-kpi-sub { font-size: 12px; color: var(--gc-muted); }
.gcal-al-list { border: 1px solid var(--gc-line); border-radius: 10px; background: var(--gc-bg); }
.gcal-al-colhead, .gcal-al-row {
  display: grid;
  grid-template-columns: 84px minmax(150px, 1.5fr) 108px minmax(80px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(120px, 1.2fr) 140px;
  align-items: center; gap: 0 12px; padding: 0 14px;
}
.gcal-al-colhead {
  padding-top: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--gc-line);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--gc-muted);
}
.gcal-al-dayhead {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-bottom: 1px solid var(--gc-line); background: var(--gc-dayhead-bg); font-size: 13px;
}
.gcal-al-dayname { font-weight: 700; color: var(--gc-strong); }
.gcal-al-today { padding: 1px 8px; border-radius: 999px; background: var(--gc-primary); color: var(--gc-primary-ink); font-size: 11px; font-weight: 700; }
.gcal-al-daycount { margin-left: auto; font-size: 12px; color: var(--gc-muted); white-space: nowrap; }
.gcal-al-day.is-today .gcal-al-dayhead { box-shadow: inset 3px 0 0 var(--gc-primary); }
.gcal-al-day:last-child .gcal-al-row:last-child { border-bottom: 0; }
.gcal-al-row {
  padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--gc-line);
  font-size: 13px; color: var(--gc-text); cursor: pointer; transition: background 0.12s;
}
.gcal-al-row:hover { background: var(--gc-hover); }
.gcal-al-row:focus-visible { outline: 2px solid var(--gc-focus); outline-offset: -2px; }
.gcal-al-row.is-done .gcal-al-time { color: var(--gc-muted); }
.gcal-al-c { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcal-al-time { display: flex; flex-direction: column; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gc-strong); }
.gcal-al-dur { font-size: 11px; font-weight: 500; color: var(--gc-muted); }
.gcal-al-client { display: flex; flex-direction: column; }
.gcal-al-client b { overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: var(--gc-strong); }
.gcal-al-sub { overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--gc-muted); }
.gcal-al-cal { display: flex; align-items: center; }
.gcal-al-cal .gcal-dot { flex-shrink: 0; }
.gcal-al-tel { font-variant-numeric: tabular-nums; }
.gcal-al-empty { padding: 40px 0; text-align: center; font-size: 14px; color: var(--gc-muted); }
.gcal-al-more { padding: 14px; text-align: center; }
.gcal-al-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 0; color: var(--gc-muted); }

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .gcal-al-colhead, .gcal-al-row {
    grid-template-columns: 78px minmax(130px, 1.4fr) 104px minmax(70px, 1fr) minmax(80px, 1fr) minmax(80px, 1fr) minmax(100px, 1fr) 128px;
    gap: 0 10px;
  }
}
@media (max-width: 900px) {
  .gcal-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gcal-al-colhead { display: none; }
  .gcal-al-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 12px; }
  .gcal-al-time { order: 1; flex-direction: row; align-items: baseline; gap: 6px; }
  .gcal-al-status { order: 2; margin-left: auto; }
  .gcal-al-client { order: 3; flex: 1 1 100%; }
  .gcal-al-meta { order: 4; font-size: 12px; }
  .gcal-al-meta::before { content: attr(data-label) ": "; color: var(--gc-muted); }
  .gcal-al-meta.is-empty { display: none; }
  .gcal-al-cal { order: 5; font-size: 12px; }
  .gcal-al-phone { order: 6; margin-left: auto; font-size: 12.5px; }
}
@media (max-width: 760px) {
  .quote-history-modal__body.gcal-cal-body { padding: 8px; }
  .quote-history-modal__body.gcal-al-body { padding: 12px 12px 24px; }
  .gcal-manage {
    position: absolute; top: 0; right: 0; bottom: 0; z-index: 50;
    width: 280px; max-width: 88%; box-shadow: var(--gc-shadow);
  }
  .gcal-al-month { min-width: 120px; font-size: 14px; }
  .gcal-al-count { flex-basis: 100%; margin-left: 0; }
}
@media (max-width: 640px) {
  .gcal-mg-inner { min-width: 0; }
  .gcal-mg-dow { padding: 4px 1px; font-size: 12px; line-height: 18px; }
  .gcal-mg-week { min-height: 86px; }
  .gcal-mg-num span { padding: 2px 4px; font-size: 12px; line-height: 16px; }
  .gcal-mg-evs { min-height: 18px; }
  .gcal-mchip { width: calc(100% - 2px); margin: 1px 1px 0; }
  .gcal-mchip-box { height: 17px; margin-bottom: 2px; padding: 0 3px; font-size: 10.5px; border-width: 1px 1px 1px 3px !important; }
  .gcal-more { margin: 0 2px 2px; padding: 0 2px; font-size: 10.5px; }
  .gcal-drawer { width: 100%; }
  .gcal-drawer-rail { display: none; }
  .gcal-drawer-head, .gcal-drawer-foot { padding: 0 14px; }
  .gcal-drawer-body { padding: 14px; }
  .gcal-modal-layer { padding: 0; align-items: stretch; }
  .gcal-modal { max-width: none; max-height: none; height: 100%; border: 0; border-radius: 0; }
  .gcal-modal-body { padding: 14px 16px; }
  .gcal-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gcal-kpi { padding: 10px 12px; }
  .gcal-kpi-value { font-size: 20px; }
}
@media (max-width: 480px) {
  .gcal-hide-xs { display: none; }
  .gcal-toolbar { padding: 8px; gap: 6px; }
  .gcal-tb-group { gap: 6px; }
  .gcal-range-title { min-width: 108px; font-size: 12px; }
  .gcal-viewsel-btn { width: 98px; }
}

/* Refreshing data already on screen (calendar-gio.js stale-while-revalidate). */
.gcal-updating {
  position: absolute; top: 8px; right: 10px; z-index: 45; pointer-events: none;
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px;
  background: var(--gc-veil); font-size: 12px; color: var(--gc-sub);
}
.gcal-updating .gcal-spinner { width: 14px; height: 14px; border-width: 2px; }
