/* ============================================================
   DDQRC — Client Dashboard Styles
   Mobile-first. Sidebar collapses on small screens.
   ============================================================ */

/* ---- Reset + base ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ---- Custom properties ------------------------------------ */
:root {
  --sidebar-bg:  #0f172a;
  --sidebar-txt: #94a3b8;
  --sidebar-act: #f8fafc;
  --accent:      #2563eb;
  --accent-dark: #1d4ed8;
  --green:       #16a34a;
  --yellow:      #d97706;
  --red:         #dc2626;
  --gray-50:     #f8fafc;
  --gray-100:    #f1f5f9;
  --gray-200:    #e2e8f0;
  --gray-400:    #94a3b8;
  --gray-600:    #475569;
  --gray-900:    #0f172a;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --radius:      .625rem;
  --brand-color: #BE0126;
}

/* ============================================================
   AUTH PAGES (login, register) — centered card
   ============================================================ */

.auth-body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;  /* avoid iOS Safari width:100% in flex-column+center bug */
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--gray-100);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;        /* center now that auth-body uses align-items:stretch */
  background: #fff;
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.75rem;
  text-decoration: none;
  color: inherit;
}

.auth-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--brand-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.auth-logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 .3rem;
}

.auth-subtitle {
  font-size: .875rem;
  color: var(--gray-600);
  margin: 0 0 1.5rem;
}

.auth-footer {
  margin-top: 1.25rem;
  font-size: .85rem;
  color: var(--gray-600);
  text-align: center;
}

.auth-footer a {
  color: var(--accent);
  font-weight: 500;
}

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */

.layout {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ---- Top bar (always horizontal) ------------------------- */
.sidebar {
  width: 100%;
  height: 52px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0 .75rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  overflow: hidden;
  gap: .25rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
  margin-right: .5rem;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

/* Single nav icon link */
.sidebar-nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: .5rem;
  color: var(--sidebar-txt);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}

.sidebar-nav-link:hover {
  background: rgba(255,255,255,.06);
  color: #cbd5e1;
}

.sidebar-nav-link.active {
  background: rgba(255,255,255,.1);
  color: var(--sidebar-act);
}

.sidebar-nav-link svg { opacity: .7; }
.sidebar-nav-link.active svg { opacity: 1; }

/* Right group: user + logout */
.sidebar-right {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: auto;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .35rem .6rem;
  border-radius: .5rem;
  text-decoration: none;
  transition: background .15s;
}
.sidebar-user:hover { background: rgba(255,255,255,.1); }

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: .85rem;
  font-weight: 500;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* Logout button */
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .65rem;
  border-radius: .5rem;
  color: var(--sidebar-txt);
  font-size: .85rem;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}

.sidebar-logout:hover {
  background: rgba(255,255,255,.06);
  color: #cbd5e1;
}

.sidebar-logout svg { opacity: .7; flex-shrink: 0; }

/* Return arrow (non-index pages) */
.sidebar-return {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: .5rem;
  color: var(--sidebar-txt);
  flex-shrink: 0;
  transition: background .15s, color .15s;
}

.sidebar-return:hover {
  background: rgba(255,255,255,.06);
  color: #cbd5e1;
}

.sidebar-return svg { opacity: .7; }

/* ---- Main content area ----------------------------------- */
.main {
  margin-left: 0;
  margin-top: 52px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.page-header-left {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.page-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--gray-400);
}

.breadcrumb a { color: var(--gray-600); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--gray-400); }

.page-content {
  padding: 1.5rem 1.75rem;
  flex: 1;
}

.dashboard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 1.75rem;
  margin-top: auto;
  font-size: 11px;
  color: #999;
}
.dashboard-footer a {
  color: #999;
  text-decoration: none;
  margin-left: .75rem;
}
.dashboard-footer a:hover { color: #555; }

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.card-title {
  font-size: .95rem;
  font-weight: 600;
  margin: 0;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* ---- Doorbell grid cards --------------------------------- */
.doorbell-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.doorbell-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: box-shadow .15s;
}

.doorbell-card:hover { box-shadow: var(--shadow-md); }

.doorbell-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}

.doorbell-card-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.doorbell-card-location {
  font-size: .8rem;
  color: var(--gray-600);
  margin-top: .15rem;
}

.doorbell-card-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.doorbell-card-actions {
  display: flex;
  gap: .5rem;
  margin-top: .25rem;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1;
}

.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .55rem 1rem;
  border-radius: .5rem;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-secondary {
  background: #fff;
  color: var(--gray-900);
  border-color: var(--gray-200);
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); }

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }

.btn-ghost-danger {
  background: transparent;
  color: #c0392b;
  border: 1px solid #c0392b;
  padding: .45rem .9rem;
  font-size: .8rem;
  border-radius: 999px;
}
.btn-ghost-danger:hover:not(:disabled) { background: #fff1f0; }

.ring-detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .35rem;
  border-radius: 4px;
  color: inherit;
  text-decoration: none;
  opacity: .75;
  transition: opacity .15s, background .15s;
}
.ring-detail-link:hover { opacity: 1; background: var(--gray-100); }

.btn-sm {
  padding: .35rem .7rem;
  font-size: .8rem;
  border-radius: .4rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: .4rem;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: .375rem;
  margin-bottom: 1rem;
}

.form-group:last-child { margin-bottom: 0; }

label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-900);
}

label .hint {
  font-weight: 400;
  color: var(--gray-400);
  font-size: .8rem;
}

.form-input {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: .5rem;
  font-size: .9rem;
  outline: none;
  background: #fff;
  color: var(--gray-900);
  transition: border-color .15s;
}

.form-input:focus { border-color: var(--accent); }

.form-input.error { border-color: var(--red); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.form-hint {
  font-size: .78rem;
  color: var(--gray-400);
}

.form-error {
  font-size: .8rem;
  color: var(--red);
}

.form-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  margin: 1.25rem 0 .75rem;
}

/* Password field with eye toggle */
.pw-wrap {
  position: relative;
}

.pw-wrap .form-input {
  padding-right: 2.5rem;
}

.pw-toggle {
  position: absolute;
  right: .65rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  line-height: 1;
}

.pw-toggle:hover { color: var(--gray-600); }

/* Color picker inline */
.color-pick {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.color-pick input[type="color"] {
  width: 36px;
  height: 36px;
  padding: 2px;
  border: 1.5px solid var(--gray-200);
  border-radius: .4rem;
  cursor: pointer;
  background: #fff;
}

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 0;
}

.toggle-label { font-size: .875rem; font-weight: 500; }
.toggle-sub   { font-size: .78rem; color: var(--gray-400); }

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-200);
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ============================================================
   TABLES / RING LISTS
   ============================================================ */

.ring-list {
  width: 100%;
  border-collapse: collapse;
}

.ring-list th {
  text-align: center;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  padding: .625rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}

.ring-list td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: .875rem;
  vertical-align: middle;
  text-align: center;
}

.ring-list tr:last-child td { border-bottom: none; }

.ring-list tr:hover td { background: var(--gray-50); }

.ring-list td a { color: var(--accent); font-weight: 500; }

/* Stacked date/time cell */
.col-time { width: 1px; white-space: nowrap; }
.ring-date { display: block; font-size: .7rem; color: var(--gray-400); line-height: 1.35; }
.ring-clock { display: block; font-size: .8rem; line-height: 1.35; }

/* ============================================================
   MODALS
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
  transform: translateY(12px) scale(.98);
  transition: transform .2s;
  max-height: 90dvh;
  overflow-y: auto;
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-100);
}

.modal-title { font-size: 1rem; font-weight: 700; margin: 0; }

.modal-body  { padding: 1.25rem 1.5rem; }

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: .625rem;
}

/* ============================================================
   TABS
   ============================================================ */

.tabs {
  display: flex;
  gap: .125rem;
  border-bottom: 2px solid var(--gray-100);
  margin-bottom: 1.25rem;
}

.tab-btn {
  padding: .625rem 1rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-400);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.tab-btn:hover { color: var(--gray-600); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   QR CODE DISPLAY
   ============================================================ */

.qr-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.qr-preview img {
  width: 200px;
  height: 200px;
  border-radius: .5rem;
  box-shadow: var(--shadow-sm);
}

.qr-actions { display: flex; gap: .625rem; flex-wrap: wrap; justify-content: center; }

.qr-url {
  font-size: .78rem;
  color: var(--gray-400);
  word-break: break-all;
  text-align: center;
  max-width: 280px;
}

/* ============================================================
   MESSAGE THREAD (dashboard reply pane)
   ============================================================ */

.thread {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 320px;
  overflow-y: auto;
  padding: .5rem 0 .75rem;
}

.bubble {
  max-width: 75%;
  padding: .55rem .85rem;
  border-radius: 1rem;
  font-size: .875rem;
  line-height: 1.45;
  word-break: break-word;
}

.bubble--client {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: .25rem;
}

.bubble--visitor {
  align-self: flex-start;
  background: var(--gray-100);
  color: var(--gray-900);
  border-bottom-left-radius: .25rem;
}

.bubble-time {
  font-size: .7rem;
  opacity: .6;
  margin-top: .2rem;
}

.reply-form {
  display: flex;
  gap: .5rem;
  align-items: flex-end;
  margin-top: .75rem;
}

.reply-form textarea {
  flex: 1;
  padding: .6rem .85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: .625rem;
  font-size: .875rem;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color .15s;
}

.reply-form textarea:focus { border-color: var(--accent); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

#toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: .625rem;
  background: var(--gray-900);
  color: #fff;
  padding: .75rem 1rem;
  border-radius: .5rem;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: auto;
  max-width: 320px;
}

.toast.show { opacity: 1; transform: translateY(0); }

.toast-success { background: #166534; }
.toast-error   { background: #991b1b; }

/* ============================================================
   LOADING / SKELETON
   ============================================================ */

.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: .375rem;
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--gray-400);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state h3   { font-size: 1rem; font-weight: 600; color: var(--gray-600); margin: 0 0 .4rem; }
.empty-state p    { font-size: .875rem; margin: 0 0 1.25rem; }

/* ============================================================
   DANGER ZONE
   ============================================================ */

.danger-zone {
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: #fff5f5;
}

.danger-zone h4 {
  font-size: .85rem;
  font-weight: 700;
  color: var(--red);
  margin: 0 0 .4rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.danger-zone p {
  font-size: .85rem;
  color: var(--gray-600);
  margin: 0 0 .875rem;
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .75rem 1rem;
  border-radius: .5rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}

.alert-error   { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef9c3; color: #92400e; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-info    { background: #dbeafe; color: #1e40af; }

/* ============================================================
   MISC UTILITIES
   ============================================================ */

.text-muted  { color: var(--gray-400); }
.text-small  { font-size: .8rem; }
.text-center { text-align: center; }
.mt-1  { margin-top: .5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-1  { margin-bottom: .5rem; }
.mb-2  { margin-bottom: 1rem; }
.flex  { display: flex; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex-1 { flex: 1; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: .25rem;
}

.stat-label {
  font-size: .78rem;
  color: var(--gray-400);
  font-weight: 500;
}

/* ============================================================
   RESPONSIVE — collapse sidebar on mobile
   ============================================================ */

/* ---- Responsive — narrow screens ------------------------- */
@media (max-width: 768px) {
  .page-header,
  .page-content { padding: 1rem; }

  .form-row { grid-template-columns: 1fr; }

  .doorbell-grid { grid-template-columns: 1fr; }
}

/* Hide user name on narrow viewports */
@media (max-width: 520px) {
  .sidebar-user-name { display: none; }
}

/* Hide "Sign out" text on very narrow viewports — keep icon */
@media (max-width: 400px) {
  .nav-text { display: none; }
}

.ring-single {
  max-width: 375px;
  margin: 0 auto;
}

.ring-single .card-header {
  border-bottom: none;
}

.ring-single .card-body {
  padding-top: 0;
}

.ring-single .thread {
  padding-left: .5rem;
  padding-right: .5rem;
  border: 1px solid var(--gray-100);
  border-radius: .5rem;
}

/* Scroll wrapper — prevents table from overflowing the card on mid-width screens */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 600px) {
  /* Show: Time (1), Visitor (2), Status (4), View (6).
     Hide: Distance (3), Messages (5). */
  .ring-list th:nth-child(3),
  .ring-list td:nth-child(3),
  .ring-list th:nth-child(5),
  .ring-list td:nth-child(5) { display: none; }

  /* Tighter horizontal padding to reclaim space for the extra column */
  .ring-list th,
  .ring-list td { padding-left: .5rem; padding-right: .5rem; }

  /* Truncate long visitor names */
  .col-visitor { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Slightly smaller badge text so Status column stays tight */
  .ring-list .badge { font-size: .7rem; padding: .2rem .5rem; }
}


/* ── NOTIFICATION SETTINGS ROWS ────────────────────────────── */
.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
}

.notif-row:last-child { border-bottom: none; }

.notif-row-info {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex: 1;
  min-width: 0;
}

.notif-value {
  font-size: .875rem;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-row-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.toggle-sm .toggle-slider {
  width: 36px;
  height: 20px;
}

.toggle-sm .toggle-slider::before {
  width: 14px;
  height: 14px;
  top: 3px;
  left: 3px;
}

.toggle-sm input:checked + .toggle-slider::before {
  transform: translateX(16px);
}
