/* Lock background scroll while any modal is open (scroll inside the modal only).
   Root element is the scroller (body only has min-height). padding-right
   compensates the removed scrollbar so the page doesn't shift on desktop. */
html.modal-open { overflow: hidden; }
html.modal-open body { padding-right: var(--modal-sbw, 0px); }

/* ===== Account / SSO / Webhooks UI ===== */
.account-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-secondary);
  height: 34px;
  min-width: 34px;
  padding: 0 6px;
  border-radius: 18px;
  cursor: pointer;
  display: none;            /* shown by JS once auth config is known */
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
}
.account-btn:hover { background: rgba(255,255,255,0.1); }
[data-theme="light"] .account-btn { border-color: rgba(0,0,0,0.1); }
[data-theme="light"] .account-btn:hover { background: rgba(0,0,0,0.05); }
.account-btn .acc-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.account-btn .acc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-btn .acc-label { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Account modal */
.acc-modal { max-width: 600px; color-scheme: dark; } /* native controls (time/select) render dark */
[data-theme="light"] .acc-modal { color-scheme: light; }
.acc-user {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 18px;
  background: var(--ring-bg); border-radius: var(--radius-sm);
}
.acc-user .acc-avatar-lg {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent-blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.acc-user .acc-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.acc-user-info { flex: 1; min-width: 0; }
.acc-user-name { font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-user-email { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.acc-section { margin-bottom: 22px; }
.acc-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.acc-section h3 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin: 0 0 6px; }
.acc-hint { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; line-height: 1.5; }

.acc-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; font-size: 13px; color: var(--text-secondary); cursor: pointer;
}
.acc-toggle input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent-blue); cursor: pointer; flex-shrink: 0; }
.acc-toggle span { flex: 1; }
.acc-time {
  background: var(--ring-bg); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary); border-radius: 8px; padding: 4px 8px; font-family: inherit; font-size: 12px;
  color-scheme: dark; /* makes the native clock/picker icon light on the dark UI */
}
[data-theme="light"] .acc-time { border-color: rgba(0,0,0,0.1); color-scheme: light; }
/* color-scheme already themes the native picker icon — just make it clickable.
   (Do NOT filter:invert here: with color-scheme:dark the icon is already light,
   so inverting would turn it black again.) */
.acc-time::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.85; }
.acc-status { font-size: 12px; color: var(--text-muted); margin-top: 6px; min-height: 16px; }
.acc-status.ok { color: var(--accent-green); }
.acc-status.err { color: var(--accent-red); }

/* Buttons */
.acc-btn {
  border: none; border-radius: 10px; padding: 8px 14px; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit; transition: all 0.15s;
}
.acc-btn.primary { background: var(--accent-blue); color: #06121c; }
.acc-btn.primary:hover { filter: brightness(1.1); }
.acc-btn.ghost { background: var(--ring-bg); color: var(--text-secondary); }
.acc-btn.ghost:hover { background: var(--ring-track); color: var(--text-primary); }
.acc-btn.danger { background: rgba(255,82,82,0.15); color: var(--accent-red); }
.acc-btn.danger:hover { background: rgba(255,82,82,0.25); }
.acc-btn:disabled { opacity: 0.5; cursor: default; }

/* Webhook cards */
.wh-card {
  background: var(--ring-bg); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 10px;
}
.wh-card-top { display: flex; align-items: center; gap: 8px; }
.wh-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 7px; border-radius: 6px; background: var(--accent-purple); color: #fff;
}
.wh-badge.meet { background: #5865F2; }
.wh-badge.matrix { background: #0DBD8B; }
.wh-badge.generic { background: var(--accent-orange); }
.wh-title { font-weight: 600; color: var(--text-primary); font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-off { opacity: 0.55; }
.wh-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.wh-status { font-size: 11px; margin-top: 4px; color: var(--text-muted); }
.wh-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.wh-actions .acc-btn { padding: 5px 10px; font-size: 12px; }

/* Webhook editor form */
.wh-form { background: var(--ring-bg); border-radius: var(--radius-sm); padding: 14px; }
.wh-field { margin-bottom: 12px; }
/* Only the field's own label — not nested .acc-toggle labels (events checkboxes) */
.wh-field > label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.wh-field input[type="text"], .wh-field input[type="password"], .wh-field select {
  width: 100%; box-sizing: border-box;
  background: var(--bg-dark); border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-primary); border-radius: 9px; padding: 9px 11px; font-size: 13px; font-family: inherit;
}
[data-theme="light"] .wh-field input, [data-theme="light"] .wh-field select { border-color: rgba(0,0,0,0.12); background: #f5f5f5; }
.wh-field input:focus, .wh-field select:focus { outline: none; border-color: var(--accent-blue); }
.wh-events { display: flex; flex-direction: column; gap: 2px; }
.wh-sched { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 4px 27px; font-size: 12px; color: var(--text-secondary); }
.wh-sched .acc-time { font-size: 12px; }
.wh-sched input[type="number"].acc-time { width: 64px; }
.wh-locs { display: flex; flex-direction: column; gap: 2px; max-height: 168px; overflow-y: auto; }
.wh-form-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; flex-wrap: wrap; }
.wh-empty { font-size: 13px; color: var(--text-muted); text-align: center; padding: 16px 0; }

/* Toast for SSO status */
.acc-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 12px;
  padding: 11px 18px; font-size: 13px; box-shadow: var(--shadow-card);
  z-index: 3000; max-width: 90vw; animation: accToastIn 0.25s ease;
}
.acc-toast.err { border-color: var(--accent-red); }
@keyframes accToastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
