/* ================================================================
   APP.CSS — Estilos do Sistema InclusivaEdu
   Design: Neo-Brutalist com paleta azul vibrante
   ================================================================ */

/* ── SKELETON LOADERS ──────────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 0.5rem;
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

.skeleton-text {
  display: inline-block;
  min-width: 3rem;
  height: 1em;
}

.skeleton-kpi {
  min-width: 4rem;
  height: 2.5rem;
  border-radius: 0.75rem;
}

.skeleton-row td {
  position: relative;
}

.skeleton-row td::after {
  content: '';
  display: block;
  height: 1em;
  border-radius: 0.25rem;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* Button loading state */
.btn.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 1rem;
  height: 1rem;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── CUSTOM SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
  border: 2px solid var(--bg-light);
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ── APP LAYOUT ─────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-light);
}

.app-main {
  flex: 1;
  min-width: 0;
  max-width: 100vw;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s var(--bouncy-ease);
}

.app-layout.sidebar-collapsed .app-main {
  margin-left: 0;
}

.app-layout.sidebar-collapsed #app-sidebar {
  transform: translateX(-100%);
}

.app-content {
  padding: 2rem;
  flex: 1;
  min-width: 0;
}

/* ── SIDEBAR ────────────────────────────────────────────────────── */
#app-sidebar {
  width: 280px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  background: var(--white);
  border-right: var(--border-thick);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--bouncy-ease);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: var(--border-thick);
}

.sidebar-mobile-close {
  display: none;
  background: var(--bg-light);
  border: 2px solid var(--deep-dark);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--deep-dark);
  transition: all 0.2s;
  color: var(--deep-dark);
  margin-left: auto;
}

.sidebar-mobile-close:active {
  box-shadow: 0 0 0 var(--deep-dark);
  transform: translate(3px, 3px);
}

.sidebar-mobile-close i, .sidebar-mobile-close svg {
  width: 18px;
  height: 18px;
}

.sidebar-logo {
  background: var(--primary-blue);
  color: var(--white);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--deep-dark);
  flex-shrink: 0;
}

.sidebar-info {
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.sidebar-subtitle {
  font-size: 0.8rem;
  opacity: 0.6;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--deep-dark);
  text-decoration: none;
  transition: all 0.15s;
  border-left: 4px solid transparent;
}

.sidebar-nav li a:hover {
  background: var(--bg-light);
  border-left-color: var(--primary-blue);
}

.sidebar-nav li a.active {
  background: var(--bg-light);
  color: var(--primary-blue);
  font-weight: 700;
  border-left-color: var(--primary-blue);
}

.sidebar-nav li a i,
.sidebar-nav li a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.menu-label {
  padding: 1.25rem 1.5rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: var(--border-thick);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  text-decoration: none;
  color: inherit;
}

.sidebar-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--primary-blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  border: 2px solid var(--deep-dark);
  flex-shrink: 0;
}

.sidebar-profile-info {
  display: flex;
  flex-direction: column;
}

.sidebar-profile-name {
  font-weight: 700;
  font-size: 0.85rem;
}

.sidebar-profile-role {
  font-size: 0.7rem;
  text-transform: uppercase;
  opacity: 0.5;
}

.sidebar-logout {
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  padding: 0.5rem;
  transition: color 0.2s;
}

.sidebar-logout:hover {
  color: #e74c3c;
}

/* ── HEADER ─────────────────────────────────────────────────────── */
#app-header {
  padding: 1rem 2rem;
  background: var(--white);
  border-bottom: var(--border-thick);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-title {
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.header-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--primary-blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  border: 2px solid var(--deep-dark);
}

/* ── NOTIFICATIONS ──────────────────────────────────────────────── */
.notification-bell {
  position: relative;
  cursor: pointer;
  padding: 0.5rem;
}

.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #e74c3c;
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white);
}

.notif-dropdown {
  position: absolute;
  top: 60px;
  right: 2rem;
  width: 380px;
  background: var(--white);
  border: var(--border-thick);
  border-radius: 1rem;
  box-shadow: 8px 8px 0px var(--deep-dark);
  z-index: 999;
  overflow: hidden;
}

.notif-header {
  padding: 1rem 1.5rem;
  border-bottom: 2px solid var(--accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-count {
  font-size: 0.8rem;
  color: var(--primary-blue);
  font-weight: 700;
}

.notif-list {
  max-height: 400px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--accent);
  transition: background 0.15s;
}

.notif-item:hover {
  background: var(--bg-light);
}

.notif-item.unread {
  background: #f0f5ff;
  border-left: 3px solid var(--primary-blue);
}

.notif-icon {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  background: var(--bg-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-msg {
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.notif-time {
  font-size: 0.7rem;
  opacity: 0.5;
}

.notif-empty {
  padding: 2rem;
  text-align: center;
  opacity: 0.5;
}

/* ── KPI CARDS ──────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--white);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hard);
  padding: 1.5rem;
  transition: transform 0.2s var(--bouncy-ease);
}

.kpi-card:hover {
  transform: translateY(-3px);
}

.kpi-label {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.6;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.kpi-detail {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  opacity: 0.5;
}

.kpi-card.accent {
  background: var(--primary-blue);
  color: var(--white);
}

.kpi-card.accent .kpi-label {
  opacity: 0.8;
}

/* ── BRUTALIST TABLE ────────────────────────────────────────────── */
.table-container {
  background: var(--white);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hard);
  overflow: hidden;
  margin-bottom: 2rem;
}

.table-header {
  padding: 1.25rem 1.5rem;
  border-bottom: var(--border-thick);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.table-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.table-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.search-input {
  padding: 0.5rem 1.25rem;
  border: 2px solid var(--deep-dark);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  background: var(--bg-light);
  transition: all 0.2s;
  height: 38px;
  display: flex;
  align-items: center;
}

select.search-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
  line-height: 1;
}

.search-input:focus {
  box-shadow: 3px 3px 0px var(--primary-blue);
}

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

table.brutalist th {
  background: var(--bg-light);
  padding: 0.75rem 1.5rem;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--deep-dark);
}

table.brutalist td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--accent);
  font-size: 0.9rem;
}

table.brutalist tr:hover td {
  background: #f8faff;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid;
}

.status-active,
.status-ativa {
  background: #d1fae5;
  color: #065f46;
  border-color: #065f46;
}

.status-inactive,
.status-inativa,
.status-closed {
  background: #fee2e2;
  color: #991b1b;
  border-color: #991b1b;
}

.status-open {
  background: #fef3c7;
  color: #92400e;
  border-color: #92400e;
}

.status-demo {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #3730a3;
}

/* User Roles */
.status-superadmin {
  background: #e0e7ff;
  color: #4338ca;
  border-color: #4338ca;
}

.status-admin {
  background: #ccfbf1;
  color: #0f766e;
  border-color: #0f766e;
}

.status-professor {
  background: #f3e8ff;
  color: #7e22ce;
  border-color: #7e22ce;
}

.status-aluno {
  background: #f1f5f9;
  color: #475569;
  border-color: #475569;
}

/* Action buttons inside tables */
.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border-width: 2px;
  box-shadow: 3px 3px 0px var(--deep-dark);
}

.btn-icon {
  padding: 0.4rem;
  border: 2px solid var(--deep-dark);
  border-radius: 0.5rem;
  background: var(--white);
  cursor: pointer;
  box-shadow: 2px 2px 0px var(--deep-dark);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--bg-light);
  transform: translateY(-1px);
}

.btn-icon.danger:hover {
  background: #fee2e2;
  color: #991b1b;
}

/* ── MODAL ──────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s;
}

.modal-overlay.show,
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--white);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: 12px 12px 0px var(--deep-dark);
  width: 95%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s var(--bouncy-ease);
}

.modal-overlay.show .modal-card,
.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: var(--border-thick);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: 2px solid var(--deep-dark);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 1rem;
}

.modal-close:hover {
  background: #fee2e2;
  transform: rotate(90deg);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1.5rem 2rem;
  border-top: var(--border-thick);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* ── TABS ───────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: var(--border-thick);
  gap: 0;
}

.tab {
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  font-family: var(--font-heading);
  background: var(--bg-light);
  border: none;
  border-right: 2px solid var(--deep-dark);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.9rem;
}

.tab:hover {
  background: var(--white);
}

.tab.active {
  background: var(--white);
  color: var(--primary-blue);
  border-bottom: 3px solid var(--primary-blue);
  margin-bottom: -4px;
}

.tab-panel {
  display: none;
  padding: 1.5rem 0;
}

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

/* ── CARDS GRID ─────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--white);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hard);
  padding: 1.5rem;
  transition: transform 0.2s var(--bouncy-ease);
  cursor: pointer;
}

.card:hover {
  transform: translateY(-4px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* ── FILTER PILLS ───────────────────────────────────────────────── */
.filter-pills {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 0.5rem 1.25rem;
  border: 2px solid var(--deep-dark);
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--white);
  transition: all 0.15s;
  box-shadow: 3px 3px 0px var(--deep-dark);
}

.filter-pill:hover {
  background: var(--bg-light);
}

.filter-pill.active {
  background: var(--primary-blue);
  color: var(--white);
  border-color: var(--deep-dark);
}

/* ── CHART CONTAINER ────────────────────────────────────────────── */
.chart-container {
  background: var(--white);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hard);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.chart-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.chart-wrap {
  position: relative;
  height: 300px;
}

/* ── SECTION TITLE ──────────────────────────────────────────────── */
.section-title {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── CHAT (Tickets) ─────────────────────────────────────────────── */
.chat-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  background: var(--white);
  border: var(--border-thick);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hard);
  overflow: hidden;
  height: 600px;
}

.chat-inbox {
  border-right: var(--border-thick);
  overflow-y: auto;
}

.chat-inbox-header {
  padding: 1rem 1.5rem;
  border-bottom: 2px solid var(--accent);
  font-family: var(--font-heading);
  font-weight: 700;
}

.chat-inbox-item {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--accent);
  cursor: pointer;
  transition: background 0.15s;
}

.chat-inbox-item:hover {
  background: var(--bg-light);
}

.chat-inbox-item.active {
  background: var(--bg-light);
  border-left: 4px solid var(--primary-blue);
}

.chat-inbox-item.unread {
  background: #f0f5ff;
}

.chat-inbox-subject {
  font-weight: 700;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.chat-inbox-meta {
  font-size: 0.75rem;
  opacity: 0.5;
  display: flex;
  justify-content: space-between;
}

.chat-panel {
  display: flex;
  flex-direction: column;
}

.chat-panel-header {
  padding: 1rem 1.5rem;
  border-bottom: var(--border-thick);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-msg {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  border: 2px solid var(--deep-dark);
}

.chat-msg.sent {
  align-self: flex-end;
  background: var(--primary-blue);
  color: var(--white);
  border-bottom-right-radius: 0.25rem;
}

.chat-msg.received {
  align-self: flex-start;
  background: var(--bg-light);
  border-bottom-left-radius: 0.25rem;
}

.chat-msg-time {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-top: 0.25rem;
}

.chat-input-container {
  padding: 1rem 1.5rem;
  border-top: var(--border-thick);
  display: flex;
  gap: 0.75rem;
}

.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--deep-dark);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
}

.chat-input:focus {
  box-shadow: 3px 3px 0px var(--primary-blue);
}

.btn-send {
  width: 3rem;
  height: 3rem;
  border: var(--border-thick);
  border-radius: 50%;
  background: var(--primary-blue);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0px var(--deep-dark);
  transition: transform 0.15s;
}

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

.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 1rem;
}

/* ── FORM STYLES (reuse + extend login) ─────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group textarea {
  width: 100%;
  padding: 1rem;
  border: var(--border-thick);
  border-radius: 1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: vertical;
  min-height: 100px;
  outline: none;
  background: var(--bg-light);
}

.form-group textarea:focus {
  box-shadow: 4px 4px 0px var(--primary-blue);
  border-color: var(--primary-blue);
}

.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: var(--border-thick);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--bg-light);
  outline: none;
  cursor: pointer;
  appearance: none;
}

.form-group select:focus {
  box-shadow: 4px 4px 0px var(--primary-blue);
}

/* ── TOGGLE SWITCH ──────────────────────────────────────────────── */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.toggle-track {
  width: 3.5rem;
  height: 2rem;
  background: var(--accent);
  border: 2px solid var(--deep-dark);
  border-radius: var(--radius-pill);
  position: relative;
  transition: background 0.3s;
}

.toggle-track.active {
  background: var(--primary-blue);
}

.toggle-knob {
  width: 1.5rem;
  height: 1.5rem;
  background: var(--white);
  border: 2px solid var(--deep-dark);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 0.15rem;
  transform: translateY(-50%);
  transition: left 0.3s var(--bouncy-ease);
}

.toggle-track.active .toggle-knob {
  left: calc(100% - 1.65rem);
}

/* ── TOAST ──────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--white);
  border: var(--border-thick);
  border-radius: 1rem;
  box-shadow: var(--shadow-hard);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  animation: slideIn 0.3s var(--bouncy-ease);
}

.toast-success {
  border-left: 4px solid #10B981;
}

.toast-error {
  border-left: 4px solid #e74c3c;
}

.toast-info {
  border-left: 4px solid var(--primary-blue);
}

.toast.fade-out {
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.3s;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── VIEW PANELS ────────────────────────────────────────────────── */
.view-panel {
  display: none;
}

.view-panel:first-of-type {
  display: block;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────── */

/* ── TABLET (≤ 1024px) ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .app-main {
    margin-left: 0;
  }

  #app-sidebar {
    transform: translateX(-100%);
    z-index: 100;
  }

  .sidebar-mobile-close {
    display: flex;
  }

  .app-layout.sidebar-open #app-sidebar {
    transform: translateX(0);
  }

  /* Overlay behind sidebar when open */
  .app-layout.sidebar-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
  }

  .sidebar-toggle {
    display: flex;
  }

  .chat-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .chat-inbox {
    border-right: none;
    border-bottom: var(--border-thick);
    max-height: 250px;
  }

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

  .notif-dropdown {
    width: 340px;
    right: 0.5rem;
  }
}

/* ── MOBILE (≤ 768px) ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .app-content {
    padding: 1rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  /* Header mobile */
  #app-header {
    padding: 0.75rem 1rem;
  }

  .header-title {
    font-size: 1.1rem;
  }

  .header-user span {
    display: none;
  }

  .header-right {
    gap: 0.75rem;
  }

  /* Sidebar width */
  #app-sidebar {
    width: 260px;
  }

  /* Tables — horizontal scroll for data-heavy tables */
  .table-container {
    border-radius: 1rem;
  }

  table.brutalist {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table.brutalist thead {
    min-width: 600px;
  }

  table.brutalist th,
  table.brutalist td {
    padding: 0.75rem 1rem;
    white-space: nowrap;
    font-size: 0.8rem;
  }

  .table-header {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .table-actions {
    width: 100%;
  }

  .search-input {
    width: 100%;
  }

  /* Notifications dropdown */
  .notif-dropdown {
    position: fixed;
    top: 60px;
    left: 1rem;
    right: 1rem;
    width: auto;
  }

  .notif-list {
    max-height: 300px;
  }

  /* Chart containers */
  .chart-container {
    border-radius: 1rem;
  }

  .chart-wrap {
    height: 220px;
  }

  /* Section titles */
  .section-title {
    font-size: 1.35rem;
  }

  /* Tabs */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .tab {
    padding: 0.65rem 1rem;
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Chat */
  .chat-layout {
    height: auto;
  }

  .chat-inbox {
    max-height: 200px;
  }

  .chat-messages {
    max-height: 350px;
    padding: 1rem;
  }

  .chat-msg {
    max-width: 90%;
    font-size: 0.85rem;
  }

  .chat-input-container {
    padding: 0.75rem 1rem;
  }

  /* Modal */
  .modal-card {
    width: 95%;
    max-width: none;
    border-radius: 1.25rem;
    box-shadow: 6px 6px 0px var(--deep-dark);
  }

  .modal-header {
    padding: 1rem 1.25rem;
  }

  .modal-header h2 {
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 1.25rem;
  }

  .modal-footer {
    padding: 1rem 1.25rem;
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  /* KPI cards */
  .kpi-card {
    padding: 1.25rem;
    border-radius: 1rem;
  }

  .kpi-value {
    font-size: 2rem;
  }

  /* Cards */
  .card {
    padding: 1.25rem;
    border-radius: 1rem;
  }

  /* Filter pills */
  .filter-pills {
    gap: 0.5rem;
  }

  .filter-pill {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
  }

  /* Toast */
  #toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .toast {
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
  }

  /* Toggle smaller */
  .toggle-track {
    width: 3rem;
    height: 1.75rem;
  }

  .toggle-knob {
    width: 1.25rem;
    height: 1.25rem;
  }

  .toggle-track.active .toggle-knob {
    left: calc(100% - 1.4rem);
  }

  /* Inline grid overrides for dashboard and superadmin layout panes */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── SMALL MOBILE (≤ 480px) ───────────────────────────────────── */
@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-value {
    font-size: 1.75rem;
  }

  .kpi-card {
    padding: 1rem;
  }

  #app-header {
    padding: 0.6rem 0.75rem;
  }

  .header-title {
    font-size: 1rem;
  }

  .app-content {
    padding: 0.75rem;
  }

  /* Table even more compact */
  table.brutalist th,
  table.brutalist td {
    padding: 0.6rem 0.75rem;
    font-size: 0.75rem;
  }

  /* Button sizes */
  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    box-shadow: 3px 3px 0px var(--deep-dark);
  }

  .btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
  }

  /* Sidebar */
  #app-sidebar {
    width: 100%;
  }

  /* Section title */
  .section-title {
    font-size: 1.15rem;
  }

  /* Cards */
  .card h3 {
    font-size: 1.1rem;
  }

  /* Status badge */
  .status {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
  }

  /* Chat */
  .chat-inbox-item {
    padding: 0.75rem 1rem;
  }

  .chat-inbox-subject {
    font-size: 0.8rem;
  }

  /* Modal */
  .modal-card {
    max-height: 95vh;
  }

  .modal-header h2 {
    font-size: 1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  /* Notification */
  .notif-dropdown {
    top: 50px;
  }

  .notif-item {
    padding: 0.75rem 1rem;
  }

  .notif-msg {
    font-size: 0.8rem;
  }
}