:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1d1f23;
  --muted: #6b7280;
  --accent: #0b5e6f;
  --accent-light: #e0f2f1;
  --danger: #b91c1c;
  --success: #047857;
  --shadow: 0 10px 30px rgba(0,0,0,0.08);
  --radius: 14px;
  --font: "Poppins", "Helvetica", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(circle at top, #ffffff, #eef2f5 60%);
  color: var(--text);
}

/* ----- App layout: sidebar fixed, only main content scrolls ----- */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 240px;
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  height: 100vh;
}

.sidebar-brand {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 12px 0;
}

.sidebar-nav a {
  display: block;
  padding: 10px 20px;
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}

.sidebar-nav a.active {
  background: rgba(15, 118, 110, 0.35);
  color: #fff;
  border-left: 3px solid var(--accent);
  padding-left: 17px;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logout { margin: 0; }
.sidebar-logout-btn {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}
.sidebar-logout-btn:hover {
  background: rgba(255,255,255,0.08);
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.app-main .topbar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  z-index: 9;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-notif-wrap {
  position: relative;
}

.topbar-notif {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 8px;
}
.topbar-notif:hover {
  background: rgba(0,0,0,0.05);
}

.topbar-notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  display: none;
  align-items: center;
  justify-content: center;
}
.topbar-notif-badge.show {
  display: inline-flex !important;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 24px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.06);
  z-index: 1000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 400px;
}
.notif-dropdown[hidden] {
  display: none !important;
}

.notif-dropdown-header {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid #e5e7eb;
  background: #fafafa;
}

.notif-dropdown-body {
  overflow-y: auto;
  max-height: 320px;
  padding: 8px 0;
}

.notif-dropdown-body .notif-item {
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text);
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}
.notif-dropdown-body .notif-item:hover {
  background: #f9fafb;
}
.notif-dropdown-body .notif-item:last-child {
  border-bottom: none;
}

.notif-dropdown-footer {
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid #e5e7eb;
  background: #fafafa;
}
.notif-dropdown-body:not(:empty) + .notif-dropdown-footer {
  display: none;
}
.topbar-user-wrap {
  position: relative;
}
.topbar-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  font-size: 0.9rem;
  transition: background 0.15s;
}
.topbar-user-trigger:hover {
  background: rgba(0,0,0,0.05);
}
.topbar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e7eb;
}
.topbar-user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .topbar-user-name { display: none; }
}
.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  max-width: calc(100vw - 24px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.06);
  z-index: 1000;
  overflow: hidden;
}
.profile-dropdown[hidden] {
  display: none !important;
}
.profile-dropdown-header {
  padding: 20px 16px;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
  background: #fafafa;
}
.profile-dropdown-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e7eb;
  margin-bottom: 10px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.profile-dropdown-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
.profile-dropdown-role {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 2px;
}
.profile-dropdown-body {
  padding: 14px 16px;
}
.profile-dropdown-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  font-size: 0.875rem;
  border-bottom: 1px solid #f3f4f6;
}
.profile-dropdown-row:last-child {
  border-bottom: none;
}
.profile-dropdown-label {
  color: var(--muted);
  font-weight: 500;
  flex-shrink: 0;
}
.profile-dropdown-footer {
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #fafafa;
  text-align: center;
}
.profile-dropdown-link {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.profile-dropdown-link:hover {
  text-decoration: underline;
}

.app-main .container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.topbar nav a,
.topbar nav button.link {
  margin-right: 16px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
}

.link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}

.topbar nav button.link:hover,
.topbar nav a:hover {
  color: var(--accent);
}

.inline {
  display: inline;
}

.container {
  padding: 32px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.panel {
  background: var(--panel);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--panel);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.button, button {
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.button-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  text-decoration: none;
  display: inline-block;
  font-size: inherit;
  font-family: inherit;
}
.button-outline:hover {
  background: var(--accent-light);
}

.case-file-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.case-file-actions .button-download {
  text-decoration: none;
  display: inline-block;
}

.button-sm {
  padding: 6px 12px;
  font-size: 0.9rem;
  margin-left: 8px;
  vertical-align: middle;
}

/* ----- Cases list filters ----- */
.cases-filters {
  margin-bottom: 24px;
}
.cases-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}
.cases-filter-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}
.cases-filter-row label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cases-filter-row select,
.cases-filter-row input[type="date"],
.cases-filter-row input[type="text"] {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 0.875rem;
  min-width: 120px;
}
.cases-filter-row--search { min-width: 180px; }
.cases-filter-row--search input { min-width: 180px; }
.cases-filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cases-filter-summary {
  margin: 12px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}
.cases-empty {
  margin-top: 16px;
  color: var(--muted);
}
.cases-empty a { color: var(--accent); }

.auth-card {
  max-width: 420px;
  margin: 60px auto;
  background: var(--panel);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  gap: 12px;
}

input, select, textarea {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
}

label {
  font-weight: 600;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table th, table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
}

.badge.open { background: #2563eb; }
.badge.in_progress { background: #f59e0b; }
.badge.escalated { background: #b91c1c; }
.badge.closed { background: #16a34a; }

.alert {
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.alert.error { background: #fee2e2; color: #991b1b; }
.alert.success { background: #dcfce7; color: #166534; }

/* ----- Profile page ----- */
.profile-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}
.profile-card {
  text-align: center;
}
.profile-photo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.profile-photo-img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent-light);
}
.profile-photo-upload form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.profile-upload-input { width: 0; height: 0; opacity: 0; position: absolute; }
.profile-upload-label { cursor: pointer; }
.profile-info h2 { margin-top: 0; }
.profile-info h3 { margin: 20px 0 12px; font-size: 1rem; }
.profile-dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
  margin: 0;
}
.profile-dl dt { color: var(--muted); font-weight: 600; }
.profile-dl dd { margin: 0; }
.profile-form { grid-template-columns: 120px 1fr; max-width: 400px; }
.profile-form label { grid-column: 1; }
.profile-form input { grid-column: 2; }
.profile-form button { grid-column: 2; }
.profile-note { font-size: 0.875rem; color: var(--muted); margin-top: 12px; }

.text-danger {
  color: var(--danger);
  font-weight: 600;
}

/* ----- Org chart tree (level-based: same level = same row) ----- */
.org-chart-panel h2 { margin-top: 0; }

.org-tree {
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.org-tree-empty {
  color: var(--muted);
  margin: 0;
}

.org-tree-level {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
}

.org-tree-level:last-child {
  margin-bottom: 0;
}

.org-tree-connector {
  width: 2px;
  height: 24px;
  background: #cbd5e1;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.org-tree-level-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
}

.org-tree-level-nodes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  align-items: flex-start;
}

.org-tree-card {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  min-width: 260px;
  max-width: 320px;
}

.org-tree-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Role-based box highlight: Management */
.org-tree-card--management {
  border-left: 4px solid #6366f1;
  background: linear-gradient(to right, rgba(99, 102, 241, 0.06), #fff);
}

.org-tree-card--management:hover {
  border-color: #6366f1;
}

/* Role-based box highlight: Team Lead */
.org-tree-card--team_lead {
  border-left: 4px solid #0ea5e9;
  background: linear-gradient(to right, rgba(14, 165, 233, 0.06), #fff);
}

.org-tree-card--team_lead:hover {
  border-color: #0ea5e9;
}

/* Role-based box highlight: Center Head */
.org-tree-card--center_head {
  border-left: 4px solid #0d9488;
  background: linear-gradient(to right, rgba(13, 148, 136, 0.06), #fff);
}

.org-tree-card--center_head:hover {
  border-color: #0d9488;
}

/* Role-based box highlight: Volunteer */
.org-tree-card--volunteer {
  border-left: 4px solid #22c55e;
  background: linear-gradient(to right, rgba(34, 197, 94, 0.06), #fff);
}

.org-tree-card--volunteer:hover {
  border-color: #22c55e;
}

.org-tree-node-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}

.org-tree-node-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.org-tree-node-name {
  font-size: 1rem;
  color: var(--text);
}

.org-tree-node-role {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}

.org-tree-node-contact {
  font-size: 0.75rem;
  color: var(--muted);
}

.profile-photo img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.list li {
  padding: 8px 0;
  border-bottom: 1px solid #e5e7eb;
}

.file-links .sep,
.list li .sep {
  margin: 0 0.5rem;
  color: var(--muted);
}

.timeline {
  width: 100%;
  height: 12px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.timeline-bar {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #0ea5e9);
}

#notifications .note {
  padding: 10px;
  background: var(--accent-light);
  border-radius: 8px;
  margin-bottom: 10px;
}

/* ----- Dashboard: status cards (like reference) ----- */
/* ----- Dashboard (reference-style layout) ----- */
.dashboard-breadcrumb {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.dashboard-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}
.dashboard-breadcrumb a:hover {
  color: var(--accent);
}

.dashboard-toolbar {
  margin-bottom: 24px;
}
.dashboard-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}
.dashboard-welcome {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.kpi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  display: block;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  position: relative;
  border: 1px solid #f1f5f9;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: #e2e8f0;
}
.kpi-card__icon {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.25rem;
  opacity: 0.8;
}
.kpi-card__value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.kpi-card__label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}
.kpi-card__meta {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.kpi-card__arrow {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 600;
}
.kpi-card--open .kpi-card__value,
.kpi-card--open .kpi-card__arrow { color: #d97706; }
.kpi-card--progress .kpi-card__value,
.kpi-card--progress .kpi-card__arrow { color: #2563eb; }
.kpi-card--escalated .kpi-card__value,
.kpi-card--escalated .kpi-card__arrow { color: #dc2626; }
.kpi-card--closed .kpi-card__value,
.kpi-card--closed .kpi-card__arrow { color: #16a34a; }
.kpi-card--overdue .kpi-card__value,
.kpi-card--overdue .kpi-card__arrow { color: #b91c1c; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.dashboard-panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #f1f5f9;
  overflow: hidden;
  margin-bottom: 24px;
}
.dashboard-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafafa;
}
.dashboard-panel__head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.dashboard-panel__sub {
  font-size: 0.8125rem;
  color: var(--muted);
}
.dashboard-panel__link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.dashboard-panel__link:hover { text-decoration: underline; }
.dashboard-panel__body {
  padding: 20px;
}

.dashboard-panel--chart .chart-wrap {
  height: 220px;
  position: relative;
}
.chart-empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  padding: 24px 0;
}

.dashboard-panel--map .dashboard-panel__body {
  padding: 0;
}
.dashboard-map {
  height: 320px;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
  background: var(--bg);
}
.dashboard-map-empty { display: flex; align-items: center; justify-content: center; min-height: 200px; }
.dashboard-map-empty-msg { margin: 0; color: var(--muted); padding: 24px; }

.overview-table-wrap {
  overflow-x: auto;
}
.overview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.overview-table th,
.overview-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}
.overview-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.overview-table tbody tr:hover {
  background: #fafafa;
}
.overview-table-empty {
  color: var(--muted);
  text-align: center;
  padding: 24px !important;
}
.overview-table-empty a { color: var(--accent); }
.overview-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}
.overview-badge--open { background: #fef3c7; color: #b45309; }
.overview-badge--in_progress { background: #dbeafe; color: #1d4ed8; }
.overview-badge--escalated { background: #fee2e2; color: #b91c1c; }
.overview-badge--closed { background: #dcfce7; color: #166534; }
.overview-badge--overdue { background: #fecaca; color: #991b1b; }
.overview-link {
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.overview-link:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .sidebar { width: 100%; height: auto; min-height: 0; }
  .app-layout { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
  .app-main { overflow: visible; }
  .app-main .container { overflow: visible; }
  .kpi-cards { grid-template-columns: repeat(2, 1fr); }
  .profile-layout { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .kpi-cards { grid-template-columns: 1fr; }
}

/* ----- Auth pages (login: two-column light theme) ----- */
.auth-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "DM Sans", system-ui, sans-serif;
  position: relative;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.auth-page--light {
  background: #f8fafc;
  color: #1e293b;
}

.auth-page__main {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

/* Two-column layout */
.auth-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  padding: 32px;
}

.auth-panel--left {
  flex: 1;
  min-width: 0;
  background: linear-gradient(145deg, #e0f2f1 0%, #f0fdfa 40%, #f8fafc 100%);
  justify-content: flex-start;
  position: relative;
}

.auth-back {
  position: absolute;
  top: 32px;
  right: 32px;
  z-index: 2;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  transition: background 0.2s, color 0.2s;
}

.auth-back:hover {
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
}

.auth-panel__hero {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #e0f2f1;
}

.auth-panel__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.2) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 48px 32px;
}

.auth-panel__overlay .auth-panel__logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin-bottom: 12px;
}

.auth-panel__overlay .auth-panel__name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.auth-panel__overlay .auth-panel__tagline {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  font-weight: 500;
  line-height: 1.4;
}

/* Right panel: form */
.auth-panel--right {
  width: 100%;
  max-width: 460px;
  flex-shrink: 0;
  background: #ffffff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.06);
  justify-content: center;
}

.auth-form-wrap {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  padding: 24px 0;
}

.auth-form__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.auth-form__sub {
  font-size: 0.9375rem;
  color: #64748b;
  margin: 0 0 28px;
}

.auth-form__sub a {
  color: #0d9488;
  font-weight: 500;
  text-decoration: none;
}

.auth-form__sub a:hover {
  text-decoration: underline;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
}

.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: #1e293b;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.auth-form input::placeholder {
  color: #94a3b8;
}

.auth-form input:hover {
  border-color: #cbd5e1;
}

.auth-form input:focus {
  outline: none;
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.auth-password-input {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-password-input input {
  padding-right: 48px;
}
.auth-password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-password-toggle:hover {
  color: #0d9488;
}
.auth-password-icon--eye-off[hidden] { display: none !important; }

.auth-form__submit {
  width: 100%;
  padding: 14px 20px;
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #0d9488 0%, #0f766e 100%);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.auth-form__submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.35);
}

.auth-form__submit:active {
  transform: translateY(0);
}

.auth-form__forgot {
  margin: 12px 0 0;
  font-size: 0.875rem;
}

.auth-form__forgot a {
  color: #0d9488;
  text-decoration: none;
  font-weight: 500;
}

.auth-form__forgot a:hover {
  text-decoration: underline;
}

.auth-form-wrap .alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.auth-form-wrap .alert.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.auth-form-wrap .alert.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* ----- Auth: mobile responsive ----- */
@media (max-width: 768px) {
  .auth-page__main {
    min-height: 100vh;
    min-height: 100dvh;
  }
  .auth-layout {
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .auth-panel--left {
    min-height: 220px;
    height: 220px;
    padding: 0;
    flex-shrink: 0;
  }
  .auth-back {
    top: 16px;
    right: 16px;
    padding: 10px 14px;
    font-size: 0.8125rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .auth-panel__overlay {
    padding: 24px 20px;
  }
  .auth-panel__overlay .auth-panel__logo {
    width: 44px;
    height: 44px;
    margin-bottom: 8px;
  }
  .auth-panel__overlay .auth-panel__name {
    font-size: 1.25rem;
  }
  .auth-panel__overlay .auth-panel__tagline {
    font-size: 0.875rem;
  }
  .auth-panel--right {
    max-width: none;
    flex: 1;
    min-height: 0;
    padding: 24px 20px 32px;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
    justify-content: flex-start;
    overflow-y: auto;
  }
  .auth-form-wrap {
    padding: 0;
    max-width: none;
    width: 100%;
  }
  .auth-form__title {
    font-size: 1.5rem;
  }
  .auth-form__sub {
    font-size: 0.875rem;
    word-break: break-word;
  }
  .auth-form input,
  .auth-form__submit {
    min-height: 48px;
    font-size: 16px; /* prevents zoom on focus in iOS */
  }
  .auth-password-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
}

@media (max-width: 480px) {
  .auth-panel--left {
    min-height: 180px;
    height: 180px;
  }
  .auth-panel--right {
    padding: 20px 16px 28px;
  }
  .auth-form__title {
    font-size: 1.35rem;
  }
  .auth-form__sub {
    font-size: 0.8125rem;
  }
  .auth-back {
    top: 12px;
    right: 12px;
    padding: 8px 12px;
  }
  .auth-page--light .auth-card {
    margin: 24px 16px;
    padding: 28px 20px;
    border-radius: 16px;
  }
}

/* Forgot / Reset pages: single centered card (light theme) */
.auth-page--light .auth-card {
  max-width: 420px;
  margin: 60px auto;
  background: #fff;
  color: #1e293b;
  padding: 40px 36px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.auth-page--light .auth-card .auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-page--light .auth-card .auth-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-bottom: 8px;
}

.auth-page--light .auth-card .auth-brand strong,
.auth-page--light .auth-card .auth-brand .auth-tagline {
  display: block;
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 4px;
}

.auth-page--light .auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 24px;
}

.auth-page--light .auth-card .form-group {
  margin-bottom: 18px;
}

.auth-page--light .auth-card label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
}

.auth-page--light .auth-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: #1e293b;
  box-sizing: border-box;
}

.auth-page--light .auth-card input:focus {
  outline: none;
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.auth-page--light .auth-card button[type="submit"] {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #0d9488 0%, #0f766e 100%);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
}

.auth-page--light .auth-card .auth-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.875rem;
  color: #0d9488;
  text-decoration: none;
  font-weight: 500;
}

.auth-page--light .auth-card .auth-link:hover {
  text-decoration: underline;
}

.auth-page--light .auth-card .alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.auth-page--light .auth-card .alert.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.auth-page--light .auth-card .alert.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
