/* UI Component Kit + OTP, Public Cards & Staff Shell Styles (<= 250 lines) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 8px 20px; border-radius: var(--r-pill);
  border: 1px solid transparent; font-weight: 700; font-size: 0.94rem; line-height: 1.4;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--sm { min-height: 38px; padding: 6px 14px; font-size: 0.85rem; }
.btn--lg { min-height: 50px; padding: 11px 26px; font-size: 1rem; }
.btn--full { width: 100%; }
.btn--icon { width: 44px; padding: 0; flex-shrink: 0; }
.btn--primary { background: var(--grad); color: var(--on-strong); box-shadow: var(--shadow-sm); }
.btn--primary:hover:not(:disabled) { opacity: 0.94; }
.btn--soft, .btn--outline { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn--soft:hover:not(:disabled), .btn--outline:hover:not(:disabled) { border-color: var(--teal); }
.btn--ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn--danger { background: var(--crit); color: #FFFFFF; }
.btn--danger:hover:not(:disabled) { opacity: 0.92; }

/* Fields & Inputs */
.field { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.field__label { font-size: 0.9rem; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 4px; }
.field__req { color: var(--crit); }
.field__hint { font-size: 0.8rem; color: var(--ink-3); }
.field__error { font-size: 0.82rem; color: var(--crit); font-weight: 600; }

.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; background: var(--surface);
  color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--info-soft); }
.input--error, .select--error, .textarea--error { border-color: var(--crit); }
.textarea { min-height: 108px; resize: vertical; line-height: 1.8; }

/* OTP 5 Digit Boxes (LTR order for left-to-right digit entry) */
.otp-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; direction: ltr; }
.otp-box {
  width: 100%; height: 50px; text-align: center; font-size: 1.25rem; font-weight: 800;
  border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface-2);
  color: var(--ink); transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.otp-box:focus { border-color: var(--teal); background: var(--surface); outline: none; box-shadow: 0 0 0 3px var(--info-soft); }

/* Switch, Checkbox, RadioChips */
.switch-row, .check-row { display: inline-flex; align-items: center; gap: var(--sp-3); min-height: 44px; cursor: pointer; user-select: none; }
.switch-track { width: 46px; height: 26px; border-radius: var(--r-pill); background: var(--line); position: relative; transition: background var(--dur) var(--ease); flex-shrink: 0; }
.switch-thumb { width: 20px; height: 20px; border-radius: 50%; background: #FFF; position: absolute; top: 3px; right: 3px; transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-sm); }
.switch-row[aria-checked="true"] .switch-track { background: var(--teal-strong); }
.switch-row[aria-checked="true"] .switch-thumb { transform: translateX(-20px); }
.check-box { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--on-strong); flex-shrink: 0; }
.check-row[aria-checked="true"] .check-box { background: var(--teal-strong); border-color: var(--teal-strong); }
.radio-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.radio-chip { min-height: 40px; padding: 6px 15px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 0.88rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.radio-chip[aria-checked="true"] { background: var(--surface-2); border-color: var(--teal); color: var(--ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--teal); }

/* Card, Stat, Badge */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow-sm); }
.card--soft { background: var(--surface-2); box-shadow: none; }
.card--interactive { cursor: pointer; transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.card--interactive:hover { transform: translateY(-2px); border-color: var(--teal); }
.card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card__title { font-size: 1.05rem; font-weight: 800; color: var(--ink); }
.card__subtitle { font-size: 0.86rem; color: var(--ink-2); }
.card__footer { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: var(--r-pill); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.badge--neutral { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.badge--ok, .badge--success, .badge--brand { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--crit, .badge--danger { background: var(--crit-soft); color: var(--crit); }
.badge--info { background: var(--info-soft); color: var(--blue); }

.stat-card { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.stat-card__val { font-size: 1.5rem; font-weight: 800; color: var(--ink); line-height: 1.3; }
.stat-card__icon { width: 44px; height: 44px; border-radius: var(--r-md); background: var(--surface-2); color: var(--teal); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Article & Result Cards */
.article-card { display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 0; }
.article-card__cover { width: 100%; aspect-ratio: 16/9; background: var(--grad-soft); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.article-card__body { padding: var(--sp-4); display: flex; flex-direction: column; gap: 8px; flex: 1; }

/* Tabs, Segmented Controls & DataTable */
.tabs-bar { display: flex; align-items: center; gap: var(--sp-2); overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs-bar::-webkit-scrollbar { display: none; }
.tab-btn { position: relative; min-height: 46px; padding: 10px 16px; background: transparent; border: none; color: var(--ink-2); font-weight: 700; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tab-btn[aria-selected="true"] { color: var(--ink); }
.tab-btn[aria-selected="true"]::after { content: ''; position: absolute; right: 8px; left: 8px; bottom: -1px; height: 3px; border-radius: var(--r-pill); background: var(--grad); }
.tab-count { font-size: 0.75rem; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); }
.segmented { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 5px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; }
.segmented__btn { min-height: 36px; padding: 6px 14px; border-radius: var(--r-pill); border: 1px solid transparent; background: transparent; color: var(--ink-2); font-size: 0.84rem; font-weight: 700; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: all var(--dur) var(--ease); }
.segmented__btn:hover { color: var(--ink); background: var(--surface); }
.segmented__btn--active { background: var(--grad); color: var(--on-strong); box-shadow: var(--shadow-sm); }
.segmented__btn--active:hover { color: var(--on-strong); background: var(--grad); }
.segmented__btn--active .badge { background: rgba(255,255,255,0.24); color: #fff; border-color: transparent; }

.data-table-wrap, .table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.data-table, .table { width: 100%; border-collapse: collapse; text-align: right; }
.data-table th, .table th { background: var(--surface-2); color: var(--ink-2); font-size: 0.82rem; font-weight: 700; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td, .table td { padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 0.88rem; vertical-align: middle; }
.data-table tr:last-child td, .table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.data-cards { display: none; flex-direction: column; gap: var(--sp-3); }
.data-card-row { display: flex; justify-content: space-between; gap: var(--sp-3); padding-block: 6px; border-bottom: 1px dashed var(--line); font-size: 0.9rem; }
.data-card-row:last-child { border-bottom: none; }
.support-grid { display: grid; grid-template-columns: 280px 1fr 270px; gap: var(--sp-3); align-items: start; }
.bulk-visit-row { display: grid; grid-template-columns: 1fr 0.9fr 1.3fr 1.2fr auto; gap: var(--sp-2); align-items: center; }
@media (max-width: 991px) { .data-table-wrap, .hide-mobile { display: none !important; } .data-cards { display: flex; } .support-grid { grid-template-columns: 1fr !important; } .bulk-visit-row { grid-template-columns: 1fr 1fr; } }
@media (min-width: 992px) { .hide-desktop { display: none !important; } }

/* StaffShell (Stage F4) */
.staff-shell { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.staff-topbar { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line); }
.staff-topbar__inner { max-width: 1280px; margin: 0 auto; padding: 10px var(--sp-4); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.staff-search { position: relative; flex: 1; max-width: 380px; min-width: 200px; }
.staff-search input { width: 100%; height: 40px; padding: 6px 36px 6px 34px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 0.86rem; }
.staff-search input:focus { border-color: var(--teal); background: var(--surface); outline: none; }
.staff-search__kbd { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-3); pointer-events: none; }
.staff-tabs { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 61px; z-index: 45; }
.staff-tabs__inner { max-width: 1280px; margin: 0 auto; padding: 0 var(--sp-4); display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.staff-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 12px 12px; color: var(--ink-2); font-weight: 700; font-size: 0.86rem; text-decoration: none; white-space: nowrap; flex-shrink: 0; border-bottom: 3px solid transparent; transition: color var(--dur) var(--ease); }
.staff-tab:hover { color: var(--ink); }
.staff-tab--active { color: var(--teal-strong); border-bottom-color: var(--teal); }
.staff-tab__badge { padding: 1px 7px; border-radius: var(--r-pill); font-size: 0.74rem; background: var(--crit-soft); color: var(--crit); font-weight: 800; }
.staff-main { max-width: 1280px; width: 100%; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-10); flex: 1; }
.row-actions { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.action-icon-btn { width: 32px; height: 32px; flex-shrink: 0; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease); }
.action-icon-btn:hover { border-color: var(--teal); color: var(--teal-strong); background: var(--surface-2); }
.patient-sticky-head { position: sticky; top: 112px; z-index: 35; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4); box-shadow: var(--shadow-sm); }

/* Overlays */
.overlay-backdrop { position: fixed; inset: 0; z-index: 80; background: var(--backdrop); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: var(--sp-4); animation: fadeIn var(--dur) var(--ease); }
.modal-box { width: 100%; max-width: 560px; max-height: 90dvh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: var(--sp-5); box-shadow: var(--shadow-lg); }
.sheet-backdrop { align-items: flex-end; padding: 0; }
.sheet-box { width: 100%; max-width: 600px; max-height: 88dvh; overflow-y: auto; background: var(--surface); border-top: 1px solid var(--line); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: var(--sp-5) var(--sp-5) calc(var(--sp-6) + env(safe-area-inset-bottom, 0px)); box-shadow: var(--shadow-lg); }
.sheet-handle { width: 44px; height: 5px; border-radius: var(--r-pill); background: var(--line); margin: 0 auto var(--sp-4); }
.drawer-backdrop { justify-content: flex-start; padding: 0; }
.drawer-box { width: min(86vw, 340px); height: 100dvh; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); padding: var(--sp-5); display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow-lg); }
.drawer-nav { display: flex; flex-direction: column; gap: 4px; margin-block: var(--sp-4); }
.drawer-link { display: flex; align-items: center; gap: var(--sp-3); min-height: 46px; padding: 10px 14px; border-radius: var(--r-md); font-weight: 700; color: var(--ink-2); }
.drawer-link:hover, .drawer-link.is-active { background: var(--surface-2); color: var(--ink); }

.toast-stack { position: fixed; bottom: calc(var(--sp-4) + env(safe-area-inset-bottom, 0px)); left: var(--sp-4); right: var(--sp-4); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); pointer-events: none; }
.toast-item { pointer-events: auto; width: 100%; max-width: 420px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 16px; box-shadow: var(--shadow-md); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); font-weight: 600; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--r-sm); }
.empty-state { text-align: center; padding: var(--sp-8) var(--sp-4); display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
.avatar { border-radius: 50%; background: var(--surface-2); color: var(--teal-strong); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; overflow: hidden; flex-shrink: 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); flex-wrap: wrap; }

.jdate-wrap { position: relative; }
.jdate-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; width: 304px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4); box-shadow: var(--shadow-lg); }
.jdate-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; margin-top: var(--sp-2); }
.jdate-weekday { font-size: 0.76rem; color: var(--ink-3); font-weight: 700; padding-block: 4px; }
.jdate-day { height: 36px; border-radius: var(--r-xs); border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 0.88rem; font-weight: 600; }
.jdate-day:hover:not(:disabled) { background: var(--surface-2); }
.jdate-day.is-today { border-color: var(--teal); color: var(--teal); font-weight: 800; }
.jdate-day.is-selected { background: var(--grad); color: var(--on-strong); font-weight: 800; }
.jdate-day:disabled { opacity: 0.3; cursor: not-allowed; }

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.85s linear infinite; }

/* Stage F6 MiniEditor & SEO Preview */
.mini-editor { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.mini-editor__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.mini-editor__btn { min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--r-xs); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 0.78rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.mini-editor__btn:hover { border-color: var(--teal); color: var(--teal-strong); }
.mini-editor__btn.is-active, .mini-editor__btn--active { background: var(--ok-soft); border-color: var(--teal); color: var(--teal-strong); }
.mini-editor__sep { width: 1px; height: 22px; background: var(--line); margin-inline: 2px; }
.mini-editor__swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.mini-editor__body, .mini-editor__canvas { min-height: 290px; max-height: 620px; overflow-y: auto; padding: var(--sp-4); outline: none; direction: rtl; text-align: right; }
.mini-editor__body:focus, .mini-editor__canvas:focus { box-shadow: inset 0 0 0 2px var(--info-soft); }
.mini-editor__body img, .mini-editor__canvas img { cursor: pointer; transition: outline 0.15s ease; }
.mini-editor__body img:hover, .mini-editor__canvas img:hover, .mini-editor__canvas img.is-selected { outline: 3px solid var(--teal); outline-offset: 2px; }
.mini-editor__inspector, .mini-editor__imgbar { padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; font-size: 0.82rem; }
.mini-editor__frame-chip { padding: 5px 12px; border-radius: var(--r-xs); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 0.78rem; font-weight: 700; cursor: pointer; }
.mini-editor__frame-chip--active { background: var(--ok-soft); border-color: var(--teal); color: var(--teal-strong); }
.mini-editor__html { width: 100%; min-height: 290px; padding: var(--sp-4); border: none; outline: none; background: var(--surface-2); color: var(--ink); font-family: monospace; font-size: 0.84rem; direction: ltr; text-align: left; }
.cover-16x9 { width: 100%; aspect-ratio: 16/9; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.cover-16x9 img { width: 100%; height: 100%; object-fit: cover; }
.serp-preview { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); direction: rtl; text-align: right; }
.serp-preview__url { font-size: 0.78rem; color: var(--teal-strong); direction: ltr; text-align: right; }
.serp-preview__title { font-size: 1.02rem; font-weight: 800; color: #1d4ed8; margin-top: 2px; }
[data-theme="dark"] .serp-preview__title { color: #60a5fa; }
.serp-preview__desc { font-size: 0.84rem; color: var(--ink-2); margin-top: 4px; line-height: 1.6; }

/* Stage F8: Sibi 3D Apple, Speech Bubble & Chat Window */
#apple-root { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: visible; }
.sibi-stage { position: fixed; top: 0; left: 0; width: 140px; height: 140px; z-index: 96; pointer-events: none; will-change: transform; transform-origin: 0 0; }
.sibi-stage.is-docked { z-index: 99; }
@media (max-width: 767px) { .sibi-stage { width: 96px; height: 96px; } }
.sibi-hit { pointer-events: auto; position: relative; width: 100%; height: 100%; padding: 0; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: transform 0.25s var(--ease); }
.sibi-hit:hover { transform: scale(1.05); }
.sibi-stage.is-gliding .sibi-hit { animation: sibiHop 0.75s var(--ease); }
.sibi-hit[data-clip="spin"] .sibi-fallback-img { animation: spin 0.9s var(--ease); }
.sibi-hit[data-clip="talk"] .sibi-fallback-img, .sibi-hit[data-clip="celebrate"] .sibi-fallback-img { animation: sibiHop 0.55s ease infinite; }
.sibi-fallback-img, .sibi-canvas { width: 100%; height: 100%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 8px 18px rgba(13,34,48,0.18)); }

.sibi-bubble { pointer-events: auto; position: absolute; bottom: calc(100% + 8px); left: 8px; width: clamp(190px, 64vw, 252px); max-width: calc(100vw - 32px); background: var(--surface); color: var(--ink); border: 1.5px solid var(--teal); border-radius: var(--r-lg) var(--r-lg) var(--r-lg) 4px; padding: 10px 12px 10px 28px; box-shadow: var(--shadow-md); font-size: 0.82rem; font-weight: 700; line-height: 1.65; direction: rtl; text-align: right; white-space: normal; overflow-wrap: break-word; word-break: break-word; animation: fadeIn 0.22s var(--ease); }
.sibi-bubble--right { left: auto; right: 8px; border-radius: var(--r-lg) var(--r-lg) 4px var(--r-lg); }
.sibi-bubble__text { cursor: pointer; display: block; white-space: normal; overflow-wrap: break-word; }
.sibi-bubble__close { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--surface-2); color: var(--ink-2); font-size: 0.85rem; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

.sibi-chat-backdrop { pointer-events: auto; position: fixed; inset: 0; background: rgba(10, 24, 34, 0.32); z-index: 96; }
@media (min-width: 768px) { .sibi-chat-backdrop { background: transparent; pointer-events: none; } }
.sibi-chat { pointer-events: auto; position: fixed; z-index: 97; width: 360px; height: 520px; max-height: calc(100dvh - 96px); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; direction: rtl; text-align: right; opacity: 0; transform: scale(0.18); transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease; }
.sibi-chat.is-open { opacity: 1; transform: scale(1); }
@media (max-width: 767px) { .sibi-chat { width: 100%; height: 75dvh; max-height: 82dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; } }

.sibi-chat__head { padding: 12px 14px; background: var(--grad); color: var(--on-strong); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sibi-chat__title-wrap { display: flex; align-items: center; gap: 10px; }
.sibi-chat__dock-slot { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,0.16); border: 1.5px dashed rgba(255,255,255,0.4); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sibi-chat__title { font-size: 0.92rem; font-weight: 800; display: block; }
.sibi-chat__sub { font-size: 0.72rem; opacity: 0.9; }
.sibi-chat__head-actions { display: flex; align-items: center; gap: 6px; }
.sibi-chat__reset { padding: 4px 9px; border-radius: var(--r-pill); border: 1px solid rgba(255,255,255,0.35); background: rgba(255,255,255,0.14); color: #fff; font-size: 0.72rem; font-weight: 700; cursor: pointer; }
.sibi-chat__close { width: 28px; height: 28px; border-radius: 50%; border: none; background: rgba(255,255,255,0.18); color: #fff; font-size: 1.1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

.sibi-chat__socials { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.sibi-chat__social-link { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; transition: all var(--dur) var(--ease); flex-shrink: 0; }
.sibi-chat__social-link:hover { border-color: var(--teal); color: var(--teal-strong); transform: translateY(-1px); background: var(--ok-soft); }
.sibi-chat__notice { padding: 6px 12px; background: var(--info-soft); color: var(--ink-2); font-size: 0.72rem; border-bottom: 1px solid var(--line); }

.sibi-chat__thread { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.sibi-msg { max-width: 88%; padding: 9px 12px; border-radius: var(--r-md); font-size: 0.84rem; line-height: 1.7; word-break: break-word; }
.sibi-msg--assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-top-right-radius: 4px; }
.sibi-msg--user { align-self: flex-end; background: var(--grad); color: var(--on-strong); border-top-left-radius: 4px; font-weight: 600; }
.sibi-msg--typing { font-size: 0.78rem; color: var(--ink-3); font-style: italic; }
.sibi-msg--error { align-self: center; background: var(--crit-soft); color: var(--crit); border: 1px solid var(--crit); display: flex; align-items: center; gap: 8px; font-size: 0.78rem; font-weight: 700; }
.sibi-chat__retry { padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--crit); background: var(--surface); color: var(--crit); font-size: 0.74rem; font-weight: 700; cursor: pointer; }
.sibi-msg__links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sibi-chat__link { display: inline-flex; align-items: center; padding: 2px 9px; margin-inline: 2px; border-radius: var(--r-pill); background: var(--ok-soft); color: var(--teal-strong); font-size: 0.76rem; font-weight: 800; text-decoration: none; border: 1px solid var(--teal); }

.sibi-chat__chips { display: flex; gap: 6px; padding: 8px 12px; background: var(--surface); border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.sibi-chat__chip { padding: 4px 11px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 0.76rem; font-weight: 700; white-space: nowrap; cursor: pointer; }
.sibi-chat__chip:hover { border-color: var(--teal); color: var(--teal-strong); }
.sibi-chat__form { display: flex; gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
.sibi-chat__input { flex: 1; height: 38px; padding: 6px 12px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 0.84rem; outline: none; }
.sibi-chat__input:focus { border-color: var(--teal); background: var(--surface); }
.sibi-chat__send { height: 38px; padding: 0 16px; border-radius: var(--r-pill); border: none; background: var(--grad); color: var(--on-strong); font-size: 0.84rem; font-weight: 800; cursor: pointer; }
.sibi-chat__send:disabled { opacity: 0.5; cursor: not-allowed; }
@keyframes sibiHop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px) scale(1.04); } }
