/* ============================================================
   Vitaloop Platform — Shell + Components
   Layout & component rules adapted from the Bholane HIMS UI.
   ============================================================ */

/* ---------- Layout ---------- */
.app-container { display: flex; min-height: 100vh; }
.app-container.not-logged-in .sidebar,
.app-container.not-logged-in .top-header { display: none !important; }
.app-container.not-logged-in .main-content { margin-left: 0 !important; }

.sidebar {
  width: var(--sidebar-rail);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  display: flex; flex-direction: column;
  position: fixed; height: 100vh; z-index: 120; overflow-x: hidden;
  transition: width var(--transition-speed) ease, transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}
/* Collapsed icon-rail that expands OVER the main content on hover (or stays open when pinned). */
.sidebar:hover,
.app-container.pinned .sidebar { width: var(--sidebar-width); }
.sidebar:hover { box-shadow: 12px 0 44px rgba(0, 0, 0, 0.28); }
.app-container.pinned .sidebar { box-shadow: none; }

/* Labels collapse to icons; revealed on hover / when pinned. */
.brand-title, .nav-label, .nav-group-label, .nav-pill, .profile-meta, .sidebar-footer .icon-btn {
  white-space: nowrap; opacity: 0; transition: opacity 0.14s ease;
}
.sidebar:hover .brand-title, .sidebar:hover .nav-label, .sidebar:hover .nav-group-label,
.sidebar:hover .nav-pill, .sidebar:hover .profile-meta, .sidebar:hover .sidebar-footer .icon-btn,
.app-container.pinned .brand-title, .app-container.pinned .nav-label, .app-container.pinned .nav-group-label,
.app-container.pinned .nav-pill, .app-container.pinned .profile-meta, .app-container.pinned .sidebar-footer .icon-btn { opacity: 1; }
.nav-link { white-space: nowrap; }
.sidebar-pin.active { color: var(--diag-primary); border-color: var(--border-focus); }

.brand-section {
  padding: 22px 24px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border-color);
}
.brand-logo-container {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--diag-primary), var(--peds-primary));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.brand-logo-container svg { color: #fff; width: 24px; height: 24px; }
.brand-title { font-size: 1.1rem; font-weight: 800; line-height: 1.2; }
.brand-title span {
  font-weight: 400; font-size: 0.7rem; display: block; color: var(--text-muted);
  letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px;
}

.nav-scroll { flex-grow: 1; overflow-y: auto; }
.nav-group-label {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 700; padding: 16px 24px 6px; opacity: 0.8;
}
.nav-menu { list-style: none; padding: 6px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item { width: 100%; }
.nav-link {
  display: flex; align-items: center; gap: 13px; padding: 11px 14px;
  border-radius: 10px; font-size: 0.9rem; font-weight: 500;
  color: var(--text-muted); transition: all var(--transition-speed) ease; cursor: pointer;
}
.nav-link svg { width: 19px; height: 19px; flex-shrink: 0; transition: transform var(--transition-speed) ease; }
.nav-link:hover { background: var(--card-bg); color: var(--text-main); }
.nav-link:hover svg { transform: translateX(2px); }
.nav-link.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(16, 185, 129, 0.1));
  border-left: 3px solid var(--diag-primary); color: var(--text-main); font-weight: 600;
}
.nav-link.active svg { color: var(--diag-primary); }
.nav-link .nav-pill {
  margin-left: auto; font-size: 0.62rem; font-weight: 800; padding: 1px 7px; border-radius: 10px;
  background: var(--diag-glow); color: var(--diag-primary);
}

.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.profile-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--diag-primary), var(--peds-primary));
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.85rem;
}
.profile-meta { min-width: 0; }
.profile-meta .name { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-meta .role { font-size: 0.72rem; color: var(--text-muted); }
.icon-btn {
  background: transparent; border: 1px solid var(--border-color); width: 32px; height: 32px;
  border-radius: 8px; color: var(--text-main); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition-speed) ease; flex-shrink: 0;
}
.icon-btn:hover { background: var(--card-bg); border-color: var(--text-muted); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- Main / header ---------- */
.main-content {
  margin-left: var(--sidebar-rail); flex-grow: 1; min-height: 100vh;
  display: flex; flex-direction: column; transition: margin-left var(--transition-speed) ease;
  min-width: 0;
}
.app-container.pinned .main-content { margin-left: var(--sidebar-width); }
.top-header {
  height: var(--header-height); background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color); display: flex; align-items: center;
  justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 90;
  backdrop-filter: blur(10px);
}
.header-left { display: flex; align-items: center; gap: 16px; }
.context-chip {
  display: flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 600;
  background: var(--card-bg); border: 1px solid var(--border-color); padding: 7px 13px; border-radius: 20px;
}
.context-chip svg { width: 15px; height: 15px; color: var(--diag-primary); }
.context-chip .muted { color: var(--text-muted); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.sync-chip {
  display: flex; align-items: center; gap: 7px; font-size: 0.78rem; font-weight: 600;
  padding: 6px 12px; border-radius: 20px; cursor: pointer; border: 1px solid var(--border-color);
  background: var(--card-bg); transition: all var(--transition-speed) ease;
}
.sync-chip:hover { background: var(--card-hover); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,0.18); }
.sync-chip.offline .sync-dot { background: var(--warning); box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
.sync-chip .queue-count { font-size: 0.62rem; background: var(--bill-glow); color: var(--bill-primary); padding: 1px 7px; border-radius: 10px; font-weight: 800; }
.sync-chip svg { width: 15px; height: 15px; }
#credit-chip svg { color: var(--bill-primary); }
#credit-chip.offline svg { color: var(--warning); }
.system-time { font-size: 0.82rem; font-weight: 500; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.system-time svg { width: 16px; height: 16px; color: var(--diag-primary); }

/* ---------- Pages ---------- */
.page-container { padding: 30px 32px; flex-grow: 1; display: none; animation: fadeIn 0.4s ease-out; }
.page-container.active-page { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.page-header h2 { font-size: 1.8rem; color: var(--text-main); }
.page-header p { color: var(--text-muted); font-size: 0.92rem; margin-top: 4px; max-width: 60ch; }
.header-buttons { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 17px; border-radius: 10px;
  font-size: 0.88rem; font-weight: 600; font-family: inherit; border: none; cursor: pointer;
  transition: all var(--transition-speed) ease; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--diag-primary), var(--diag-secondary)); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4); filter: brightness(1.05); }
.btn-secondary { background: var(--card-bg); color: var(--text-main); border: 1px solid var(--border-color); box-shadow: none; }
.btn-secondary:hover { background: var(--card-hover); border-color: var(--text-muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(239, 68, 68, 0.3); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16, 185, 129, 0.3); }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none; }
.btn-icon-only { width: 36px; height: 36px; border-radius: 8px; padding: 0; justify-content: center; }

/* ---------- Cards ---------- */
.section-card {
  background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px;
  padding: 24px; box-shadow: var(--card-shadow);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); min-width: 0;
}
.card-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }
.card-title-row h3 { font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.card-title-row h3 svg { color: var(--diag-primary); width: 19px; height: 19px; }

.grid { display: grid; gap: 20px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 24px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* KPI */
.kpi-card {
  background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px;
  padding: 22px; backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--card-shadow); display: flex; align-items: center; justify-content: space-between;
  position: relative; overflow: hidden; transition: all var(--transition-speed) ease;
}
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--accent, var(--diag-primary)); }
.kpi-card:hover { transform: translateY(-4px); background: var(--card-hover); border-color: var(--border-focus); }
.kpi-meta .kpi-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-meta .kpi-value { font-size: 2.1rem; font-weight: 800; font-family: var(--font-display); line-height: 1.1; margin-top: 6px; }
.kpi-meta .kpi-sub { font-size: 0.74rem; color: var(--text-muted); margin-top: 4px; }
.kpi-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-glow, var(--diag-glow)); color: var(--accent, var(--diag-primary)); flex-shrink: 0;
}
.kpi-icon svg { width: 24px; height: 24px; }

/* ---------- Badges / pills ---------- */
.badge {
  font-size: 0.68rem; font-weight: 700; padding: 4px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.05em; display: inline-block;
}
.badge-accent { background: var(--accent-glow, var(--diag-glow)); color: var(--accent, var(--diag-primary)); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-muted { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-info { background: rgba(6, 182, 212, 0.15); color: var(--info); }

.status-pill { font-size: 0.74rem; font-weight: 700; padding: 4px 9px; border-radius: 6px; display: inline-flex; align-items: center; gap: 5px; }
.status-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.ok { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-pill.warn { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-pill.err { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.status-pill.idle { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* ---------- Tables ---------- */
.table-wrapper { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border-color); background: rgba(0, 0, 0, 0.02); width: 100%; }
.custom-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.86rem; }
.custom-table th { background: rgba(0, 0, 0, 0.03); padding: 13px 16px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.custom-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); color: var(--text-main); font-weight: 500; vertical-align: middle; }
.custom-table tr:last-child td { border-bottom: none; }
.custom-table tbody tr:hover td { background: rgba(99, 102, 241, 0.05); }
.custom-table td .mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.82rem; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.form-control {
  background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 10px 13px;
  color: var(--text-main); font-family: inherit; font-size: 0.9rem; outline: none; width: 100%;
  transition: all var(--transition-speed) ease;
}
.form-control:focus { border-color: var(--border-focus); background: var(--input-focus-bg); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1); }
.form-control::placeholder { color: var(--input-placeholder); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px; animation: fadeIn 0.25s ease;
}
.modal-overlay.active { display: flex; }
.modal-card {
  background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 18px; width: 100%;
  max-width: 560px; max-height: 90vh; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); display: flex; flex-direction: column;
  overflow: hidden; animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-card.wide { max-width: 820px; }
@keyframes modalSlideUp { from { transform: translateY(18px) scale(0.97); opacity: .6; } to { transform: translateY(0) scale(1); opacity: 1; } }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.25rem; display: flex; align-items: center; gap: 10px; }
.modal-header h3 svg { width: 20px; height: 20px; color: var(--diag-primary); }
.modal-close-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; display: flex; width: 32px; height: 32px; border-radius: 50%; align-items: center; justify-content: center; transition: all var(--transition-speed) ease; }
.modal-close-btn:hover { background: var(--card-bg); color: var(--text-main); }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toast ---------- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 400; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bg-secondary); border-left: 4px solid var(--diag-primary);
  border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); border-right: 1px solid var(--border-color);
  padding: 12px 18px; border-radius: 8px; color: var(--text-main); font-size: 0.84rem; font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.14); display: flex; align-items: center; gap: 10px;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); max-width: 360px;
}
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast.success { border-left-color: var(--success); } .toast.success svg { color: var(--success); }
.toast.danger { border-left-color: var(--danger); } .toast.danger svg { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); } .toast.warning svg { color: var(--warning); }
.toast.info svg { color: var(--diag-primary); }
@keyframes toastSlideIn { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 44px; color: var(--text-muted); }
.empty-state svg { width: 46px; height: 46px; margin-bottom: 14px; opacity: 0.5; }
.empty-state h4 { font-size: 1.05rem; color: var(--text-main); margin-bottom: 6px; }
.empty-state p { font-size: 0.9rem; max-width: 42ch; margin: 0 auto; }

/* ---------- Service grid (Backend / Database services) ---------- */
.service-card {
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 14px; padding: 18px;
  display: flex; align-items: flex-start; gap: 14px; transition: all var(--transition-speed) ease;
  backdrop-filter: blur(var(--glass-blur));
}
.service-card:hover { transform: translateY(-3px); border-color: var(--border-focus); }
.service-ico { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--accent-glow, var(--diag-glow)); color: var(--accent, var(--diag-primary)); }
.service-ico svg { width: 21px; height: 21px; }
.service-body { min-width: 0; flex-grow: 1; }
.service-body h4 { font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.service-body p { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }
.service-stat { font-size: 0.72rem; color: var(--text-muted); margin-top: 8px; font-weight: 600; }

/* Clickable specialty-workflow launch tiles (dashboard) — accent-tinted, arrow nudges */
.service-card-link { cursor: pointer; }
.service-card-link:hover { border-color: var(--accent, var(--border-focus)); box-shadow: 0 10px 28px -14px var(--accent-glow, transparent); }
.service-card-link:focus-visible { outline: 2px solid var(--accent, var(--border-focus)); outline-offset: 2px; }
.service-card-link .service-go { color: var(--accent, var(--text-muted)); transition: transform var(--transition-speed) ease; }
.service-card-link:hover .service-go { transform: translateX(3px); }

/* ---------- Workflow catalog cards ---------- */
.wf-card {
  position: relative; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px;
  padding: 20px; display: flex; flex-direction: column; gap: 14px; overflow: hidden;
  transition: all var(--transition-speed) ease; backdrop-filter: blur(var(--glass-blur));
}
.wf-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: var(--accent, var(--diag-primary)); }
.wf-card:hover { transform: translateY(-4px); box-shadow: var(--card-shadow); border-color: var(--border-focus); }
.wf-card-top { display: flex; align-items: center; gap: 13px; }
.wf-ico { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; background: linear-gradient(135deg, var(--accent, var(--diag-primary)), var(--accent2, var(--diag-secondary))); }
.wf-ico svg { width: 24px; height: 24px; }
.wf-card-top h4 { font-size: 1.02rem; line-height: 1.2; }
.wf-card-top .wf-sub { font-size: 0.74rem; color: var(--text-muted); margin-top: 2px; }
.wf-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; min-height: 38px; }
.wf-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.wf-tag { font-size: 0.66rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--input-bg); color: var(--text-muted); border: 1px solid var(--border-color); }
.wf-card-actions { display: flex; gap: 8px; margin-top: auto; align-items: center; }
.wf-card-actions .spacer { flex-grow: 1; }

/* ---------- Workspace (workflow mount host) ---------- */
.workspace-frame { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border-color); border-radius: 16px; overflow: hidden; background: var(--card-bg); min-height: 60vh; }
.workspace-bar {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}
.workspace-bar .wbadge { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(135deg, var(--accent, var(--diag-primary)), var(--accent2, var(--diag-secondary))); }
.workspace-bar .wbadge svg { width: 17px; height: 17px; }
.workspace-bar .wtitle { font-weight: 700; font-size: 0.95rem; }
.workspace-bar .wmeta { font-size: 0.74rem; color: var(--text-muted); }
.workspace-bar .spacer { flex-grow: 1; }
.workspace-host { padding: 22px; flex-grow: 1; }

/* Embedded-app (OBGY) frame + full-screen overlay */
.wf-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.wf-toolbar .spacer { flex-grow: 1; }
.wf-iframe-wrap { position: relative; }
.wf-frame { width: 100%; height: 72vh; border: 1px solid var(--border-color); border-radius: 12px; background: #fff; display: block; }
.wf-iframe-wrap.fullscreen { position: fixed; inset: 0; z-index: 9999; background: var(--bg-primary); }
.wf-iframe-wrap.fullscreen .wf-frame { height: 100vh; border-radius: 0; border: none; }
.wf-fs-exit { position: fixed; top: 14px; right: 18px; z-index: 10000; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }

/* Reference-workflow internal styles (provided by SDK demo) */
.assist-dock { display: flex; flex-direction: column; gap: 14px; }
.assist-panel { border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; background: var(--bg-secondary); }
.assist-panel h5 { font-size: 0.85rem; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.assist-panel h5 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent, var(--diag-primary)); }
.kv-row { display: flex; justify-content: space-between; font-size: 0.83rem; padding: 5px 0; border-bottom: 1px dashed var(--border-color); }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--text-muted); } .kv-row .v { font-weight: 600; }

/* selectable chips (risk flags, round checklists in surface assists) */
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border-color); background: var(--bg-secondary); font-size: 0.78rem; cursor: pointer; user-select: none; }
.chip-check:hover { border-color: var(--accent, var(--diag-primary)); }
.chip-check input { accent-color: var(--accent, var(--diag-primary)); margin: 0; }

/* surface-assist slot shown inside a platform page (reception, nursing, pharmacy…) */
.surface-slot { margin-top: 14px; }
.surface-slot:empty { display: none; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; width: 100%; }
.login-card {
  width: 100%; max-width: 420px; background: var(--card-bg); border: 1px solid var(--border-color);
  border-radius: 22px; padding: 38px 34px; box-shadow: var(--card-shadow);
  backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; text-align: center; }
.login-brand .brand-logo-container { width: 58px; height: 58px; border-radius: 16px; }
.login-brand .brand-logo-container svg { width: 30px; height: 30px; }
.login-brand h1 { font-size: 1.5rem; }
.login-brand p { font-size: 0.82rem; color: var(--text-muted); }
.login-fields { display: flex; flex-direction: column; gap: 16px; }
.login-hint { margin-top: 18px; font-size: 0.74rem; color: var(--text-muted); text-align: center; line-height: 1.6; }
.login-hint code { background: var(--input-bg); padding: 1px 6px; border-radius: 5px; font-size: 0.72rem; }

/* ---------- Misc ---------- */
.muted { color: var(--text-muted); }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; }
.text-accent { color: var(--accent, var(--diag-primary)); }
.list-line { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-secondary); }
.list-line + .list-line { margin-top: 8px; }
.toggle {
  position: relative; width: 42px; height: 24px; border-radius: 13px; background: var(--input-bg);
  border: 1px solid var(--border-color); cursor: pointer; transition: all var(--transition-speed) ease; flex-shrink: 0;
}
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-muted); transition: all var(--transition-speed) ease; }
.toggle.on { background: var(--diag-primary); border-color: var(--diag-primary); }
.toggle.on::after { left: 20px; background: #fff; }

@media (max-width: 880px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
}
