@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700&family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');

/* ============================================================
   Society Management — Sky blue + white (same as Hub portal)
   ============================================================ */

:root {
  /* Market-standard UI: Roboto (Android/WebView), system UI (iOS), Noto for Devanagari */
  --sm-font-sans: Roboto, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --sm-font-body: var(--sm-font-sans), 'Noto Sans Devanagari', sans-serif;
  /* Sky + gold — matches animated SAB logo (light) */
  --sm-primary: #0284c7;
  --sm-primary-dark: #0369a1;
  --sm-primary-light: #38bdf8;
  --sm-primary-rgb: 2, 132, 199;
  --sm-accent: #10b981;
  --sm-accent-gold: #d4a017;
  --sm-accent-gold-soft: rgba(212, 160, 23, 0.22);
  --sm-warn: #f59e0b;
  --sm-danger: #dc2626;
  --sm-bg: #e0f2fe;
  --sm-surface: #ffffff;
  --sm-text: #0c4a6e;
  --sm-muted: #64748b;
  --sm-border: #7dd3fc;
  --sm-sidebar-bg: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 48%, #f8fafc 100%);
  --sm-radius: 10px;
  --sm-sidebar-w: 260px;
  --sm-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --sm-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --sm-shadow-accent: 0 6px 16px rgba(var(--sm-primary-rgb), 0.14);
  /* Fluid type scale - compact for phone / tablet / desktop */
  --sm-fs-body: clamp(0.8125rem, 0.78rem + 0.18vw, 0.9375rem);
  --sm-fs-small: clamp(0.7rem, 0.68rem + 0.12vw, 0.8125rem);
  --sm-fs-h1: clamp(1.1rem, 1rem + 0.45vw, 1.4rem);
  --sm-fs-h5: clamp(0.95rem, 0.9rem + 0.22vw, 1.1rem);
  --sm-fs-nav: clamp(0.8rem, 0.78rem + 0.12vw, 0.9rem);
  --sm-fs-stat: clamp(1.15rem, 1.05rem + 0.4vw, 1.45rem);
  --sm-pad-main: clamp(0.75rem, 0.5rem + 1.5vw, 2rem);
  /* Chart palette (theme-aware) */
  --sm-chart-collection: #0284c7;
  --sm-chart-expenses:   #f59e0b;
  --sm-chart-income:     #10b981;
  --sm-chart-debit:      #dc2626;
  --sm-chart-collection-bg: rgba(var(--sm-primary-rgb), .14);
  --sm-chart-expenses-bg:   rgba(245, 158, 11, .15);
  /* Bootstrap 5 — full-page HR canvas (not default white) */
  --bs-body-bg: var(--sm-bg);
  --bs-body-color: var(--sm-text);
  --bs-border-color: var(--sm-border);
  --bs-secondary-bg: var(--sm-surface);
  --bs-tertiary-bg: #e0f2fe;
  --bs-emphasis-color: var(--sm-text);
  --bs-link-color: var(--sm-primary);
  --bs-link-hover-color: var(--sm-primary-dark);
}

html {
  font-size: 100%; /* 16px root — readable on mobile / APK WebView */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (max-width: 991.98px) {
  :root {
    --sm-fs-body: 1rem;
    --sm-fs-small: 0.875rem;
    --sm-fs-nav: 0.9375rem;
    --sm-fs-h1: clamp(1.2rem, 1.08rem + 0.55vw, 1.45rem);
    --sm-fs-h5: 1.0625rem;
    --sm-fs-stat: clamp(1.35rem, 1.15rem + 0.65vw, 1.5rem);
    --sm-pad-main: 1rem;
  }
  html, body {
    line-height: 1.58;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  .table { font-size: var(--sm-fs-body); font-weight: 500; }
  .table thead th { font-weight: 700; }
  .sm-main .small, .form-text { font-size: var(--sm-fs-small); font-weight: 500; }
  .sm-main label,
  .sm-main .form-label,
  .int-field-label { font-weight: 600; }
  .sm-main .btn { font-weight: 600; }
  .sm-main h5, .sm-main h6, .int-section-title { font-weight: 700; }
  .card.p-2, .card.p-3, .card-body { padding: 1rem !important; }
  .sm-main .nav-tabs .nav-link,
  .int-tabs .nav-link {
    font-weight: 600;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Discourage copying page text / image drag (forms remain selectable) */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body input,
body textarea,
body select,
body [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
html, body {
  height: auto;
  min-height: 100%;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: auto;
  font-family: var(--sm-font-body);
  font-size: var(--sm-fs-body);
  line-height: 1.52;
  font-weight: 500;
  background: var(--sm-bg);
  color: var(--sm-text);
  /* Notch / gesture bar (Android + iPhone) */
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
}
*, *::before, *::after { box-sizing: border-box; }

.sm-app,
.btn,
.form-control,
.form-select,
.dropdown-menu,
.modal-content,
.table {
  font-family: inherit;
}

.btn-primary {
  background-color: var(--sm-primary);
  border-color: var(--sm-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--sm-primary-dark);
  border-color: var(--sm-primary-dark);
}
.btn-outline-primary { color: var(--sm-primary); border-color: var(--sm-primary); }
.btn-outline-primary:hover { background-color: var(--sm-primary); border-color: var(--sm-primary); }

.text-primary  { color: var(--sm-primary) !important; }
.bg-primary    { background-color: var(--sm-primary) !important; }
.bg-primary-soft { background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%); }

/* ---- Sidebar / Layout ---- */
.sm-app {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: var(--sm-sidebar-w) minmax(0, 1fr);
  align-items: stretch;
  transition: grid-template-columns 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--sm-bg);
}
.sm-sidebar {
  background: var(--sm-sidebar-bg);
  color: var(--sm-text);
  padding: 0;
  box-shadow: inset -1px 0 0 var(--sm-border);
  position: sticky;
  top: 0;
  align-self: stretch;
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100dvh;
  height: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sm-border);
  transition: width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.28s ease,
    border 0.28s ease,
    transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, width, opacity;
}
.sm-sidebar .brand {
  display: flex; align-items: center; gap: .7rem;
  color: var(--sm-primary-dark); font-weight: 700; font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
  padding: .35rem 0.35rem 1rem;
  border-bottom: 1px solid var(--sm-border);
  margin-bottom: .85rem;
  text-decoration: none;
}
.sm-sidebar .brand i { font-size: 1.5rem; color: var(--sm-primary); flex-shrink: 0; }
.sm-sidebar .nav-link {
  color: var(--sm-text);
  padding: .55rem .65rem;
  border-radius: 10px;
  display: flex; align-items: center; gap: .65rem;
  font-size: var(--sm-fs-nav);
  font-weight: 600;
  margin-bottom: 4px;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  transition: background .18s ease, box-shadow .18s ease, color .18s ease, border-color .18s;
}
.sm-sidebar .nav-link i {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef0f8;
  color: var(--sm-primary);
  font-size: 1rem;
  flex-shrink: 0;
  border: none;
  box-shadow: none;
}
.sm-sidebar .nav-link:hover {
  background: #f4f5f7;
  color: var(--sm-primary-dark);
  border-color: transparent;
}
.sm-sidebar .nav-link.active {
  background: rgba(var(--sm-primary-rgb), .1);
  color: var(--sm-primary-dark);
  font-weight: 700;
  border-color: rgba(var(--sm-primary-rgb), .22);
  box-shadow: var(--sm-shadow-sm);
}
.sm-sidebar .nav-link.active i {
  background: var(--sm-primary);
  color: #fff;
}
.sm-sidebar .nav-section {
  color: var(--sm-muted);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  margin: .85rem 0 .35rem .2rem;
}
.sm-sidebar .nav-section-super {
  color: #b45309;
  margin-top: 1.1rem;
  padding-top: .65rem;
  border-top: 1px solid var(--sm-border);
}

/* HR-style sidebar shell (logo + inset nav + user + wave footer) */
.sm-sidebar-inner {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.45rem;
  padding: 0.75rem 0.6rem max(0.65rem, env(safe-area-inset-bottom));
}
.sm-sidebar-brand.brand {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
  flex-shrink: 0;
}
.sm-sidebar-grow {
  display: none !important;
}
.sm-sidebar-menu-stack {
  flex: 0 1 auto;
  min-height: 0;
  width: 100%;
  max-height: calc(100dvh - 7.25rem);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--sm-border);
  border-radius: 14px;
  box-shadow: var(--sm-shadow-sm);
  overflow: hidden;
}
.sm-sidebar-nav-panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.4rem 0.38rem 0.25rem;
  box-shadow: none;
  margin-bottom: 0;
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(100dvh - 10rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.sm-sidebar-spacer {
  display: none;
}
.sm-sidebar-nav-panel > .nav-link,
.sm-sidebar-nav-panel > .sm-nav-group {
  margin-bottom: 2px;
}
.sm-sidebar-nav-panel > .nav-link {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.5rem 0.55rem;
}
.sm-sidebar-nav-panel .nav-link i {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: transparent;
  color: var(--sm-primary);
  font-size: 1.05rem;
}
.sm-sidebar-nav-panel .nav-link:hover i {
  background: rgba(var(--sm-primary-rgb), 0.08);
}
.sm-sidebar-nav-panel .nav-link.active {
  background: rgba(var(--sm-primary-rgb), 0.08);
  border-color: transparent;
  box-shadow: none;
}
.sm-sidebar-nav-panel .nav-link.active i {
  background: var(--sm-primary);
  color: #fff;
}
.sm-sidebar-nav-panel .sm-nav-group-toggle {
  border: none;
  background: transparent;
  box-shadow: none;
  font-size: var(--sm-fs-nav);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  padding: 0.5rem 0.55rem;
}
.sm-sidebar-nav-panel .sm-nav-group-toggle .sm-nav-ico {
  background: transparent;
  color: var(--sm-primary);
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.sm-sidebar-nav-panel .sm-nav-group.open > .sm-nav-group-toggle .sm-nav-ico,
.sm-sidebar-nav-panel .sm-nav-group.has-active > .sm-nav-group-toggle .sm-nav-ico {
  background: var(--sm-primary);
  color: #fff;
}
.sm-sidebar-nav-panel .sm-nav-group-body .nav-link {
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 600;
  font-size: var(--sm-fs-nav);
}
.sm-sidebar-bottom {
  flex-shrink: 0;
  padding: 0.35rem 0.65rem 0;
  background: #f7f8fb;
  border-top: 1px solid var(--sm-border);
}
.sm-sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  margin: 0 0 0.4rem;
  border: 1px solid var(--sm-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--sm-shadow-sm);
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.sm-sidebar-user:hover {
  opacity: 0.92;
}
.sm-sidebar-user-caret {
  margin-left: auto;
  color: var(--sm-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}
.sm-sidebar-user-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--sm-primary) 0%, var(--sm-primary-light) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(var(--sm-primary-rgb), 0.35);
}
.sm-sidebar-user-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--sm-primary-dark);
  line-height: 1.2;
}
.sm-sidebar-user-role {
  margin-top: 0.2rem;
}
.sm-sidebar-user-role .sm-role-badge {
  font-size: 0.62rem;
  padding: 0.12rem 0.45rem;
}
.sm-sidebar-action-bar {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}
.sm-sidebar-foot-btn {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.48rem 0.4rem;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.15;
  cursor: pointer;
  border: 1px solid var(--sm-border);
  background: #fff;
  color: var(--sm-primary-dark);
  box-shadow: var(--sm-shadow-sm);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s;
}
.sm-sidebar-foot-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sm-sidebar-foot-btn:hover {
  border-color: rgba(var(--sm-primary-rgb), 0.35);
  color: var(--sm-primary);
}
.sm-sidebar-foot-btn-solo {
  flex: 1 1 100%;
}
.sm-sidebar-deco {
  flex-shrink: 0;
  position: relative;
  margin: 0 -0.65rem;
  min-height: 64px;
}
.sm-sidebar-waves {
  display: block;
  width: 100%;
  height: 64px;
}
.sm-wave { fill: var(--sm-primary-dark); }
.sm-wave-1 { fill: var(--sm-primary-dark); opacity: 1; }
.sm-wave-2 { fill: var(--sm-warn); opacity: 0.92; }
.sm-wave-3 { fill: var(--sm-primary); opacity: 0.95; }
.sm-sidebar-signout {
  position: absolute;
  left: 50%;
  bottom: 0.4rem;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  z-index: 2;
  white-space: nowrap;
}
.sm-sidebar-signout span {
  text-transform: none;
}
.sm-sidebar-signout:hover {
  color: #fff;
  background: rgba(0, 0, 0, 0.22);
}

/* Categorized dropdown groups */
.sm-nav-group { margin-bottom: 4px; }
.sm-nav-group-toggle {
  width: 100%;
  border: 1px solid var(--sm-border);
  background: #ffffff;
  color: var(--sm-text);
  padding: .55rem .65rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: var(--sm-fs-nav);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(3, 105, 161, .04);
}
.sm-nav-group-toggle .sm-nav-ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e0f2fe;
  color: var(--sm-primary);
  flex-shrink: 0;
}
.sm-nav-group-toggle .sm-nav-chevron {
  margin-left: auto;
  color: var(--sm-muted);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.sm-nav-group.open > .sm-nav-group-toggle {
  border-color: var(--sm-primary-light);
  color: var(--sm-primary-dark);
}
.sm-nav-group.open > .sm-nav-group-toggle .sm-nav-chevron { transform: rotate(90deg); }
.sm-nav-group.open > .sm-nav-group-toggle .sm-nav-ico {
  background: var(--sm-primary);
  color: #fff;
}
.sm-nav-group-body {
  display: block;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0 0 0 .55rem;
  margin: 0;
  border-left: 2px solid transparent;
  transition:
    max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.28s ease,
    padding 0.28s ease,
    margin 0.28s ease,
    border-color 0.28s ease;
}
.sm-nav-group.open > .sm-nav-group-body {
  max-height: 640px;
  opacity: 1;
  padding: .35rem 0 .15rem .55rem;
  margin: .2rem 0 .35rem;
  border-left-color: rgba(var(--sm-primary-rgb), .35);
}
.sm-nav-group-body .nav-link {
  font-weight: 600;
  padding: .45rem .55rem;
  margin-bottom: 3px;
}
.sm-nav-group-body .nav-link i {
  width: 28px;
  height: 28px;
  font-size: .9rem;
  border-radius: 8px;
}
.sm-nav-group.has-active > .sm-nav-group-toggle {
  border-color: var(--sm-primary);
}

.sm-main {
  padding: var(--sm-pad-main);
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden; /* older Android WebView - clip unsupported */
  overflow-x: clip;
  background: var(--sm-bg);
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}
.sm-main > .row.g-3:last-child {
  flex: 1 1 auto;
  align-items: stretch;
  min-height: min(32vh, 360px);
}
.sm-main > .row.g-3:last-child > [class*="col-"] {
  display: flex;
  flex-direction: column;
}
.sm-main > .row.g-3:last-child .card {
  flex: 1 1 auto;
  width: 100%;
}
.sm-main.sm-main-with-footer {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.sm-portal-footer {
  margin-top: auto;
  padding: 1.5rem 0.5rem 0.85rem;
  text-align: center;
}
.sm-portal-footer-inner {
  border-top: 1px solid var(--sm-border);
  padding-top: 0.85rem;
}
.sm-portal-footer-copy {
  margin: 0;
  font-weight: 500;
  font-size: clamp(0.78rem, 0.74rem + 0.2vw, 0.88rem);
  color: var(--sm-muted);
  letter-spacing: 0.01em;
  line-height: 1.45;
}
.sm-portal-footer-brand {
  font-weight: 700;
  font-size: clamp(0.9rem, 0.85rem + 0.25vw, 1.05rem);
  color: var(--sm-primary-dark);
  letter-spacing: 0.02em;
}
.sm-portal-footer-sub {
  font-size: 0.75rem;
  color: var(--sm-muted);
  margin-top: 0.15rem;
}
.sm-auth-footer {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  margin-top: 0.85rem;
  padding-bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
  text-align: center;
  z-index: 3;
  pointer-events: none;
  width: 100%;
}
.sm-auth-footer .sm-portal-footer-copy {
  color: var(--sm-muted);
  font-size: 0.78rem;
}
.sm-auth-footer .sm-portal-footer-brand {
  color: var(--sm-primary-dark);
  font-weight: 700;
  font-size: 0.85rem;
  text-shadow: none;
}
.sm-auth-footer .sm-portal-footer-sub {
  color: #64748b;
  font-size: 0.72rem;
}
html.dark-mode .sm-portal-footer-copy { color: #94a3b8; }
html.dark-mode .sm-portal-footer-brand { color: var(--sm-primary-light); }
html.dark-mode .sm-portal-footer-inner { border-top-color: var(--sm-border); }
html.dark-mode .sm-auth-footer .sm-portal-footer-copy { color: #94a3b8; }
html.dark-mode .sm-auth-footer .sm-portal-footer-brand { color: #7dd3fc; }
html.dark-mode .sm-auth-footer .sm-portal-footer-sub { color: #94a3b8; }
.sm-topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: clamp(1rem, 0.8rem + 0.8vw, 1.5rem);
}
.sm-topbar-brand {
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  line-height: 1;
}
.sm-topbar-brand:hover { opacity: 0.92; }
.sm-topbar-title {
  min-width: 0;
  flex: 1 1 auto;
}
@media (max-width: 576px) {
  .sm-topbar-title { font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.1rem); }
}
.sm-topbar h1 {
  font-size: var(--sm-fs-h1); font-weight: 700; margin: 0; color: var(--sm-text);
  line-height: 1.25;
}
.sm-topbar .user-chip {
  display: flex; align-items: center; gap: .55rem;
  background: var(--sm-surface, #fff); padding: .35rem .7rem; border-radius: 999px;
  border: 1px solid var(--sm-border); font-size: var(--sm-fs-small);
  max-width: 100%;
}
.sm-topbar .user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--sm-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .8rem; flex-shrink: 0;
}

/* ---- Profile dropdown (standard account menu) ---- */
.sm-profile-dropdown { flex-shrink: 0; }
.sm-profile-trigger {
  cursor: pointer;
  border: 1px solid var(--sm-border);
  background: var(--sm-surface, #fff);
  padding: .35rem .75rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--sm-text);
  transition: border-color .15s, box-shadow .15s;
}
.sm-profile-trigger:hover,
.sm-profile-trigger:focus,
.sm-profile-trigger[aria-expanded="true"] {
  border-color: var(--sm-primary-light);
  box-shadow: 0 0 0 3px rgba(var(--sm-primary-rgb), .18);
  outline: none;
}
.sm-profile-name { font-weight: 600; font-size: .9rem; line-height: 1.15; }
.sm-profile-role { font-size: .72rem; color: var(--sm-muted); }
.sm-profile-caret { font-size: .7rem; color: var(--sm-muted); margin-left: .1rem; }
.sm-profile-menu {
  min-width: min(300px, calc(100vw - 1.5rem));
  max-width: min(340px, calc(100vw - 1rem));
  max-height: min(85vh, 28rem);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: .45rem 0 .35rem;
  border: 1px solid var(--sm-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .12);
  margin-top: .4rem !important;
  background: #fff;
  color: var(--sm-text, #0f172a);
  z-index: 1080;
}
.sm-profile-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1rem .35rem;
}
.sm-profile-head-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--sm-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem; flex-shrink: 0;
}
.sm-profile-head-name { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.sm-profile-head-sub { font-size: .75rem; color: var(--sm-muted); }
.sm-profile-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sm-muted);
  padding: .35rem 1rem .15rem;
}
.sm-profile-details { padding: .15rem 1rem .5rem; }
.sm-profile-row {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  font-size: .82rem;
  padding: .28rem 0;
  border-bottom: 1px solid var(--sm-border);
}
.sm-profile-row:last-child { border-bottom: 0; }
.sm-profile-row span { color: var(--sm-muted); flex-shrink: 0; }
.sm-profile-row strong {
  font-weight: 600;
  text-align: right;
  word-break: break-word;
  color: var(--sm-text);
}
.sm-profile-theme {
  padding: 0 1rem 0.2rem !important;
}
.sm-profile-theme .sm-theme-toggle { width: 100%; }
.sm-profile-theme .sm-theme-btn { flex: 1; justify-content: center; }
.sm-profile-menu .dropdown-divider {
  margin: 0.3rem 0;
}
/* Profile menu: full theme list (System / Light / Dark) */
.sm-theme-toggle-full {
  flex-direction: column;
  align-items: stretch;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  background: var(--sm-bg);
}
.sm-theme-toggle-full .sm-theme-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
}
.sm-theme-toggle-full .sm-theme-btn span { flex: 1; text-align: left; }
.sm-theme-toggle-full .sm-theme-btn i { width: 1.15rem; text-align: center; }
.sm-profile-menu .dropdown-item {
  font-size: .88rem;
  padding: .55rem 1rem;
  display: flex;
  align-items: center;
}

/* Role badges - same for Super Admin / Society Admin / Owner / Hub */
.sm-role-badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
  white-space: nowrap;
}
.sm-role-super { background: #fef3c7; color: #92400e; }
.sm-role-admin { background: #dbeafe; color: #1e40af; }
.sm-role-finance { background: #d1fae5; color: #065f46; }
.sm-role-committee { background: #ede9fe; color: #5b21b6; }
.sm-role-user { background: #e0f2fe; color: #075985; }
.sm-role-hub { background: #eef0f8; color: var(--sm-primary-dark); }
html.dark-mode .sm-role-super { background: rgba(251, 191, 36, .2); color: #fbbf24; }
html.dark-mode .sm-role-admin { background: rgba(59, 130, 246, .22); color: #93c5fd; }
html.dark-mode .sm-role-finance { background: rgba(16, 185, 129, .2); color: #34d399; }
html.dark-mode .sm-role-committee { background: rgba(139, 92, 246, .22); color: #c4b5fd; }
html.dark-mode .sm-role-user,
html.dark-mode .sm-role-hub { background: rgba(var(--sm-primary-rgb), .22); color: var(--sm-primary-dark); }
.sm-profile-row strong .sm-role-badge { margin-left: auto; }

html.dark-mode .sm-profile-menu {
  background: var(--sm-surface, #1e293b);
  color: var(--sm-text, #f1f5f9);
  border-color: var(--sm-border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
html.dark-mode .sm-profile-trigger {
  background: var(--sm-surface);
  color: var(--sm-text);
}
html.dark-mode .sm-theme-toggle-full {
  background: rgba(255, 255, 255, 0.04);
}
html.dark-mode .dropdown-menu,
html.dark-mode .sm-profile-menu {
  --bs-dropdown-bg: var(--sm-surface);
  background-color: var(--sm-surface);
}

/* ---- Theme toggle (Light / Dark) ---- */
.sm-theme-toggle {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: var(--sm-surface, #fff);
  border: 1px solid var(--sm-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  flex-shrink: 0;
}
.sm-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 0;
  background: transparent;
  color: var(--sm-muted);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1;
  padding: .4rem .7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
  white-space: nowrap;
}
.sm-theme-btn i { font-size: .9rem; }
.sm-theme-btn:hover { color: var(--sm-text); background: rgba(30, 58, 138, .06); }
.sm-theme-btn.active {
  background: var(--sm-primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(30, 58, 138, .35);
}
.sm-theme-btn.active:hover { color: #fff; background: var(--sm-primary-dark); }
html.dark-mode .sm-theme-toggle {
  background: var(--sm-surface);
  border-color: var(--sm-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
html.dark-mode .sm-theme-btn:hover { background: rgba(255, 255, 255, .08); }
html.dark-mode .sm-theme-btn.active {
  background: var(--sm-primary-light);
  box-shadow: 0 1px 6px rgba(72, 149, 239, .4);
}
.sm-theme-float {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top, 0px));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  z-index: 1050;
}
@media (max-width: 576px) {
  .sm-theme-btn span { display: none; }
  .sm-theme-btn { padding: .42rem .55rem; }
  .sm-sidebar-theme .sm-theme-btn span { display: inline; }
  .sm-profile-theme .sm-theme-btn span { display: inline; }
}

/* Sidebar foot — sign out inside menu stack (no dead gap) */
.sm-sidebar-foot {
  flex-shrink: 0;
  margin-top: 0;
  padding: 0.1rem 0.4rem 0.35rem;
  background: transparent;
  border: none;
  border-top: 1px solid var(--sm-border);
  border-radius: 0;
  box-shadow: none;
}
.sm-sidebar-foot .nav-link {
  margin-bottom: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.sm-sidebar-signout-plain {
  margin-bottom: 0 !important;
  color: var(--sm-muted);
  font-weight: 600;
}
.sm-sidebar-signout-plain:hover {
  color: var(--sm-danger);
  background: rgba(220, 38, 38, 0.06);
}
.sm-sidebar-theme {
  padding: 0.15rem 0.35rem 0.65rem;
}
.sm-sidebar-theme .sm-theme-toggle {
  width: 100%;
  justify-content: stretch;
  background: var(--sm-bg);
  border-color: var(--sm-border);
  box-shadow: none;
}
.sm-sidebar-theme .sm-theme-btn {
  flex: 1;
  justify-content: center;
  color: var(--sm-muted);
}
.sm-sidebar-theme .sm-theme-btn:hover {
  color: var(--sm-text);
  background: rgba(var(--sm-primary-rgb), .08);
}
.sm-sidebar-theme .sm-theme-btn.active {
  background: var(--sm-primary);
  color: #fff;
  box-shadow: var(--sm-shadow-sm);
}
.sm-sidebar-theme .sm-theme-btn.active:hover {
  background: var(--sm-primary-dark);
  color: #fff;
}
html.dark-mode .sm-sidebar-theme .sm-theme-btn.active {
  background: var(--sm-primary-light);
  color: #12141c;
}

/* ---- Cards ---- */
.card {
  border: 1px solid var(--sm-border);
  border-radius: var(--sm-radius);
  box-shadow: var(--sm-shadow-sm);
  background: var(--sm-surface);
}
.card-title { font-weight: 600; margin: 0; }
.card h5, .sm-main > .mb-2 h5, .sm-main h5 {
  font-size: var(--sm-fs-h5);
}
.card h6 { font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem); }

.stat-card {
  border: 1px solid var(--sm-border);
  border-radius: var(--sm-radius);
  background: #fff;
  padding: clamp(0.9rem, 0.8rem + 0.5vw, 1.2rem);
  height: 100%;
  box-shadow: var(--sm-shadow-sm);
}
.stat-card .icon {
  width: clamp(38px, 36px + 0.5vw, 44px);
  height: clamp(38px, 36px + 0.5vw, 44px);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(1.1rem, 1rem + 0.3vw, 1.3rem); margin-bottom: .7rem;
}
.stat-card .label { color: var(--sm-muted); font-size: var(--sm-fs-small); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: var(--sm-fs-stat); font-weight: 700; margin-top: .2rem; color: var(--sm-text); line-height: 1.2; }
.stat-card .sub   { font-size: var(--sm-fs-small); color: var(--sm-muted); margin-top: .3rem; }

.stat-card.indigo .icon { background: #e8eaf6; color: var(--sm-primary); }
.stat-card.green  .icon { background: #d1fae5; color: #059669; }
.stat-card.amber  .icon { background: #fef3c7; color: #b45309; }
.stat-card.rose   .icon { background: #ffe4e6; color: #be123c; }
.stat-card.sky    .icon { background: #dbeafe; color: #1d4ed8; }

/* ---- Login page (base; layout refined further below) ---- */
.login-card {
  background: #fff;
  padding: clamp(1.4rem, 1.2rem + 1.5vw, 2.2rem) clamp(1.1rem, 1rem + 1vw, 2rem);
  border-radius: 14px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-card .brand-lg {
  text-align: center; margin-bottom: 1.5rem;
}
.login-card .brand-lg i { font-size: clamp(1.5rem, 1.35rem + 0.6vw, 1.85rem); color: var(--sm-primary); }
.login-card .brand-lg h2 { margin-top: .35rem; font-weight: 700; color: var(--sm-primary-dark); font-size: clamp(1.05rem, 1rem + 0.25vw, 1.2rem); }
.login-card .brand-lg p { color: var(--sm-muted); font-size: var(--sm-fs-small); margin: 0; }

/* ---- Tables ---- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  scrollbar-gutter: stable;
  max-height: none;
}
/* Opt-in: bounded height (modals / log panels) — avoids trapping page scroll on main lists */
.table-responsive.table-scroll-y,
.table-scroll-y.table-responsive {
  max-height: min(70vh, 720px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.table-scroll-y-sm { max-height: min(220px, 40dvh) !important; }
.table-scroll-y-md { max-height: min(360px, 52dvh) !important; }
.table-scroll-y-lg { max-height: min(22rem, 55dvh) !important; }
.table-responsive > .table {
  margin-bottom: 0;
  width: max-content;
  min-width: 100%;
}
.table-responsive > .table th,
.table-responsive > .table td {
  white-space: nowrap;
}
.table {
  font-size: clamp(0.8rem, 0.76rem + 0.2vw, 0.92rem);
  margin-bottom: 0;
}

/* Always-visible scrollbars on data areas (mobile + desktop) */
.table-responsive,
.sm-sidebar,
.sm-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--sm-primary-light, #38bdf8) rgba(148, 163, 184, .25);
}
.table-responsive::-webkit-scrollbar,
.sm-sidebar::-webkit-scrollbar,
.sm-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.table-responsive::-webkit-scrollbar-track,
.sm-sidebar::-webkit-scrollbar-track,
.sm-scroll::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, .18);
  border-radius: 8px;
}
.table-responsive::-webkit-scrollbar-thumb,
.sm-sidebar::-webkit-scrollbar-thumb,
.sm-scroll::-webkit-scrollbar-thumb {
  background: var(--sm-primary, #0284c7);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.table-responsive::-webkit-scrollbar-thumb:hover,
.sm-sidebar::-webkit-scrollbar-thumb:hover,
.sm-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--sm-primary-dark, #0369a1);
  background-clip: padding-box;
}
html.dark-mode .table-responsive::-webkit-scrollbar-track,
html.dark-mode .sm-sidebar::-webkit-scrollbar-track,
html.dark-mode .sm-scroll::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, .55);
}
html.dark-mode .table-responsive::-webkit-scrollbar-thumb,
html.dark-mode .sm-scroll::-webkit-scrollbar-thumb {
  background: #38bdf8;
  background-clip: padding-box;
}
html.dark-mode .sm-sidebar::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, .55);
  background-clip: padding-box;
}
.table thead th {
  background: #f9fafb;
  color: var(--sm-muted);
  font-weight: 600;
  font-size: clamp(0.68rem, 0.65rem + 0.15vw, 0.78rem);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--sm-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
.table td { vertical-align: middle; }
.badge-status {
  padding: .3em .65em; font-size: .7rem; font-weight: 600; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.badge-status.pending  { background: #fef3c7; color: #92400e; }
.badge-status.approved { background: #d1fae5; color: #065f46; }
.badge-status.rejected { background: #fee2e2; color: #991b1b; }
.badge-status.overdue  { background: #ffe4e6; color: #9f1239; }
.badge-status.under_verification { background: #dbeafe; color: #1e40af; }
.badge-status.partially_paid { background: #ffedd5; color: #9a3412; }
.badge-status.open     { background: #e0f2fe; color: #075985; }
.badge-status.in_progress { background: #fef3c7; color: #92400e; }
.badge-status.resolved,
.badge-status.closed   { background: #d1fae5; color: #065f46; }
.badge-status.po_raised { background: #e0f2fe; color: #075985; }
.badge-status.awaiting_invoice { background: #fef3c7; color: #92400e; }
.badge-status.invoice_received { background: #dbeafe; color: #1e40af; }
.badge-status.paid { background: #d1fae5; color: #065f46; }
.badge-status.cancelled { background: #f3f4f6; color: #4b5563; }

/* ---- Utilities ---- */
.section-title {
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem); font-weight: 600; color: var(--sm-text);
  margin: 1.25rem 0 .75rem; display: flex; align-items: center; gap: .5rem;
}
.hover-shadow { transition: box-shadow .2s, transform .15s; }
.hover-shadow:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); }
a.stat-card {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.1); }
a.stat-card:focus-visible { outline: 2px solid var(--sm-primary); outline-offset: 2px; }
.spinner-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.7);
  display: none; align-items: center; justify-content: center; z-index: 9999;
}
.spinner-overlay.active { display: flex; }

.sm-menu-toggle { display: none; }
.sm-sidebar-backdrop {
  display: block;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.32s;
  -webkit-tap-highlight-color: transparent;
}
.sm-sidebar-backdrop.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.sm-sidebar-edge,
#smSidebarEdge {
  display: none !important;
}
.sm-sidebar-edge i { pointer-events: none; }
.sm-sidebar-edge .sm-edge-open { display: none; }
.sm-sidebar-edge .sm-edge-close { display: inline; }
/* Desktop / OS browser: collapse left menu */
body.sm-sidebar-collapsed .sm-app {
  grid-template-columns: 0 minmax(0, 1fr);
}
body.sm-sidebar-collapsed .sm-sidebar {
  width: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
body.sm-sidebar-collapsed .sm-sidebar-edge {
  left: 0;
  transform: translate(0, -50%);
  border-radius: 0 12px 12px 0;
}
body.sm-sidebar-collapsed .sm-sidebar-edge .sm-edge-open { display: inline; }
body.sm-sidebar-collapsed .sm-sidebar-edge .sm-edge-close { display: none; }
html.dark-mode .sm-sidebar-edge {
  background: #0f172a;
  border-color: #1e3a5f;
  color: var(--sm-primary-light);
}

/* ---- Screen-wise breakpoints ---- */
@media (max-width: 1200px) {
  :root { --sm-sidebar-w: 232px; }
}

@media (max-width: 992px) {
  .sm-app { grid-template-columns: 1fr; }
  .sm-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1050;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    box-shadow: 8px 0 24px rgba(0,0,0,.2);
    opacity: 1;
    pointer-events: auto;
  }
  .sm-sidebar.open { transform: translateX(0); }
  .sm-main { padding: var(--sm-pad-main); }
  .sm-menu-toggle { display: inline-flex !important; align-items: center; }
  /* Mobile / APK: edge arrow at screen left; moves with open drawer */
  .sm-sidebar-edge {
    left: 0;
    transform: translateY(-50%);
    border-radius: 0 12px 12px 0;
  }
  body.sm-nav-open .sm-sidebar-edge {
    left: min(280px, 86vw);
    transform: translate(-50%, -50%);
    border-radius: 999px;
  }
  body.sm-nav-open .sm-sidebar-edge .sm-edge-open { display: none; }
  body.sm-nav-open .sm-sidebar-edge .sm-edge-close { display: inline; }
  .sm-sidebar-edge .sm-edge-open { display: inline; }
  .sm-sidebar-edge .sm-edge-close { display: none; }
  /* Collapse class not used on small screens */
  body.sm-sidebar-collapsed .sm-app { grid-template-columns: 1fr; }
  body.sm-sidebar-collapsed .sm-sidebar {
    width: min(280px, 86vw);
    padding: 1rem 0.75rem 1.25rem;
    border-right: 1px solid var(--sm-border);
    opacity: 1;
    pointer-events: auto;
  }
  .sm-topbar h1 { font-size: 1.25rem; }
  .stat-card .value { font-size: 1.4rem; }
}

@media (max-width: 768px) {
  :root {
    --sm-pad-main: 0.85rem;
  }
  .sm-topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .sm-topbar .user-chip span:not(.avatar) {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .card.p-3 { padding: 0.9rem !important; }
  .btn { white-space: nowrap; }
  .form-control, .form-select, .form-control-sm, .form-select-sm {
    font-size: 16px; /* avoids iOS zoom on focus */
  }
  .btn-sm { font-size: 0.875rem; }
  .login-card { max-width: 100%; }

  /* Tabs: horizontal scroll, no cramped wrap */
  .nav-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.15rem;
    padding-bottom: 2px;
  }
  .nav-tabs .nav-item { flex: 0 0 auto; }
  .nav-tabs .nav-link {
    white-space: nowrap;
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
  }

  /* Action button rows wrap cleanly */
  .sm-main .d-flex.justify-content-between {
    flex-direction: column;
    align-items: stretch !important;
  }
  .sm-main .d-flex.gap-2.flex-wrap {
    width: 100%;
  }
  .sm-main .d-flex.gap-2.flex-wrap > .btn {
    flex: 1 1 auto;
    min-width: calc(50% - 0.35rem);
  }

  /* Tables: horizontal pan; page scrolls vertically */
  .table-responsive {
    margin-left: -0.15rem;
    margin-right: -0.15rem;
  }
  .table th, .table td {
    vertical-align: middle;
  }
  .table .btn-sm {
    padding: 0.28rem 0.45rem;
  }

  /* Modals full-width on phones */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  .modal-dialog.modal-lg,
  .modal-dialog.modal-xl {
    max-width: calc(100% - 1rem);
  }
  .modal-body .row > [class*="col-"] {
    margin-bottom: 0.15rem;
  }

  /* Filter bars stack */
  .owners-filter-bar .row > [class*="col-"] {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
  }
  .owners-filter-bar .text-md-end {
    text-align: start !important;
  }

  /* Stat cards full width */
  #summary .col-md,
  #summary > .col,
  .row > .col-md {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .sm-sidebar .brand span { font-size: 1rem; }
  .stat-card .value { font-size: 1.35rem; }
  .table { font-size: var(--sm-fs-body); }
  .sm-main .small, .form-text { font-size: var(--sm-fs-small); }
  .sm-main .row.g-3 { --bs-gutter-x: 0.65rem; --bs-gutter-y: 0.65rem; }
}

@media (min-width: 992px) {
  .table { font-size: var(--sm-fs-body); }
  .sm-topbar h1 { font-size: var(--sm-fs-h1); }
}

/* ============================================================
   Dark Theme — sky night + gold accents (matches SAB logo)
   ============================================================ */
html.dark-mode {
  --sm-primary:        #38bdf8;
  --sm-primary-dark:   #7dd3fc;
  --sm-primary-light:  #0ea5e9;
  --sm-primary-rgb:    56, 189, 248;
  --sm-accent:         #34d399;
  --sm-accent-gold:    #fbbf24;
  --sm-accent-gold-soft: rgba(251, 191, 36, 0.28);
  --sm-warn:           #fbbf24;
  --sm-danger:         #f87171;
  --sm-bg:             #082f49;
  --sm-surface:        #0f172a;
  --sm-text:           #e0f2fe;
  --sm-muted:          #94a3b8;
  --sm-border:         #1e4976;
  --sm-sidebar-bg:     linear-gradient(180deg, #0f172a 0%, #0c4a6e 52%, #082f49 100%);
  --sm-chart-collection: #38bdf8;
  --sm-chart-expenses:   #fbbf24;
  --sm-chart-income:     #34d399;
  --sm-chart-debit:      #f87171;
  --sm-chart-collection-bg: rgba(56, 189, 248, .22);
  --sm-chart-expenses-bg:   rgba(251, 191, 36, .2);
  --bs-body-bg: var(--sm-bg);
  --bs-body-color: var(--sm-text);
  --bs-border-color: var(--sm-border);
  --bs-secondary-bg: var(--sm-surface);
  --bs-tertiary-bg: #0c4a6e;
  --bs-emphasis-color: var(--sm-text);
  --bs-link-color: var(--sm-primary-dark);
  --bs-link-hover-color: var(--sm-primary-light);
}

html.dark-mode body {
  background: var(--sm-bg);
  color: var(--sm-text);
}

html.dark-mode .card,
html.dark-mode .stat-card,
html.dark-mode .user-chip,
html.dark-mode .login-card,
html.dark-mode .bg-primary-soft {
  background-color: var(--sm-surface) !important;
}

html.dark-mode .card { border-color: var(--sm-border); }
html.dark-mode .table thead th {
  background: #0f1c2e;
  color: var(--sm-muted);
  border-color: var(--sm-border);
}
html.dark-mode .table td { border-color: var(--sm-border); }
html.dark-mode .table td.bg-primary-soft { background: rgba(14, 165, 233, .12) !important; }
html.dark-mode .text-muted { color: var(--sm-muted) !important; }
html.dark-mode .btn-light,
html.dark-mode .sm-menu-toggle {
  background-color: var(--sm-surface);
  border-color: var(--sm-border);
  color: var(--sm-text);
}
html.dark-mode .btn-light:hover,
html.dark-mode .sm-menu-toggle:hover {
  background-color: var(--sm-border);
}
html.dark-mode .nav-tabs .nav-link.active,
html.dark-mode .nav-tabs .nav-link:hover {
  color: var(--sm-primary-light);
}

/* Page tabs (Owners / Flats / ...) - clear active marker both themes */
.nav-tabs.sm-page-tabs {
  flex-wrap: wrap;
  gap: .15rem .25rem;
  border-bottom-color: var(--sm-border);
}
.nav-tabs .nav-link {
  border-radius: 8px 8px 0 0;
  color: var(--sm-muted);
  transition: box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.15s ease, z-index 0s;
}
.nav-tabs .nav-item {
  position: relative;
  z-index: 1;
}
.nav-tabs .nav-link {
  position: relative;
  z-index: 1;
}
.nav-tabs .nav-link:hover:not(.active) {
  color: var(--sm-primary-dark);
  background: var(--sm-surface) !important;
  box-shadow:
    0 12px 28px rgba(var(--sm-primary-rgb), 0.3),
    0 3px 10px rgba(15, 23, 42, 0.1),
    inset 0 -4px 0 var(--sm-primary),
    0 0 0 1px rgba(var(--sm-primary-rgb), 0.2);
  z-index: 14;
  transform: scale(1.08) translateY(-5px);
  transform-origin: bottom center;
}
.nav-tabs .nav-link.active {
  color: var(--sm-primary) !important;
  font-weight: 600;
  background: var(--sm-surface) !important;
  border-color: var(--sm-border) var(--sm-border) var(--sm-surface) !important;
  z-index: 16;
  transform: scale(1.06) translateY(-4px);
  transform-origin: bottom center;
  box-shadow:
    inset 0 4px 0 var(--sm-primary),
    0 10px 24px rgba(var(--sm-primary-rgb), 0.26),
    0 -2px 12px rgba(var(--sm-primary-rgb), 0.14),
    0 0 0 1px rgba(var(--sm-primary-rgb), 0.18);
}
html.dark-mode .nav-tabs .nav-link.active {
  color: var(--sm-primary-dark) !important;
  background: var(--sm-surface) !important;
  border-color: var(--sm-border) var(--sm-border) var(--sm-surface) !important;
  box-shadow: 0 -2px 14px rgba(var(--sm-primary-rgb), .28), 0 0 0 1px rgba(var(--sm-primary-rgb), .22);
}
html.dark-mode a { color: var(--sm-primary-light); }
html.dark-mode .sm-sidebar {
  background: var(--sm-sidebar-bg);
  color: var(--sm-text);
  border-right-color: var(--sm-border);
  box-shadow: inset -1px 0 0 rgba(56, 189, 248, 0.12);
}
html.dark-mode .sm-sidebar-nav-panel {
  background: var(--sm-surface);
  border-color: var(--sm-border);
}
html.dark-mode .sm-sidebar-bottom { background: #151822; }
html.dark-mode .sm-sidebar-user {
  background: var(--sm-surface);
  border-color: var(--sm-border);
}
html.dark-mode .sm-sidebar-user-name { color: var(--sm-primary-dark); }
html.dark-mode .sm-sidebar-foot-btn {
  background: var(--sm-surface);
  border-color: var(--sm-border);
  color: var(--sm-text);
}
html.dark-mode .sm-sidebar-foot-btn:hover {
  border-color: var(--sm-primary-light);
  color: var(--sm-primary-dark);
}
html.dark-mode .sm-sidebar .brand {
  border-bottom-color: rgba(56, 189, 248, .18);
  color: #f0f9ff;
}
html.dark-mode .sm-sidebar .nav-section {
  color: rgba(125, 211, 252, .55);
}
html.dark-mode .sm-sidebar .nav-section-super {
  color: rgba(253, 224, 171, .75);
  border-top-color: rgba(251, 191, 36, .2);
}
html.dark-mode .sm-sidebar .nav-link,
html.dark-mode .sm-nav-group-toggle {
  background: #132337;
  border-color: #1e3a5f;
  color: rgba(224, 242, 254, .9);
  box-shadow: none;
}
html.dark-mode .sm-sidebar .nav-link i,
html.dark-mode .sm-nav-group-toggle .sm-nav-ico {
  background: rgba(56, 189, 248, .18);
  color: #7dd3fc;
}
html.dark-mode .sm-sidebar .nav-link:hover,
html.dark-mode .sm-nav-group-toggle:hover {
  background: #17324a;
  color: #fff;
  border-color: rgba(56, 189, 248, .45);
}
html.dark-mode .sm-sidebar .nav-link.active {
  background: #17324a;
  color: #e0f2fe;
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(125, 211, 252, .35), 0 0 16px rgba(56, 189, 248, .25);
}
html.dark-mode .sm-sidebar .nav-link.active i,
html.dark-mode .sm-nav-group.open > .sm-nav-group-toggle .sm-nav-ico {
  background: #0ea5e9;
  color: #061018;
}
html.dark-mode .sm-nav-group-body { border-left-color: #1e3a5f; }
html.dark-mode .sm-nav-group.open > .sm-nav-group-toggle {
  border-color: #38bdf8;
  color: #e0f2fe;
}
html.dark-mode .sm-sidebar-menu-stack {
  background: var(--sm-surface, #0f172a);
  border-color: var(--sm-border);
}
html.dark-mode .sm-sidebar-foot {
  background: transparent;
  border-color: var(--sm-border);
}
html.dark-mode .sm-sidebar-nav-panel {
  border-color: var(--sm-border);
}
html.dark-mode .bg-primary-soft { background: linear-gradient(135deg, rgba(14,165,233,.22) 0%, rgba(3,105,161,.15) 100%) !important; }
html.dark-mode .stat-card.indigo .icon { background: rgba(14,165,233,.22); color: var(--sm-primary-light); }
html.dark-mode .stat-card.green  .icon { background: rgba(16,185,129,.2); color: #34d399; }
html.dark-mode .stat-card.amber  .icon { background: rgba(245,158,11,.2); color: #fbbf24; }
html.dark-mode .stat-card.rose   .icon { background: rgba(220,38,38,.2); color: #f87171; }
html.dark-mode .stat-card.sky    .icon { background: rgba(56,189,248,.22); color: #7dd3fc; }
html.dark-mode .login-hero { background: #132337; }
html.dark-mode .dash-sketch { background: #132337; border-color: var(--sm-border); }

/* Bootstrap light surfaces - must not flash white in night mode */
html.dark-mode .table-light,
html.dark-mode tr.table-light,
html.dark-mode .table > tbody > tr.table-light > *,
html.dark-mode thead.table-light > tr > th {
  --bs-table-bg: rgba(19, 35, 55, .92);
  --bs-table-color: var(--sm-text);
  --bs-table-hover-bg: rgba(56, 189, 248, .08);
  background-color: rgba(19, 35, 55, .92) !important;
  color: var(--sm-text) !important;
  border-color: var(--sm-border) !important;
}

html.dark-mode .bg-light,
html.dark-mode .text-bg-light {
  background-color: rgba(19, 35, 55, .92) !important;
  color: var(--sm-text) !important;
  border-color: var(--sm-border) !important;
}

html.dark-mode .bg-white {
  background-color: var(--sm-surface) !important;
  color: var(--sm-text) !important;
}

html.dark-mode .table tbody tr { color: var(--sm-text); }
html.dark-mode .table tbody tr td {
  background-color: transparent;
  color: inherit;
}

html.dark-mode .table code {
  color: #7dd3fc;
  background-color: rgba(56, 189, 248, .14);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

html.dark-mode .btn-outline-warning {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, .7);
}
html.dark-mode .btn-outline-warning:hover,
html.dark-mode .btn-outline-warning:focus {
  color: #fde68a;
  background-color: rgba(251, 191, 36, .14);
  border-color: #fbbf24;
}

html.dark-mode .badge.bg-success-subtle {
  background-color: rgba(16, 185, 129, .2) !important;
  color: #6ee7b7 !important;
}
html.dark-mode .badge.bg-warning-subtle {
  background-color: rgba(251, 191, 36, .2) !important;
  color: #fcd34d !important;
}
html.dark-mode .badge.bg-secondary-subtle,
html.dark-mode .badge.text-bg-secondary {
  background-color: rgba(148, 163, 184, .22) !important;
  color: #e2e8f0 !important;
}

html.dark-mode .alert-light {
  background: var(--sm-surface);
  border-color: var(--sm-border);
  color: var(--sm-text);
}

html.dark-mode .sm-main .form-control,
html.dark-mode .sm-main .form-select {
  background-color: #0f1c2e;
  border-color: var(--sm-border);
  color: var(--sm-text);
}
html.dark-mode .sm-main .form-control:focus,
html.dark-mode .sm-main .form-select:focus {
  background-color: #0f1c2e;
  border-color: var(--sm-primary);
  color: var(--sm-text);
  box-shadow: 0 0 0 0.2rem rgba(56, 189, 248, .2);
}
html.dark-mode .sm-main .form-control::placeholder { color: #64748b; }

html.dark-mode .modal-content {
  background: var(--sm-surface);
  border-color: var(--sm-border);
  color: var(--sm-text);
}
html.dark-mode .modal-header,
html.dark-mode .modal-footer { border-color: var(--sm-border); }

html.dark-mode .sm-approver-chip {
  background: rgba(15, 28, 46, .95) !important;
  border-color: var(--sm-border) !important;
  color: var(--sm-text);
}
html.dark-mode .sm-approver-chip .text-muted { color: #94a3b8 !important; }

html.dark-mode .sm-row-vacant,
html.dark-mode .sm-row-vacant > td {
  background-color: rgba(15, 28, 46, .55) !important;
  color: var(--sm-muted) !important;
}

html.dark-mode .sm-surface-panel {
  background: rgba(15, 28, 46, .55) !important;
  border-color: var(--sm-border) !important;
}

/* Light theme helpers */
.sm-approver-chip {
  background: rgba(var(--sm-primary-rgb), .08);
  border-color: var(--sm-border) !important;
}
.sm-row-vacant { background: rgba(236, 238, 241, .85); }
.sm-surface-panel { background: rgba(236, 238, 241, .85); }
html.dark-mode .sm-row-vacant { background: rgba(28, 31, 46, .55); }
html.dark-mode .sm-surface-panel { background: rgba(28, 31, 46, .55); }

@media (min-width: 1400px) {
  /* Fill wide Windows / Mac displays - do not leave empty right gutter */
  .sm-main {
    max-width: none;
    width: 100%;
  }
}

.toast-container { z-index: 10000; }

/* ---- Society logo (sidebar + login) - animated box centered ---- */
.sm-sidebar .brand {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  padding: 0.85rem 0.65rem 1rem;
  gap: 0;
}
.sm-brand-logo,
.sm-brand-logo-lg,
.login-logo-panel img {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background: linear-gradient(165deg, #ffffff, #e0f2fe) !important;
  object-fit: contain;
}
html.dark-mode .sm-brand-logo,
html.dark-mode .sm-brand-logo-lg,
html.dark-mode .login-logo-panel img {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background: linear-gradient(165deg, #0f172a, #0c4a6e) !important;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, .35), 0 4px 16px rgba(0, 0, 0, .35);
}
@media (min-width: 1200px) {
  .login-card .brand-lg .sm-brand-logo-lg { display: block !important; }
  .login-card .brand-lg .sm-animated-logo { display: flex !important; }
}
/* Compact login logo - same on phone + desktop */
.login-card .brand-lg .sm-login-logo,
.login-card .brand-lg .sm-brand-logo-lg {
  display: block !important;
  width: 72px;
  height: 72px;
  margin: 0 auto 0.65rem;
  border-radius: 50%;
  object-fit: cover;
  padding: 0;
  background: #0b1220;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, .35), 0 6px 18px rgba(3, 105, 161, .18);
}
@media (max-width: 576px) {
  .login-card .brand-lg .sm-login-logo,
  .login-card .brand-lg .sm-brand-logo-lg {
    width: 64px;
    height: 64px;
    margin-bottom: 0.5rem;
  }
}
.sm-brand-logo {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  padding: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, .28), 0 6px 16px rgba(3, 105, 161, .12);
}
.sm-brand-logo-lg {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  margin: 0 0 0.65rem;
  padding: 4px;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, .28), 0 6px 18px rgba(3, 105, 161, .14);
}
.login-logo-panel img {
  width: min(160px, 58%);
  height: auto;
  max-height: 160px;
  padding: 8px;
  border-radius: 18px;
}
.sm-sidebar .brand .sm-brand-sub {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ===== Login page (desktop + mobile) ===== */
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: clamp(0.5rem, 1.5vh, 0.85rem);
  padding:
    max(clamp(0.5rem, 2vh, 1rem), env(safe-area-inset-top))
    clamp(0.55rem, 2vw, 1.15rem)
    max(clamp(0.65rem, 2vh, 1.15rem), env(safe-area-inset-bottom));
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  background: linear-gradient(165deg, #f0f9ff 0%, #e0f2fe 45%, #bae6fd 100%);
}
.login-logo-panel,
.login-hero {
  display: none !important;
}

/* Continuous SVG building sketch skyline (old good look) */
.login-skyline {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(42vh, 320px);
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.55;
}
.login-skyline::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 0%, rgba(224, 242, 254, 0.35) 55%, rgba(125, 211, 252, 0.55) 100%);
}
.login-skyline-track {
  display: flex;
  width: max-content;
  height: 100%;
  align-items: flex-end;
  animation: login-skyline-scroll 48s linear infinite;
  will-change: transform;
}
.login-skyline-strip {
  display: flex;
  align-items: flex-end;
  height: 100%;
  flex-shrink: 0;
  padding: 0 0.5rem;
  gap: 0.75rem;
}
.login-skyline-strip svg {
  height: 100%;
  width: auto;
  display: block;
  flex-shrink: 0;
}
@keyframes login-skyline-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .login-skyline-track { animation: none; }
}

.login-captcha-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.2fr) auto minmax(90px, 1fr);
  gap: 0.4rem;
  align-items: center;
}
.login-captcha-q {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: #eef0f8;
  border: 1px solid var(--sm-border);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--sm-primary-dark);
  letter-spacing: 0.18em;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  user-select: none;
}

/* Outer glass shell: brand | form | apk - fluid fit for all viewports */
body.login-page {
  margin: 0;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
}
html.dark-mode body.login-page {
  background: #0f172a;
  color: #e2e8f0;
}
body.login-page .login-wrap {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
}
.login-shell,
.login-panel {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(9.25rem, 11.25rem) minmax(17rem, 23rem) minmax(8.75rem, 10.75rem);
  align-items: stretch;
  justify-content: center;
  column-gap: clamp(0.55rem, 1.2vw, 0.85rem);
  row-gap: clamp(0.55rem, 1.2vw, 0.85rem);
  width: fit-content;
  max-width: min(100%, 52rem);
  margin: 0 auto;
  padding: clamp(0.55rem, 1.4vw, 0.9rem);
  box-sizing: border-box;
  border-radius: clamp(14px, 2vw, 20px);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.5) 0%, rgba(224, 242, 254, 0.55) 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 20px 50px rgba(3, 105, 161, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
}

.login-wrap > .login-card,
.login-shell > .login-card,
.login-panel > .login-card {
  margin: 0;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 100%;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(186, 230, 253, 0.9);
  box-shadow: 0 10px 28px rgba(3, 105, 161, 0.12);
  padding: clamp(1rem, 2vw, 1.25rem) clamp(0.9rem, 1.8vw, 1.2rem) clamp(0.9rem, 1.8vw, 1.1rem);
}

.login-wrap > .login-card {
  width: min(100%, 26rem);
  max-width: 26rem;
  height: auto;
}

.login-brand-panel,
.login-apk-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: clamp(0.7rem, 1.5vw, 1rem) clamp(0.55rem, 1.2vw, 0.8rem);
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(186, 230, 253, 0.9);
  box-shadow: 0 10px 28px rgba(3, 105, 161, 0.12);
  box-sizing: border-box;
}
.login-brand-panel .sm-animated-logo {
  display: flex !important;
  justify-content: center;
  max-width: 100%;
}
.login-brand-panel .sm-logo-box {
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.login-brand-panel .sm-logo-orbit--lg {
  width: clamp(72px, 9vw, 96px) !important;
  height: clamp(72px, 9vw, 96px) !important;
}
.login-brand-panel .sm-logo-text { text-align: center; }
.login-brand-panel .sm-logo-title {
  font-size: clamp(0.8rem, 1.5vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--sm-primary-dark);
  line-height: 1.2;
}
.login-brand-panel .sm-logo-sub {
  font-size: clamp(0.55rem, 1vw, 0.62rem);
  color: #475569;
  font-weight: 600;
}

.login-apk-panel {
  gap: 0.4rem;
  color: #0f172a;
}
.login-apk-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0c4a6e;
}
.login-apk-scan-hint {
  font-size: 0.75rem;
  color: #64748b;
}
.login-apk-qr-img {
  width: clamp(96px, 12vw, 120px);
  height: clamp(96px, 12vw, 120px);
  border-radius: 12px;
  border: 1px solid rgba(186, 230, 253, 0.95);
  background: #fff;
  box-shadow: 0 6px 18px rgba(3, 105, 161, 0.12);
  object-fit: contain;
  padding: 4px;
}
.login-apk-download-link {
  color: var(--sm-primary-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
}
.login-apk-download-link:hover { text-decoration: underline; }
.login-apk-link-mobile { display: none; }

.login-owner-note {
  margin-top: 1rem;
  margin-bottom: 0;
}
.login-support {
  margin-top: 0.85rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  font-size: 0.8rem;
  text-align: left;
}

.sm-auth-footer {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: min(100%, 52rem);
  margin: 0 auto;
  padding: 0 0.5rem max(0.25rem, env(safe-area-inset-bottom));
  text-align: center;
  flex-shrink: 0;
}
.sm-auth-footer .sm-portal-footer-brand {
  color: var(--sm-primary-dark);
  font-weight: 700;
  font-size: 0.88rem;
  text-shadow: none;
}
.sm-auth-footer .sm-portal-footer-sub { display: none; }

/* Laptop / narrow desktop: keep 3 columns but shrink */
@media (max-width: 1100px) and (min-width: 901px) {
  .login-shell,
  .login-panel {
    grid-template-columns: minmax(8.5rem, 10rem) minmax(16rem, 21rem) minmax(8rem, 9.75rem);
  }
}

/* Tablet / phone: stack - full width of usable screen */
@media (max-width: 900px) {
  .login-shell,
  .login-panel {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: min(100%, 26rem);
    gap: 0.55rem;
    padding: 0.55rem;
  }
  .login-brand-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
    padding: 0.45rem 0.55rem;
  }
  .login-brand-panel .sm-animated-logo {
    width: auto;
    justify-content: center;
    align-items: center;
  }
  .login-brand-panel .sm-logo-box {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    padding: 0.55rem 0.7rem 0.5rem;
    border-radius: 14px;
    box-sizing: border-box;
  }
  .login-brand-panel .sm-logo-orbit--lg {
    width: clamp(56px, 16vw, 72px) !important;
    height: clamp(56px, 16vw, 72px) !important;
    margin: 0 auto;
    flex-shrink: 0;
  }
  .login-brand-panel .sm-logo-text {
    text-align: center;
    min-width: 0;
  }
  .login-brand-panel .sm-logo-title {
    font-size: 0.92rem;
    letter-spacing: 0.1em;
    line-height: 1.15;
  }
  .login-brand-panel .sm-logo-sub {
    display: block;
    font-size: 0.58rem;
    line-height: 1.25;
    margin-top: 0.08rem;
  }
  .login-apk-panel {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    height: auto;
    padding: 0.55rem;
  }
  .login-apk-title { flex: 1 1 100%; }
  .login-apk-qr-img { width: 100px; height: 100px; }
}

/* Phone - prior layout, tighter empty space (brand / captcha / gaps) */
@media (max-width: 640px) {
  .login-wrap {
    justify-content: safe flex-start;
    padding: max(0.4rem, env(safe-area-inset-top)) 0.45rem max(0.55rem, env(safe-area-inset-bottom));
    gap: 0.4rem;
  }
  .login-skyline {
    height: min(18vh, 120px);
    opacity: 0.4;
  }
  /* Captcha hugs text; answer shares the row */
  .login-captcha-row {
    display: grid;
    grid-template-columns: max-content auto minmax(4.5rem, 1fr);
    grid-template-areas: none;
    gap: 0.35rem;
    align-items: stretch;
  }
  .login-captcha-q {
    grid-area: auto;
    width: auto;
    min-width: 0;
    justify-self: start;
    padding: 0.3rem 0.65rem;
    min-height: 40px;
    font-size: 0.9rem;
  }
  #captchaRefresh {
    grid-area: auto;
    min-height: 40px;
    min-width: 40px;
    padding: 0.25rem 0.45rem;
  }
  #captchaAnswer {
    grid-area: auto;
    min-height: 40px;
  }
  .login-shell,
  .login-panel {
    max-width: 100%;
    width: 100%;
    gap: 0.4rem;
    padding: 0.4rem;
    border-radius: 14px;
  }
  .login-shell > .login-card,
  .login-panel > .login-card {
    padding: 0.75rem 0.75rem 0.65rem;
    height: auto;
  }
  .login-brand-panel {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    padding: 0.3rem 0.4rem;
    box-sizing: border-box;
  }
  .login-brand-panel .sm-logo-box {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    width: 100%;
    max-width: 100%;
    padding: 0.45rem 0.6rem 0.4rem;
    text-align: center;
    margin: 0 auto;
    box-sizing: border-box;
  }
  .login-brand-panel .sm-animated-logo {
    width: 100%;
    max-width: 100%;
  }
  .login-brand-panel .sm-logo-orbit--lg {
    width: clamp(48px, 15vw, 60px) !important;
    height: clamp(48px, 15vw, 60px) !important;
    margin: 0 auto;
  }
  .login-brand-panel .sm-logo-text {
    text-align: center;
    width: 100%;
  }
  .login-brand-panel .sm-logo-title {
    font-size: clamp(0.78rem, 2.8vw, 0.9rem);
    letter-spacing: 0.08em;
  }
  .login-brand-panel .sm-logo-sub {
    display: block !important;
    font-size: clamp(0.48rem, 1.8vw, 0.56rem);
  }
  .login-card .brand-lg { margin-bottom: 0.4rem; }
  .login-card .brand-lg h2 { font-size: 1.02rem; margin-bottom: 0.1rem; }
  .login-card .brand-lg p { font-size: 0.78rem; margin-bottom: 0; }
  .login-card .alert { margin-bottom: 0.5rem !important; padding: 0.4rem 0.55rem; }
  .login-card .mb-3 { margin-bottom: 0.45rem !important; }
  .login-card .form-label { font-size: 0.72rem; margin-bottom: 0.12rem; }
  .login-card .input-group-text,
  .login-card .form-control,
  .login-card .btn { min-height: 40px; font-size: 0.88rem; }
  .login-card .input-group .btn { min-width: 40px; padding-left: 0.55rem; padding-right: 0.55rem; }
  .login-card .input-group-text { padding-left: 0.55rem; padding-right: 0.45rem; }
  .login-card .form-control { padding-left: 0.5rem; padding-right: 0.5rem; }
  .login-card #submitBtn { min-height: 42px; font-weight: 700; }
  .login-owner-note { margin-top: 0.45rem; font-size: 0.7rem; }
  .login-support {
    margin-top: 0.45rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.72rem;
    line-height: 1.35;
  }
  .login-support .btn {
    display: inline-flex;
    align-items: center;
    width: auto;
    min-height: 30px;
    margin-top: 0.3rem !important;
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
  }
  .login-apk-qr-img,
  .login-apk-scan-hint,
  .login-apk-title { display: none !important; }
  .login-apk-panel {
    border: 1px solid rgba(186, 230, 253, 0.9);
    padding: 0;
    flex-direction: column;
    background: transparent;
    box-shadow: none;
  }
  .login-apk-link-desktop { display: none !important; }
  .login-apk-link-mobile { display: inline !important; }
  .login-apk-download-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 40px;
    padding: 0.45rem 0.75rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #7dd3fc;
    color: #0369a1 !important;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(3, 105, 161, 0.1);
  }
  .login-apk-download-link:hover { text-decoration: none !important; }
  .sm-theme-float {
    top: max(0.4rem, env(safe-area-inset-top));
    right: max(0.4rem, env(safe-area-inset-right));
  }
}

/* APK WebView only: hide Download APK (same UI otherwise) */
html.sab-native-app .login-apk-panel,
body.sab-native-app .login-apk-panel {
  display: none !important;
}

@media (max-width: 380px) {
  .login-shell,
  .login-panel { padding: 0.35rem; }
  .login-brand-panel { padding: 0.25rem 0.3rem; }
  .login-brand-panel .sm-logo-box {
    gap: 0.25rem;
    padding: 0.4rem 0.5rem 0.35rem;
  }
  .login-brand-panel .sm-logo-orbit--lg {
    width: 46px !important;
    height: 46px !important;
  }
  .login-captcha-row {
    grid-template-columns: max-content auto;
    grid-template-areas:
      "q refresh"
      "ans ans";
  }
  .login-captcha-q { grid-area: q; }
  #captchaRefresh { grid-area: refresh; }
  #captchaAnswer { grid-area: ans; }
}

/* Short windows / laptops - keep everything on screen */
@media (max-height: 760px) {
  .login-wrap {
    justify-content: safe flex-start;
    padding-top: max(0.35rem, env(safe-area-inset-top));
  }
  .login-skyline { height: min(16vh, 110px); opacity: 0.35; }
  .login-shell,
  .login-panel { padding: 0.35rem; gap: 0.35rem; }
  .login-brand-panel .sm-logo-orbit--lg {
    width: 52px !important;
    height: 52px !important;
  }
  .login-apk-qr-img { width: 80px; height: 80px; }
  .login-card .brand-lg { margin-bottom: 0.35rem; }
  .login-card .mb-3 { margin-bottom: 0.4rem !important; }
  .login-card .alert { margin-bottom: 0.4rem !important; }
}

html.dark-mode .login-shell,
html.dark-mode .login-panel {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.78) 0%, rgba(19, 35, 55, 0.82) 100%);
  border-color: rgba(30, 58, 95, 0.85);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(125, 211, 252, 0.08);
}
html.dark-mode .login-shell > .login-card,
html.dark-mode .login-panel > .login-card,
html.dark-mode .login-brand-panel,
html.dark-mode .login-apk-panel {
  background: rgba(19, 35, 55, 0.96) !important;
  border-color: #1e3a5f;
}
html.dark-mode .login-brand-panel .sm-logo-title { color: #7dd3fc; }
html.dark-mode .login-brand-panel .sm-logo-sub { color: #94a3b8; }
html.dark-mode .login-apk-title { color: #e2e8f0; }
html.dark-mode .login-apk-scan-hint { color: #94a3b8; }
html.dark-mode .login-apk-qr-img {
  border-color: #1e3a5f;
  background: rgba(15, 23, 42, 0.9);
}
html.dark-mode .login-support {
  background: rgba(15, 23, 42, 0.55);
  border-color: #1e3a5f;
}
html.dark-mode .login-skyline {
  opacity: 0.4;
}
html.dark-mode .login-skyline::before {
  background: linear-gradient(180deg, transparent 0%, rgba(15, 23, 42, 0.45) 60%, rgba(12, 74, 110, 0.65) 100%);
}
html.dark-mode .login-skyline-strip svg .bldg-fill {
  fill: #1e3a5f;
}
html.dark-mode .login-skyline-strip svg .bldg-stroke {
  stroke: #38bdf8;
}
html.dark-mode .login-skyline-strip svg .bldg-window {
  fill: #38bdf8;
  opacity: 0.35;
}
html.dark-mode .login-captcha-q {
  background: rgba(15, 23, 42, 0.7);
  border-color: #1e3a5f;
  color: #7dd3fc;
}
html.dark-mode .login-wrap {
  background: linear-gradient(180deg, #0f172a 0%, #132337 50%, #0c4a6e 100%);
}

.login-card .brand-lg {
  text-align: center;
  margin-bottom: 1.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-card .brand-lg h2 {
  margin: 0;
  font-weight: 700;
  color: var(--sm-primary-dark);
  font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem);
}
.login-card .brand-lg p {
  color: var(--sm-muted);
  font-size: var(--sm-fs-small);
  margin: 0.25rem 0 0;
}
.login-card .input-group-text {
  background: #f0f9ff !important;
  border-color: var(--sm-border);
  color: var(--sm-primary);
}
.login-card .form-control {
  border-color: var(--sm-border);
}
.login-card .btn-primary {
  font-weight: 600;
}
.login-card hr { display: none; }

/* Auth theme toggle */
.sm-theme-float {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top, 0px));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  z-index: 1050;
  max-width: min(calc(100vw - 1.5rem), 300px);
}
.sm-theme-float .sm-theme-toggle {
  background: #fff;
  border-color: var(--sm-border);
  box-shadow: var(--sm-shadow-md);
}
.sm-theme-float .sm-theme-btn {
  flex: 1;
  justify-content: center;
}
.sm-theme-float .sm-theme-btn span { display: inline; }
.sm-theme-float .sm-theme-btn.active { background: var(--sm-primary); }
@media (max-width: 420px) {
  .sm-theme-float .sm-theme-btn span { display: none; }
}

html.dark-mode .login-card .brand-lg h2 { color: #7dd3fc; }
html.dark-mode .login-card .brand-lg p,
html.dark-mode .login-card .text-muted,
html.dark-mode .login-card .form-label { color: #94a3b8 !important; }
html.dark-mode .login-card .input-group-text {
  background: #0b1220 !important;
  border-color: #1e3a5f;
  color: #7dd3fc;
}
html.dark-mode .login-card .form-control {
  background: #0b1220;
  border-color: #1e3a5f;
  color: #e0f2fe;
}
html.dark-mode .login-card .form-control::placeholder { color: #64748b; }
html.dark-mode .login-card .btn-outline-secondary {
  border-color: #1e3a5f;
  color: #94a3b8;
  background: #0b1220;
}
html.dark-mode .sm-theme-float .sm-theme-toggle {
  background: #132337;
  border-color: #1e3a5f;
}

/* Dashboard: building strip fills width */
.dash-sketch {
  border-radius: 12px;
  overflow: hidden;
  background: #e8e4dc;
  border: 1px solid #e7e2d8;
  max-height: 140px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dash-sketch img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  object-position: center;
  display: block;
  padding: 0;
  opacity: 0.95;
}
@media (max-width: 576px) {
  .dash-sketch { max-height: 100px; }
  .dash-sketch img { max-height: 100px; }
}

/* Mobile menu + touch + anti-glitch */
@media (max-width: 992px) {
  .sm-sidebar {
    padding-top: max(1.25rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  body.sm-nav-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    left: 0;
    right: 0;
  }
  body.sm-nav-open .sm-sidebar {
    overflow: hidden;
    touch-action: pan-y;
  }
  .sm-sidebar-inner {
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    justify-content: flex-start;
    gap: 0.45rem;
  }
  .sm-sidebar-menu-stack {
    flex: 0 1 auto;
    max-height: calc(100dvh - 8rem);
  }
  .sm-sidebar-nav-panel {
    flex: 0 1 auto;
    min-height: 0;
    max-height: calc(100dvh - 11rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .sm-menu-toggle {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }
  .sm-sidebar .nav-link {
    min-height: 44px;
  }
}

/* Generate Bills - responsive rate card (no cramped table scroll) */
.sm-rate-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: none;
}
.sm-rate-row {
  border: 1px solid var(--sm-border);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: var(--sm-bg, #f0f9ff);
}
.sm-rate-row .form-label { font-weight: 600; }
.sm-rate-card .btn { white-space: normal; }
html.dark-mode .sm-rate-row {
  background: rgba(15, 23, 42, .45);
  border-color: var(--sm-border);
}
@media (min-width: 768px) {
  .sm-rate-row .w-md-auto { width: auto !important; }
}

/* Cards / tables fill available width without horizontal page scroll */
.sm-main .card,
.sm-main .table-responsive,
.sm-main .row {
  max-width: 100%;
}
.sm-main img {
  max-width: 100%;
  height: auto;
}

/* Prevent double-tap zoom glitch on controls (Android Chrome) */
@media (hover: none) and (pointer: coarse) {
  .btn, .nav-link, .form-control, .form-select {
    touch-action: manipulation;
  }
}

/* ============================================================
   ALL PAGES - mobile / tablet / monitor (global)
   ============================================================ */

/* Monitor / desktop: readable content width, fill main column */
@media (min-width: 1200px) {
  .sm-main > .card,
  .sm-main > .row,
  .sm-main > .table-responsive,
  .sm-main > .mb-2,
  .sm-main > .mb-3,
  .sm-main > .d-flex.justify-content-between {
    max-width: 100%;
  }
}

@media (min-width: 1600px) {
  :root { --sm-pad-main: clamp(1.25rem, 1rem + 1vw, 2.25rem); }
}

/* Tablet (portrait + landscape) */
@media (min-width: 768px) and (max-width: 991.98px) {
  :root {
    --sm-pad-main: 1rem;
    --sm-sidebar-w: 220px;
  }
  .sm-main .row.g-3,
  .sm-main .row.g-2 {
    --bs-gutter-x: 0.85rem;
    --bs-gutter-y: 0.85rem;
  }
  .stat-card .value { font-size: 1.45rem; }
  .card.p-3 { padding: 1rem !important; }
  .table { font-size: 0.9rem; }
  .modal-dialog.modal-lg { max-width: min(720px, 94vw); }
}

/* Phone + small tablet: forms, filters, toolbars */
@media (max-width: 767.98px) {
  .sm-main h5,
  .sm-main > .mb-2 h5,
  .sm-main > .mb-3 h5 {
    font-size: 1.05rem;
    line-height: 1.3;
  }
  .sm-main .small.text-muted {
    font-size: var(--sm-fs-small);
    line-height: 1.45;
    font-weight: 500;
  }
  .sm-main .form-control,
  .sm-main .form-select {
    font-weight: 500;
    font-size: max(16px, 1rem);
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
  }

  /* Stack Bootstrap cols that are only col-md-* / col-lg-* */
  .sm-main .row > [class*="col-md-"],
  .sm-main .row > [class*="col-lg-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }
  /* Keep half-width when col-6 / col-sm-6 present */
  .sm-main .row > .col-6,
  .sm-main .row > .col-sm-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  .sm-main .row > .col-12,
  .sm-main .row > .col-sm-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Input groups: wrap test/save rows */
  .sm-main .input-group {
    flex-wrap: wrap;
    row-gap: 0.35rem;
  }
  .sm-main .input-group > .form-control,
  .sm-main .input-group > .form-select {
    flex: 1 1 8rem;
    min-width: 0;
  }
  .sm-main .input-group > .btn {
    flex: 0 0 auto;
  }

  /* Page action toolbars */
  .sm-main .btn-toolbar,
  .sm-main .btn-group {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .sm-main .btn-group > .btn {
    flex: 1 1 auto;
  }

  /* Filter / search bars */
  .sm-main .card .row.g-2 > [class*="col-"],
  .sm-main .card .row.g-3 > [class*="col-"],
  .owners-filter-bar .row > [class*="col-"],
  .filter-bar .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
  }

  /* Form switches: easier tap */
  .sm-main .form-check-input {
    min-width: 2.2em;
    min-height: 1.15em;
  }
  .sm-main .form-switch .form-check-input {
    width: 2.5em;
  }

  /* Badges / pills wrap */
  .sm-main .badge { white-space: normal; text-align: left; }

  /* Charts / canvases */
  .sm-main canvas {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Dropdown menus stay on screen */
  .dropdown-menu {
    max-width: min(100vw - 1.5rem, 22rem);
  }
}

/* Very small phones */
@media (max-width: 400px) {
  .sm-main .row > .col-6,
  .sm-main .row > .col-sm-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  .sm-topbar .user-chip span:not(.avatar) { max-width: 6.5rem; }
  .sm-main .btn-sm { font-size: 0.8rem; padding: 0.3rem 0.5rem; }
}

/* Landscape phones */
@media (max-height: 480px) and (orientation: landscape) {
  .sm-sidebar {
    height: 100dvh;
  }
  .login-wrap {
    align-items: flex-start;
    padding-top: 0.75rem;
  }
  .table-responsive.table-scroll-y {
    max-height: min(48vh, 320px);
  }
}

/* Print: hide chrome */
@media print {
  .sm-sidebar,
  .sm-menu-toggle,
  .sm-sidebar-backdrop,
  .sm-sidebar-edge,
  .sm-topbar .user-chip,
  .spinner-overlay { display: none !important; }
  .sm-app { display: block; }
  .sm-main { padding: 0; overflow: visible; }
}

/* ---- MyGate-inspired home (existing color tokens) ---- */
.mg-welcome {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  max-width: 100%;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.65rem;
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--sm-muted);
  background: var(--sm-surface);
  border: 1px solid var(--sm-border);
  border-left: 4px solid var(--sm-primary);
  border-radius: var(--sm-radius);
  box-shadow: var(--sm-shadow-sm);
}
.mg-welcome .mg-hello {
  font-size: inherit;
  font-weight: 700;
  margin: 0;
  color: var(--sm-primary-dark);
}
.mg-welcome .mg-sub {
  font-size: 0.75rem;
  margin: 0;
  font-weight: 400;
  color: inherit;
  opacity: 1;
}
.mg-welcome-sep {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--sm-border, #cbd5e1);
  flex-shrink: 0;
}
.mg-section-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--sm-muted);
  margin: 0 0 .45rem;
}

.mg-quick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: .5rem;
  margin-bottom: .75rem;
  width: 100%;
}
.mg-quick a,
.mg-quick button.mg-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  text-decoration: none;
  color: var(--sm-text);
  background: var(--sm-surface);
  border: 1px solid var(--sm-border);
  border-radius: 12px;
  padding: .55rem .35rem;
  min-height: 72px;
  transition: transform .15s, box-shadow .2s;
  position: relative;
  width: 100%;
  cursor: pointer;
  font: inherit;
}
.mg-quick a:hover,
.mg-quick button.mg-quick-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--sm-shadow-md);
  color: var(--sm-primary-dark);
  border-color: rgba(var(--sm-primary-rgb), .25);
}
.mg-quick .mg-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #e0f2fe 0%, #f0f9ff 100%);
  color: var(--sm-primary);
  font-size: 1rem;
  border: 1px solid rgba(2, 132, 199, 0.16);
  box-shadow: none;
}
.mg-quick .mg-lbl {
  font-size: .68rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.15;
}
.mg-quick .mg-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
  box-shadow: 0 0 0 2px var(--sm-surface);
}
html.dark-mode .mg-quick a,
html.dark-mode .mg-quick button.mg-quick-btn {
  background: #0f172a;
  border-color: #1e3a5f;
}
html.dark-mode .mg-quick .mg-ico {
  background: rgba(14, 165, 233, .2);
  color: var(--sm-primary-light);
}
html.dark-mode .mg-quick .mg-badge {
  box-shadow: 0 0 0 2px #0f172a;
}

.mg-updates {
  background: var(--sm-surface);
  border: 1px solid var(--sm-border);
  border-radius: 12px;
  padding: .65rem .85rem .75rem;
  margin-bottom: .75rem;
}
.mg-updates-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .65rem;
}
.sm-collapse-collapsed .sm-collapse-head {
  margin-bottom: 0 !important;
}
.mg-updates-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}
.mg-updates-toggle {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--sm-border);
  background: #fff;
  color: var(--sm-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}
.mg-updates-toggle:hover {
  border-color: var(--sm-primary-light);
  background: #f0f9ff;
}
html.dark-mode .mg-updates-toggle {
  background: #0f172a;
  border-color: #1e3a5f;
  color: var(--sm-primary-light);
}
.mg-updates-head h6 {
  margin: 0;
  font-size: .92rem;
  font-weight: 700;
}
.mg-update-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .7rem 0;
  border-top: 1px solid var(--sm-border);
  text-decoration: none;
  color: inherit;
}
.mg-update-item:first-of-type { border-top: 0; padding-top: .15rem; }
.mg-update-item:hover { color: var(--sm-primary-dark); }
.mg-update-ico {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e0f2fe;
  color: var(--sm-primary);
}
.mg-update-body { flex: 1 1 auto; min-width: 0; }
.mg-update-body .ttl { font-weight: 600; font-size: .88rem; margin: 0; }
.mg-update-body .sub { font-size: .75rem; color: var(--sm-muted); margin: .15rem 0 0; }
.mg-update-go {
  flex: 0 0 auto;
  font-size: .72rem;
  font-weight: 600;
  color: var(--sm-primary);
  white-space: nowrap;
  align-self: center;
}
.mg-more-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
  margin-bottom: 1rem;
}
.mg-more-tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .35rem;
  background: var(--sm-surface);
  border: 1px solid var(--sm-border);
  border-radius: 14px;
  padding: .55rem .35rem .45rem;
  position: relative;
}
.mg-on-dash {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.mg-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: #e0f2fe;
  color: var(--sm-primary-dark);
  border: 1px solid var(--sm-border);
  border-radius: 999px;
  padding: .2rem .35rem .2rem .55rem;
  font-size: .72rem;
  font-weight: 600;
}
.mg-chip i { font-size: .8rem; }
.mg-chip-x {
  border: 0;
  background: rgba(var(--sm-primary-rgb), .14);
  color: var(--sm-primary-dark);
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  line-height: 1;
  font-size: .9rem;
  padding: 0;
  cursor: pointer;
}
.mg-chip-x:hover { background: #e11d48; color: #fff; }
html.dark-mode .mg-chip {
  background: rgba(14, 165, 233, .2);
  color: var(--sm-primary-light);
}
html.dark-mode .mg-chip-x {
  background: rgba(14, 165, 233, .25);
  color: var(--sm-primary-light);
}
.mg-more-tile > a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  text-decoration: none;
  color: var(--sm-text);
  position: relative;
  padding-top: .15rem;
}
.mg-more-tile > a:hover { color: var(--sm-primary-dark); }
.mg-more-grid .mg-ico {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e0f2fe;
  color: var(--sm-primary);
}
.mg-more-grid .mg-lbl { font-size: .72rem; font-weight: 600; text-align: center; line-height: 1.2; }
.mg-more-grid .mg-badge {
  position: absolute;
  top: -2px;
  right: 8px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 .3rem;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
}
.mg-pin-btn {
  font-size: .68rem !important;
  padding: .15rem .35rem !important;
  border-radius: 8px !important;
  width: 100%;
}
.mg-edit-row {
  display: none;
}
html.dark-mode .mg-update-ico,
html.dark-mode .mg-more-grid .mg-ico {
  background: rgba(14, 165, 233, .2);
  color: var(--sm-primary-light);
}

.stat-card {
  border-radius: 16px;
}

.login-card {
  border-radius: 20px !important;
}
.login-card .form-control,
.login-card .input-group-text,
.login-card .btn {
  border-radius: 12px;
}
.login-card .input-group > :not(:first-child) {
  margin-left: -1px;
}
.login-card .btn-primary {
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: .01em;
}
.login-card #supportBox {
  border-radius: 12px !important;
}
.sm-auth-footer .sm-portal-footer-sub,
.login-card code,
.login-card .tech-url {
  display: none !important;
}

@media (max-width: 768px) {
  .mg-quick { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem; }
  .mg-quick a,
  .mg-quick button.mg-quick-btn { min-height: 64px; padding: .5rem .25rem; }
  .mg-quick .mg-lbl { font-size: .65rem; }
  .mg-more-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .mg-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mg-more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Integrations (HR-style tabs + form panes) ---- */
.int-wrap { width: 100%; max-width: 1100px; }
.int-status { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.int-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--sm-border);
  background: var(--sm-surface);
  box-shadow: var(--sm-shadow-sm);
}
.int-section-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; color: var(--sm-text); }
.int-sub { font-size: 0.85rem; color: var(--sm-muted); margin-bottom: 1rem; }
.int-tabs {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  position: relative;
  z-index: 3;
  border-bottom-color: var(--sm-border);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.int-tabs::-webkit-scrollbar { height: 4px; }
.int-tabs::-webkit-scrollbar-thumb { background: rgba(var(--sm-primary-rgb), 0.35); border-radius: 4px; }
.int-tabs .nav-item {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.int-tabs .nav-link {
  position: relative;
  z-index: 1;
  font-weight: 500;
  width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--sm-muted);
  border-radius: 8px 8px 0 0;
}
.int-tabs .nav-link i { margin-right: 0.35rem; }
.int-tabs .nav-link.active {
  color: var(--sm-primary-dark) !important;
  font-weight: 700;
  background: var(--sm-surface) !important;
  border-color: var(--sm-primary) var(--sm-border) var(--sm-surface) !important;
  z-index: 16;
  transform: scale(1.06) translateY(-4px);
  transform-origin: bottom center;
  box-shadow:
    inset 0 4px 0 var(--sm-primary),
    0 10px 26px rgba(var(--sm-primary-rgb), 0.28),
    0 2px 8px rgba(15, 23, 42, 0.06),
    0 0 0 1px rgba(var(--sm-primary-rgb), 0.2);
}
.int-pane {
  border: 1px solid var(--sm-border);
  border-top: 0;
  border-radius: 0 0 var(--sm-radius) var(--sm-radius);
  padding: 1rem;
  background: var(--sm-surface);
  box-shadow: var(--sm-shadow-sm);
}
/* Integrations: no nested scroll trap on Zoho UUID / notify tables (page scrolls) */
.int-pane .table-responsive,
.int-pane .int-flow-table-wrap,
#waZohoKeysPanel .table-responsive {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
}
#waZohoKeysPanel .table th,
#waZohoKeysPanel .table td {
  white-space: normal;
  vertical-align: middle;
}
#waZohoKeysPanel .zoho-key-input {
  min-width: 12rem;
  font-size: 0.75rem;
}
.int-scroll-box {
  display: block;
  width: 100%;
  max-height: none;
  overflow: visible;
  overscroll-behavior-y: auto;
}
.int-scroll-box.int-scroll-box--compact {
  max-height: min(52vh, 520px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
/* Owner notify main table: page scrolls; only horizontal pan if needed */
.int-flow-table-wrap {
  display: block;
  width: 100%;
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
}
.int-scroll-box > .table {
  margin-bottom: 0;
  width: max-content;
  min-width: 100%;
}
.int-scroll-box > #notifyFlowTable,
.int-scroll-box > #notifyPlanChart {
  width: 100%;
  table-layout: fixed;
}
#notifyFlowTable th:nth-child(4),
#notifyFlowTable td:nth-child(4) {
  width: 26%;
  max-width: 14rem;
}
#notifyFlowTable th.zoho-flow-key-col,
#notifyFlowTable td.zoho-flow-key-col {
  width: 28%;
  min-width: 0;
}
#notifyFlowTable .int-wa-preview-cell {
  max-width: 14rem;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
  font-size: 0.72rem;
  line-height: 1.35;
}
#notifyFlowTable .int-wa-preview-body {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 11rem;
  overflow-y: auto;
  margin-top: 0.25rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  background: var(--sm-bg, #f0f9ff);
  border: 1px solid var(--sm-border, #bae6fd);
}
#notifyFlowTable .int-wa-preview-toggle {
  font-size: 0.72rem;
}
#notifyFlowTable .int-wa-preview-open {
  font-size: 0.72rem;
  white-space: nowrap;
}
.int-wa-modal-preview {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(50vh, 360px);
  overflow: auto;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: var(--sm-bg, #f0f9ff);
  border: 1px solid var(--sm-border, #bae6fd);
}
#notifyFlowTable tbody tr {
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}
#notifyFlowTable tbody tr:hover {
  background-color: rgba(var(--sm-primary-rgb), 0.12) !important;
  box-shadow: inset 4px 0 0 rgba(var(--sm-primary-rgb), 0.55);
}
#notifyFlowTable tbody tr:focus-within {
  background-color: rgba(var(--sm-primary-rgb), 0.14) !important;
  box-shadow: inset 4px 0 0 var(--sm-primary);
}
#notifyFlowTable tbody tr.notify-row-marked,
#notifyFlowTable tbody tr:has(.notify-flow-email:checked),
#notifyFlowTable tbody tr:has(.notify-flow-wa:checked) {
  background-color: rgba(var(--sm-primary-rgb), 0.1);
  box-shadow: inset 5px 0 0 var(--sm-primary);
}
#notifyFlowTable tbody tr.notify-row-marked:hover,
#notifyFlowTable tbody tr:has(.notify-flow-email:checked):hover,
#notifyFlowTable tbody tr:has(.notify-flow-wa:checked):hover {
  background-color: rgba(var(--sm-primary-rgb), 0.18) !important;
  box-shadow: inset 6px 0 0 var(--sm-primary-dark);
}
#notifyFlowTable tbody tr.table-secondary:hover {
  background-color: rgba(var(--sm-primary-rgb), 0.06) !important;
}
.int-tabs .nav-link {
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.nav-tabs.nav-tabs-sm .nav-link {
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.nav-tabs.nav-tabs-sm .nav-link:hover:not(.active) {
  background: rgba(var(--sm-primary-rgb), 0.12) !important;
  color: var(--sm-primary-dark) !important;
  box-shadow: inset 0 -2px 0 rgba(var(--sm-primary-rgb), 0.4);
}
.nav-tabs.nav-tabs-sm .nav-link.active {
  color: var(--sm-primary-dark) !important;
  background: rgba(var(--sm-primary-rgb), 0.14) !important;
  box-shadow: inset 0 2px 0 var(--sm-primary), 0 0 0 1px rgba(var(--sm-primary-rgb), 0.2);
}
.int-tabs .nav-link:hover:not(.active) {
  color: var(--sm-primary-dark);
  background: var(--sm-surface) !important;
  border-color: var(--sm-primary) var(--sm-border) transparent !important;
  z-index: 14;
  transform: scale(1.08) translateY(-5px);
  transform-origin: bottom center;
  box-shadow:
    0 12px 30px rgba(var(--sm-primary-rgb), 0.32),
    0 3px 10px rgba(15, 23, 42, 0.1),
    inset 0 -4px 0 var(--sm-primary),
    0 0 0 1px rgba(var(--sm-primary-rgb), 0.2);
}
@media (hover: none) and (pointer: coarse) {
  .int-tabs .nav-link:hover:not(.active),
  .nav-tabs .nav-link:hover:not(.active) {
    transform: none;
    z-index: 1;
    box-shadow: none;
    background: transparent !important;
  }
  .nav-tabs .nav-link.active,
  .int-tabs .nav-link.active {
    z-index: 10;
    transform: none;
    background: rgba(var(--sm-primary-rgb), 0.12) !important;
    box-shadow: inset 0 3px 0 var(--sm-primary), 0 4px 12px rgba(var(--sm-primary-rgb), 0.12);
  }
}
.int-tabs .nav-link.active:hover {
  background: var(--sm-surface) !important;
  box-shadow:
    inset 0 3px 0 var(--sm-primary),
    0 -4px 18px rgba(var(--sm-primary-rgb), 0.22),
    0 0 0 1px rgba(var(--sm-primary-rgb), 0.16);
}
.int-tabs .nav-link:focus-visible {
  outline: none;
  box-shadow: inset 0 -2px 0 var(--sm-primary), 0 0 0 2px rgba(var(--sm-primary-rgb), 0.25);
}
.int-field-label { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.25rem; }
.int-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch; }
.int-actions .btn { min-height: 2.25rem; }
.int-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--sm-border);
  border-radius: var(--sm-radius);
  background: var(--sm-bg);
  min-height: 3rem;
}
.int-switch-row .form-check-input { width: 2.4em; height: 1.25em; margin-top: 0; cursor: pointer; }
@media (min-width: 576px) and (max-width: 991.98px) {
  .int-wrap { max-width: 100%; }
  .int-pane { padding: 1rem 1.1rem; }
  .int-actions .btn { flex: 1 1 auto; min-width: 8rem; }
}
@media (max-width: 991.98px) {
  .int-tab-content > .tab-pane.show.active {
    max-height: none;
    overflow-y: visible;
  }
  .int-scroll-box.int-scroll-box--compact { max-height: min(48vh, 420px); }
}
@media (max-width: 767.98px) {
  .int-wrap > .mb-2:first-child { display: none; }
  .int-status { margin-bottom: 0.65rem; gap: 0.45rem; }
  .int-pill { font-size: 0.8125rem; font-weight: 600; padding: 0.38rem 0.65rem; }
  .int-tabs {
    margin-bottom: 0.5rem;
    gap: 0.2rem;
    padding-bottom: 0.15rem;
  }
  .int-tabs .nav-item {
    flex: 0 0 auto;
    min-width: 0;
  }
  .int-tabs .nav-link {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    padding: 0.72rem 0.85rem;
    font-size: 0.9375rem;
    font-weight: 600;
  }
  .int-tabs .nav-link.active {
    background: rgba(var(--sm-primary-rgb), 0.14) !important;
    border-color: var(--sm-primary) var(--sm-border) var(--sm-surface) !important;
    box-shadow:
      inset 0 3px 0 var(--sm-primary),
      0 0 0 1px rgba(var(--sm-primary-rgb), 0.2);
  }
  .int-pane {
    padding: 1.15rem 1rem 1.25rem;
    border-radius: 0 0 12px 12px;
  }
  .int-sub { margin-bottom: 0.85rem; font-size: 0.875rem; line-height: 1.5; }
  .int-scroll-box.int-scroll-box--compact { max-height: min(52vh, 440px); }
  #notifyFlowTable { table-layout: auto; }
  #notifyFlowTable th,
  #notifyFlowTable td {
    white-space: normal;
    padding: 0.65rem 0.55rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.45;
  }
  #notifyFlowTable th { font-weight: 700; font-size: 0.8125rem; }
  #notifyFlowTable .form-check-input {
    width: 1.45em;
    height: 1.45em;
    margin: 0 auto;
    border-width: 2px;
  }
  #notifyFlowTable tbody tr:has(.notify-flow-email:checked),
  #notifyFlowTable tbody tr:has(.notify-flow-wa:checked) {
    background-color: rgba(var(--sm-primary-rgb), 0.11) !important;
    box-shadow: inset 5px 0 0 var(--sm-primary);
  }
  #notifyFlowTable .int-wa-preview-open {
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.4rem 0.6rem;
  }
  .int-flow-table-wrap {
    padding: 0.15rem;
    border-radius: 10px;
  }
  .sm-main .table > :not(caption) > * > * {
    padding: 0.55rem 0.5rem;
  }
}
@media (max-width: 575.98px) {
  .int-wrap {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
  }
  .int-pane {
    padding: 1.1rem 0.95rem 1.2rem;
  }
  .int-section-title { font-size: 1.08rem; font-weight: 700; }
  .int-sub { font-size: 0.9375rem; font-weight: 500; line-height: 1.55; }
  .int-tabs .nav-link { font-size: 0.9rem; font-weight: 600; padding: 0.75rem 0.7rem; }
  .int-tabs .nav-link i { margin-right: 0.25rem; }
  .int-actions { flex-direction: column; }
  .int-actions .btn,
  .int-actions .input-group { width: 100%; }
  .int-actions .input-group .btn { white-space: nowrap; }
  .int-status { gap: 0.4rem; }
  .int-pill { font-size: 0.75rem; padding: 0.3rem 0.65rem; }
}
@media (min-width: 1400px) {
  .int-wrap { max-width: 1180px; }
  .int-pane { padding: 1.25rem 1.5rem; }
}
html.dark-mode .int-pane { background: var(--sm-surface); border-color: var(--sm-border); }
html.dark-mode .int-pill { background: var(--sm-surface); border-color: var(--sm-border); }
html.dark-mode .int-switch-row { background: rgba(255, 255, 255, 0.04); }

/* Login: no bottom copyright strip (footer injected by ensurePortalFooter) */
body.login-page .sm-auth-footer {
  display: none !important;
}

/* ---- Login: split hero + form (desktop / mobile WebView) ---- */
.login-wrap.login-pro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 36vw, 440px);
  grid-template-rows: minmax(100vh, 1fr);
  grid-template-rows: minmax(100dvh, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  gap: 0;
  align-items: stretch;
  background: #e0f2fe;
}
.login-pro-hero {
  position: relative;
  display: block;
  padding: 0;
  text-align: left;
  background: #bae6fd url("../img/login-hero.jpg") center / cover no-repeat;
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  align-self: stretch;
  overflow: hidden;
}
.login-pro-hero-brand {
  position: absolute;
  z-index: 3;
  top: max(1.1rem, env(safe-area-inset-top));
  left: max(1.1rem, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  width: auto;
  max-width: min(16rem, 42vw);
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
}
.login-pro-hero-brand .sm-animated-logo {
  display: flex !important;
  justify-content: flex-start;
  max-width: 100%;
  pointer-events: auto;
}
.login-pro-hero-brand .sm-logo-box {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}
.login-pro-hero-brand .sm-logo-orbit--lg {
  width: clamp(72px, 7vw, 96px) !important;
  height: clamp(72px, 7vw, 96px) !important;
}
.login-pro-hero-brand .sm-logo-text { text-align: left; }
.login-pro-hero-brand .sm-logo-title {
  font-size: clamp(0.88rem, 1.4vw, 1.05rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #0f172a;
  line-height: 1.2;
  text-shadow: none;
}
.login-pro-hero-brand .sm-logo-sub {
  font-size: clamp(0.55rem, 1vw, 0.65rem);
  color: #475569;
  font-weight: 600;
  text-shadow: none;
}
.login-pro-mobile-brand {
  display: none;
  position: absolute;
  z-index: 3;
  top: max(0.85rem, env(safe-area-inset-top));
  left: max(0.85rem, env(safe-area-inset-left));
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.15;
  color: #f8fafc;
  text-shadow: 0 2px 14px rgba(15, 23, 42, 0.75);
}
.login-pro-mobile-brand span {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(226, 232, 240, 0.92);
}
.login-pro-hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.login-pro-hero-media picture,
.login-pro-hero-media img {
  display: block;
  width: 100%;
  height: 100%;
}
.login-pro-hero-media {
  background: #bae6fd url("../img/login-hero.jpg") center / cover no-repeat;
}
.login-pro-hero-media img {
  object-fit: cover;
  object-position: 52% 38%;
  min-height: 100%;
}
.login-pro-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.48) 0%, rgba(255, 255, 255, 0.12) 36%, transparent 62%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.15) 0%, transparent 45%);
  pointer-events: none;
}
.login-pro-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse 90% 75% at 68% 50%, transparent 55%, rgba(14, 165, 233, 0.06) 100%);
  pointer-events: none;
}
.login-pro-main {
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #fff;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  align-self: stretch;
  padding: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-left: 1px solid #e2e8f0;
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.06);
}
.login-pro-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 420px;
  min-height: min(100%, 100dvh);
  margin: 0 auto;
  padding:
    clamp(1.75rem, 4vh, 2.75rem)
    max(clamp(1.35rem, 4vw, 2rem), env(safe-area-inset-right))
    max(1.25rem, env(safe-area-inset-bottom))
    max(clamp(1.35rem, 4vw, 2rem), env(safe-area-inset-left));
  box-sizing: border-box;
}
.login-wrap.login-pro .login-field-pro {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-wrap.login-pro .login-field-pro:focus-within {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
  background: #fff;
}
.login-wrap.login-pro .login-field-pro-input {
  padding: 0.72rem 2.65rem 0.72rem 0.85rem;
  font-size: max(16px, 1rem);
  border-radius: 10px;
}
.login-wrap.login-pro .login-field-pro-icon,
.login-wrap.login-pro .login-field-pro-icon-btn {
  right: 0.65rem;
}
.login-wrap.login-pro .login-pro-captcha-row .form-control,
.login-wrap.login-pro .login-pro-captcha-row .login-captcha-q,
.login-wrap.login-pro .login-pro-captcha-row #captchaRefresh {
  min-height: 44px;
}
.login-wrap.login-pro .login-pro-captcha-row .form-control {
  padding: 0.5rem 0.75rem;
  font-size: max(16px, 0.95rem);
  border-radius: 8px;
}
.login-wrap.login-pro .login-pro-submit {
  min-height: 48px;
  border-radius: 8px;
}
.login-wrap.login-pro .login-card-pro .alert {
  border-radius: 8px;
}
.login-pro-panel-foot {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.35rem;
  width: 100%;
}
.login-pro-panel-foot .login-owner-note {
  margin-top: 0;
  line-height: 1.45;
}
.login-pro-panel-foot .login-support {
  margin-top: 0;
  width: 100%;
}
.login-pro-captcha-row {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}
.login-pro-captcha-row .login-captcha-q {
  min-width: 0;
  font-size: clamp(0.82rem, 2.5vw, 0.95rem);
  letter-spacing: 0.12em;
}
.login-card-pro {
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  background: transparent !important;
  max-width: none !important;
}
.brand-lg-pro h2 {
  font-size: clamp(1.25rem, 2.8vw, 1.5rem);
  font-weight: 700;
  color: #0c4a6e;
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}
.brand-lg-pro p {
  color: #64748b;
  font-size: 0.92rem;
  margin-bottom: 1.65rem;
  line-height: 1.45;
}
.login-field-pro {
  position: relative;
  border-bottom: 1px solid #cbd5e1;
  transition: border-color 0.15s ease;
}
.login-field-pro:focus-within { border-bottom-color: #0284c7; }
.login-field-pro-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 0.65rem 2.25rem 0.65rem 0;
  font-size: 1rem;
  color: #0f172a;
  box-sizing: border-box;
}
.login-field-pro-input::placeholder { color: #94a3b8; }
.login-field-pro-icon {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 1.1rem;
  pointer-events: none;
}
.login-field-pro-icon-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #64748b;
  padding: 0.25rem;
  line-height: 1;
}
.login-field-pro-icon-btn:hover { color: #0284c7; }
.login-pro-link {
  color: #64748b;
  text-decoration: none;
}
.login-pro-link:hover { color: #0284c7; text-decoration: underline; }
.login-pro-submit {
  background: #1e88e5;
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.login-pro-submit:hover,
.login-pro-submit:focus {
  background: #1565c0;
  color: #fff;
}
.login-pro-submit:disabled { opacity: 0.7; }
.login-pro-apk {
  margin-top: 0;
  padding: 0 !important;
  border: none !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  height: auto !important;
  min-height: 0;
}
.login-pro-apk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid #bae6fd;
  background: #f8fafc;
  color: #0369a1 !important;
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.25;
  text-decoration: none !important;
  text-align: center;
  box-shadow: none;
}
.login-pro-apk-btn:hover,
.login-pro-apk-btn:focus {
  background: #e0f2fe;
  color: #0c4a6e !important;
  border-color: #38bdf8;
}
html.dark-mode .login-wrap.login-pro {
  background: linear-gradient(165deg, #0f172a 0%, #132337 45%, #0c4a6e 100%);
}
html.dark-mode .login-pro-main {
  background: linear-gradient(180deg, #132337 0%, #0f172a 100%);
  border-left-color: rgba(30, 58, 95, 0.65);
  box-shadow: -10px 0 36px rgba(0, 0, 0, 0.35);
}
html.dark-mode .login-pro-hero::before {
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.72) 0%, rgba(15, 23, 42, 0.38) 34%, transparent 58%),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.5) 0%, transparent 42%);
}
html.dark-mode .login-pro-hero::after {
  background: radial-gradient(ellipse 88% 72% at 66% 48%, transparent 52%, rgba(56, 189, 248, 0.12) 100%);
}
html.dark-mode .brand-lg-pro h2 { color: #7dd3fc; }
html.dark-mode .brand-lg-pro p { color: #94a3b8; }
html.dark-mode .login-wrap.login-pro .login-field-pro {
  border-color: #1e3a5f;
  background: #0b1220;
}
html.dark-mode .login-wrap.login-pro .login-field-pro:focus-within {
  border-color: #0284c7;
  background: #0f172a;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.22);
}
html.dark-mode .login-wrap.login-pro .login-field-pro-input {
  color: #e2e8f0;
  background: transparent;
}
html.dark-mode .login-wrap.login-pro .login-field-pro-input::placeholder { color: #64748b; }
html.dark-mode .login-wrap.login-pro .login-field-pro-icon,
html.dark-mode .login-wrap.login-pro .login-field-pro-icon-btn { color: #7dd3fc; }
html.dark-mode .login-wrap.login-pro .login-pro-captcha-row .form-control {
  background: #0b1220;
  border-color: #1e3a5f;
  color: #e2e8f0;
}
html.dark-mode .login-wrap.login-pro .login-pro-captcha-row .btn-outline-secondary {
  background: #0b1220;
  border-color: #1e3a5f;
  color: #94a3b8;
}
html.dark-mode .login-pro-link { color: #38bdf8; }
html.dark-mode .login-pro-apk-btn {
  background: rgba(11, 18, 32, 0.85);
  border-color: #1e3a5f;
  color: #7dd3fc !important;
}
html.dark-mode .login-pro-apk-btn:hover,
html.dark-mode .login-pro-apk-btn:focus {
  background: rgba(30, 58, 95, 0.9);
  border-color: #0284c7;
  color: #bae6fd !important;
}
html.dark-mode .login-pro-panel-foot .login-owner-note { color: #94a3b8 !important; }
html.dark-mode .login-pro-hero-brand .sm-logo-box {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(100, 116, 139, 0.45);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
html.dark-mode .login-pro-hero-brand .sm-logo-title {
  color: #f1f5f9;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
}
html.dark-mode .login-pro-hero-brand .sm-logo-sub {
  color: #94a3b8;
  text-shadow: none;
}

@media (min-width: 1024px) {
  .login-pro-hero-media img { object-position: 50% 36%; }
  .login-pro-mobile-brand { display: none !important; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .login-wrap.login-pro {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 42vw);
  }
  .login-pro-hero-brand { display: none !important; }
  .login-pro-mobile-brand { display: block; }
  .login-pro-hero-media img { object-position: 48% 34%; }
  .login-pro-panel { max-width: 100%; }
}
@media (max-width: 767px) {
  .login-wrap.login-pro {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100dvh;
    background: #fff;
  }
  html.dark-mode .login-wrap.login-pro {
    background: #0f172a;
  }
  html.dark-mode .login-pro-main {
    background: linear-gradient(180deg, #132337 0%, #0f172a 100%);
    margin-top: -8px;
  }
  .login-pro-hero {
    min-height: clamp(108px, 20vh, 150px);
    height: auto;
    flex-shrink: 0;
  }
  .login-pro-main {
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    border-left: none;
    box-shadow: none;
    border-radius: 14px 14px 0 0;
    margin-top: -8px;
  }
  .login-pro-hero-brand { display: none !important; }
  .login-pro-mobile-brand {
    display: block;
    font-size: 0.92rem;
  }
  .login-pro-hero-media img { object-position: 50% 28%; }
  .login-pro-panel {
    justify-content: flex-start;
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-height: 0;
    padding-top: 0.75rem;
    padding-left: max(1rem, calc(env(safe-area-inset-left) + 0.45rem));
    padding-right: max(1rem, calc(env(safe-area-inset-right) + 0.45rem));
    padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
  }
  .login-wrap.login-pro .brand-lg-pro h2 { font-size: 1.15rem; margin-bottom: 0.2rem; }
  .login-wrap.login-pro .brand-lg-pro p { margin-bottom: 1rem; font-size: 0.85rem; }
  .login-wrap.login-pro .login-field-pro { margin-bottom: 0.85rem !important; }
  .login-wrap.login-pro .login-field-pro.mb-2 { margin-bottom: 0.5rem !important; }
  .login-wrap.login-pro .login-pro-captcha-wrap { margin-bottom: 0.85rem !important; }
  .login-wrap.login-pro .login-field-pro-input {
    padding-left: 0.85rem;
    padding-right: 2.65rem;
    padding-top: 0.62rem;
    padding-bottom: 0.62rem;
  }
  .login-pro-panel-foot {
    margin-top: 0.75rem;
    gap: 0.55rem;
  }
  .login-wrap.login-pro .sm-auth-footer {
    margin-top: 0.35rem;
    padding-bottom: max(0.25rem, env(safe-area-inset-bottom));
  }
}
@media (max-width: 640px) {
  .login-pro-panel {
    padding-left: max(0.85rem, calc(env(safe-area-inset-left) + 0.35rem));
    padding-right: max(0.85rem, calc(env(safe-area-inset-right) + 0.35rem));
  }
  .login-pro-panel-foot .login-support {
    padding: 0.65rem 0.75rem;
    font-size: 0.78rem;
  }
  .login-pro-captcha-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "q refresh"
      "ans ans";
    gap: 0.5rem;
  }
  .login-pro-captcha-row .login-captcha-q { grid-area: q; }
  .login-pro-captcha-row #captchaRefresh { grid-area: refresh; }
  .login-pro-captcha-row #captchaAnswer { grid-area: ans; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .login-pro-panel {
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
  }
}
@media (min-width: 1280px) {
  .login-pro-hero-media img { object-position: 50% 35%; }
  .login-wrap.login-pro {
    grid-template-columns: minmax(0, 1fr) minmax(420px, 480px);
  }
  .login-pro-panel {
    max-width: 440px;
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
  }
}
@media (min-width: 1600px) {
  .login-wrap.login-pro {
    grid-template-columns: minmax(0, 1fr) minmax(440px, 520px);
  }
  .login-pro-panel { max-width: 460px; }
}

/* ===== All screens: fluid layout (login + portal + admin) ===== */
.sm-app,
.login-wrap.login-pro {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.sm-main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-left: max(var(--sm-pad-main), env(safe-area-inset-left, 0px));
  padding-right: max(var(--sm-pad-main), env(safe-area-inset-right, 0px));
}
.sm-main > .int-wrap,
.sm-main > .card,
.sm-main > .row,
.sm-main .table-responsive,
.sm-main .tab-content {
  max-width: 100%;
  min-width: 0;
}
.sm-main img:not([width]),
.sm-main canvas,
.sm-main video,
.sm-main iframe {
  max-width: 100%;
}
.int-wrap {
  width: 100%;
  max-width: min(100%, 1180px);
  margin-left: auto;
  margin-right: auto;
}
.login-pro-panel {
  width: 100%;
  max-width: min(100%, 420px);
}
@media (min-width: 576px) and (max-width: 767.98px) {
  .login-wrap.login-pro {
    grid-template-columns: minmax(0, 1fr) clamp(260px, 48vw, 360px);
  }
}
@media (min-width: 768px) and (max-width: 991.98px) {
  .login-wrap.login-pro {
    grid-template-columns: minmax(0, 1fr) clamp(280px, 44vw, 400px);
  }
  :root { --sm-pad-main: clamp(1rem, 1.5vw, 1.25rem); }
  .int-tabs .nav-link { font-size: 0.9375rem; padding-left: 0.65rem; padding-right: 0.65rem; }
}
@media (min-width: 992px) and (max-width: 1279.98px) {
  :root { --sm-pad-main: clamp(0.85rem, 1.1vw, 1.5rem); }
  .login-wrap.login-pro {
    grid-template-columns: minmax(0, 1fr) clamp(320px, 38vw, 420px);
  }
}
@media (min-width: 1280px) and (max-width: 1599.98px) {
  .int-wrap { max-width: min(100%, 1100px); }
}
@media (min-width: 1600px) {
  .int-wrap { max-width: min(100%, 1240px); }
  .sm-main > .card.p-3,
  .sm-main > .int-wrap {
    margin-left: auto;
    margin-right: auto;
  }
}
@media (max-width: 575.98px) {
  .table-responsive.table-scroll-y {
    max-height: min(58dvh, 520px);
  }
  .sm-topbar-left .sm-page-title {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }
}

/* ===== All inside pages: readable weight + comfortable gutters ===== */
.sm-main,
.sm-main .card,
.int-pane,
.modal-body {
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}
.sm-main p,
.sm-main li,
.sm-main td,
.sm-main .form-control,
.sm-main .form-select {
  font-weight: 500;
}
.sm-main .fw-semibold,
.table .fw-semibold,
label,
.form-label {
  font-weight: 600;
}
.sm-main h1, .sm-main h2, .sm-main h3,
.sm-main h4, .sm-main h5, .sm-main h6,
.int-section-title {
  font-weight: 700;
}
.form-control,
.form-select {
  font-weight: 500;
  font-size: max(16px, 1rem);
  line-height: 1.45;
}
@media (max-width: 991.98px) {
  .sm-main {
    padding-top: max(0.85rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(1.15rem, env(safe-area-inset-bottom, 0px));
  }
  .sm-main > .card,
  .sm-main .card.shadow-sm,
  .sm-main .card.border-0 {
    border-radius: 12px;
  }
  .sm-main .card > .card-body,
  .sm-main .card.p-3,
  .sm-main .card.p-2 {
    padding: 1.1rem 1rem !important;
  }
  .nav-tabs.sm-page-tabs {
    gap: 0.25rem;
    margin-bottom: 1rem !important;
  }
  .nav-tabs.sm-page-tabs .nav-link {
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.65rem 0.9rem !important;
    min-height: 2.75rem;
  }
  .nav-tabs.sm-page-tabs .nav-link.active {
    background: rgba(var(--sm-primary-rgb), 0.14) !important;
    box-shadow: inset 0 3px 0 var(--sm-primary), 0 0 0 1px rgba(var(--sm-primary-rgb), 0.18);
  }
  .sm-sub-tabs-bar .nav-link {
    font-weight: 600;
    font-size: 0.875rem;
  }
  .alert {
    font-weight: 500;
    line-height: 1.5;
    padding: 0.75rem 0.95rem;
  }
}
