* { box-sizing: border-box; }

:root {
  --maroon-dark: #4A0808;
  --maroon: #6B0D0D;
  --maroon-mid: #7B1010;
  --maroon-light: #8B1212;
  --eg-border: #C08080;
  --green: #10B981;
  --blue-badge: #3B82F6;
  --amber-badge: #D97706;
  --purple-badge: #7C3AED;
  --red-badge: #DC2626;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #F0F2F5;
  color: #1f2937;
  margin: 0;
  min-height: 100vh;
}

/* ---------- Login page ---------- */

.login-shell { min-height: 100vh; display: flex; flex-direction: column; }

.login-topbar {
  background: var(--maroon-mid);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 0.95rem;
}

.login-body { flex: 1; display: flex; flex-wrap: wrap; }

.login-brand {
  flex: 1 1 480px;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, var(--maroon-light), var(--maroon) 60%, var(--maroon-dark));
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
}
.login-brand::before, .login-brand::after {
  content: '';
  position: absolute;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  pointer-events: none;
}
.login-brand::before { width: 560px; height: 560px; }
.login-brand::after { width: 380px; height: 380px; }

.login-brand > * { position: relative; z-index: 1; }

.login-brand img { width: 104px; height: 104px; border-radius: 20px; background: #fff; padding: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.login-brand h1 { font-size: 1.85rem; margin: 24px 0 6px; font-weight: 800; letter-spacing: -0.01em; }
.login-brand p.tagline { opacity: 0.9; margin: 0 0 26px; font-size: 0.92rem; line-height: 1.5; }
.login-brand .pill {
  border: 1px solid rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 7px 22px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 32px;
  letter-spacing: 0.02em;
}

.feature-list { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; }
.feature-card {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 14px 18px;
  text-align: left;
  backdrop-filter: blur(2px);
}
.feature-card b { display: block; font-size: 0.92rem; }
.feature-card span { font-size: 0.78rem; opacity: 0.85; }

.login-form-panel {
  flex: 1 1 380px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 64px;
  box-shadow: -8px 0 24px rgba(0,0,0,0.06);
}
.login-form-panel h2 { margin: 0 0 6px; font-size: 1.6rem; color: var(--maroon-mid); font-weight: 800; }
.login-form-panel p.sub { color: #6b7280; margin: 0 0 28px; font-size: 0.9rem; }
.login-form-panel input { padding: 12px 14px; border-radius: 10px; }
.login-form-panel button.full { padding: 13px; border-radius: 10px; font-size: 0.95rem; letter-spacing: 0.01em; }
@media (max-width: 900px) { .login-form-panel { padding: 40px 28px; } }

.login-footer {
  background: var(--maroon-mid);
  color: rgba(255,255,255,0.85);
  text-align: center;
  font-size: 0.75rem;
  padding: 8px;
}

/* ---------- Shared form controls ---------- */

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  margin-top: 16px;
  color: #374151;
}

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #FAFAFA;
}
input:focus, textarea:focus, select:focus { background: #fff; border-color: var(--maroon-mid); outline: none; }
textarea { resize: vertical; min-height: 70px; }

button {
  padding: 11px 18px;
  border: none;
  border-radius: 8px;
  background: var(--maroon-mid);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--maroon-dark); }
button.secondary { background: transparent; color: var(--maroon-mid); border: 1px solid var(--maroon-mid); }
button.secondary:hover { background: #FEF2F2; }
button.full { width: 100%; }

.error {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-top: 16px;
}
.dev-otp {
  margin-top: 16px;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* ---------- App shell ---------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--maroon-dark), var(--maroon-mid) 55%, var(--maroon-light));
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 20px; }
.sidebar-logo img { width: 56px; height: 56px; border-radius: 12px; background: #fff; padding: 6px; }
.sidebar-logo h1 { font-size: 1rem; margin: 10px 0 0; }
.sidebar-logo p { font-size: 0.75rem; opacity: 0.75; margin: 2px 0 0; }

.profile-card {
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 20px;
}
.profile-top { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #DC2626;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.profile-name { font-weight: 700; font-size: 0.9rem; }
.profile-designation { font-size: 0.75rem; opacity: 0.75; }
.role-pill {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--green);
  color: #fff;
}
.role-pill.role-District { background: var(--blue-badge); }
.role-pill.role-Field { background: var(--amber-badge); }
.role-pill.role-Zone { background: var(--purple-badge); }
.profile-district { font-size: 0.72rem; opacity: 0.8; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.15); }

.menu-label { font-size: 0.7rem; letter-spacing: 0.08em; opacity: 0.6; margin: 4px 0 8px 8px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: rgba(255,255,255,0.85);
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer; margin-bottom: 2px;
  transition: transform 0.1s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); transform: translateX(2px); }
.nav-item.active { background: rgba(255,255,255,0.18); color: #fff; }

.sidebar-bottom { margin-top: auto; }
.logout-btn {
  width: 100%; background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3); color: #fff;
}
.logout-btn:hover { background: rgba(255,255,255,0.2); }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: #fff;
  padding: 18px 28px;
  border-bottom: 2px solid var(--maroon-mid);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { margin: 0; font-size: 1.25rem; }
.topbar p { margin: 2px 0 0; color: #6b7280; font-size: 0.85rem; }

.content { padding: 24px 28px; flex: 1; }

/* ---------- Cards ---------- */

.panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  margin-bottom: 24px;
  overflow: hidden;
}
.panel-header {
  padding: 14px 24px;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-header.blue { background: linear-gradient(90deg, #1F4E79, #2563EB); }
.panel-header.teal { background: linear-gradient(90deg, #0F766E, #059669); }
.panel-header.orange { background: linear-gradient(90deg, #C2410C, #D97706); }
.panel-header.purple { background: linear-gradient(90deg, #5B21B6, #7C3AED); }
.panel-body { padding: 24px; }

/* ---------- Meeting type / duration pickers ---------- */

.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 8px; }
.type-card {
  border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 14px 8px; text-align: center; cursor: pointer;
  font-size: 0.8rem; font-weight: 600; color: #374151;
  background: #FAFAFA;
}
.type-card .icon { font-size: 1.4rem; display: block; margin-bottom: 6px; }
.type-card.selected { border-color: var(--maroon-mid); background: #FEF2F2; color: var(--maroon-mid); }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pill-btn {
  border: 1px solid #d1d5db; border-radius: 999px;
  padding: 7px 16px; font-size: 0.82rem; font-weight: 600;
  background: #fff; color: #374151; cursor: pointer;
}
.pill-btn.selected { background: var(--maroon-mid); border-color: var(--maroon-mid); color: #fff; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Filters row ---------- */

.filters-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.month-nav { display: flex; align-items: center; gap: 10px; margin: 0 auto 16px; justify-content: center; }
.month-nav button { padding: 6px 12px; }
.month-nav span { font-weight: 700; }
.filters-row select, .filters-row input { width: auto; flex: 1 1 180px; margin: 0; }
.csv-btn { background: #059669; flex-shrink: 0; }
.csv-btn:hover { background: #047857; }
.results-count { color: #6b7280; font-size: 0.85rem; margin-bottom: 10px; }

/* ---------- Tables & badges ---------- */

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
th { color: #6b7280; font-weight: 700; font-size: 0.72rem; text-transform: uppercase; background: #F9FAFB; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.badge-Planned { background: #DBEAFE; color: #1D4ED8; }
.badge-Follow-up { background: #EDE9FE; color: #6D28D9; }
.badge-Conducted { background: #D1FAE5; color: #047857; }
.badge-Postponed { background: #FEF3C7; color: #92400E; }
.badge-Cancelled { background: #FEE2E2; color: #B91C1C; }

.mom-pending { background: #FEF3C7; color: #92400E; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.mom-link {
  display: inline-block; background: #1E3A8A; color: #fff; text-decoration: none;
  padding: 4px 10px; border-radius: 6px; font-size: 0.72rem; font-weight: 700; margin: 2px 4px 2px 0;
}
.upload-label {
  display: inline-block; background: #EDE9FE; color: #5B21B6;
  padding: 4px 10px; border-radius: 6px; font-size: 0.72rem; font-weight: 700; cursor: pointer;
}
.upload-label input { display: none; }

.empty-state { text-align: center; padding: 60px 20px; color: #6b7280; }
.empty-state .icon { font-size: 2.5rem; display: block; margin-bottom: 12px; }
.empty-state h3 { color: #1f2937; margin: 0 0 4px; }

.action-link {
  background: none; border: none; color: #4f46e5; cursor: pointer;
  font-size: 0.85rem; padding: 0; margin: 0; width: auto; font-weight: 700;
}
.action-link:hover { text-decoration: underline; background: none; }

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 100;
}
.modal-box { background: #fff; border-radius: 12px; padding: 28px; width: 100%; max-width: 420px; }

.colleague-row {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.colleague-row:hover { background: #FEF2F2; }
.colleague-row .name { font-weight: 600; font-size: 0.88rem; }
.colleague-row .meta { font-size: 0.75rem; color: #6b7280; }

/* ---------- Toasts ---------- */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
}
.toast {
  min-width: 240px;
  max-width: 360px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.25s ease-out;
  border-left: 4px solid #10B981;
}
.toast.error { border-left-color: #DC2626; }
.toast.leaving { animation: toast-out 0.25s ease-in forwards; }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { from { transform: translateX(0); opacity: 1; } to { transform: translateX(30px); opacity: 0; } }

/* ---------- Loading / disabled buttons ---------- */

button:disabled { opacity: 0.65; cursor: not-allowed; }
.spinner {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: -2px;
}
button.secondary .spinner { border-color: rgba(123,16,16,0.35); border-top-color: var(--maroon-mid); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Inline field errors ---------- */

.field-error { color: #b91c1c; font-size: 0.75rem; margin-top: 4px; }
.field-invalid { border-color: #DC2626 !important; background: #FEF2F2 !important; }

/* ---------- Mobile: tables become stacked cards ---------- */

@media (max-width: 720px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 8px 12px;
  }
  table.responsive td {
    border-bottom: none;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    text-align: right;
  }
  table.responsive td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    color: #6b7280;
    text-align: left;
    flex-shrink: 0;
  }
}
