/* ============================================================
   HMO SERVICE DESK — Design System CSS
   Versão: 1.0.0 | Cor Principal: Verde #16a34a
   ============================================================ */

/* ---- GOOGLE FONTS ----
   NOTA: O @import aqui bloqueia a renderização. A carga foi movida para <link rel="preconnect">
   no head_meta.php. Este @import permanece como fallback para contextos sem head_meta. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES (LIGHT MODE)
   ============================================================ */
:root {
  /* Primary Green */
  --primary:        #16a34a;
  --primary-dark:   #15803d;
  --primary-light:  #22c55e;
  --primary-50:     #f0fdf4;
  --primary-100:    #dcfce7;
  --primary-200:    #bbf7d0;
  --primary-600:    #16a34a;
  --primary-700:    #15803d;

  /* Neutrals */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic Colors */
  --success:   #16a34a;
  --danger:    #dc2626;
  --warning:   #d97706;
  --info:      #2563eb;
  --purple:    #7c3aed;

  /* Backgrounds */
  --bg:        #f0fdf4;
  --bg-card:   #ffffff;
  --bg-input:  #ffffff;
  --bg-hover:  #f1f5f9;

  /* Text */
  --text:      #1e293b;
  --text-muted:#64748b;
  --text-light:#94a3b8;
  --text-inv:  #ffffff;

  /* Border */
  --border:    #e2e8f0;
  --border-focus: #16a34a;

  /* Sidebar */
  --sidebar-bg:     #0f172a;
  --sidebar-width:  260px;
  --sidebar-text:   #94a3b8;
  --sidebar-hover:  rgba(255,255,255,0.07);
  --sidebar-active: rgba(22,163,74,0.2);
  --sidebar-active-text: #4ade80;

  /* Header */
  --header-h:   64px;
  --header-bg:  #ffffff;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow:    0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 0 3px rgba(22,163,74,0.2);

  /* Border Radius */
  --radius-sm:  6px;
  --radius:     10px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-full:9999px;

  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.35s ease;

  /* Font */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --bg:         #0f172a;
  --bg-card:    #1e293b;
  --bg-input:   #1e293b;
  --bg-hover:   #334155;
  --text:       #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border:     #334155;
  --header-bg:  #1e293b;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow:     0 4px 6px rgba(0,0,0,0.3);

  /* Tons primários redefinidos para dark mode.
     No light: fundos muito claros (#f0fdf4, #dcfce7) + texto escuro (#15803d).
     No dark: texto branco (#f1f5f9) → fundos devem ser escuros/transparentes
     para não criar contraste invertido (texto branco sobre fundo claríssimo). */
  --primary-50:  rgba(22, 163, 74, 0.12);   /* hover de linha de tabela        */
  --primary-100: rgba(22, 163, 74, 0.22);   /* card stats, chat ativo          */
  --primary-200: rgba(22, 163, 74, 0.35);   /* bordas sutis primárias          */
  --primary-700: #4ade80;                    /* texto primário escuro → claro   */
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%; /* Safari/iOS */
  text-size-adjust: 100%;         /* Chrome 54+, Edge 79+, Samsung Internet 6+ */
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }
ul { list-style: none; }

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

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition-slow);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(22,163,74,0.4);
}

.logo-text { display: flex; flex-direction: column; }
.logo-title { font-weight: 700; font-size: 16px; color: #ffffff; line-height: 1.1; }
.logo-subtitle { font-size: 11px; color: var(--sidebar-text); font-weight: 500; }

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--sidebar-text);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.sidebar-close:hover { background: var(--sidebar-hover); }

/* Sidebar User */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  position: relative;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { display: block; font-weight: 600; font-size: 13px; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--sidebar-text); }

.sidebar-user-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sidebar-user-status.online { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.6); }

/* Sidebar Nav */
.sidebar-nav { flex: 1; padding: 8px 8px; }

.nav-section { margin-bottom: 8px; }

.nav-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-text);
  padding: 12px 10px 4px;
  opacity: 0.6;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  margin-bottom: 1px;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
  text-decoration: none;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}

.nav-item.active .nav-icon { color: var(--primary-light); }

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: color var(--transition);
}

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

.nav-badge-alert { background: var(--danger); }

.nav-logout { margin-top: 4px; }
.nav-logout:hover { background: rgba(220,38,38,0.15); color: #fca5a5; }

/* Sidebar Footer */
.sidebar-footer {
  padding: 8px 8px 0;
  border-top: 1px solid rgba(255,255,255,0.07);
}

/* Créditos no rodapé da sidebar */
.sidebar-credits {
  margin-top: 8px;
  padding: 10px 8px 14px;
  border-top: 1px solid rgba(255,255,255,0.05);
  text-align: center;
}
.credits-org {
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  letter-spacing: .03em;
  line-height: 1.5;
  margin-bottom: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.credits-copy {
  font-size: 9px;
  color: rgba(255,255,255,0.28);
  margin-bottom: 3px;
}
.credits-dev {
  font-size: 9px;
  color: rgba(255,255,255,0.28);
}
.credits-dev a {
  color: #4ade80;
  text-decoration: none;
  font-weight: 600;
}
.credits-dev a:hover { text-decoration: underline; }

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  min-width: 0;          /* crítico: impede overflow em flex */
  overflow-x: hidden;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
}

/* ---- HEADER ---- */
.app-header {
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.header-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.header-menu-btn:hover { background: var(--bg-hover); }

.header-breadcrumb {
  flex: 1;
}

.breadcrumb-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.breadcrumb-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-icon-btn {
  position: relative;
  background: none;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.header-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.header-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--header-bg);
}

.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid var(--primary-200);
  transition: border-color var(--transition);
}
.header-avatar:hover { border-color: var(--primary); }

/* ---- PAGE CONTENT ---- */
.page-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  padding: 24px;
  box-sizing: border-box;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
h4 { font-size: 14px; font-weight: 600; }
h5 { font-size: 13px; font-weight: 600; }

.text-sm    { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-danger{ color: var(--danger); }
.text-success{ color: var(--success); }
.text-warning{ color: var(--warning); }
.text-info  { color: var(--info); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
  padding: 16px 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;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }
.card-body-sm { padding: 14px 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--primary));
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--stat-bg, var(--primary-100));
  color: var(--stat-color, var(--primary));
  flex-shrink: 0;
}

.stat-info, .stat-body { flex: 1; }
.stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}
.stat-sub {
  font-size: 11px;
  font-weight: 500;
  margin-top: 3px;
  color: var(--text-muted);
}
.stat-change {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  font-family: var(--font);
  line-height: 1;
}

.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-lg  { padding: 11px 22px; font-size: 15px; }
.btn-icon{ padding: 8px; width: 36px; height: 36px; }
.btn-sm.btn-icon { width: 30px; height: 30px; padding: 5px; }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22,163,74,0.35);
  color: white;
  text-decoration: none;
}
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary-50);
  color: var(--primary-dark);
  text-decoration: none;
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--gray-200);
  color: var(--text);
  text-decoration: none;
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #b91c1c;
  color: white;
  text-decoration: none;
}

.btn-warning {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}
.btn-info {
  background: var(--info);
  color: white;
  border-color: var(--info);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }

.btn:disabled, .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Status badges — v2 (fluxo de manutenção expandido) */
.status-open                { background: #dbeafe; color: #1d4ed8; }
.status-sent                { background: #ede9fe; color: #5b21b6; }
.status-received            { background: #cffafe; color: #0e7490; }
.status-maintenance-started { background: #fef3c7; color: #92400e; }
.status-in-maintenance      { background: #ffedd5; color: #9a3412; }
.status-maintenance-done    { background: #dcfce7; color: #15803d; }
.status-ready-delivery      { background: #dbeafe; color: #1e40af; }
.status-out-delivery        { background: #ede9fe; color: #4c1d95; }
.status-delivered           { background: #d1fae5; color: #065f46; }
.status-closed              { background: var(--gray-100); color: var(--gray-600); }
/* Legados (retrocompatibilidade) */
.status-progress { background: #fef3c7; color: #92400e; }
.status-pending  { background: #ede9fe; color: #5b21b6; }
.status-resolved { background: #dcfce7; color: #15803d; }

/* Barra de progresso do fluxo de status */
.status-flow { display:flex;align-items:flex-start;gap:0;overflow-x:auto;padding:16px 4px 8px;scrollbar-width:thin; }
.status-flow-step { display:flex;flex-direction:column;align-items:center;flex-shrink:0;min-width:54px; }
.status-flow-dot {
    width:30px;height:30px;border-radius:50%;border:2px solid var(--border);
    background:var(--surface);display:flex;align-items:center;justify-content:center;
    font-size:11px;font-weight:700;position:relative;z-index:1;transition:.2s;cursor:default;
}
.status-flow-dot.done    { background:var(--primary);border-color:var(--primary);color:#fff; }
.status-flow-dot.current { background:var(--primary);border-color:var(--primary);color:#fff;
                           box-shadow:0 0 0 4px rgba(22,163,74,.18); }
.status-flow-line        { height:2px;width:16px;background:var(--border);flex-shrink:0;margin-top:15px; }
.status-flow-line.done   { background:var(--primary); }
.status-flow-label       { font-size:9px;font-weight:600;text-align:center;color:var(--text-muted);
                           max-width:54px;line-height:1.2;margin-top:4px;white-space:normal;word-break:break-word; }

/* Priority badges */
.priority-critical { background: #fee2e2; color: #991b1b; }
.priority-high     { background: #ffedd5; color: #92400e; }
.priority-medium   { background: #fef9c3; color: #713f12; }
.priority-low      { background: #dbeafe; color: #1e40af; }

/* Generic badges */
.badge-primary { background: var(--primary-100); color: var(--primary-700); }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-row {
  display: grid;
  gap: 16px;
  width: 100%;
  min-width: 0;
}
.form-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

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

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text);
  transition: all var(--transition);
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}
.form-control::placeholder { color: var(--text-light); }
.form-control:disabled { background: var(--gray-100); cursor: not-allowed; opacity: 0.7; }

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

select.form-control { cursor: pointer; }

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
}
.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.form-control.is-invalid { border-color: var(--danger); }

/* Search input */
.search-wrapper {
  position: relative;
}
.search-wrapper .form-control {
  padding-left: 38px;
}
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 16px;
  height: 16px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

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

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

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

tbody tr {
  transition: background var(--transition);
}
tbody tr:hover { background: var(--primary-50); }

.table-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  padding: 16px;
}
.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s cubic-bezier(0.16,1,0.3,1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-title { font-size: 16px; font-weight: 700; color: var(--text); }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  display: flex;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }

.modal-body { padding: 20px 22px; }

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  margin-bottom: 16px;
}
.alert-success { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }

/* ============================================================
   DROPDOWN
   ============================================================ */
.dropdown { position: relative; display: inline-flex; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 150;
  overflow: hidden;
  animation: dropIn 0.15s ease;
  display: none;
}
.dropdown-menu.show { display: block; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text);
  transition: background var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--primary); }
.dropdown-item.danger:hover { background: #fee2e2; color: var(--danger); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ============================================================
   PROGRESS
   ============================================================ */
.progress {
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.5s ease;
}
.progress-bar.danger  { background: var(--danger); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.info    { background: var(--info); }

/* ============================================================
   AVATAR GROUP
   ============================================================ */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
}
.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 48px; height: 48px; }
.avatar-xl { width: 80px; height: 80px; }

.avatar-group {
  display: flex;
  align-items: center;
}
.avatar-group .avatar {
  border: 2px solid var(--bg-card);
  margin-right: -8px;
}
.avatar-group .avatar:last-child { margin-right: 0; }

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

.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  opacity: 0.3;
}
.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.empty-desc { font-size: 13px; }

/* ============================================================
   SKELETON LOADER
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--gray-900);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
  pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.16,1,0.3,1);
  max-width: 340px;
  border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(110%); }
}
.toast.removing { animation: toastOut 0.3s ease forwards; }

/* ============================================================
   KANBAN BOARD
   ============================================================ */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  min-height: calc(100vh - 180px);
}

.kanban-column {
  min-width: 280px;
  max-width: 300px;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.kanban-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kanban-col-title {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-col-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(0,0,0,0.08);
}

.kanban-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  min-height: 80px;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: grab;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}
.kanban-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.kanban-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
}
.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  flex-wrap: wrap;
  gap: 4px;
}
.kanban-card-id {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  font-family: var(--font-mono);
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  width: 100%;
}

.chart-container {
  position: relative;
  height: 260px;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 6px;
  flex-shrink: 0;
}

/* ============================================================
   CHAT
   ============================================================ */
.chat-layout {
  display: flex;
  height: calc(100vh - var(--header-h) - 48px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.chat-sidebar {
  width: 300px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-rooms { flex: 1; overflow-y: auto; }

.chat-room-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid rgba(0,0,0,0.03);
  position: relative;
}
.chat-room-item:hover { background: var(--bg-hover); }
.chat-room-item.active { background: var(--primary-50); }

.chat-room-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--primary-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
}

.chat-room-info { flex: 1; overflow: hidden; }
.chat-room-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-room-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-room-time { font-size: 10px; color: var(--text-light); margin-top: 2px; }
.chat-room-unread {
  position: absolute;
  right: 14px;
  top: 14px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Chat Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-group { margin-bottom: 16px; }

.msg-date-divider {
  text-align: center;
  font-size: 11px;
  color: var(--text-light);
  margin: 12px 0;
  position: relative;
}
.msg-date-divider::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 1px solid var(--border);
  z-index: 0;
}
.msg-date-divider span {
  background: var(--bg-card);
  padding: 0 10px;
  position: relative;
  z-index: 1;
}

.chat-msg {
  display: flex;
  gap: 8px;
  max-width: 75%;
}
.chat-msg.own {
  flex-direction: row-reverse;
  margin-left: auto;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  align-self: flex-end;
}
.chat-msg.own .msg-avatar { display: none; }

.msg-content { display: flex; flex-direction: column; gap: 2px; }
.chat-msg.own .msg-content { align-items: flex-end; }

.msg-sender {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 4px;
}

.msg-bubble {
  background: var(--gray-100);
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  border-bottom-left-radius: 4px;
  max-width: 100%;
  word-break: break-word;
}
.chat-msg.own .msg-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 16px;
}

.msg-time {
  font-size: 10px;
  color: var(--text-light);
  padding: 0 4px;
}

/* Chat Input */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--gray-50);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: border-color var(--transition);
}
.chat-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}
#chatInput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text);
  resize: none;
  max-height: 100px;
}

/* ============================================================
   VIDEO CONFERÊNCIA
   ============================================================ */
.meeting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.meeting-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition);
}
.meeting-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.meeting-card-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 20px;
}
.meeting-time {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 4px;
}
.meeting-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}
.meeting-card-body { padding: 16px; }

.jitsi-container {
  width: 100%;
  height: 75vh;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* ============================================================
   TICKET DETAIL
   ============================================================ */
.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  width: 100%;
}

.ticket-header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.ticket-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 10px; top: 4px; bottom: 4px;
  width: 2px;
  background: var(--border);
}

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

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 2px var(--primary-200);
}

.timeline-content {
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.timeline-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.timeline-author { font-weight: 600; font-size: 13px; }
.timeline-time { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   REPORTS
   ============================================================ */
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  width: 100%;
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar .form-control {
  width: auto;
  min-width: 140px;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.flex      { display: flex; }
.flex-col  { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-4   { gap: 4px; }
.gap-6   { gap: 6px; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.flex-1  { flex: 1; }
.w-full  { width: 100%; }
.mt-4    { margin-top: 4px; }
.mt-8    { margin-top: 8px; }
.mt-12   { margin-top: 12px; }
.mt-16   { margin-top: 16px; }
.mt-24   { margin-top: 24px; }
.mb-4    { margin-bottom: 4px; }
.mb-8    { margin-bottom: 8px; }
.mb-12   { margin-bottom: 12px; }
.mb-16   { margin-bottom: 16px; }
.mb-24   { margin-bottom: 24px; }
.p-0     { padding: 0; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  background: #0f172a;
}

.login-left {
  flex: 1;
  background: linear-gradient(135deg, #15803d 0%, #166534 50%, #0f172a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border: 80px solid rgba(255,255,255,0.04);
  border-radius: 50%;
  top: -100px;
  right: -100px;
}

.login-left::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border: 50px solid rgba(255,255,255,0.06);
  border-radius: 50%;
  bottom: -50px;
  left: -50px;
}

.login-brand {
  text-align: center;
  position: relative;
  z-index: 1;
}

.login-logo {
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,0.15);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  border: 1px solid rgba(255,255,255,0.2);
}

.login-app-name {
  font-size: 32px;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.login-tagline {
  font-size: 16px;
  color: rgba(255,255,255,0.65);
  margin-top: 8px;
  font-weight: 400;
}

.login-features {
  margin-top: 52px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(255,255,255,0.75);
  font-size: 15px;
}

.login-feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.login-right {
  width: 480px;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.login-form-header { text-align: center; margin-bottom: 36px; }
.login-form-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 6px;
}
.login-form-sub { color: var(--gray-500); font-size: 14px; }

.login-form { width: 100%; max-width: 360px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* ── Utilitário de layout 2 colunas (conteúdo + painel lateral) ── */
.page-2col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
  width: 100%;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVO — 1200 px  (telas largas / TV)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .stats-grid    { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid{ grid-template-columns: minmax(0, 1fr); }
  .page-2col     { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1024px) {
  .ticket-layout { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVO — 1024 px  (tablets landscape / notebooks pequenos)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  /* Login */
  .login-left   { display: none; }
  .login-right  { width: 100%; min-height: 100vh; background: #0f172a; }
  .login-form-title { color: #fff; }
  .login-form-sub   { color: rgba(255,255,255,.6); }
  .login-form .form-label   { color: rgba(255,255,255,.8); }
  .login-form .form-control { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); color: #fff; }
  .login-form .form-control::placeholder { color: rgba(255,255,255,.3); }
  .login-form .form-control:focus       { border-color: var(--primary); background: rgba(255,255,255,.12); }

  /* Layout 2 colunas → 1 coluna */
  .page-2col { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVO — 900 px  (tablets portrait)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .chat-sidebar  { width: 260px; }
  .form-row-3    { grid-template-columns: 1fr 1fr; }
  .meeting-grid  { grid-template-columns: 1fr; }

  /* Tabelas: scroll horizontal */
  .data-table-wrap,
  .table-wrapper { overflow-x: auto; scroll-behavior: smooth; }
  .data-table    { min-width: 600px; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVO — 768 px  (mobile landscape / tablets pequenos)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
    --header-h: 56px;
  }

  /* Sidebar: drawer overlay */
  .sidebar {
    transform: translateX(-280px);
    width: 280px !important;
    z-index: 200;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.show { display: block; }
  .sidebar-close        { display: flex; }

  /* Layout principal */
  .main-content     { margin-left: 0; }
  .header-menu-btn  { display: flex; }
  .page-content     { padding: 14px; }

  /* Header */
  .app-header      { padding: 0 14px; gap: 10px; }
  .breadcrumb-sub  { display: none; }
  .breadcrumb-title{ font-size: 14px; }
  .header-actions  { gap: 6px; }
  .header-icon-btn { width: 34px; height: 34px; }

  /* Stats grid */
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card  { padding: 14px 12px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 11px; }

  /* Dashboard e ticket */
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .ticket-layout  { grid-template-columns: minmax(0, 1fr); }
  .report-grid    { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Layout 2 colunas */
  .page-2col  { grid-template-columns: minmax(0, 1fr); gap: 14px; }

  /* Forms */
  .form-row-2 { grid-template-columns: minmax(0, 1fr); }
  .form-row-3 { grid-template-columns: minmax(0, 1fr); }

  /* Cards */
  .card-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .card-body   { padding: 14px; }
  .card-footer {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Buttons no footer wrap */
  .card-footer .btn { flex: 1 1 auto; justify-content: center; min-width: 100px; }

  /* Tabelas */
  .data-table-wrap,
  .table-wrapper { overflow-x: auto; scroll-behavior: smooth; }
  .data-table    { min-width: 560px; }
  thead th, tbody td { padding: 10px 10px; font-size: 12px; }

  /* Filter bar */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filter-bar .form-control,
  .filter-bar .btn { width: 100%; }

  /* Chat */
  .chat-sidebar {
    position: fixed;
    left: 0; top: var(--header-h); bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    border-radius: 0;
    box-shadow: var(--shadow-lg);
    width: 280px;
  }
  .chat-sidebar.open { transform: translateX(0); }
  .chat-layout       { border-radius: 0; }

  /* Modais */
  .modal-container {
    width: 96vw !important;
    max-width: 96vw !important;
    margin: 16px auto;
    max-height: 92vh;
    overflow-y: auto;
  }

  /* Toasts */
  #toast-container { right: 10px; bottom: 10px; left: 10px; }
  .toast           { max-width: 100%; }

  /* Portal header */
  .portal-header { padding: 0 14px !important; height: 54px !important; }
  .portal-content { padding: 16px 14px !important; max-width: 100% !important; }

  /* Kanban */
  .kanban-board  { overflow-x: auto; gap: 12px; padding-bottom: 8px; }
  .kanban-column { min-width: 240px; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVO — 480 px  (mobile portrait)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  :root { --header-h: 52px; }

  /* Tipo "1 coluna forçada" */
  .stats-grid    { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .page-2col     { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .report-grid   { grid-template-columns: minmax(0, 1fr); }
  .dashboard-grid{ grid-template-columns: minmax(0, 1fr); }
  .ticket-layout { grid-template-columns: minmax(0, 1fr); }

  /* Kanban empilhado */
  .kanban-board  { flex-direction: column; overflow-x: unset; }
  .kanban-column { min-width: unset; max-width: unset; width: 100%; }

  /* Tipografia */
  h1 { font-size: 18px; }
  h2 { font-size: 16px; }

  /* Botões menores */
  .btn    { padding: 7px 12px; font-size: 12.5px; }
  .btn-lg { padding: 10px 16px; font-size: 14px; }

  /* Cards sem padding excessivo */
  .card-body   { padding: 12px; }
  .card-header { padding: 10px 12px; }
  .card-footer { padding: 8px 12px; }
  .page-content{ padding: 10px; }

  /* Prioridade em 2 colunas no portal */
  .priority-cards { grid-template-columns: 1fr 1fr !important; }

  /* Header actions: só ícones */
  .header-actions .btn-secondary { display: none; }

  /* Breadcrumb mais curto */
  .breadcrumb-title { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Tabelas mais compactas */
  .data-table { min-width: 480px; }
  thead th, tbody td { padding: 8px 8px; font-size: 11.5px; }

  /* Portal logo: só ícone */
  .portal-logo > div:last-child { display: none; }
  .portal-header .btn-secondary { font-size: 11px; padding: 5px 9px; }

  /* Tela de login */
  .login-card { padding: 24px 18px; margin: 12px; border-radius: 16px; }
  .login-logo  { width: 48px; height: 48px; }
  .login-title { font-size: 20px; }

  /* Filtros de ticket empilhados */
  .ticket-filters { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVO — 360 px  (dispositivos muito pequenos)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
  .page-content { padding: 8px; }
  .stats-grid   { gap: 6px; }
  .stat-value   { font-size: 20px; }
  .btn          { padding: 6px 10px; font-size: 12px; }
  .badge        { font-size: 10px; padding: 2px 6px; }
  thead th, tbody td { padding: 6px 6px; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .app-header, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
  body { background: white; }
}
