/* ==========================================
   FamilyCare Scheduler - Main Styles
   ========================================== */

:root {
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-300: #5eead4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-900: #134e4a;
  --cyan-500: #06b6d4;
  --cyan-600: #0891b2;
  --cyan-700: #0e7490;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --white: #ffffff;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --amber-500: #f59e0b;
  --orange-500: #f97316;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --purple-500: #a855f7;

  --sidebar-w: 240px;
  --header-h: 60px;
  --border-r: 12px;
  --border-r-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 4px 16px rgba(0,0,0,.1), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.15), 0 4px 12px rgba(0,0,0,.1);
  --font: 'Inter', -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: #d6f0f5;
  background-image: url('../images/background.png');
  background-size: cover;
  background-position: center bottom;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--slate-800);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--teal-300); border-radius: 3px; }

/* ==========================================
   AUTH SCREEN
   ========================================== */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  padding: 20px;
}

.auth-container {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(13,148,136,.18), 0 2px 12px rgba(0,0,0,.08);
  border: 1px solid rgba(255,255,255,0.7);
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo-img {
  width: 280px;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 12px;
}

.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-form h2 { font-size: 20px; font-weight: 700; color: var(--slate-800); margin-bottom: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--slate-700); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--border-r-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--slate-800);
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(20,184,166,.15);
}

.input-icon { position: relative; }
.input-icon i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--slate-400); font-size: 14px; pointer-events: none;
}
.input-icon input { padding-left: 38px; }

.error-msg {
  background: #fef2f2;
  color: var(--red-600);
  border: 1px solid #fecaca;
  border-radius: var(--border-r-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-link { text-align: center; font-size: 13px; color: var(--slate-500); margin-top: 16px; }
.auth-link a { color: var(--teal-600); text-decoration: none; font-weight: 600; }
.auth-link a:hover { text-decoration: underline; }

/* demo-accounts removed (production mode) */

/* ==========================================
   APP LAYOUT
   ========================================== */
.app { display: flex; min-height: 100vh; background: transparent; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, rgba(13,94,89,0.96) 0%, rgba(17,78,74,0.97) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: transform .3s ease;
  box-shadow: 4px 0 24px rgba(13,148,136,.25);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
  padding: 3px;
  flex-shrink: 0;
  box-shadow: 0 1px 6px rgba(0,0,0,.18);
}
.logo-text { font-size: 15px; font-weight: 800; flex: 1; color: #fff; letter-spacing: .02em; }
.sidebar-close { display: none; background: none; border: none; color: rgba(255,255,255,.6); cursor: pointer; font-size: 16px; padding: 4px; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: var(--white); }
.nav-item.active { background: rgba(255,255,255,.15); color: var(--white); font-weight: 600; }
.nav-item i { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--red-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-card { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; padding: 6px; border-radius: 8px; transition: background .15s; }
.user-card:hover { background: rgba(255,255,255,.08); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-info span:first-child { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-badge { font-size: 10px; color: rgba(255,255,255,.6); text-transform: capitalize; }

.btn-logout { background: none; border: none; color: rgba(255,255,255,.5); cursor: pointer; font-size: 16px; padding: 8px; border-radius: 8px; transition: all .15s; }
.btn-logout:hover { color: var(--red-500); background: rgba(239,68,68,.1); }

/* ── Sidebar Overlay ── */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 190; }

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: transparent;
}

/* ── Top Bar ── */
.top-bar {
  height: var(--header-h);
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(13,148,136,.15);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(13,148,136,.1);
}

.menu-btn { display: none; background: none; border: none; color: var(--slate-600); cursor: pointer; font-size: 18px; padding: 6px; border-radius: 8px; transition: background .15s; }
.menu-btn:hover { background: var(--slate-100); }
.top-bar-title { font-size: 17px; font-weight: 700; color: var(--slate-800); flex: 1; }
.top-bar-actions { display: flex; gap: 8px; }
.icon-btn { position: relative; background: none; border: none; color: var(--slate-600); cursor: pointer; font-size: 18px; padding: 8px; border-radius: 10px; transition: all .15s; }
.icon-btn:hover { background: var(--teal-50); color: var(--teal-600); }
.dot-badge { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--red-500); border-radius: 50%; border: 2px solid white; }

/* ── Page Content ── */
.page-content { flex: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; background: transparent; }

.page { display: none; }
.page.active { display: block; }

/* Messages page: remove section padding, let chat fill full height */
#page-messages { flex: 1; min-height: 0; }
#page-messages.active { display: flex; flex-direction: column; }
.page-content:has(#page-messages.active) { padding: 0; overflow: hidden; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-header h2 { font-size: 22px; font-weight: 800; color: var(--slate-800); }
.page-subtitle { font-size: 13px; color: var(--slate-500); margin-top: 2px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.hebrew-date { font-size: 13px; color: var(--teal-600); font-weight: 500; }
.hebrew-date-sm { font-size: 12px; color: var(--teal-600); }

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--border-r-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--teal-600), var(--cyan-600)); color: white; box-shadow: 0 2px 8px rgba(13,148,136,.3); }
.btn-primary:hover { background: linear-gradient(135deg, var(--teal-700), var(--cyan-700)); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13,148,136,.4); }
.btn-secondary { background: var(--teal-50); color: var(--teal-700); border: 1.5px solid var(--teal-200); }
.btn-secondary:hover { background: var(--teal-100); }
.btn-ghost { background: transparent; color: var(--slate-600); border: 1.5px solid var(--slate-200); }
.btn-ghost:hover { background: var(--slate-100); }
.btn-danger { background: var(--red-600); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { font-size: 12px; padding: 5px 10px; }
.btn-icon-sm { background: none; border: none; color: var(--teal-600); cursor: pointer; font-size: 16px; padding: 6px; border-radius: 6px; transition: all .15s; }
.btn-icon-sm:hover { background: var(--teal-50); }

/* ==========================================
   DASHBOARD
   ========================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  gap: 20px;
}

.dash-today { grid-column: 1; }
.dash-open { grid-column: 2; }
.dash-upcoming { grid-column: 1; }
.dash-bulletin { grid-column: 2; }
.dash-messages { grid-column: 1 / -1; }

.dash-card {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--border-r);
  padding: 18px;
  box-shadow: 0 2px 16px rgba(13,148,136,.1), 0 1px 4px rgba(0,0,0,.06);
  border: 1px solid rgba(255,255,255,0.7);
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.dash-card-header h3 { font-size: 15px; font-weight: 700; color: var(--slate-800); display: flex; align-items: center; gap: 8px; }
.dash-card-header h3 i { color: var(--teal-600); }

/* ==========================================
   SHIFT CARDS
   ========================================== */
.shift-list { display: flex; flex-direction: column; gap: 8px; }

.shift-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.6);
  overflow: hidden;
  cursor: pointer;
  transition: all .15s;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.shift-card:hover { border-color: var(--teal-300); box-shadow: 0 2px 8px rgba(0,0,0,.08); transform: translateY(-1px); }

.shift-color-bar { width: 5px; flex-shrink: 0; }

.shift-card-body {
  flex: 1;
  padding: 10px 12px;
  min-width: 0;
}
.shift-card-title { font-size: 13px; font-weight: 700; color: var(--slate-800); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift-card-meta { font-size: 11px; color: var(--slate-500); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.shift-card-meta i { color: var(--teal-500); }
.shift-card-people { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }

.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--teal-50);
  border: 1px solid var(--teal-200);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--teal-700);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-open { background: #fef3c7; color: #92400e; }
.status-assigned { background: #d1fae5; color: #065f46; }
.status-completed { background: #dbeafe; color: #1e40af; }
.status-canceled { background: #fee2e2; color: #991b1b; }

/* ==========================================
   SCHEDULE VIEW
   ========================================== */
.schedule-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  background: white;
  padding: 12px 16px;
  border-radius: var(--border-r);
  box-shadow: var(--shadow-sm);
}

.schedule-title-wrap { flex: 1; text-align: center; }
.schedule-title-wrap h3 { font-size: 16px; font-weight: 700; color: var(--slate-800); }

.nav-arrow { background: none; border: 1.5px solid var(--slate-200); border-radius: 8px; padding: 8px 12px; cursor: pointer; color: var(--slate-600); transition: all .15s; font-size: 14px; }
.nav-arrow:hover { background: var(--teal-50); border-color: var(--teal-300); color: var(--teal-600); }

.btn-today { background: var(--teal-50); border: 1.5px solid var(--teal-200); border-radius: 8px; padding: 8px 14px; cursor: pointer; color: var(--teal-700); font-size: 13px; font-weight: 600; transition: all .15s; }
.btn-today:hover { background: var(--teal-100); }

.view-toggle { display: flex; border: 1.5px solid var(--slate-200); border-radius: 8px; overflow: hidden; }
.view-btn { border: none; padding: 7px 14px; font-family: var(--font); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--slate-600); background: white; transition: all .15s; }
.view-btn.active { background: var(--teal-600); color: white; }
.view-btn:hover:not(.active) { background: var(--teal-50); }

/* ==========================================
   DAY VIEW — Positioned blocks
   ========================================== */
.day-view { background: white; border-radius: var(--border-r); box-shadow: var(--shadow-sm); overflow: hidden; }
.day-view-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--slate-200);
  background: var(--teal-50);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.day-view-header h3 { font-size: 15px; font-weight: 700; color: var(--slate-800); flex: 1; }

.hour-grid { overflow-y: auto; max-height: calc(100vh - 280px); }

/* The wrapper that holds both the rows and the floating shift blocks */
.day-grid-inner { position: relative; width: 100%; }
.day-rows { position: absolute; top: 0; left: 0; right: 0; z-index: 1; }

.hour-row {
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid var(--slate-100);
  cursor: pointer;
  box-sizing: border-box;
}
.hour-row:hover { background: rgba(20,184,166,.03); }
.hour-row.current-hour { background: rgba(20,184,166,.05); }
.hour-label {
  width: 64px;
  flex-shrink: 0;
  padding: 5px 10px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-400);
  border-right: 1px solid var(--slate-200);
  text-align: right;
  line-height: 1;
  user-select: none;
  box-sizing: border-box;
}
.hour-content { flex: 1; }

/* The absolute layer where shift blocks are drawn */
.day-shifts-layer {
  position: absolute;
  right: 0;
  z-index: 2;
  pointer-events: none; /* clicks fall through to rows by default */
}

/* Individual positioned shift block */
.day-shift-block {
  position: absolute;
  border-radius: 7px;
  overflow: hidden;
  cursor: pointer;
  pointer-events: all;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
  transition: filter .15s, box-shadow .15s, transform .1s;
  border-left: 3px solid rgba(255,255,255,.4);
}
.day-shift-block:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 14px rgba(0,0,0,.28);
  transform: translateX(1px);
  z-index: 10;
}
.dsb-inner {
  padding: 4px 7px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}
.dsb-title {
  font-size: 11px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.dsb-time {
  font-size: 10px;
  color: rgba(255,255,255,.85);
  white-space: nowrap;
  margin-top: 1px;
}
.dsb-people {
  font-size: 10px;
  color: rgba(255,255,255,.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Current-time indicator */
.now-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: #ef4444;
  z-index: 20;
  pointer-events: none;
}
.now-dot {
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px; height: 10px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(239,68,68,.25);
}

/* ==========================================
   WEEK VIEW — Positioned blocks per column
   ========================================== */
.week-view { background: white; border-radius: var(--border-r); box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column; }

.week-header { display: grid; grid-template-columns: 64px repeat(7, 1fr); border-bottom: 2px solid var(--slate-200); flex-shrink: 0; }
.week-header-cell {
  padding: 10px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-600);
  border-right: 1px solid var(--slate-200);
  transition: background .1s;
}
.week-header-cell.wh-time { cursor: default; }
.week-header-cell:not(.wh-time):hover { background: var(--teal-50); color: var(--teal-700); }
.week-header-cell.today { background: var(--teal-50); color: var(--teal-700); }
.week-header-cell span { display: block; font-size: 10px; color: var(--slate-400); font-weight: 400; margin-top: 1px; }

.week-body-outer { overflow: hidden; flex: 1; }
.wv-scroll-body { overflow-y: auto; max-height: calc(100vh - 330px); }

/* The tall inner canvas */
.wv-inner { position: relative; width: 100%; }

/* Hour rows (background lines) */
.wv-hour-row {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  border-bottom: 1px solid var(--slate-100);
  pointer-events: none;
}
.wv-hour-label {
  width: 64px;
  flex-shrink: 0;
  padding: 4px 8px 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--slate-400);
  text-align: right;
  line-height: 1;
  border-right: 1px solid var(--slate-200);
  user-select: none;
}
.wv-hour-line { flex: 1; }

/* Day columns wrapper — sits on top of hour lines, offset past the time label */
.wv-cols-wrap {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 64px;
  right: 0;
  display: flex;
  flex-direction: row;
}

/* Each day column — flex children fill equal width */
.wv-day-col {
  flex: 1;
  position: relative;
  border-right: 1px solid var(--slate-100);
  cursor: pointer;
  transition: background .1s;
  min-width: 0;
}
.wv-day-col:hover { background: rgba(20,184,166,.02); }
.wv-day-col.wv-today { background: rgba(20,184,166,.04); }

/* Shift blocks inside a day column */
.wv-shift-block {
  position: absolute;
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  pointer-events: all;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: filter .15s, box-shadow .15s;
  border-left: 3px solid rgba(255,255,255,.35);
  z-index: 2;
}
.wv-shift-block:hover {
  filter: brightness(1.1);
  box-shadow: 0 3px 10px rgba(0,0,0,.3);
  z-index: 10;
}
.wsb-title {
  font-size: 10px;
  font-weight: 700;
  color: white;
  padding: 2px 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wsb-time {
  font-size: 9px;
  color: rgba(255,255,255,.85);
  padding: 0 4px;
  white-space: nowrap;
}
.wsb-people {
  font-size: 9px;
  color: rgba(255,255,255,.75);
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Month View */
.month-view { background: white; border-radius: var(--border-r); box-shadow: var(--shadow-sm); overflow: hidden; }
.month-header { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 2px solid var(--slate-200); }
.month-day-name { padding: 10px; text-align: center; font-size: 12px; font-weight: 700; color: var(--slate-600); }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-cell {
  min-height: 100px;
  border-right: 1px solid var(--slate-100);
  border-bottom: 1px solid var(--slate-100);
  padding: 4px;
  cursor: pointer;
  transition: background .1s;
}
.month-cell:hover { background: var(--teal-50); }
.month-cell.other-month { background: var(--slate-50); }
.month-cell.today-cell { background: rgba(20,184,166,.06); }
.month-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-700);
  margin-bottom: 3px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.month-cell.today-cell .month-date { background: var(--teal-600); color: white; }
.month-cell.other-month .month-date { color: var(--slate-400); }
.month-he { font-size: 9px; color: var(--teal-500); margin-bottom: 2px; }
.month-shift {
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  margin-bottom: 1px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}
.month-more { font-size: 10px; color: var(--teal-600); font-weight: 600; padding: 1px 4px; }

/* ==========================================
   OPEN SHIFTS
   ========================================== */
.shifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.open-shift-card {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--border-r);
  border: 1.5px solid rgba(255,255,255,0.65);
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(13,148,136,.1);
  transition: all .2s;
}
.open-shift-card:hover { border-color: var(--teal-300); box-shadow: var(--shadow); transform: translateY(-2px); }
.open-shift-card-header { padding: 14px 16px; color: white; }
.open-shift-card-header h4 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.open-shift-card-body { padding: 14px 16px; }
.open-shift-meta { font-size: 13px; color: var(--slate-600); margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.open-shift-meta i { color: var(--teal-500); width: 14px; }
.open-shift-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==========================================
   PEOPLE
   ========================================== */
.people-filters { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--slate-200);
  background: white;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  transition: all .15s;
}
.filter-btn.active { background: var(--teal-600); color: white; border-color: var(--teal-600); }
.filter-btn:hover:not(.active) { border-color: var(--teal-300); color: var(--teal-700); }

.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.person-card {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--border-r);
  padding: 18px;
  border: 1.5px solid rgba(255,255,255,0.65);
  box-shadow: 0 2px 16px rgba(13,148,136,.1);
  transition: all .2s;
}
.person-card:hover { border-color: var(--teal-200); box-shadow: var(--shadow); }
.person-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.person-card-info h4 { font-size: 15px; font-weight: 700; color: var(--slate-800); }
.person-card-info span { font-size: 12px; color: var(--slate-500); }
.person-card-details { font-size: 13px; color: var(--slate-600); display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.person-card-details i { color: var(--teal-500); width: 14px; }
.person-card-actions { display: flex; gap: 8px; }
.avatar-lg { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: white; flex-shrink: 0; }

.role-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}
.role-owner { background: linear-gradient(135deg,#0f766e,#0891b2); color: #fff; letter-spacing:.3px; }
.role-super_admin { background: #fef3c7; color: #92400e; }
.role-admin { background: #dbeafe; color: #1e40af; }
.role-coordinator { background: #d1fae5; color: #065f46; }
.role-user { background: var(--teal-50); color: var(--teal-700); }

/* ==========================================
   BULLETIN BOARD
   ========================================== */
.bulletin-container { display: flex; flex-direction: column; gap: 14px; }

.bulletin-post {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--border-r);
  border: 1.5px solid rgba(255,255,255,0.65);
  padding: 18px;
  box-shadow: 0 2px 16px rgba(13,148,136,.1);
  transition: all .15s;
}
.bulletin-post:hover { border-color: var(--teal-200); }
.bulletin-post.pinned { border-top: 3px solid var(--teal-500); }
.bulletin-post.urgent-post { border-left: 4px solid var(--red-500); }
.bulletin-post.important-post { border-left: 4px solid var(--amber-500); }

.bulletin-post-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.bulletin-post-header h4 { font-size: 15px; font-weight: 700; color: var(--slate-800); flex: 1; }
.priority-badge { padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.priority-normal { background: var(--slate-100); color: var(--slate-600); }
.priority-important { background: #fef3c7; color: #92400e; }
.priority-urgent { background: #fee2e2; color: #991b1b; }

.bulletin-post-meta { font-size: 12px; color: var(--slate-400); margin-bottom: 10px; }
.bulletin-post-content { font-size: 14px; color: var(--slate-700); line-height: 1.6; white-space: pre-wrap; }
.bulletin-post-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ==========================================
   MESSAGES
   ========================================== */
/* ══════════════════════════════════════════
   Single Team Chat Layout
   ══════════════════════════════════════════ */

.single-chat-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--border-r);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(13,148,136,.12);
  border: 1px solid rgba(255,255,255,0.7);
}

/* ── Chat header bar ── */
.chat-header {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(13,148,136,.12);
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 8px rgba(13,148,136,.08);
  flex-shrink: 0;
}

.team-chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-600), var(--cyan-600));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  flex-shrink: 0;
}

.team-chat-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate-800);
}

.team-chat-subtitle {
  font-size: 11px;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.online-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Messages scroll area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(240,253,250,0.55);
}

/* ── Date divider ── */
.msg-date-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 8px;
}
.msg-date-divider::before,
.msg-date-divider::after { content: ''; flex: 1; height: 1px; background: var(--slate-200); }
.msg-date-divider span { font-size: 11px; font-weight: 600; color: var(--slate-400); white-space: nowrap; padding: 0 4px; }

/* ── Welcome screen (empty state) ── */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 60px 40px;
  color: var(--slate-400);
}
.chat-welcome-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-100), var(--cyan-100));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--teal-500);
  margin-bottom: 18px;
}
.chat-welcome h3 { font-size: 18px; font-weight: 700; color: var(--slate-700); margin-bottom: 8px; }
.chat-welcome p { font-size: 13px; line-height: 1.7; color: var(--slate-500); }

/* ── Each message row ── */
.msg-row-wrap {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 720px;
  padding: 3px 0;
}
.msg-row-wrap.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg-row-wrap.other {
  align-self: flex-start;
}

/* Avatar circle beside bubble */
.msg-bubble-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Column: meta + bubble */
.msg-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 100%;
  min-width: 0;
}

/* Sender name + timestamp on same line */
.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px;
}
.msg-row-wrap.own .msg-meta { flex-direction: row-reverse; }

.msg-sender-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-700);
  white-space: nowrap;
}
/* own messages: name shown in muted color */
.msg-row-wrap.own .msg-sender-name { color: var(--slate-500); }

.msg-timestamp {
  font-size: 10px;
  color: var(--slate-400);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Bubble + delete button row */
.msg-bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.msg-row-wrap.own .msg-bubble-row { flex-direction: row-reverse; }

/* The bubble itself */
.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 520px;
}
.msg-bubble.own {
  background: linear-gradient(135deg, var(--teal-600), var(--cyan-600));
  color: white;
  border-bottom-right-radius: 5px;
  box-shadow: 0 2px 8px rgba(13,148,136,.25);
}
.msg-bubble.other {
  background: white;
  color: var(--slate-800);
  border-bottom-left-radius: 5px;
  border: 1px solid var(--slate-200);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* Delete button (appears on hover) */
.msg-delete-btn {
  background: none;
  border: none;
  color: var(--slate-300);
  cursor: pointer;
  font-size: 11px;
  padding: 5px 6px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
  flex-shrink: 0;
  align-self: center;
}
.msg-row-wrap:hover .msg-delete-btn { opacity: 1; }
.msg-delete-btn:hover { color: #ef4444; background: #fee2e2; }

/* ── Chat input area ── */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: white;
}
.chat-input-area textarea {
  flex: 1;
  border: 1.5px solid var(--slate-200);
  border-radius: 20px;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 13px;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color .2s, box-shadow .2s;
  background: var(--slate-50);
}
.chat-input-area textarea:focus {
  border-color: var(--teal-400);
  background: white;
  box-shadow: 0 0 0 3px rgba(20,184,166,.1);
}
.chat-input-area textarea::placeholder { color: var(--slate-400); }
.btn-send {
  background: linear-gradient(135deg, var(--teal-600), var(--cyan-600));
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all .15s;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(13,148,136,.3);
}
.btn-send:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(13,148,136,.4); }
.btn-send:active { transform: scale(.96); }

/* ==========================================
   NOTIFICATIONS
   ========================================== */
.notifications-container { display: flex; flex-direction: column; gap: 8px; }

.notif-item {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--border-r-sm);
  padding: 14px 16px;
  border: 1.5px solid rgba(255,255,255,0.65);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  transition: all .15s;
}
.notif-item.unread { border-left: 4px solid var(--teal-500); background: rgba(204,251,241,0.75); }
.notif-item:hover { border-color: var(--teal-300); }
.notif-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.notif-icon.shift { background: var(--teal-100); color: var(--teal-700); }
.notif-icon.bulletin { background: #fef3c7; color: #92400e; }
.notif-icon.message { background: #dbeafe; color: #1e40af; }
.notif-title { font-size: 13px; font-weight: 700; color: var(--slate-800); margin-bottom: 2px; }
.notif-msg { font-size: 12px; color: var(--slate-600); }
.notif-time { font-size: 11px; color: var(--slate-400); margin-top: 3px; }

/* ==========================================
   AUDIT LOG
   ========================================== */
.audit-container { background: rgba(255,255,255,0.82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: var(--border-r); box-shadow: 0 2px 16px rgba(13,148,136,.1); border: 1px solid rgba(255,255,255,0.65); overflow: hidden; }
.audit-table { width: 100%; border-collapse: collapse; }
.audit-table th { padding: 12px 16px; background: var(--teal-50); font-size: 12px; font-weight: 700; color: var(--slate-700); text-align: left; border-bottom: 2px solid var(--teal-200); }
.audit-table td { padding: 12px 16px; font-size: 13px; color: var(--slate-700); border-bottom: 1px solid var(--slate-100); }
.audit-table tr:hover td { background: var(--slate-50); }

/* ==========================================
   SETTINGS
   ========================================== */
.settings-container { display: flex; flex-direction: column; gap: 20px; max-width: 700px; }

.settings-card {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--border-r);
  padding: 20px;
  box-shadow: 0 2px 16px rgba(13,148,136,.1);
  border: 1.5px solid rgba(255,255,255,0.65);
}
.settings-card h3 { font-size: 16px; font-weight: 700; color: var(--slate-800); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.settings-card h3 i { color: var(--teal-600); }

.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--slate-100); }
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 14px; color: var(--slate-700); }
.settings-row-label span { display: block; font-size: 12px; color: var(--slate-400); margin-top: 2px; }

/* Toggle Switch */
.toggle-switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--slate-300);
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle-switch input:checked + .toggle-slider { background: var(--teal-500); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.profile-form { display: flex; flex-direction: column; gap: 12px; }
.profile-form .form-row { display: flex; gap: 12px; }

/* ==========================================
   MODALS
   ========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,80,80,.35);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(13,148,136,.2), 0 4px 16px rgba(0,0,0,.1);
  border: 1px solid rgba(255,255,255,0.75);
  animation: modalIn .2s ease;
}
.modal.modal-sm { max-width: 400px; }

@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(-10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-200);
  background: linear-gradient(135deg, var(--teal-50), white);
}
.modal-header h3 { font-size: 17px; font-weight: 800; color: var(--slate-800); }
.modal-close { background: none; border: none; color: var(--slate-400); cursor: pointer; font-size: 18px; padding: 4px; border-radius: 6px; transition: all .15s; }
.modal-close:hover { background: var(--slate-100); color: var(--slate-700); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--slate-200); display: flex; justify-content: flex-end; gap: 10px; background: var(--slate-50); }

.modal-info { font-size: 13px; color: var(--slate-600); background: var(--teal-50); border: 1px solid var(--teal-200); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* People checkboxes in modals */
.people-checkboxes { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; background: var(--slate-50); border-radius: 8px; padding: 8px; border: 1.5px solid var(--slate-200); }
.person-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .1s;
}
.person-checkbox:hover { background: var(--teal-50); }
.person-checkbox input { accent-color: var(--teal-500); width: 15px; height: 15px; }

/* Dup days grid */
.dup-days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dup-day { text-align: center; }
.dup-day input { display: none; }
.dup-day label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--slate-200);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  color: var(--slate-600);
}
.dup-day input:checked + label { background: var(--teal-600); border-color: var(--teal-600); color: white; }
.dup-day label:hover { border-color: var(--teal-400); }

/* Invite result */
.invite-result {
  background: var(--teal-50);
  border: 1.5px solid var(--teal-200);
  border-radius: 10px;
  padding: 14px;
  margin-top: 12px;
}
.invite-result p { font-size: 13px; color: var(--teal-800); margin-bottom: 6px; }
.invite-token-box {
  background: white;
  border: 1.5px solid var(--teal-300);
  border-radius: 8px;
  padding: 10px;
  font-family: monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--teal-700);
  word-break: break-all;
  text-align: center;
  letter-spacing: 2px;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid;
  min-width: 280px;
  max-width: 380px;
  animation: toastIn .3s ease;
  font-size: 13px;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }

.toast-success { border-color: var(--green-500); }
.toast-success i { color: var(--green-500); }
.toast-error { border-color: var(--red-500); }
.toast-error i { color: var(--red-500); }
.toast-info { border-color: var(--teal-500); }
.toast-info i { color: var(--teal-500); }
.toast-warning { border-color: var(--amber-500); }
.toast-warning i { color: var(--amber-500); }
.toast-content { flex: 1; }
.toast-title { font-weight: 700; color: var(--slate-800); }
.toast-msg { color: var(--slate-600); margin-top: 1px; }

/* ==========================================
   UTILITIES
   ========================================== */
.hidden { display: none !important; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--slate-400); }
.empty-state i { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dash-today, .dash-open, .dash-upcoming, .dash-bulletin, .dash-messages { grid-column: 1; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close { display: flex; align-items: center; }
  .main-content { margin-left: 0; }
  .menu-btn { display: flex; }
  .page-content { padding: 16px; }
  .form-row { flex-direction: column; }
  .messages-layout { height: calc(100vh - var(--header-h) - 32px); position: relative; }
  .conversations-panel { width: 100%; display: none; position: absolute; inset: 0; z-index: 5; border-radius: var(--border-r); }
  .conversations-panel.mobile-show { display: flex; }
  .chat-panel { width: 100%; }
  .week-view { overflow-x: auto; }
  .week-header { min-width: 500px; }
  .wv-inner { min-width: 500px; }
  .month-cell { min-height: 60px; }
  .dashboard-grid { gap: 14px; }
  .shift-modal-title { font-size: 15px; }
}

@media (max-width: 480px) {
  .auth-container { padding: 28px 20px; }
  .people-grid { grid-template-columns: 1fr; }
  .shifts-grid { grid-template-columns: 1fr; }
  .modal { max-width: 100%; margin: 0; border-radius: 16px 16px 0 0; max-height: 95vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; }
}

/* ==========================================
   AUTH TABS
   ========================================== */
.auth-tabs {
  display: flex;
  background: var(--slate-100);
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  padding: 8px 6px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-500);
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font);
}
.auth-tab.active {
  background: var(--white);
  color: var(--teal-700);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.auth-tab:hover:not(.active) { color: var(--teal-600); }

.auth-form-desc {
  font-size: 13px;
  color: var(--slate-500);
  margin-bottom: 18px;
  line-height: 1.5;
}

.auth-link-sm {
  text-align: center;
  font-size: 12px;
  color: var(--slate-400);
  margin-top: 12px;
}
.auth-link-sm a {
  color: var(--teal-600);
  font-weight: 600;
  text-decoration: none;
}
.auth-link-sm a:hover { text-decoration: underline; }

/* Auth divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--slate-300);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--slate-200);
}
.auth-divider span { color: var(--slate-400); white-space: nowrap; }

/* ==========================================
   GOOGLE SIGN-IN BUTTON
   ========================================== */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--border-r-sm);
  background: var(--white);
  color: var(--slate-700);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.btn-google:hover {
  background: var(--slate-50);
  border-color: var(--slate-300);
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.btn-google svg { flex-shrink: 0; }

/* ==========================================
   AUTH EXTRAS — loading, Google info, helpers
   ========================================== */

/* Required field asterisk */
.req { color: var(--red-600); margin-left: 2px; }

/* Auth loading overlay on buttons */
.btn[disabled] {
  opacity: .7;
  cursor: not-allowed;
}
.btn.btn-primary[disabled] {
  background: var(--teal-400);
}

/* Google info banner (shown when Google Sign-In is not configured) */
.google-info-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 16px;
  font-size: 12.5px;
  color: #1e40af;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-6px);} to { opacity:1; transform:translateY(0);} }

/* Auth loading state — full-form overlay */
.auth-form.loading {
  pointer-events: none;
  opacity: .7;
}
.auth-loading-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--teal-400), var(--cyan-400), var(--teal-400));
  background-size: 200%;
  border-radius: 2px;
  margin-bottom: 16px;
  animation: shimmer 1.2s infinite linear;
  display: none;
}
.auth-form.loading .auth-loading-bar { display: block; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Auth container scrollable on small screens */
.auth-screen {
  overflow-y: auto;
  align-items: flex-start;
  padding-top: 24px;
  padding-bottom: 24px;
}
.auth-container {
  max-height: none !important;
  margin: auto;
}

/* Google button container placeholder (when real button is not rendered) */
.google-btn-container:empty { display: none; }

/* ==========================================
   FAMILIES PANEL (Owner only)
   ========================================== */
/* Stats row */
.families-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.fam-stat-card {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  border-radius: var(--border-r);
  border: 1px solid rgba(255,255,255,.6);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}
.fam-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.fam-stat-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--slate-800);
  line-height: 1;
}
.fam-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 3px;
}

/* Toolbar */
.families-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.families-search {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.82);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--border-r-sm);
  padding: 0 12px;
}
.families-search i { color: var(--slate-400); font-size: 13px; }
.families-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 14px;
  font-family: var(--font);
  color: var(--slate-800);
  outline: none;
}

/* Table */
.families-table-wrap {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  border-radius: var(--border-r);
  border: 1px solid rgba(255,255,255,.6);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.families-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.families-table thead th {
  background: rgba(248,250,252,0.9);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--slate-100);
}
.families-table tbody tr {
  border-bottom: 1px solid var(--slate-100);
  transition: background .15s;
}
.families-table tbody tr:last-child { border-bottom: none; }
.families-table tbody tr:hover { background: rgba(240,253,250,.7); }
.families-table tbody td { padding: 12px 16px; vertical-align: middle; }

/* Family name cell */
.fam-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fam-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal-500), var(--cyan-600));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fam-name { font-weight: 700; color: var(--slate-800); }
.fam-id-label { font-size: 10px; color: var(--slate-400); margin-top: 1px; }
.fam-members-count { font-weight: 700; color: var(--teal-700); }

/* Plan badges */
.plan-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.plan-free { background: var(--slate-100); color: var(--slate-500); }
.plan-pro  { background: linear-gradient(135deg,#7c3aed,#a855f7); color:#fff; }

/* Actions */
.fam-actions { display: flex; gap: 4px; }

/* Status badges (shared) */
.status-active    { background: #dcfce7; color: #166534; }
.status-suspended { background: #fee2e2; color: #991b1b; }

/* Nav families highlight */
.nav-families { border-top: 1px solid rgba(255,255,255,.15); margin-top: 4px; padding-top: 4px; }

/* Owner dashboard prompt */
.owner-dash-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--slate-500);
  cursor: pointer;
}
.owner-dash-prompt i { font-size: 28px; color: var(--teal-400); margin-bottom: 8px; }
.owner-dash-prompt p { font-size: 13px; }

/* ==========================================
   PWA INSTALL BANNER
   ========================================== */
.pwa-install-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  z-index: 8888;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: 0 8px 40px rgba(13,148,136,.22), 0 2px 12px rgba(0,0,0,.12);
  border: 1.5px solid rgba(255,255,255,0.8);
  min-width: 320px;
  max-width: 460px;
  width: calc(100vw - 48px);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .35s ease;
  opacity: 0;
  pointer-events: none;
}
.pwa-install-banner.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.pwa-install-icon img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(13,148,136,.2);
  flex-shrink: 0;
}

.pwa-install-text {
  flex: 1;
  min-width: 0;
}
.pwa-install-text strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--slate-800);
  margin-bottom: 2px;
}
.pwa-install-text span {
  display: block;
  font-size: 12px;
  color: var(--slate-500);
  line-height: 1.4;
}

.pwa-install-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pwa-install-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--teal-600), var(--cyan-600));
  color: white;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 2px 8px rgba(13,148,136,.3);
  white-space: nowrap;
}
.pwa-install-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(13,148,136,.4);
}
.pwa-install-btn:active { transform: translateY(0); }

.pwa-install-dismiss {
  background: var(--slate-100);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-400);
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
  font-family: var(--font);
}
.pwa-install-dismiss:hover {
  background: var(--slate-200);
  color: var(--slate-600);
}

@media (max-width: 480px) {
  .pwa-install-banner {
    bottom: 16px;
    left: 16px;
    right: 16px;
    width: auto;
    transform: translateX(0) translateY(120px);
    min-width: 0;
  }
  .pwa-install-banner.visible {
    transform: translateX(0) translateY(0);
  }
}

/* ==========================================
   PWA — Safe area insets (notched phones)
   ========================================== */
@supports (padding: env(safe-area-inset-bottom)) {
  .chat-input-area {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .sidebar {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .pwa-install-banner {
    bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .toast-container {
    bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

