/* Google Fonts - Noto Sans Thai Looped & Plus Jakarta Sans */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai+Looped:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --font-main: 'Noto Sans Thai Looped', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Color Palette - Fresh Mint Green & Deep Emerald / Coral Red Accent */
  --bg-primary: #06110e;
  --bg-surface: rgba(12, 28, 23, 0.78);
  --bg-surface-hover: rgba(18, 42, 34, 0.88);
  --bg-card: rgba(15, 34, 28, 0.65);
  --bg-card-hover: rgba(22, 48, 39, 0.85);
  --border-subtle: rgba(52, 211, 153, 0.12);
  --border-focus: rgba(52, 211, 153, 0.55);
  
  /* Vibrant Mint Primary with Fresh Coral Orange & Emerald Accents */
  --primary: #10b981;
  --primary-light: #34d399;
  --primary-mint: #6ee7b7;
  --primary-gradient: linear-gradient(135deg, #10b981 0%, #06b6d4 50%, #3b82f6 100%);
  --mint-coral-gradient: linear-gradient(135deg, #10b981 0%, #059669 45%, #f43f5e 100%);
  --secondary-gradient: linear-gradient(135deg, #34d399 0%, #0ea5e9 100%);
  
  --text-main: #f0fdf4;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --info: #06b6d4;
  --info-bg: rgba(6, 182, 212, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-card: 0 8px 24px -4px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(52, 211, 153, 0.08);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.35);
  --shadow-fab: 0 10px 25px rgba(16, 185, 129, 0.45);

  --blur-glass: blur(16px);
}

/* Light Theme Variables (Toggled via [data-theme="light"]) */
[data-theme="light"] {
  --bg-primary: #f0fdf4;
  --bg-surface: rgba(255, 255, 255, 0.88);
  --bg-surface-hover: rgba(240, 253, 244, 0.95);
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: #ffffff;
  --border-subtle: rgba(16, 185, 129, 0.14);
  --border-focus: rgba(16, 185, 129, 0.6);
  --text-main: #064e3b;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-card: 0 8px 20px -3px rgba(6, 78, 59, 0.08), 0 0 0 1px rgba(16, 185, 129, 0.08);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.2);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  background-image: 
    radial-gradient(circle at 12% 8%, rgba(16, 185, 129, 0.18) 0%, transparent 42%),
    radial-gradient(circle at 88% 68%, rgba(244, 63, 94, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 95%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Ambient Ambient Light Mesh */
.ambient-glow {
  position: fixed;
  top: -160px;
  left: 50%;
  transform: translateX(-50%);
  width: 650px;
  height: 420px;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.22) 0%, rgba(16, 185, 129, 0.06) 50%, transparent 70%);
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0.85rem 0.85rem 5.5rem;
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  .app-container {
    padding: 1.5rem 1.25rem 6rem;
  }
}

/* Top App Bar */
.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow-card);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
  color: white;
  overflow: hidden;
  border: 1.5px solid rgba(52, 211, 153, 0.4);
}

.brand-logo svg {
  width: 24px;
  height: 24px;
}

.brand-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 11px;
}

.brand-text h1 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #a7f3d0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

[data-theme="light"] .brand-text h1 {
  background: linear-gradient(135deg, #064e3b 0%, #059669 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.03em;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.icon-btn:hover {
  background: rgba(52, 211, 153, 0.12);
  color: var(--primary-light);
  border-color: rgba(52, 211, 153, 0.3);
  transform: translateY(-2px);
}

.logout-nav-btn:hover {
  background: rgba(244, 63, 94, 0.18);
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.4);
}

.icon-btn.has-notification::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

/* Install Banner (for PWA Add to Home Screen) */
.install-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(6, 182, 212, 0.14) 100%);
  border: 1px solid rgba(52, 211, 153, 0.35);
  backdrop-filter: var(--blur-glass);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.15rem;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  animation: fadeIn 0.4s ease;
}

.install-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.install-icon {
  background: var(--primary);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.install-text h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.1rem;
}

.install-text p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.install-btn {
  background: var(--primary-gradient);
  color: white;
  border: none;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.install-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.install-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

/* Notification Permission Reminder Alert */
.notif-alert-card {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.15rem;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.notif-alert-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.notif-alert-left svg {
  color: var(--warning);
  flex-shrink: 0;
}

.notif-alert-text h5 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--warning);
}

.notif-alert-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.notif-enable-btn {
  background: var(--warning);
  color: #1e1b4b;
  border: none;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s;
}

.notif-enable-btn:hover {
  transform: scale(1.05);
}

/* Dashboard Metrics Stats Cards - Streamlined */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.85rem;
  }
}

.stat-card {
  background: var(--bg-surface);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.95rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3.5px;
  height: 100%;
}

.stat-card.total::before { background: var(--primary); }
.stat-card.urgent::before { background: var(--danger); }
.stat-card.upcoming::before { background: var(--warning); }
.stat-card.completed::before { background: var(--info); }

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.stat-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.stat-card.total .stat-icon { color: var(--primary-light); background: rgba(16, 185, 129, 0.15); }
.stat-card.urgent .stat-icon { color: var(--danger); background: var(--danger-bg); }
.stat-card.upcoming .stat-icon { color: var(--warning); background: var(--warning-bg); }
.stat-card.completed .stat-icon { color: var(--info); background: var(--info-bg); }

.stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
}

/* Branch Filter Carousel */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  padding: 0 0.2rem;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-count {
  font-size: 0.76rem;
  color: var(--text-dim);
  font-weight: 500;
}

.branch-nav-container {
  position: relative;
  margin-bottom: 1.15rem;
}

.branch-chips-list {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.2rem 0.2rem 0.6rem 0.2rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.branch-chips-list::-webkit-scrollbar {
  display: none;
}

.branch-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.branch-icon-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.branch-chip.active .branch-icon-svg {
  opacity: 1;
}

.branch-chip:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: rgba(52, 211, 153, 0.25);
}

.branch-chip.active {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.branch-badge-count {
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.7rem;
  padding: 0.08rem 0.42rem;
  border-radius: var(--radius-full);
}

.branch-chip.active .branch-badge-count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Action Controls (Search, Sort, Filters) */
.controls-bar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

@media (min-width: 640px) {
  .controls-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-box {
  position: relative;
  flex: 1;
}

.search-box > svg {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.55rem 2.2rem 0.55rem 2.4rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
  transition: all 0.2s;
}

.search-clear-btn {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.search-clear-btn:hover {
  background: rgba(244, 63, 94, 0.2);
  color: var(--danger);
  transform: translateY(-50%) scale(1.1);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.filter-pills {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.pill-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.55rem 2.2rem 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  outline: none;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2334d399' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 14px;
  transition: all 0.2s ease;
}

.pill-select:hover {
  border-color: rgba(52, 211, 153, 0.4);
  background-color: rgba(255, 255, 255, 0.05);
}

.pill-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Style <option> dropdown list to match autocomplete */
select option {
  background-color: #0d241d !important;
  color: #f1f5f9 !important;
  padding: 0.6rem 0.8rem !important;
  font-size: 0.88rem !important;
  border: none;
}

[data-theme="light"] select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

/* Task List - Compact & Clean Height */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem; /* Compact row spacing */
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--blur-glass);
}

.empty-state-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.empty-state h3 {
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.empty-state p {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 360px;
  margin: 0 auto 1.15rem;
}

/* Compact Modern Task Card (Optimized Height for dense list) */
.task-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.95rem; /* Reduced height from 1.1rem to 0.65rem */
  display: flex;
  gap: 0.75rem;
  align-items: center; /* Center-aligned for clean single/double row layout */
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.task-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(52, 211, 153, 0.25);
  transform: translateY(-1px);
}

.task-card.is-completed {
  opacity: 0.55;
}

.task-card.is-completed .task-title {
  text-decoration: line-through;
  color: var(--text-dim);
}

/* Left accent border by Priority */
.task-card.p-urgent { border-left: 3.5px solid var(--danger); }
.task-card.p-high { border-left: 3.5px solid var(--warning); }
.task-card.p-normal { border-left: 3.5px solid var(--primary); }
.task-card.p-low { border-left: 3.5px solid var(--info); }

/* Custom Checkbox */
.custom-checkbox {
  position: relative;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}

.custom-checkbox input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.checkbox-mark {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-checkbox:hover .checkbox-mark {
  border-color: var(--primary-light);
}

.custom-checkbox input:checked ~ .checkbox-mark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-mark svg {
  display: none;
  width: 12px;
  height: 12px;
  stroke: white;
  stroke-width: 3;
}

.custom-checkbox input:checked ~ .checkbox-mark svg {
  display: block;
}

/* Task Content - Streamlined & Horizontal Flow */
.task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.task-top-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge-branch {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.16);
  color: var(--primary-mint);
  border: 1px solid rgba(16, 185, 129, 0.25);
  white-space: nowrap;
}

.badge-branch.general {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border-color: rgba(148, 163, 184, 0.2);
}

.badge-priority {
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.1rem 0.42rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-priority.urgent { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-priority.high { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-priority.normal { background: var(--info-bg); color: var(--info); border: 1px solid rgba(6, 182, 212, 0.25); }
.badge-priority.low { background: rgba(100, 116, 139, 0.15); color: var(--text-dim); }

.task-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  word-break: break-word;
  color: var(--text-main);
}

.task-description {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-meta-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.task-due {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
}

.task-due.is-overdue {
  color: var(--danger);
}

.task-due.is-today {
  color: var(--warning);
}

.task-reminder-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary-mint);
  font-weight: 500;
}

/* Task Actions */
.task-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.task-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-btn:hover {
  background: rgba(52, 211, 153, 0.1);
  color: var(--primary-mint);
}

.task-btn.delete-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Floating Action Button (FAB) */
.fab-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--primary-gradient);
  color: white;
  border: none;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-fab);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 90;
}

.fab-btn:hover {
  transform: scale(1.08) rotate(90deg);
  box-shadow: 0 14px 30px rgba(16, 185, 129, 0.55);
}

.fab-btn:active {
  transform: scale(0.95);
}

/* Modal UI */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-card {
  min-width: 0;
  background: #091a15;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(52, 211, 153, 0.15);
  transform: translateY(20px) scale(0.96);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="light"] .modal-card {
  background: #ffffff;
}

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

.modal-header {
  padding: 1.1rem 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-mint);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-form {
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s;
}

.form-select {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2334d399' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 15px;
  padding-right: 2.3rem;
  cursor: pointer;
}

[data-theme="light"] .form-input, 
[data-theme="light"] .form-textarea, 
[data-theme="light"] .form-select {
  background: rgba(0, 0, 0, 0.03);
}

.modal-form input[type="date"],
.modal-form input[type="time"] {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding-left: 0.3rem;
  padding-right: 0.2rem;
  overflow: hidden;
}

.task-date-row {
  gap: 0.5rem;
}

.task-date-row input[type="date"],
.task-date-row input[type="time"] {
  font-size: 0.82rem;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}

@media (max-width: 520px) {
  .modal-card {
    max-width: calc(100vw - 1rem);
  }

  .modal-form {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Keep location/priority and date/time side by side on phone screens. */
  .task-location-row,
  .task-date-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .task-date-row input[type="date"],
  .task-date-row input[type="time"] {
    padding-left: 0.2rem;
    padding-right: 0.1rem;
    font-size: 0.78rem;
  }
}

/* Custom Autocomplete Dropdown aligned precisely under the input */
.custom-autocomplete-container {
  position: relative;
}

.custom-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100%;
  max-height: 190px;
  overflow-y: auto;
  background: #0d241d;
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.75), 0 0 15px rgba(16, 185, 129, 0.2);
  z-index: 1050;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  animation: fadeIn 0.15s ease-out;
}

[data-theme="light"] .custom-autocomplete-dropdown {
  background: #ffffff;
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.autocomplete-item:hover, .autocomplete-item.is-selected {
  background: rgba(16, 185, 129, 0.2);
  color: var(--primary-mint);
}

.autocomplete-item .loc-icon {
  display: inline-flex;
  align-items: center;
  color: var(--primary-light);
}

.autocomplete-item mark {
  background: rgba(16, 185, 129, 0.35);
  color: var(--text-main);
  font-weight: 700;
  border-radius: 2px;
  padding: 0 1px;
}

.reminder-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px dashed rgba(52, 211, 153, 0.3);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.reminder-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.reminder-toggle span {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--primary-mint);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 34px;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.modal-footer {
  padding: 1.1rem 1.35rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary-gradient);
  border: none;
  color: white;
  padding: 0.55rem 1.3rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  transition: all 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

/* In-App Notification Toast/Banner */
.inapp-notification-banner {
  position: fixed;
  top: 1.15rem;
  right: 1.15rem;
  left: 1.15rem;
  max-width: 420px;
  margin: 0 0 0 auto;
  background: #0b241c;
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.05rem;
  box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.6), 0 0 20px rgba(16, 185, 129, 0.45);
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  z-index: 1000;
  animation: slideDown 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: pointer;
}

.banner-icon {
  background: var(--primary-gradient);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.banner-content {
  flex: 1;
}

.banner-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.15rem;
}

.banner-body {
  font-size: 0.78rem;
  color: #a7f3d0;
  line-height: 1.35;
}

.banner-close {
  background: transparent;
  border: none;
  color: #6ee7b7;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

/* Animations */
@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.fade-out {
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   PIN Lock Screen & Security Styles
   ========================================================================== */
.pin-lock-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: radial-gradient(circle at 50% 30%, rgba(16, 185, 129, 0.18) 0%, rgba(6, 17, 14, 0.98) 75%);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.pin-lock-overlay.pin-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pin-lock-card {
  width: 100%;
  max-width: 360px;
  background: rgba(12, 28, 23, 0.85);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 24px;
  padding: 2.2rem 1.8rem 1.8rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(16, 185, 129, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: modalScaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pin-brand-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 2.5px solid var(--primary);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.45);
  margin-bottom: 1rem;
}

.pin-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pin-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.35rem 0;
  letter-spacing: -0.01em;
}

.pin-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem 0;
  line-height: 1.4;
}

/* 6 Dots Row */
.pin-dots-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pin-dots-row.shake {
  animation: pinShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes pinShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

.pin-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(52, 211, 153, 0.45);
  background: transparent;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary-light);
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.7);
}

.pin-error-msg {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 500;
  min-height: 1.4rem;
  margin-bottom: 0.75rem;
}

/* Keypad Grid */
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  width: 100%;
  max-width: 280px;
  margin-bottom: 1.25rem;
}

.pin-key {
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(52, 211, 153, 0.15);
  color: var(--text-main);
  font-size: 1.4rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pin-key:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  transform: translateY(-2px);
}

.pin-key:active {
  transform: scale(0.92);
  background: var(--primary);
  color: #06110e;
  border-color: var(--primary);
}

.pin-key.pin-key-action {
  font-size: 1.1rem;
  color: var(--text-muted);
  background: transparent;
}

.pin-key.pin-key-action:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.pin-lock-footer {
  margin-top: 0.25rem;
}

.pin-hint-text {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.pin-hint-text code {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary-mint);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
}

/* ==========================================================================
   Custom Modern Dialog & Toast System
   ========================================================================== */
.custom-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 17, 14, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s ease;
}

.custom-dialog-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.custom-dialog-box {
  background: #0d1a16;
  border: 1px solid rgba(16, 185, 129, 0.24);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 35px rgba(16, 185, 129, 0.15);
  padding: 1.75rem 1.5rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-dialog-backdrop.is-open .custom-dialog-box {
  transform: scale(1) translateY(0);
}

.custom-dialog-icon-wrapper {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  margin: 0 auto 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary-mint);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.custom-dialog-icon-wrapper.is-danger {
  background: rgba(244, 63, 94, 0.14);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.32);
}

.custom-dialog-icon-wrapper.is-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.32);
}

.custom-dialog-icon-wrapper.is-success {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.custom-dialog-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.custom-dialog-message {
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  word-break: break-word;
}

.custom-dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.custom-dialog-btn {
  flex: 1;
  padding: 0.72rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.custom-dialog-btn.cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.custom-dialog-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.custom-dialog-btn.confirm {
  background: var(--gradient-primary);
  color: #041410;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.custom-dialog-btn.confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.custom-dialog-btn.confirm.is-danger {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
}

.custom-dialog-btn.confirm.is-danger:hover {
  box-shadow: 0 6px 18px rgba(244, 63, 94, 0.5);
}

.custom-dialog-btn.confirm.is-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.custom-dialog-btn:active {
  transform: scale(0.96);
}

/* Modern Toasts */
.custom-toast-container {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10600;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.custom-toast {
  background: rgba(13, 26, 22, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 15px rgba(16, 185, 129, 0.12);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #f8fafc;
  font-size: 0.88rem;
  font-weight: 500;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-16px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.custom-toast.is-success .custom-toast-icon {
  color: #34d399;
}

.custom-toast.is-error,
.custom-toast.is-fail {
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 15px rgba(244, 63, 94, 0.15);
}

.custom-toast.is-error .custom-toast-icon,
.custom-toast.is-fail .custom-toast-icon {
  color: #fb7185;
}

.custom-toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.custom-toast-msg {
  flex: 1;
  line-height: 1.35;
}




/* Server PIN Login - polished keypad design */
#serverLoginModal {
  background:
    radial-gradient(circle at 50% 18%, rgba(52, 211, 153, 0.22), transparent 34%),
    radial-gradient(circle at 15% 85%, rgba(6, 182, 212, 0.14), transparent 34%),
    rgba(3, 12, 10, 0.88);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
}

#serverLoginModal .modal-card {
  position: relative;
  overflow: hidden;
  width: min(100%, 390px);
  max-width: 390px !important;
  border: 1px solid rgba(110, 231, 183, 0.3);
  border-radius: 30px;
  padding: 0;
  background: linear-gradient(155deg, rgba(16, 45, 36, 0.96), rgba(5, 20, 17, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.68), 0 0 55px rgba(16, 185, 129, 0.16);
  animation: serverLoginEnter 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

#serverLoginModal .modal-card::before {
  content: '';
  position: absolute;
  width: 230px;
  height: 230px;
  top: -145px;
  right: -80px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.22);
  filter: blur(4px);
  pointer-events: none;
}

#serverLoginModal .modal-header {
  position: relative;
  justify-content: center;
  border-bottom: 0;
  padding: 1.55rem 1.4rem 0.35rem;
}

#serverLoginModal .modal-header h3 {
  color: var(--text-main);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

#serverLoginModal .modal-form {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.45rem 1.35rem 1.55rem !important;
}

#serverLoginModal .modal-form > p {
  margin-bottom: 0.95rem !important;
  color: #a7f3d0 !important;
  font-size: 0.78rem !important;
  letter-spacing: 0.01em;
}

#serverLoginModal .pin-dots-row {
  gap: 0.85rem;
  margin: 0.15rem 0 0.7rem;
}

#serverLoginModal .pin-dot {
  width: 13px;
  height: 13px;
  border-color: rgba(167, 243, 208, 0.52);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

#serverLoginModal .pin-dot.filled {
  background: linear-gradient(135deg, #6ee7b7, #06b6d4);
  border-color: #a7f3d0;
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.85);
}

#serverLoginModal .pin-error-msg {
  width: 100%;
  min-height: 1.35rem;
  margin: 0 0 0.5rem;
  color: #fda4af;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}

#serverLoginModal .pin-keypad {
  max-width: 292px;
  gap: 0.62rem;
  margin: 0;
}

#serverLoginModal .pin-key {
  height: 54px;
  border-radius: 18px;
  border: 1px solid rgba(167, 243, 208, 0.13);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 14px rgba(0, 0, 0, 0.16);
  color: #ecfdf5;
  font-size: 1.3rem;
  font-weight: 700;
}

#serverLoginModal .pin-key:hover {
  transform: translateY(-2px);
  border-color: rgba(110, 231, 183, 0.55);
  background: linear-gradient(145deg, rgba(52, 211, 153, 0.22), rgba(6, 182, 212, 0.1));
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.16);
}

#serverLoginModal .pin-key:active {
  transform: scale(0.94);
  background: linear-gradient(145deg, #10b981, #0891b2);
  color: #04251b;
}

#serverLoginModal .pin-key:disabled {
  cursor: wait;
  opacity: 0.55;
}

#serverLoginModal .pin-key.pin-key-action {
  color: #94a3b8;
  font-size: 1rem;
  font-weight: 700;
}

#serverLoginModal .pin-key.pin-key-action:hover {
  color: #f0fdf4;
}

@keyframes serverLoginEnter {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

[data-theme="light"] #serverLoginModal {
  background: radial-gradient(circle at 50% 15%, rgba(16, 185, 129, 0.2), rgba(240, 253, 244, 0.9) 70%);
}

[data-theme="light"] #serverLoginModal .modal-card {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(236, 253, 245, 0.98));
  border-color: rgba(16, 185, 129, 0.28);
  box-shadow: 0 25px 70px rgba(6, 78, 59, 0.18), 0 0 35px rgba(16, 185, 129, 0.12);
}

[data-theme="light"] #serverLoginModal .modal-form > p {
  color: #047857 !important;
}

[data-theme="light"] #serverLoginModal .pin-key {
  background: linear-gradient(145deg, #ffffff, #ecfdf5);
  border-color: rgba(16, 185, 129, 0.2);
  color: #064e3b;
  box-shadow: 0 6px 14px rgba(6, 78, 59, 0.08);
}

@media (max-width: 420px) {
  #serverLoginModal { padding: 0.8rem; }
  #serverLoginModal .modal-card { border-radius: 26px; }
  #serverLoginModal .pin-key { height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  #serverLoginModal .modal-card { animation: none; }
  #serverLoginModal .pin-key { transition: none; }
}

/* Prevent iOS Safari focus-zoom on form controls. */
@media (max-width: 767px) {
  input, textarea, select, button {
    font-size: 16px;
  }

  #serverLoginModal,
  #serverLoginModal .modal-card,
  #serverLoginModal .pin-keypad {
    touch-action: manipulation;
  }

  #serverLoginModal #serverPin {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }
}

