/* ============================================
   MLA OS — Civic Platform
   Design: Structured Minimalism
   Palette: White, Deep Green accent
   Typography: Outfit (display) + Source Serif 4 (body)
============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;1,8..60,300&display=swap');

:root {
  --bg: #F6FAF7;
  --bg-alt: #EEF7F1;
  --surface: #FFFFFF;
  --border: #DCE8DF;
  --border-dark: #B9D1C1;
  --text: #102016;
  --text-2: #385142;
  --text-3: #6C8172;
  --accent: #0E7A3D;
  --accent-light: #35B86B;
  --accent-bg: #E8F7EE;
  --accent-2: #14705A;
  --accent-2-bg: #E4F4F0;
  --success: #15834B;
  --success-bg: #E7F7EE;
  --danger: #B83232;
  --danger-bg: #FAF0F0;
  --warning: #A07200;
  --warning-bg: #FBF5E6;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(26,25,22,0.06), 0 4px 16px rgba(26,25,22,0.04);
  --shadow-md: 0 2px 8px rgba(26,25,22,0.08), 0 8px 32px rgba(26,25,22,0.06);
  --shadow-lg: 0 8px 32px rgba(26,25,22,0.12), 0 24px 64px rgba(26,25,22,0.08);
  --nav-h: 64px;
  --sidebar-w: 220px;
  --sidebar-collapsed-w: 64px;
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-alt); }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 99px; }

/* ===== LAYOUT ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition), transform var(--transition);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
}

.sidebar.collapsed .brand-constituency,
.sidebar.collapsed .brand-name span,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .mla-info {
  display: none;
}

.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-footer {
  padding-left: 10px;
  padding-right: 10px;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 11px;
}

.sidebar-brand {
  padding: 18px 14px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-light);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 99px;
  margin-bottom: 10px;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.brand-name span {
  color: var(--accent);
}

.brand-constituency {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
}

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

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--transition);
  margin-bottom: 2px;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: rgba(14,122,61,0.18);
}

.nav-item .nav-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.mla-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
}

.mla-card-simple {
  padding: 10px;
}

.mla-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.mla-info { flex: 1; min-width: 0; }
.mla-info strong { display: block; font-size: 14px; font-weight: 700; }
.mla-info span { font-size: 11px; color: var(--text-3); }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: calc(100% - var(--sidebar-w));
  overflow-x: hidden;
  transition: margin-left var(--transition), max-width var(--transition);
}

.main-content.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed-w);
  max-width: calc(100% - var(--sidebar-collapsed-w));
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.topbar-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background var(--transition);
}

.topbar-menu-btn.always { display: flex; }

.topbar-menu-btn:hover { background: var(--bg-alt); }

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }

.portal-toggle {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-dark);
  color: var(--text-2);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
}

.portal-toggle.is-on {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: rgba(14,122,61,0.28);
}

.portal-toggle-icon,
.portal-toggle-icon svg {
  width: 17px;
  height: 17px;
}

.topbar-date {
  font-size: 13px;
  color: var(--text-3);
  background: var(--bg-alt);
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.topbar-notif {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-2);
  position: relative;
  transition: all var(--transition);
}

.topbar-notif:hover { border-color: var(--accent); color: var(--accent); }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ===== PAGE WRAPPER ===== */
.page-wrap {
  padding: 18px 28px 28px;
  flex: 1;
  display: none;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.page-wrap.active { display: block; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 16px;
}

.page-actions-only {
  margin-bottom: 12px;
}

.page-header-left h1 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.page-header-left p {
  font-size: 14px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #096532;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-dark);
  color: var(--text-2);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding: 7px 12px;
}

.btn-ghost:hover { background: var(--bg-alt); color: var(--text); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(184,50,50,0.2);
}

.btn-danger:hover { background: var(--danger); color: white; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
  min-width: 0;
}

.kpi-row {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 12px;
  overflow: visible;
  padding-bottom: 0;
  align-items: stretch;
}

.kpi-card {
  text-align: left;
  min-width: 0;
  min-height: 112px;
  height: auto;
  justify-content: space-between;
  gap: 6px;
  border-color: #E4EEE7;
  box-shadow: 0 8px 24px rgba(14,122,61,0.035);
  overflow: hidden;
}

.kpi-card .stat-value {
  font-size: 20px;
  color: #0B1B11;
  line-height: 1.05;
}

.kpi-card .stat-label {
  font-size: 12px;
  line-height: 1.08;
  color: #5F7084;
}

.kpi-card .stat-sub {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  color: var(--accent);
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 16px;
  height: 16px;
}

.kpi-chip {
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #E8FFF1;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.dashboard-grid {
  align-items: start;
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.muted {
  color: var(--text-3);
  font-size: 16px;
  font-weight: 500;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow var(--transition);
}

.complaint-kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.report-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-label {
  font-size: 13px;
  line-height: 1.08;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: 15px;
  font-weight: 500;
  color: #66768A;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.15;
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.orange { background: var(--accent-bg); color: var(--accent); }
.stat-icon.blue { background: var(--accent-2-bg); color: var(--accent-2); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }

.stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-3);
}

.stat-sub strong { color: var(--success); }

/* ===== CARD ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.card-body { padding: 20px; }

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; min-width: 0; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.grid-2 > *,
.grid-3 > *,
.grid-auto > * {
  min-width: 0;
}

/* ===== EVENT CARD ===== */
.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all var(--transition);
  cursor: pointer;
}

.event-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.event-date-block {
  text-align: center;
  min-width: 48px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  flex-shrink: 0;
}

.event-date-block .day {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
}

.event-date-block .month {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-top: 2px;
}

.event-info { flex: 1; min-width: 0; }

.event-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.event-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-icon {
  color: var(--accent);
}

.meta-icon svg {
  width: 14px;
  height: 14px;
}

.meta-dot {
  width: 4px;
  height: 4px;
  border-radius: 99px;
  background: var(--border-dark);
}

.event-detail p {
  color: var(--text-2);
  line-height: 1.65;
}

.event-badges { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }

.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge-orange { background: var(--accent-bg); color: var(--accent); border-color: rgba(14,122,61,0.2); }
.badge-blue { background: var(--accent-2-bg); color: var(--accent-2); border-color: rgba(26,77,143,0.2); }
.badge-green { background: var(--success-bg); color: var(--success); border-color: rgba(42,122,78,0.2); }
.badge-red { background: var(--danger-bg); color: var(--danger); border-color: rgba(184,50,50,0.2); }
.badge-gray { background: var(--bg-alt); color: var(--text-3); border-color: var(--border); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); border-color: rgba(160,114,0,0.2); }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.form-label .req { color: var(--danger); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,122,61,0.12);
}

.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--bg-alt);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:hover { background: var(--bg-alt); }

tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 13px 16px;
  font-size: 14px;
  vertical-align: middle;
}

/* ===== COMPLAINT CARD ===== */
.complaint-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: all var(--transition);
}

.complaint-card:hover { box-shadow: var(--shadow); }

.complaint-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.complaint-id {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  font-family: monospace;
}

.complaint-subject {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.complaint-body {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 12px;
  font-family: 'Source Serif 4', serif;
}

.complaint-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.complaint-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
}

/* ===== TASKS ===== */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  box-shadow: 0 8px 24px rgba(14,122,61,0.025);
}

.task-main {
  min-width: 0;
}

.task-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 5px;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-3);
  font-size: 12px;
}

.task-main p {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}

.task-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-status {
  width: 128px;
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 12px;
}

.related-tasks {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.related-tasks div {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--accent-bg);
}

.related-tasks strong,
.related-tasks span {
  display: block;
}

.related-tasks span {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 2px;
}

/* ===== POLL CARD ===== */
.poll-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.poll-question {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.4;
}

.poll-option {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  display: block;
  margin-bottom: 10px;
  cursor: pointer;
}

.poll-option-inner,
.poll-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  background: var(--surface);
}

.poll-option-inner:hover,
.poll-option:hover { border-color: var(--accent); }

.poll-option.voted .poll-option-inner,
.poll-option.voted {
  border-color: var(--accent);
}

.poll-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--accent-bg);
  z-index: 0;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.poll-option-text { position: relative; z-index: 1; font-weight: 500; }
.poll-option-pct { position: relative; z-index: 1; font-size: 13px; font-weight: 600; color: var(--accent); }

.poll-meta { margin-top: 14px; font-size: 12px; color: var(--text-3); display: flex; gap: 14px; }

.poll-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.poll-vote-btn {
  margin-top: 14px;
  width: 100%;
}

/* ===== TIMELINE ===== */
.timeline { position: relative; padding-left: 28px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -24px; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--accent);
}

.timeline-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.timeline-content {
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,25,22,0.5);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal { transform: translateY(0); }

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

.modal-title { font-size: 17px; font-weight: 700; }

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: all var(--transition);
}

.modal-close:hover { background: var(--bg-alt); color: var(--text); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== SEARCH BAR ===== */
.search-bar {
  position: relative;
  max-width: 320px;
}

.search-bar input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg-alt);
  outline: none;
  transition: all var(--transition);
}

.search-bar input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(14,122,61,0.12);
}

.search-bar .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

/* ===== FILTER ROW ===== */
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

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

.toast {
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--accent-2); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}

.empty-state svg { margin: 0 auto 16px; opacity: 0.3; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* ===== CALENDAR ===== */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.cal-day-header {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 0;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  position: relative;
  min-height: 44px;
}

.cal-day:hover { background: var(--bg-alt); }

.cal-day.today { background: var(--accent-bg); border-color: var(--accent); }
.cal-day.today .cal-day-num { color: var(--accent); font-weight: 700; }
.cal-day.has-events { border-color: rgba(14,122,61,0.28); background: var(--accent-bg); }
.cal-count {
  margin-top: 4px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.cal-day.other-month { opacity: 0.35; }

.cal-day-num { font-size: 13px; font-weight: 500; }

.cal-dots { display: flex; gap: 2px; margin-top: 3px; }
.cal-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal-dot.blue { background: var(--accent-2); }
.cal-dot.green { background: var(--success); }

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  min-width: 0;
}

.month-picker {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, #F7FBF8);
  color: var(--text);
  border-radius: 10px;
  padding: 5px 10px;
  box-shadow: 0 8px 24px rgba(14,122,61,0.04);
  min-width: 0;
}

.month-picker span {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.month-picker input {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  min-width: 128px;
}

.cal-today-btn {
  height: 32px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--accent);
  background: var(--accent-bg);
  font-size: 12px;
  font-weight: 800;
}

.cal-nav-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all var(--transition);
}

.cal-nav-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== PRIORITY BAR ===== */
.priority-high { border-left: 3px solid var(--danger); }
.priority-medium { border-left: 3px solid var(--warning); }
.priority-low { border-left: 3px solid var(--success); }

/* ===== PROGRESS ===== */
.progress-bar-wrap {
  height: 6px;
  background: var(--bg-alt);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.5s ease;
}

/* ===== FEEDBACK RATING ===== */
.rating-stars { display: flex; gap: 6px; }

.star {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--border-dark);
  transition: color var(--transition), transform var(--transition);
}

.star svg {
  width: 24px;
  height: 24px;
}

.star:hover, .star.active { color: var(--accent); transform: scale(1.08); }

.rating-icons {
  display: flex;
  gap: 3px;
  color: var(--border-dark);
}

.rating-icons span {
  width: 16px;
  height: 16px;
  display: inline-flex;
}

.rating-icons svg {
  width: 16px;
  height: 16px;
}

.rating-icons .filled { color: var(--accent); }

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,25,22,0.5);
  z-index: 99;
}

/* ===== MOBILE NAV ===== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 90;
  justify-content: space-around;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--transition);
  flex: 1;
  max-width: 80px;
}

.mobile-nav-item.active { color: var(--accent); }

.mobile-nav-item svg { width: 20px; height: 20px; }

/* ===== SECTION DIVIDER ===== */
.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== PUBLIC PAGE OVERRIDES ===== */
.public-banner {
  background: linear-gradient(135deg, #1A1916 0%, #2D2A25 100%);
  color: white;
  padding: 60px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* ===== LOGIN / PUBLIC PORTAL ===== */
.login-page,
.public-page {
  min-height: 100vh;
  background: var(--bg);
}

.login-page {
  display: grid;
  place-items: center;
  height: 100vh;
  padding: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(14,122,61,0.10), transparent 35%),
    linear-gradient(180deg, #FFFFFF 0%, #F6FAF7 100%);
}

.login-panel {
  width: min(390px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 26px;
}

.login-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--accent-bg);
  margin-bottom: 18px;
}

.login-mark svg {
  width: 24px;
  height: 24px;
}

.login-subtitle {
  color: var(--text-3);
  margin: 8px 0 22px;
  font-size: 14px;
}

.public-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}

.public-hero {
  min-height: 260px;
  padding: 36px clamp(20px, 5vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(8,66,33,0.95), rgba(14,122,61,0.72)),
    url('https://images.unsplash.com/photo-1524492412937-b28074a5d7da?auto=format&fit=crop&w=1600&q=75') center/cover;
}

.public-hero .brand-name {
  color: #fff;
  font-size: clamp(28px, 5vw, 48px);
}

.public-hero p {
  max-width: 720px;
  color: rgba(255,255,255,0.84);
  margin-top: 10px;
  font-size: 16px;
}

.public-page .tabs,
.public-page #public-host {
  width: min(980px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.public-page .tabs {
  margin-top: 24px;
}

.portal-container {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.portal-lang-bar {
  background: #0F3D25;
  color: rgba(255,255,255,0.76);
  font-size: 12px;
}

.portal-bar-inner {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-bar-inner a {
  color: #F5E9C0;
  font-weight: 700;
}

.portal-navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.portal-nav-inner {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #0F3D25;
}

.portal-emblem {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0F3D25, var(--accent));
  color: #fff;
  font-weight: 900;
}

.portal-brand strong { display: block; font-size: 15px; }
.portal-brand small { display: block; color: var(--text-3); font-size: 11px; }

.portal-nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
}

.portal-nav-links button {
  padding: 7px 13px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
}

.portal-nav-links button:hover {
  background: var(--accent-bg);
  color: var(--accent);
}

.portal-hero {
  min-height: 560px;
  background:
    radial-gradient(circle at 80% 20%, rgba(201,151,12,0.18), transparent 28%),
    linear-gradient(145deg, #0F3D25 0%, #1A5C38 58%, #2A7A50 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.portal-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 42px 42px;
}

.portal-hero-inner {
  min-height: 560px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 56px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.portal-kicker {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(245,233,192,0.42);
  background: rgba(201,151,12,0.18);
  color: #F5E9C0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
  margin-bottom: 18px;
}

.portal-hero h1 {
  font-family: Georgia, serif;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1;
  margin-bottom: 18px;
}

.portal-hero-sub {
  max-width: 680px;
  color: rgba(255,255,255,0.84);
  font-size: 18px;
  line-height: 1.7;
}

.portal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 34px;
}

.btn-hero-primary,
.btn-hero-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 14px;
}

.btn-hero-primary {
  background: #C9970C;
  color: #0F3D25;
  box-shadow: 0 10px 24px rgba(201,151,12,0.28);
}

.btn-hero-outline {
  border: 1px solid rgba(255,255,255,0.28);
  color: white;
  background: rgba(255,255,255,0.10);
}

.portal-photo-card {
  aspect-ratio: 3 / 4;
  border-radius: 22px;
  border: 3px solid rgba(255,255,255,0.15);
  box-shadow: 0 22px 70px rgba(0,0,0,0.32);
  background: linear-gradient(160deg, #246B44, #0F3D25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}

.portal-photo-card .photo-initials {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.12);
  font-size: 34px;
  font-weight: 900;
}

.portal-photo-card span { color: #F5E9C0; font-size: 13px; }

.portal-stats {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.portal-stats-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.portal-stats-inner div {
  padding: 24px 18px;
  text-align: center;
  border-right: 1px solid var(--border);
}

.portal-stats-inner div:last-child { border-right: 0; }
.portal-stats-inner strong { display: block; font-size: 34px; line-height: 1; color: #0F3D25; }
.portal-stats-inner span { color: var(--text-3); font-size: 12px; font-weight: 700; }

.portal-workspace {
  padding: 42px 0 70px;
}

.public-disabled {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(14,122,61,0.12), transparent 34%),
    var(--bg);
}

.public-disabled section {
  width: min(460px, 100%);
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 34px;
  box-shadow: var(--shadow-md);
}

.public-disabled h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.public-disabled p {
  color: var(--text-3);
  margin-bottom: 22px;
}

.public-card {
  max-width: 760px;
  margin: 0 auto 32px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.span-2 { grid-column: 1 / -1; }

.toolbar {
  justify-content: space-between;
}

.toolbar > div:first-child {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sort-select {
  width: auto;
  min-width: 150px;
}

.rbac-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  font-size: 14px;
}

.role-select { width: 120px; }

.detail-list {
  display: grid;
  gap: 10px;
}

.notice-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.notice-item p {
  color: var(--text-2);
  font-size: 14px;
  margin: 4px 0;
}

.notice-item small { color: var(--text-3); }

/* ===== REPORTS ===== */
.report-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  min-width: 0;
  grid-auto-flow: dense;
}

.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 28px rgba(14,122,61,0.035);
  min-height: 280px;
  min-width: 0;
}

.report-wide { grid-column: span 2; }

.report-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.report-card h3 {
  font-size: 16px;
  line-height: 1.1;
}

.report-card p {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 4px;
}

.chart-wrap svg {
  width: 100%;
  height: 230px;
  display: block;
}

.report-table {
  display: grid;
  gap: 8px;
}

.report-table button {
  min-width: 0;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: linear-gradient(90deg, var(--accent-bg), #fff);
}

.report-table span,
.report-table em {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.report-table strong {
  color: var(--accent);
  flex-shrink: 0;
}

.report-table em {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 12px;
  font-style: normal;
}

.chart-axis {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 10px rgba(14,122,61,0.18));
}

.chart-point {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 4;
}

.chart-wrap text {
  fill: var(--text-3);
  font-size: 10px;
}

.chart-point-hit { cursor: pointer; }

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  position: relative;
  min-height: 40px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #FBFDFC;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  text-align: left;
}

.bar-row i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(14,122,61,0.14), rgba(53,184,107,0.06));
  z-index: 0;
}

.bar-row span,
.bar-row strong {
  position: relative;
  z-index: 1;
  font-size: 13px;
}

.bar-row strong { color: var(--accent); }

.pie-layout {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px;
  align-items: center;
}

.pie-ring {
  fill: transparent;
  stroke-width: 18;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
}

.pie-layout text {
  fill: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.pie-legend {
  display: grid;
  gap: 8px;
}

.pie-legend button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
  text-align: left;
}

.pie-legend span {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--accent);
}

.public-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(14,122,61,0.28) 0%, transparent 65%);
}

.public-banner-content { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; }

.public-banner h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 14px;
}

.public-banner p {
  font-size: 16px;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  font-family: 'Source Serif 4', serif;
  font-style: italic;
}

.accent-text { color: var(--accent-light); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1320px) {
  .kpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-wide { grid-column: span 2; }
}

@media (max-width: 980px) {
  .complaint-kpis,
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-actions { gap: 6px; }
  .topbar .btn-sm { padding-left: 9px; padding-right: 9px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .main-content {
    margin-left: 0;
    max-width: 100%;
    width: 100%;
  }

  .topbar-menu-btn { display: flex; }

  .topbar { padding: 0 16px; }

  .page-wrap { padding: 16px 16px 80px; }

  .page-header { flex-direction: column; align-items: flex-start; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .form-row { grid-template-columns: 1fr; }

  .stats-grid,
  .kpi-row,
  .complaint-kpis,
  .report-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .kpi-row .kpi-card:nth-child(n + 5),
  .complaint-kpis .kpi-card:nth-child(n + 5) {
    display: none;
  }

  .kpi-row,
  .complaint-kpis,
  .report-kpis {
    gap: 6px;
    margin-bottom: 12px;
  }

  .kpi-card {
    min-height: 66px;
    padding: 7px;
    gap: 3px;
  }

  .kpi-card .kpi-top {
    align-items: center;
  }

  .kpi-icon {
    width: 22px;
    height: 22px;
    border-radius: 7px;
  }

  .kpi-icon svg {
    width: 12px;
    height: 12px;
  }

  .kpi-chip {
    display: none;
  }

  .kpi-card .stat-value {
    font-size: 16px;
  }

  .kpi-card .stat-label {
    font-size: 9.5px;
    line-height: 1.05;
  }

  .kpi-card .stat-sub {
    display: none;
  }

  .filter-row { gap: 8px; }

  .search-bar { max-width: 100%; width: 100%; }

  .card-header { flex-wrap: wrap; }
  .card-body { padding: 12px; }

  .premium-cal-nav {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 8px;
    margin-bottom: 0;
  }

  .premium-cal-nav .cal-today-btn {
    grid-column: 1 / -1;
    width: max-content;
  }

  .month-picker {
    width: 100%;
    gap: 8px;
    padding: 5px 8px;
  }

  .month-picker input {
    min-width: 0;
    width: 100%;
    font-size: 12px;
  }

  .cal-day-header {
    font-size: 9px;
    padding: 6px 0;
  }

  .cal-day {
    min-height: 38px;
    padding-top: 4px;
    border-radius: 8px;
    font-size: 11px;
  }

  .cal-day-num { font-size: 11px; }

  .cal-count {
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    margin-top: 2px;
  }

  .task-card {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .task-controls {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .mobile-bottom-nav { display: flex; }

  .tabs { margin-bottom: 16px; }

  .tab-btn { padding: 8px 14px; font-size: 13px; }

  .topbar-date { display: none; }

  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  .main-content.sidebar-collapsed { margin-left: 0; }
  .public-hero { align-items: flex-start; flex-direction: column; }
  .portal-nav-inner { flex-wrap: wrap; padding: 12px 0; }
  .portal-nav-links { width: 100%; margin-left: 0; }
  .portal-hero,
  .portal-hero-inner { min-height: auto; }
  .portal-hero-inner { grid-template-columns: 1fr; padding-top: 48px; padding-bottom: 48px; }
  .portal-photo-card { display: none; }
  .portal-stats-inner { grid-template-columns: repeat(2, 1fr); }
  .report-grid { grid-template-columns: 1fr; }
  .report-wide { grid-column: auto; }
  .pie-layout { grid-template-columns: 1fr; justify-items: center; }
  .portal-toggle-text { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .toolbar { align-items: stretch; }
  .sort-select { width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi-row,
  .complaint-kpis,
  .report-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .kpi-card { min-height: 64px; padding: 7px; }
  .kpi-card .stat-value { font-size: 16px; }
  .kpi-card .stat-label { font-size: 9.5px; }
  .topbar-title { font-size: 14px; }
  .topbar-actions .btn[href="public.html"] { display: none; }
}

/* ===== PRINT HIDE ===== */
@media print {
  .sidebar, .topbar, .mobile-bottom-nav { display: none; }
  .main-content { margin-left: 0; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }

.page-wrap.active { animation: fadeIn 0.25s ease; }
