/* =============================================
   SHIMLA 24x7 WATER SUPPLY - DPR MANAGEMENT SYSTEM
   Base Styles | Login | Layout | Responsive
   ============================================= */

/* =============================================
   DESIGN TOKENS & CSS VARIABLES
   ============================================= */
:root {
  /* Shimla Water Primary Palette */
  --teal-50: #E3F1EE;
  --teal-100: #B8DDD6;
  --teal-200: #8DC9BE;
  --teal-300: #62B5A6;
  --teal-400: #3AA18E;
  --teal-500: #0E6B66;
  --teal-600: #0A5A55;
  --teal-700: #0A4F4B;
  --teal-800: #053937;
  --teal-900: #032928;

  /* Sky Accent */
  --sky-400: #2E7DA6;
  --sky-500: #256E94;
  --sky-600: #1C5F82;

  /* Semantic Colors */
  --danger-400: #E07A65;
  --danger-500: #B5482F;
  --danger-600: #8F3A26;
  --warning-400: #E0A05A;
  --warning-500: #C97A1F;
  --success-400: #5CAF6B;
  --success-500: #427A4C;
  --info-400: #5A9BBF;
  --info-500: #2E7DA6;

  /* Dark Theme (Login) */
  --bg-primary: #081413;
  --bg-secondary: #0C1E1C;
  --bg-tertiary: #0F2926;
  --bg-elevated: #153632;
  --surface-primary: rgba(255,255,255,0.04);
  --surface-secondary: rgba(255,255,255,0.07);
  --surface-tertiary: rgba(255,255,255,0.1);
  --border-primary: rgba(255,255,255,0.08);
  --border-secondary: rgba(255,255,255,0.14);
  --text-primary: #E8F0EE;
  --text-secondary: #8AA09D;
  --text-tertiary: #5B6C6B;
  --text-muted: #3D4A49;

  /* App Theme (Light - Shimla Water branded) */
  --app-bg: #EEF3F1;
  --app-surface: #FFFFFF;
  --app-ink: #142625;
  --app-muted: #5B6C6B;
  --app-muted-2: #8AA09D;
  --app-line: #DCE6E2;
  --app-teal: #0E6B66;
  --app-teal-dark: #0A4F4B;
  --app-teal-light: #E3F1EE;
  --app-sky: #2E7DA6;
  --app-sky-light: #E6EFF5;
  --app-slate: #5C6770;
  --app-slate-light: #EAEDEF;
  --app-amber: #C97A1F;
  --app-amber-light: #FBEFDE;
  --app-moss: #427A4C;
  --app-moss-light: #E7F1E8;
  --app-rose: #B5482F;
  --app-rose-light: #FBEAE5;

  /* Layout */
  --topbar-height: 64px;
  --bottom-nav-height: 64px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.6);
  --glow-teal: 0 0 20px rgba(14,107,102,0.25);
  --app-shadow: 0 1px 2px rgba(15,35,33,0.06), 0 6px 16px -8px rgba(15,35,33,0.10);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Mono', Consolas, monospace;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4,0,0.2,1);
  --transition-base: 250ms cubic-bezier(0.4,0,0.2,1);

  /* Z-index */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 500;
  --z-toast: 900;
  --z-loading: 1000;
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
}

button, a, input, select, textarea {
  touch-action: manipulation;
  font-family: inherit;
  font-size: 16px;
  color: inherit;
}

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--teal-500);
  outline-offset: 2px;
}

::selection {
  background: var(--teal-500);
  color: white;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-secondary); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* =============================================
   LOADING SCREEN
   ============================================= */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-loading);
  gap: var(--space-5);
}

.loader-logo {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-500));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
  animation: pulse-scale 1.8s ease-in-out infinite;
  box-shadow: var(--glow-teal);
}

@keyframes pulse-scale {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.85; }
}

.loader-bar {
  width: 180px;
  height: 3px;
  background: var(--border-primary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.loader-bar-fill {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, var(--teal-500), var(--sky-400));
  border-radius: var(--radius-full);
  animation: loader-slide 1.5s ease-in-out infinite;
}

@keyframes loader-slide {
  0% { transform: translateX(-150%); }
  50% { transform: translateX(150%); }
  100% { transform: translateX(-150%); }
}

.loader-text { text-align: center; }
.loader-text h1 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--space-1);
  color: var(--text-primary);
}
.loader-text p {
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Connection Status Badge */
.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: all var(--transition-fast);
}
.connection-badge.online {
  background: rgba(66,122,76,0.2);
  color: var(--success-400);
}
.connection-badge.offline {
  background: rgba(181,72,47,0.2);
  color: var(--danger-400);
}
.connection-badge.reconnecting {
  background: rgba(201,122,31,0.2);
  color: var(--warning-400);
  animation: pulse-scale 1.2s ease-in-out infinite;
}

/* =============================================
   LOGIN SCREEN
   ============================================= */
#login-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 100;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 30%, rgba(14,107,102,0.2) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 80% 70%, rgba(46,125,166,0.08) 0%, transparent 50%);
  pointer-events: none;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(14,107,102,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14,107,102,0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

.login-wrap {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  gap: var(--space-5);
}

.login-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.4s ease;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-8);
  gap: var(--space-3);
}

.login-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-500));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  box-shadow: var(--glow-teal);
}

.login-brand h1 {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
}
.login-brand p {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-form { display: flex; flex-direction: column; gap: var(--space-5); }

.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.input-wrapper { position: relative; }

.form-input {
  width: 100%;
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  padding-left: 42px;
  color: var(--text-primary);
  font-size: 15px;
  transition: all var(--transition-fast);
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--teal-500);
  background: var(--surface-secondary);
  box-shadow: 0 0 0 3px rgba(14,107,102,0.15);
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 16px;
  pointer-events: none;
}

.input-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 15px;
  cursor: pointer;
  padding: var(--space-1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--teal-700), var(--teal-500));
  color: white;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(14,107,102,0.4);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-secondary);
  color: var(--text-secondary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border-color: var(--text-tertiary);
}

.btn-danger {
  background: rgba(181,72,47,0.15);
  border-color: rgba(181,72,47,0.3);
  color: var(--danger-400);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(181,72,47,0.25);
  border-color: var(--danger-500);
}

.btn-info {
  background: rgba(46,125,166,0.15);
  border-color: rgba(46,125,166,0.3);
  color: var(--info-400);
}
.btn-info:hover:not(:disabled) {
  background: rgba(46,125,166,0.25);
  border-color: var(--info-500);
}

.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }

.login-error {
  display: none;
  align-items: center;
  gap: var(--space-2);
  background: rgba(181,72,47,0.1);
  border: 1px solid rgba(181,72,47,0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--danger-400);
}
.login-error.show { display: flex; }

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-tertiary);
  font-size: 12px;
  margin: var(--space-2) 0;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-primary);
}

.login-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-5);
}

/* =============================================
   ENGINEER SELECTION SCREEN
   ============================================= */
#eng-select-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 90;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.eng-select-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: var(--space-6) var(--space-4);
}

.eng-select-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 800px;
  box-shadow: var(--shadow-lg);
}

.eng-select-header { text-align: center; margin-bottom: var(--space-6); }
.eng-select-header .icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-500));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  margin: 0 auto var(--space-4);
  box-shadow: var(--glow-teal);
}
.eng-select-header h2 { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: var(--space-1); }
.eng-select-header p { font-size: 13px; color: var(--text-tertiary); }

.eng-select-search { margin-bottom: var(--space-6); }
.eng-select-search .search-wrapper { position: relative; max-width: 100%; }
.eng-select-search input {
  width: 100%;
  padding: 14px 14px 14px 48px;
  font-size: 16px;
  background: var(--surface-primary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  -webkit-appearance: none;
}
.eng-select-search input:focus {
  border-color: var(--teal-500);
  background: var(--surface-secondary);
  box-shadow: 0 0 0 3px rgba(14,107,102,0.1);
  outline: none;
}
.eng-select-search i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 16px;
}

.eng-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
  max-height: 60vh;
  overflow-y: auto;
  padding-right: var(--space-2);
}

.eng-select-item {
  background: var(--surface-primary);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.eng-select-item:hover {
  border-color: var(--teal-500);
  background: var(--surface-secondary);
  transform: translateY(-2px);
}
.eng-select-item .esi-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--teal-700), var(--teal-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: white;
  margin: 0 auto var(--space-3);
}
.eng-select-item .esi-name { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.eng-select-item .esi-id { font-size: 12px; color: var(--text-tertiary); font-family: var(--font-mono); }
.eng-select-item .esi-status { margin-top: 10px; }

.eng-select-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-8);
  color: var(--text-tertiary);
}

.eng-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-tertiary);
}
.eng-loading i { font-size: 24px; margin-bottom: 12px; display: block; }

.eng-select-back { text-align: center; margin-top: 24px; }

/* =============================================
   ENGINEER PASSWORD MODAL
   ============================================= */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-4);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  width: 100%;
  max-width: 420px;
  margin-top: 15vh;
  animation: modal-in 0.25s ease;
  box-shadow: var(--shadow-xl);
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--danger-500); color: white; border-color: var(--danger-500); }

.eng-password-info { text-align: center; margin-bottom: var(--space-5); }
.eng-password-info .esi-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--teal-700), var(--teal-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: white;
  margin: 0 auto var(--space-3);
  box-shadow: var(--glow-teal);
}
.eng-password-info .eng-name { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.eng-password-info .eng-id { font-size: 13px; color: var(--text-tertiary); font-family: var(--font-mono); }

.password-input-wrapper { position: relative; }
.password-input-wrapper input {
  text-align: center;
  font-size: 24px;
  letter-spacing: 8px;
  padding: 16px;
  font-family: var(--font-mono);
  width: 100%;
  background: var(--surface-primary);
  border: 1.5px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  -webkit-appearance: none;
}
.password-input-wrapper input:focus {
  border-color: var(--teal-500);
  outline: none;
  box-shadow: 0 0 0 3px rgba(14,107,102,0.1);
}

.form-hint {
  text-align: center;
  margin-top: var(--space-2);
  color: var(--text-tertiary);
  font-size: 12px;
}

.password-error {
  color: var(--danger-400);
  font-size: 13px;
  text-align: center;
  margin-top: var(--space-2);
  display: none;
}
.password-error.show { display: block; }

.modal-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-primary);
}

/* =============================================
   MAIN APP SHELL
   ============================================= */
#app {
  display: none;
  background: var(--app-bg);
  color: var(--app-ink);
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: linear-gradient(135deg, var(--app-teal-dark), var(--app-teal) 70%);
  color: #fff;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--app-line);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.topbar-brand .eyebrow {
  font-size: 11.5px;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: rgba(255,255,255,.72);
  font-weight: 600;
  margin: 0 0 4px;
}
.topbar-brand h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-brand .sub { margin: 4px 0 0; font-size: 12.5px; color: rgba(255,255,255,.78); }

.topbar-user { text-align: right; flex: none; }
.topbar-user .who { margin: 0 0 8px; font-size: 12px; color: rgba(255,255,255,.85); }
.role-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,.18);
  color: #fff;
  margin-left: 6px;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* Tabs */
nav.tabs {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--app-bg);
  border-bottom: 1px solid var(--app-line);
  padding-top: 8px;
}
nav.tabs .inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
nav.tabs button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 11px 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--app-muted);
  border-bottom: 3px solid transparent;
  transition: color .15s;
  font-family: var(--font-sans);
  cursor: pointer;
  min-width: 100px;
}
nav.tabs button i { font-size: 14px; }
nav.tabs button.active { color: var(--app-teal-dark); border-bottom-color: var(--app-teal); }
nav.tabs button:hover { color: var(--app-teal-dark); }

/* App content */
.app-content { max-width: 1100px; margin: 0 auto; padding: 18px 16px 64px; }

.view { display: none; animation: fade-in 0.25s ease; }
.view.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* App Footer */
.app-footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--app-muted-2);
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--app-line);
}

/* =============================================
   CARDS (Shimla Water)
   ============================================= */
.sw-card {
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 12px;
  box-shadow: var(--app-shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.sw-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-left: 4px solid var(--accent, var(--app-teal));
  background: var(--accent-light, var(--app-teal-light));
}
.sw-card-head .ic {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-surface);
  color: var(--accent, var(--app-teal));
  flex: none;
}
.sw-card-head .ic i { font-size: 13px; }
.sw-card-head h2 { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--app-ink); }
.sw-card-head .hint { margin: 0; font-size: 11.5px; color: var(--app-muted); }
.sw-card-body { padding: 16px; }

/* =============================================
   BUTTONS (App)
   ============================================= */
.sw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  border-radius: 9px;
  border: 1.5px solid transparent;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-sans);
  transition: filter .15s, background .15s;
  cursor: pointer;
  white-space: nowrap;
}
.sw-btn-primary { background: var(--app-teal); color: #fff; }
.sw-btn-primary:hover { background: var(--app-teal-dark); }
.sw-btn-primary:disabled { background: var(--app-muted-2); cursor: not-allowed; }
.sw-btn-ghost { background: transparent; border-color: var(--app-line); color: var(--app-muted); }
.sw-btn-ghost:hover { border-color: var(--app-muted-2); color: var(--app-ink); }
.sw-btn-danger { background: transparent; border-color: var(--app-rose-light); color: var(--app-rose); }
.sw-btn-danger:hover { background: var(--app-rose-light); }
.sw-btn-info {
  background: rgba(46,125,166,0.1);
  border-color: rgba(46,125,166,0.3);
  color: var(--app-sky);
}
.sw-btn-info:hover { background: rgba(46,125,166,0.2); }
.sw-btn-block { width: 100%; }
.sw-btn-sm { padding: 7px 11px; font-size: 12.5px; border-radius: 7px; }

.actions-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

/* Checkbox */
.sw-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--app-teal);
  cursor: pointer;
}

/* Editing banner */
.editing-banner {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--app-amber-light);
  color: #8a5414;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.editing-banner.show { display: flex; }

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
#toast-container {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.toast {
  background: var(--app-ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.3s ease;
  max-width: 90vw;
  pointer-events: none;
}
.toast.err { background: var(--app-rose); }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* =============================================
   MODAL (App-level)
   ============================================= */
.sw-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,20,18,.86);
  z-index: var(--z-modal);
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sw-modal-overlay.open { display: flex; }
.sw-modal {
  background: var(--app-surface);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  margin-top: 10vh;
  box-shadow: var(--shadow-xl);
  animation: modal-in 0.25s ease;
  overflow: hidden;
}
.sw-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--app-line);
}
.sw-modal-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--app-ink); }
.sw-modal-body { padding: 20px; color: var(--app-ink); }
.sw-modal-body p { color: var(--app-ink); }
#confirm-msg { margin: 0; font-size: 14px; line-height: 1.55; color: var(--app-ink); }
.sw-modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--app-line);
  background: #FAFCFB;
}

/* =============================================
   LOG TABLE
   ============================================= */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.filters .full { grid-column: 1 / -1; }

.summary-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
}
.stat-pill {
  flex: none;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 118px;
  box-shadow: var(--app-shadow);
}
.stat-pill .v { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--app-teal-dark); }
.stat-pill .l { font-size: 10.5px; color: var(--app-muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

table.log { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.log th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--app-muted);
  padding: 8px 8px;
  border-bottom: 1.5px solid var(--app-line);
  white-space: nowrap;
}
table.log td { padding: 9px 8px; border-bottom: 1px solid var(--app-line); vertical-align: middle; color: var(--app-ink); }
table.log tbody tr:hover { background: #FAFCFB; }

.log-wrap { overflow-x: auto; border: 1px solid var(--app-line); border-radius: 12px; background: #fff; }

.pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--app-sky-light);
  color: var(--app-sky);
  white-space: nowrap;
}
.mono { font-family: var(--font-mono); }

.log-actions-cell { display: flex; gap: 4px; }
.icon-btn-sm {
  background: none;
  border: none;
  color: var(--app-muted-2);
  padding: 6px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn-sm:hover { color: var(--app-teal); background: var(--app-teal-light); }
.icon-btn-sm.del:hover { color: var(--app-rose); background: var(--app-rose-light); }
.icon-btn-sm i { font-size: 13px; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--app-muted); }
.empty-state i { font-size: 38px; color: var(--app-muted-2); margin-bottom: 10px; display: block; }
.empty-state p { margin: 0; font-size: 13.5px; }

/* =============================================
   BADGES
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 10.5px;
  font-weight: 700;
}
.badge-success { background: var(--app-moss-light); color: var(--app-moss); }
.badge-muted { background: var(--app-slate-light); color: var(--app-slate); }
.badge-danger { background: var(--app-rose-light); color: var(--app-rose); }

/* =============================================
   MANAGE USERS - ENGINEER CARD GRID
   ============================================= */
.eng-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.eng-card {
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 12px;
  padding: 20px;
  transition: all var(--transition-fast);
  box-shadow: var(--app-shadow);
}
.eng-card:hover { border-color: var(--app-teal); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,35,33,0.12); }

.eng-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.eng-avatar {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--app-teal-dark), var(--app-teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.eng-info .eng-name { font-size: 16px; font-weight: 700; color: var(--app-ink); }
.eng-info .eng-meta { font-size: 12px; color: var(--app-muted); font-family: var(--font-mono); margin-top: 2px; }

.eng-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.eng-stat {
  background: var(--app-bg);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.eng-stat .es-val { font-size: 18px; font-weight: 700; font-family: var(--font-mono); color: var(--app-teal-dark); }
.eng-stat .es-label { font-size: 10px; color: var(--app-muted); margin-top: 2px; letter-spacing: .04em; text-transform: uppercase; }

.eng-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--app-line);
}

.add-eng-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.add-eng-grid .full { grid-column: 1 / -1; }

/* =============================================
   UTILITIES
   ============================================= */
.text-mono { font-family: var(--font-mono); }
.text-primary { color: var(--app-teal); }
.text-muted { color: var(--app-muted); }
.text-rose { color: var(--app-rose); }
.text-sm { font-size: 12px; }
.hidden { display: none !important; }
.field-hidden { display: none !important; }

/* =============================================
   MOBILE RESPONSIVENESS
   ============================================= */
@media (max-width: 768px) {
  .login-card { padding: var(--space-6) var(--space-4); }
  .eng-select-card { padding: var(--space-5); }
  .eng-select-grid { grid-template-columns: 1fr; max-height: 50vh; }
  .modal { margin-top: var(--space-4); padding: var(--space-4); max-height: calc(100vh - var(--space-8)); }
  .eng-grid { grid-template-columns: 1fr; }
  .topbar-brand h1 { font-size: 16px; }

  nav.tabs button {
    font-size: 12px;
    padding: 9px 4px;
    min-width: 80px;
  }
  nav.tabs button i { display: none; }
}

@media (max-width: 480px) {
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; }
  .eng-card { padding: 16px; }
  .eng-avatar { width: 44px; height: 44px; font-size: 16px; }
  .eng-stats { grid-template-columns: repeat(3, 1fr); }
  .eng-stat { padding: 8px; }
  .eng-stat .es-val { font-size: 14px; }

  .filters { grid-template-columns: 1fr; }
  .add-eng-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   PWA · BRAND LOGO · BUSY OVERLAY · INSTALL · ADMIN ENHANCEMENTS
   (appended)
   ============================================================ */

/* Shared SVG drop logo */
.brand-logo { display: block; width: 100%; height: 100%; }
.loader-logo, .login-logo { overflow: hidden; }
.loader-logo .brand-logo,
.login-logo .brand-logo { width: 58%; height: 58%; margin: auto; color: #fff; }
.loader-logo, .login-logo { display: flex; align-items: center; justify-content: center; }

/* Topbar logo + left cluster */
.topbar-inner { align-items: center; }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-logo {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  background: rgba(255,255,255,.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
  display: flex; align-items: center; justify-content: center;
}
.topbar-logo .brand-logo { width: 60%; height: 60%; color: #fff; }

/* Install buttons */
.install-btn[hidden] { display: none !important; }
.install-btn { gap: 6px; }
@media (max-width: 560px) { #installBtnTop .install-label { display: none; } }

/* Busy overlay — blocks taps while data loads */
#busy-overlay {
  position: fixed; inset: 0; z-index: 990;
  display: none; align-items: center; justify-content: center;
  background: rgba(8,20,19,.45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  touch-action: none;
}
#busy-overlay.show { display: flex; }
.busy-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--app-surface); color: var(--app-ink);
  padding: 14px 20px; border-radius: 12px;
  box-shadow: var(--shadow-xl); font-weight: 600; font-size: 14px;
}
.busy-spinner i { color: var(--app-teal); font-size: 18px; }

/* Loading screen blocks touches until released */
#loading-screen { touch-action: none; }

/* iOS install steps */
.ios-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.ios-steps li { font-size: 13.5px; color: var(--app-ink); line-height: 1.5; }
.ios-steps i { color: var(--app-teal); margin: 0 2px; }

/* Admin-controlled hiding of built-in fields in the DPR form */
.admin-hidden { display: none !important; }

/* Field-editor badges / states */
.fd-hidden-badge {
  display: inline-flex; align-items: center; padding: 1px 6px; margin-left: 6px;
  border-radius: 3px; background: var(--app-slate-light); color: var(--app-slate);
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.fd-system-tag { font-size: 10px; color: var(--app-muted-2); padding: 6px; font-weight: 700; letter-spacing: .03em; }
.field-def-item.is-hidden-field { opacity: .6; }

/* Notch / safe-area padding */
.topbar { padding-top: calc(18px + env(safe-area-inset-top)); }
.app-content { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

/* Slightly larger tap targets on phones */
@media (max-width: 480px) {
  .sw-btn { padding: 12px 16px; }
  .icon-btn-sm { padding: 8px; }
}

/* ============================================================
   COMPACT MOBILE TOPBAR (appended)
   Keeps the header small, simple & professional on phones
   ============================================================ */
@media (max-width: 768px) {
  .topbar { padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .topbar-inner { align-items: center; gap: 10px; }
  .topbar-left { gap: 10px; flex: 1 1 auto; min-width: 0; }
  .topbar-logo { width: 36px; height: 36px; border-radius: 9px; }
  .topbar-brand { min-width: 0; }
  .topbar-brand .eyebrow { font-size: 9px; letter-spacing: .05em; margin: 0 0 2px; line-height: 1.3; }
  .topbar-brand h1 { font-size: 15px; line-height: 1.2; }
  .topbar-brand .sub { display: none; }              /* hide long descriptive subtitle on phones */

  .topbar-user { flex: 0 0 auto; max-width: 42%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
  .topbar-user .who { margin: 0; font-size: 11px; line-height: 1.3; }
  .role-tag { font-size: 9px; padding: 1px 5px; margin-left: 5px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .sw-btn-sm { padding: 8px 9px; }
  #logoutBtn .btn-label { display: none; }            /* icon-only logout on phones */
}

@media (max-width: 420px) {
  .topbar-brand h1 { font-size: 14px; }
  .topbar-user { max-width: 40%; }
}

/* ============================================================
   WHATSAPP SHARE (appended)
   ============================================================ */
.icon-btn-sm.share { color: #1ba84f; }
.icon-btn-sm.share:hover {
  background: rgba(37,211,102,.12);
  border-color: rgba(37,211,102,.40);
  color: #128a3e;
}

.sw-modal-share { max-width: 460px; width: 100%; }
.share-hint { margin: 0 0 10px; font-size: 12.5px; color: var(--app-muted); }
.share-preview {
  margin: 0;
  background: var(--app-slate-light);
  border: 1px solid var(--app-line);
  border-radius: 10px;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--app-ink);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 46vh;
  overflow-y: auto;
}
.sw-btn-wa { background: #25D366; color: #fff; border: 1px solid #25D366; }
.sw-btn-wa:hover { background: #1eb858; border-color: #1eb858; }

/* ============================================================
   PRINT / PDF (appended) — clean report-table-only output
   ============================================================ */
@page { size: A4 landscape; margin: 12mm; }
@media print {
  .topbar, nav.tabs, #busy-overlay, #toast-container, .sw-modal-overlay,
  #loading-screen, #view-log .filters, #view-log .actions-row,
  .pwa-install, .install-hint { display: none !important; }

  html, body, #app, .app-main { background: #fff !important; }

  /* hide the Actions column (last) entirely */
  table.log th:last-child, table.log td:last-child { display: none !important; }

  .log-wrap { overflow: visible !important; border: none !important; box-shadow: none !important; max-height: none !important; }
  table.log { width: 100%; border-collapse: collapse; font-size: 11px; }
  table.log th, table.log td {
    border: 1px solid #bbb; padding: 4px 6px; color: #000 !important; white-space: normal !important;
  }
  table.log thead th {
    background: #eaeaea !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .pill { border: 1px solid #bbb; background: #f3f3f3 !important; color: #000 !important; }

  #view-log::before {
    content: "Shimla 24x7 Water Supply Project \2014 Daily Progress Report";
    display: block; font-size: 14px; font-weight: 700; margin: 0 0 12px; color: #000;
  }
}

/* ============================================================
   HAMBURGER MENU + NAVIGATION DRAWER (appended)
   ============================================================ */
nav.tabs { display: none !important; }   /* replaced by the drawer */
.topbar-user { margin-left: auto; }

.menu-toggle {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 11px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.12);
  color: #fff; font-size: 17px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.menu-toggle:hover { background: rgba(255,255,255,.22); }

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(8,20,19,.5);
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
  z-index: 1200;
}
.drawer-backdrop.show { opacity: 1; visibility: visible; }

.drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 284px; max-width: 84vw;
  background: var(--app-surface, #fff);
  border-right: 1px solid var(--app-line);
  box-shadow: 2px 0 24px rgba(8,20,19,.18);
  transform: translateX(-104%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  z-index: 1300;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: center; gap: 11px;
  padding: calc(16px + env(safe-area-inset-top)) 16px 16px;
  background: linear-gradient(135deg, var(--app-teal-dark), var(--app-teal) 75%);
  color: #fff;
}
.drawer-logo {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center;
}
.drawer-logo .brand-logo { width: 58%; height: 58%; color: #fff; }
.drawer-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.drawer-eyebrow { font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.8); }
.drawer-title strong { font-size: 16px; }
.drawer-close {
  margin-left: auto; flex: none;
  width: 34px; height: 34px; border-radius: 9px;
  background: rgba(255,255,255,.16); border: none; color: #fff; cursor: pointer; font-size: 15px;
}

.drawer-nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.drawer-group-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--app-muted); padding: 14px 12px 6px;
}
.drawer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px;
  border: none; background: transparent; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--app-ink);
  text-align: left; width: 100%;
  transition: background .14s ease, color .14s ease;
}
.drawer-item i { width: 20px; text-align: center; color: var(--app-muted); font-size: 15px; }
.drawer-item:hover { background: var(--app-teal-light); }
.drawer-item.active { background: var(--app-teal); color: #fff; }
.drawer-item.active i { color: #fff; }
.drawer-spacer { flex: 1; min-height: 8px; }
.drawer-logout { color: #c0392b; }
.drawer-logout i { color: #c0392b; }
.drawer-logout:hover { background: rgba(192,57,43,.10); }

/* Module banner on the entry form */
.module-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; margin-bottom: 14px; border-radius: 12px;
  background: linear-gradient(135deg, var(--app-teal-dark), var(--app-teal) 80%);
  color: #fff; font-weight: 700; font-size: 15px;
}
.module-banner i { font-size: 17px; }

@media (max-width: 768px) {
  .menu-toggle { width: 38px; height: 38px; font-size: 16px; }
  .topbar-logo { display: none; }   /* hamburger stands in for the logo on phones */
}

/* ============================================================
   MODULE FILTER CHIPS (Reports) — appended
   ============================================================ */
.module-filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.mod-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--app-line); background: var(--app-surface, #fff);
  color: var(--app-ink); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.mod-chip i { font-size: 13px; color: var(--app-muted); }
.mod-chip:hover { border-color: var(--app-teal); }
.mod-chip.active { background: var(--app-teal); border-color: var(--app-teal); color: #fff; }
.mod-chip.active i { color: #fff; }

/* ============================================================
   OCEAN WATER THEME (appended)
   Retunes the existing tokens to a premium ocean-blue / cyan
   palette (dark stays dark, light stays light — contrast safe)
   and adds a subtle animated water wave under the header.
   ============================================================ */
:root {
  /* Dark login surfaces -> deep ocean navy */
  --bg-primary: #06141F;
  --bg-secondary: #0A1E2E;
  --bg-tertiary: #0E2A3D;
  --bg-elevated: #143447;
  --text-primary: #E8F1F8;
  --text-secondary: #8AA3B5;

  /* Light app surfaces */
  --app-bg: #EDF4F8;
  --app-ink: #12222E;
  --app-line: #D5E3ED;
  --app-muted: #5A6B78;

  /* Brand -> ocean blue + cyan accents */
  --app-teal: #0C6B9A;
  --app-teal-dark: #084C73;
  --app-teal-light: #E2F1FA;
  --app-sky: #1782A8;
  --app-sky-light: #E0F2FA;
}

/* Animated water wave under the header */
.topbar { position: sticky; top: 0; overflow: hidden; }
.topbar::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='240'%20height='16'%20viewBox='0%200%20240%2016'%3E%3Cpath%20d='M0,8C30,0,60,0,90,8S150,16,180,8S240,0,240,8V16H0Z'%20fill='%23EDF4F8'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 240px 16px;
  animation: dprWave 9s linear infinite;
  pointer-events: none;
}
@keyframes dprWave { from { background-position-x: 0; } to { background-position-x: -240px; } }

/* Gradient primary buttons + soft depth */
.sw-btn-primary {
  background: linear-gradient(135deg, var(--app-sky), var(--app-teal) 72%);
  border: none;
  box-shadow: 0 4px 14px rgba(12,107,154,.26);
}
.sw-btn-primary:hover {
  background: linear-gradient(135deg, var(--app-sky), var(--app-teal-dark) 82%);
  box-shadow: 0 6px 18px rgba(12,107,154,.32);
}

/* Slightly softer, more premium cards */
.sw-card { box-shadow: 0 2px 18px rgba(8,40,60,.06); }

/* ============================================================
   FASTER / SMOOTHER DRAWER (appended override)
   ============================================================ */
.drawer { transition: transform .2s cubic-bezier(.22,.61,.36,1); will-change: transform; }
.drawer-backdrop { transition: opacity .18s ease, visibility .18s ease; }
.drawer-item { transition: background .1s ease, color .1s ease; }

/* ============================================================
   MOBILE OVERFLOW GUARD (appended)
   Stops any wide row from dragging the page wider than the screen
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
#app, .app-content, .topbar, .view { max-width: 100%; }
.app-content { overflow-x: clip; }      /* clip stray horizontal overflow, keeps sticky header working */
.actions-row .sw-btn { flex: 0 1 auto; }
