/* CDS – Central de Demandas e Solicitações */
/* Custom styles complementando Tailwind */

:root {
  --cds-primary: #1e40af;
  --cds-primary-light: #3b82f6;
  --cds-secondary: #7c3aed;
  --cds-success: #059669;
  --cds-warning: #d97706;
  --cds-danger: #dc2626;
  --cds-sidebar-width: 260px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── LAYOUT PRINCIPAL ── */
#app { min-height: 100vh; }

.cds-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.cds-sidebar {
  width: var(--cds-sidebar-width);
  background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.cds-sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.cds-sidebar-logo h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cds-sidebar-logo p {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 2px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cds-nav-section {
  padding: 12px 12px 4px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #475569;
  font-weight: 600;
}

.cds-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  margin: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  color: #94a3b8;
  text-decoration: none;
}

.cds-nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
}

.cds-nav-item.active {
  background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(139,92,246,0.3));
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(59,130,246,0.3);
}

.cds-nav-item i {
  width: 18px;
  text-align: center;
  font-size: 0.85rem;
}

.cds-nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: white;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

.cds-user-info {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.cds-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
  color: white; flex-shrink: 0;
}

.cds-avatar.lg {
  width: 48px; height: 48px;
  font-size: 1.2rem;
}

/* ── MAIN CONTENT ── */
.cds-main {
  margin-left: var(--cds-sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.cds-topbar {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.cds-content {
  padding: 24px;
  flex: 1;
  /* Garante que o conteúdo não fica por baixo de elementos fixed */
  position: relative;
  z-index: 1;
}

/* ── PAGE HEADER ── */
.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #0f172a;
}

.page-header p {
  color: #64748b;
  margin-top: 2px;
  font-size: 0.9rem;
}

/* ── CARDS ── */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: 20px; }

/* ── STAT CARDS ── */
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: #0f172a;
}

.stat-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 3px;
  font-weight: 500;
}

/* ── BADGES / STATUS ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-aberta { background: #dbeafe; color: #1d4ed8; }
.badge-em_andamento { background: #fef3c7; color: #92400e; }
.badge-aguardando { background: #ede9fe; color: #5b21b6; }
.badge-concluida { background: #d1fae5; color: #065f46; }
.badge-cancelada { background: #f1f5f9; color: #475569; }
.badge-reprovada { background: #fee2e2; color: #991b1b; }

.priority-critica { color: #dc2626; }
.priority-alta { color: #f97316; }
.priority-media { color: #3b82f6; }
.priority-baixa { color: #10b981; }

.priority-badge-critica { background: #fee2e2; color: #dc2626; }
.priority-badge-alta { background: #fff7ed; color: #c2410c; }
.priority-badge-media { background: #eff6ff; color: #1d4ed8; }
.priority-badge-baixa { background: #f0fdf4; color: #166534; }

/* ── SLA INDICATOR ── */
.sla-ok { color: #059669; }
.sla-warning { color: #d97706; }
.sla-overdue { color: #dc2626; animation: pulse 2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.sla-bar {
  height: 4px;
  border-radius: 2px;
  background: #e2e8f0;
  overflow: hidden;
}

.sla-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ── TICKET CARD ── */
.ticket-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid transparent;
}

.ticket-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.ticket-card.priority-critica { border-left-color: #dc2626; }
.ticket-card.priority-alta { border-left-color: #f97316; }
.ticket-card.priority-media { border-left-color: #3b82f6; }
.ticket-card.priority-baixa { border-left-color: #10b981; }

.ticket-number {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }

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

.form-label .required { color: #ef4444; margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
  color: #1e293b;
  outline: none;
}

.form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.form-control:disabled {
  background: #f8fafc;
  color: #94a3b8;
}

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 80px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; box-shadow: 0 4px 12px rgba(37,99,235,0.3); }

.btn-secondary { background: #f1f5f9; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }

.btn-success { background: #059669; color: white; }
.btn-success:hover:not(:disabled) { background: #047857; }

.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-warning { background: #d97706; color: white; }
.btn-warning:hover:not(:disabled) { background: #b45309; }

.btn-ghost { background: transparent; color: #374151; }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 8px;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none; /* começa oculto — JS seta display:flex ao abrir */
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 720px;
  margin: auto;
  box-shadow: 0 25px 80px rgba(0,0,0,0.3);
  animation: slideIn 0.3s ease;
}

.modal-lg { max-width: 900px; }
.modal-md { max-width: 640px; }
.modal-sm { max-width: 480px; }
.modal-xs { max-width: 360px; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: #0f172a; }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}

/* ── TABLES ── */
.table-wrapper { overflow-x: auto; }

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

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
  vertical-align: middle;
}

tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }

/* ── COMMENTS ── */
.comment-bubble {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.comment-bubble.internal .comment-content-box {
  background: #fef3c7;
  border-color: #fcd34d;
}

.comment-bubble.system .comment-content-box {
  background: #f0f9ff;
  border-color: #bae6fd;
  font-style: italic;
}

.comment-content-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  flex: 1;
}

.comment-meta {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 4px;
}

/* ── TIMELINE ── */
.timeline { position: relative; padding-left: 24px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 0; bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.timeline-item {
  position: relative;
  padding-bottom: 16px;
}

.timeline-dot {
  position: absolute;
  left: -21px;
  top: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: white;
  border: 2px solid #3b82f6;
}

/* ── NOTIFICATIONS ── */
.notif-dropdown {
  position: absolute;
  top: 50px; right: 0;
  width: 360px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  border: 1px solid #e2e8f0;
  z-index: 200;
  animation: slideIn 0.2s ease;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eff6ff; }
.notif-item:last-child { border-bottom: none; }

/* ── FILTERS BAR ── */
.filters-bar {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 0.72rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }

.filter-select {
  padding: 6px 10px;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.82rem;
  background: white;
  cursor: pointer;
  min-width: 130px;
  outline: none;
  color: #374151;
}

.filter-select:focus { border-color: #3b82f6; }

/* ── SEARCH ── */
.search-input {
  padding: 8px 14px 8px 36px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
  background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.44 1.406a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E") no-repeat 10px center;
}

.search-input:focus { border-color: #3b82f6; background-color: white; }

/* ── TYPE SELECTOR (new request) ── */
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.type-card {
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.type-card:hover { border-color: #3b82f6; background: #eff6ff; }
.type-card.selected { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

.type-card-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px;
  font-size: 1.2rem;
}

.type-card-name { font-size: 0.78rem; font-weight: 600; color: #374151; }
.type-card-sla { font-size: 0.68rem; color: #94a3b8; margin-top: 2px; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
}

.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: #64748b; }
.empty-state p { font-size: 0.875rem; margin-top: 8px; }

/* ── LOADING ── */
.loading-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid rgba(0,0,0,0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

/* ── TOAST ── */
#toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none; /* container não captura cliques */
  width: max-content;   /* não expande além dos toasts */
  max-width: 400px;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 260px;
  max-width: 380px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
  pointer-events: auto; /* toasts individuais SIM capturam cliques */
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast-success { background: #065f46; color: white; }
.toast-error { background: #991b1b; color: white; }
.toast-info { background: #1e40af; color: white; }
.toast-warning { background: #92400e; color: white; }

/* ── RESPONSIVE placeholder (full rules at bottom) ── */
.chart-container {
  position: relative;
  height: 240px;
  z-index: 0; /* Canvas do chart não deve subir acima do bottom-nav */
}
.chart-container canvas {
  position: relative !important;
  z-index: 0 !important;
}

/* ── DETAIL VIEW ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

/* ── PROGRESS STEPS ── */
.progress-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
}

.step::after {
  content: '';
  position: absolute;
  top: 15px; left: 50%;
  width: 100%;
  height: 2px;
  background: #e2e8f0;
  z-index: 0;
}

.step:last-child::after { display: none; }

.step-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #94a3b8;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 6px;
  font-size: 0.75rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.step.active .step-dot { background: #2563eb; color: white; }
.step.done .step-dot { background: #059669; color: white; }
.step.done::after { background: #059669; }

.step-label { font-size: 0.7rem; color: #64748b; font-weight: 500; }
.step.active .step-label { color: #2563eb; font-weight: 600; }
.step.done .step-label { color: #059669; }

/* ── KANBAN ── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 20px;
}

.kanban-col {
  min-width: 280px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
}

.kanban-col-header {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── TABS ── */
.tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
  gap: 0;
}

.tab-btn {
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover { color: #2563eb; }
.tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; }

/* ── MOBILE MENU BUTTON ── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #374151;
  padding: 6px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
}

/* ── OVERLAY for mobile sidebar ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  /* Importante: sem pointer-events quando oculto */
  pointer-events: none;
}
.sidebar-overlay.show {
  display: block;
  pointer-events: auto;
}

/* ── BOTTOM NAV (mobile only) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #0f172a;
  border-top: 1px solid rgba(255,255,255,0.1);
  z-index: 98;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* Garante que o nav não capture cliques do conteúdo quando não visível */
  pointer-events: auto;
}
.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 56px;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: #64748b;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 6px 4px;
  border-radius: 8px;
  transition: color 0.2s;
  min-height: 48px;
}
.bottom-nav-item i { font-size: 1.1rem; }
.bottom-nav-item.active { color: #60a5fa; }
.bottom-nav-item:active { background: rgba(255,255,255,0.05); }

/* ── RESPONSIVE: TABLET ── */
@media (max-width: 1024px) {
  .detail-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ── RESPONSIVE: MOBILE ── */
@media (max-width: 768px) {
  /* Sidebar off-screen by default */
  .cds-sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .cds-sidebar.open { transform: translateX(0); }

  /* Main area fills screen */
  .cds-main { margin-left: 0 !important; }

  /* Topbar */
  .cds-topbar {
    padding: 0 12px;
    height: 52px;
  }

  /* Content area with bottom nav padding */
  .cds-content {
    padding: 12px;
    padding-bottom: 80px; /* space for bottom nav — must be > nav height */
  }

  /* Show mobile controls */
  .mobile-menu-btn { display: flex; }
  .bottom-nav { display: block; }

  /* Page header */
  .page-header { margin-bottom: 16px; }
  .page-header h2 { font-size: 1.2rem; }
  .page-header p { font-size: 0.8rem; }

  /* Force full-width flex stacks */
  .page-header .flex { flex-wrap: wrap; gap: 8px; }
  .page-header .flex > * { flex-shrink: 0; }

  /* Stat cards: 2 columns on mobile */
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card { padding: 14px 12px; }
  .stat-card .text-3xl { font-size: 1.5rem; }
  .stat-card .text-sm { font-size: 0.7rem; }

  /* Charts: single column */
  .charts-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .chart-container { height: 200px; }

  /* Cards */
  .card { border-radius: 12px; }
  .card-header { padding: 12px 14px; }

  /* Type grid: 2 columns on mobile */
  .type-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .type-card { padding: 14px 10px; }
  .type-card .text-sm { font-size: 0.7rem; }

  /* Tables → card layout on mobile */
  .table-wrapper table { display: none; }
  .table-wrapper .admin-table-card { display: block !important; }

  /* Modals: full-screen on mobile */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 20px 20px 0 0 !important;
    max-height: 92vh;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0;
    overflow-y: auto;
  }
  .modal.modal-sm { width: 100% !important; max-width: 100% !important; }
  .modal.modal-md { width: 100% !important; max-width: 100% !important; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }

  /* Forms: single column */
  .modal-body .grid { grid-template-columns: 1fr !important; }
  .modal-body .col-span-2 { grid-column: 1 !important; }

  /* Request ticket cards */
  .ticket-card { padding: 14px; }
  .ticket-card .flex { flex-wrap: wrap; gap: 6px; }

  /* Filters: stacked */
  .filters-bar { flex-direction: column; gap: 8px; }
  .filters-bar .flex { flex-wrap: wrap; gap: 6px; }
  .filters-bar select,
  .filters-bar input { font-size: 0.85rem; min-width: 120px; }

  /* Buttons: touch-friendly */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; padding: 6px 10px; font-size: 0.78rem; }
  .btn-lg { min-height: 48px; }

  /* Navigation steps */
  .progress-steps { gap: 0; }
  .step-label { font-size: 0.6rem; }

  /* Admin tables → list cards */
  .admin-table-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
  }
  .admin-row-card {
    background: white;
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .admin-row-card .row-title { font-weight: 600; font-size: 0.9rem; }
  .admin-row-card .row-meta { font-size: 0.75rem; color: #64748b; }
  .admin-row-card .row-actions { display: flex; gap: 6px; margin-top: 4px; }

  /* Detail grid stacks */
  .detail-grid { grid-template-columns: 1fr; }

  /* Kanban: horizontal scroll */
  .kanban-board { padding-bottom: 8px; }
  .kanban-col { min-width: 240px; }

  /* Tabs: scrollable */
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab-btn { white-space: nowrap; padding: 8px 14px; font-size: 0.8rem; }

  /* Hide text labels on small topbar */
  .cds-topbar .hidden { display: none !important; }

  /* Notification dropdown full width */
  #notif-dropdown {
    position: fixed !important;
    top: 52px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    border-radius: 0 0 12px 12px !important;
  }

  /* Toast: full width bottom */
  #toast-container {
    bottom: 70px !important;
    top: auto !important;
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
    max-width: calc(100% - 16px) !important;
    pointer-events: none;
  }
  .toast {
    width: 100%;
    justify-content: center;
    pointer-events: auto;
  }

  /* Login page */
  .login-page { padding: 16px; align-items: flex-start; padding-top: 60px; }
  .login-card { border-radius: 16px; padding: 24px 20px; }

  /* User info in sidebar: compact */
  .cds-user-info { padding: 12px 14px; }
}

/* ── RESPONSIVE: small phones ── */
@media (max-width: 380px) {
  .stat-cards { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .cds-content { padding: 10px; padding-bottom: 72px; }
  .bottom-nav-item span { display: none; }
  .bottom-nav-item { gap: 0; }
  .bottom-nav-item i { font-size: 1.3rem; }
  .bottom-nav-inner { height: 52px; }
}
