/* ============================================================
   HelpDesk IT — Design System v2.0
   Mobile-First · Zero regras duplicadas
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary:    #4f46e5;
  --primary-d:  #3730a3;
  --primary-l:  #eef2ff;
  --secondary:  #64748b;
  --success:    #10b981;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --info:       #06b6d4;
  --dark:       #0f172a;
  --dark-2:     #1e293b;
  --light:      #f8fafc;
  --white:      #ffffff;
  --border:     #e2e8f0;
  --text:       #334155;
  --text-muted: #94a3b8;
  --sidebar-w:  260px;
  --topbar-h:   60px;
  --radius:     10px;
  --radius-sm:  7px;
  --radius-lg:  16px;
  --shadow:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:  0 12px 32px rgba(0,0,0,.12);
  --ease:       cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--light);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-d); }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ============================================================
   LAYOUT — Mobile-First
   Sidebar: oculta por padrão → slide-in (mobile) / fixa (≥1024px)
   ============================================================ */

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.65);
  backdrop-filter: blur(3px);
  z-index: 199;
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.sidebar-overlay.active { opacity: 1; }

.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100dvh;
  background: var(--dark);
  display: flex; flex-direction: column;
  z-index: 200;
  overflow-y: auto; overflow-x: hidden;
  transform: translateX(-100%);
  transition: transform .28s var(--ease);
  will-change: transform;
}
.sidebar.active { transform: translateX(0); }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  height: var(--topbar-h);
  color: var(--white); font-size: 16px; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-brand i { color: #818cf8; font-size: 22px; flex-shrink: 0; }
.sidebar-brand img { max-height: 32px; width: auto; object-fit: contain; }
.sidebar-brand-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-close-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex-shrink: 0;
  background: rgba(255,255,255,.07); border: none; border-radius: 6px;
  color: rgba(255,255,255,.5); font-size: 16px; cursor: pointer;
  transition: all .15s; margin-left: auto;
}
.sidebar-close-btn:hover { background: rgba(255,255,255,.14); color: #fff; }

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

.nav-group-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: rgba(255,255,255,.25);
  padding: 14px 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; color: rgba(255,255,255,.58);
  transition: all .15s var(--ease); border-radius: var(--radius-sm);
  position: relative; margin-bottom: 1px;
  font-size: 13.5px; font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(99,102,241,.22); font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 22%; bottom: 22%;
  width: 3px; border-radius: 0 3px 3px 0; background: #818cf8;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-item.active i { color: #a5b4fc; }

.badge-count {
  margin-left: auto; background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px; min-width: 18px;
  text-align: center; flex-shrink: 0;
}

.sidebar-footer {
  padding: 10px; border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.user-card {
  flex: 1; display: flex; align-items: center; gap: 10px;
  color: var(--white); padding: 8px 10px; border-radius: var(--radius-sm);
  transition: background .15s; min-width: 0;
}
.user-card:hover { background: rgba(255,255,255,.07); color: #fff; }
.user-card .user-info { min-width: 0; }
.user-info .user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .user-role { font-size: 11px; opacity: .45; text-transform: capitalize; }

.avatar-sm {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.btn-logout {
  color: rgba(255,255,255,.35); font-size: 16px; padding: 7px;
  border-radius: var(--radius-sm); background: none; border: none;
  cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.btn-logout:hover { color: #fca5a5; background: rgba(239,68,68,.15); }

.main-wrapper { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h); background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
}

.sidebar-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: var(--secondary); font-size: 18px;
  border-radius: var(--radius-sm); transition: all .15s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.sidebar-toggle:hover { color: var(--primary); background: var(--primary-l); }

.topbar-search { position: relative; flex: 1; max-width: 380px; }
.topbar-search i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px; pointer-events: none;
}
.topbar-search input {
  width: 100%; padding: 8px 12px 8px 34px;
  border: 1px solid var(--border); border-radius: 20px;
  background: var(--light); font-size: 13px; outline: none;
  transition: all .15s; font-family: inherit; color: var(--text);
}
.topbar-search input:focus { border-color: var(--primary); background: var(--white); box-shadow: 0 0 0 3px rgba(79,70,229,.08); }

.search-results {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 300; max-height: 320px; overflow-y: auto;
}
.search-results.open { display: block; }
.search-result-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; font-size: 13px; }
.search-result-item:hover { background: var(--light); }
.search-result-item:last-child { border-bottom: none; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px; border-radius: var(--radius);
  cursor: pointer; transition: all .15s; text-decoration: none;
  border: 1px solid transparent;
}
.topbar-user:hover { background: var(--light); border-color: var(--border); }
.avatar-xs {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.topbar-user-info { display: none; }
.topbar-user-info .tui-name { font-size: 13px; font-weight: 600; color: var(--dark-2); line-height: 1.2; }
.topbar-user-info .tui-role { font-size: 11px; color: var(--text-muted); }

.notification-bell {
  position: relative; cursor: pointer; padding: 8px;
  font-size: 18px; color: var(--secondary); border-radius: 8px;
  transition: all .15s; background: none; border: none;
  display: flex; align-items: center; justify-content: center;
}
.notification-bell:hover { color: var(--primary); background: var(--primary-l); }
.notif-badge {
  position: absolute; top: 3px; right: 3px;
  background: var(--danger); color: #fff; font-size: 9px; font-weight: 700;
  width: 15px; height: 15px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--white);
}
.notif-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  width: min(340px, calc(100vw - 32px));
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 500;
}
.notif-dropdown.mostrar { display: block; }
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; color: var(--dark-2); background: #f8fafc; }
.notif-header a { font-size: 12px; font-weight: 400; }
.notif-list { max-height: 300px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.notif-item:hover { background: var(--light); }
.notif-item.unread { background: #eff6ff; }
.notif-item .notif-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.notif-text { font-size: 13px; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.content { padding: 16px; flex: 1; }

/* ============================================================
   COMPONENTES
   ============================================================ */

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 700; color: var(--dark); letter-spacing: -.02em; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; color: var(--dark); gap: 10px; }
.card-body { padding: 18px; }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.charts-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-bottom: 20px; align-items: start; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; position: relative; overflow: hidden; transition: all .15s var(--ease); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.stat-card.blue::before   { background: linear-gradient(90deg,#4f46e5,#818cf8); }
.stat-card.green::before  { background: linear-gradient(90deg,#10b981,#34d399); }
.stat-card.yellow::before { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.stat-card.red::before    { background: linear-gradient(90deg,#ef4444,#f87171); }
.stat-card.purple::before { background: linear-gradient(90deg,#8b5cf6,#a78bfa); }
.stat-card.cyan::before   { background: linear-gradient(90deg,#06b6d4,#22d3ee); }

.stat-icon { width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.stat-icon.blue   { background: #eff6ff; color: #4f46e5; }
.stat-icon.green  { background: #ecfdf5; color: #10b981; }
.stat-icon.yellow { background: #fffbeb; color: #f59e0b; }
.stat-icon.red    { background: #fef2f2; color: #ef4444; }
.stat-icon.purple { background: #f5f3ff; color: #8b5cf6; }
.stat-icon.cyan   { background: #ecfeff; color: #0891b2; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--dark); line-height: 1; letter-spacing: -.03em; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th { text-align: left; padding: 10px 14px; background: #f8fafc; color: var(--secondary); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbff; }
.ticket-subject a { font-weight: 600; color: var(--dark); font-size: 13px; transition: color .12s; }
.ticket-subject a:hover { color: var(--primary); }
.ticket-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-primary   { background: #eff6ff; color: #4f46e5; }
.badge-warning   { background: #fffbeb; color: #92400e; }
.badge-success   { background: #ecfdf5; color: #065f46; }
.badge-secondary { background: var(--light); color: var(--secondary); }
.badge-danger    { background: #fef2f2; color: #991b1b; }
.badge-dark      { background: #f1f5f9; color: var(--dark); }
.badge-info      { background: #ecfeff; color: #155e75; }
.badge-outline-success { border: 1px solid #10b981; color: #065f46; }
.badge-outline-warning { border: 1px solid #f59e0b; color: #92400e; }
.badge-outline-danger  { border: 1px solid #ef4444; color: #991b1b; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all .15s var(--ease); font-family: inherit; white-space: nowrap; text-decoration: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }
.btn-secondary { background: var(--white); color: var(--secondary); border-color: var(--border); }
.btn-secondary:hover { background: var(--light); color: var(--dark); border-color: #cbd5e1; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #d97706; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; font-size: 12px; margin-bottom: 6px; color: var(--dark-2); }
.form-label .required { color: var(--danger); }
.form-control { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; color: var(--text); outline: none; transition: all .15s; background: var(--white); font-family: inherit; appearance: none; -webkit-appearance: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.form-control:hover:not(:focus) { border-color: #cbd5e1; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-text { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 16px; }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; font-weight: 500; border-left: 4px solid transparent; animation: alertIn .2s ease; }
@keyframes alertIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.alert i { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; border-left-color: #10b981; }
.alert-danger   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; border-left-color: #ef4444; }
.alert-warning  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; border-left-color: #f59e0b; }
.alert-info     { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; border-left-color: #4f46e5; }
.alert-close { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 18px; opacity: .4; transition: opacity .15s; color: inherit; line-height: 1; flex-shrink: 0; }
.alert-close:hover { opacity: 1; }

.ticket-detail-header { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.ticket-detail-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; line-height: 1.3; }
.ticket-meta-row { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-muted); }
.ticket-meta-row span { display: flex; align-items: center; gap: 5px; }
.ticket-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }

.comment { display: flex; gap: 10px; margin-bottom: 16px; }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.comment-avatar.internal { background: var(--warning); }
.comment-bubble { flex: 1; min-width: 0; background: var(--light); border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 12px 14px; border: 1px solid var(--border); }
.comment-bubble.internal { background: #fffbeb; border-color: #fde68a; }
.comment-bubble.solution { background: #ecfdf5; border-color: #a7f3d0; }
.comment-header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; font-size: 12px; }
.comment-author { font-weight: 700; color: var(--dark); }
.comment-time { color: var(--text-muted); }
.comment-body { font-size: 13px; line-height: 1.7; word-break: break-word; }
.comment-body p { margin-bottom: 8px; }
.internal-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--warning); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 3px; }

.info-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.info-card-header { padding: 11px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13px; background: #f8fafc; }
.info-list { list-style: none; }
.info-list li { display: flex; justify-content: space-between; align-items: flex-start; padding: 9px 16px; border-bottom: 1px solid var(--border); font-size: 13px; gap: 8px; }
.info-list li:last-child { border-bottom: none; }
.info-list .label { color: var(--text-muted); flex-shrink: 0; }
.info-list .value { font-weight: 500; text-align: right; word-break: break-word; }
.sla-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 4px; }
.sla-fill { height: 100%; border-radius: 2px; transition: width .3s; }
.sla-ok { background: var(--success); } .sla-warn { background: var(--warning); } .sla-over { background: var(--danger); }

.filters-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.filter-select { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; outline: none; background: var(--white); cursor: pointer; font-family: inherit; flex: 1; min-width: 120px; }
.filter-select:focus { border-color: var(--primary); }
.search-input { padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; outline: none; flex: 2; min-width: 160px; font-family: inherit; }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.08); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 4px; padding: 16px 0; flex-wrap: wrap; }
.page-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--white); font-size: 13px; cursor: pointer; transition: all .15s; color: var(--text); font-family: inherit; }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn[disabled] { opacity: .4; cursor: not-allowed; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.6); backdrop-filter: blur(4px); z-index: 9999; align-items: flex-end; justify-content: center; padding: 0; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-lg); width: 100%; max-height: 92dvh; display: flex; flex-direction: column; overflow: hidden; animation: modalSlideUp .25s ease; }
@keyframes modalSlideUp { from { transform:translateY(40px); opacity:0; } to { transform:translateY(0); opacity:1; } }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.modal-header span { font-weight: 700; font-size: 17px; color: var(--dark-2); }
.modal-close { background: var(--light); border: none; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--secondary); cursor: pointer; transition: all .15s; }
.modal-close:hover { background: #fee2e2; color: var(--danger); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.modal-footer { padding: 14px 20px; background: #f8fafc; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; flex-wrap: wrap; }

.star-rating { display: flex; gap: 4px; cursor: pointer; }
.star-rating .star { font-size: 24px; color: var(--border); transition: color .1s; }
.star-rating .star.active, .star-rating .star:hover { color: var(--warning); }

.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state i { font-size: 44px; margin-bottom: 16px; opacity: .18; display: block; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--dark-2); margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 300px; margin: 0 auto; }

.timeline { padding-left: 18px; border-left: 2px solid var(--border); }
.timeline-item { position: relative; padding: 0 0 14px 18px; }
.timeline-item::before { content: ''; position: absolute; left: -24px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--border); border: 2px solid var(--white); }
.timeline-item.status::before { background: var(--primary); }
.timeline-text { font-size: 13px; }
.timeline-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.loading-spinner { text-align: center; padding: 20px; color: var(--text-muted); }
.chart-wrap { position: relative; }

.kanban-board { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
.kanban-col { background: #f8fafc; border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.kanban-col-header { font-weight: 700; font-size: 14px; color: var(--dark); margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.kanban-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); cursor: pointer; transition: all .15s; }
.kanban-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.kanban-card-title { font-weight: 600; font-size: 13px; color: var(--dark); }

.login-page { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 420px; background: var(--white); border-radius: var(--radius-lg); padding: 32px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .logo-icon { width: 56px; height: 56px; background: var(--primary); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff; margin: 0 auto 12px; }
.login-logo h1 { font-size: 21px; font-weight: 800; color: var(--dark); }
.login-logo p { color: var(--text-muted); font-size: 13px; }

/* ============================================================
   RESPONSIVIDADE — Mobile-First, UMA única seção, zero duplicatas
   ============================================================ */

/* ≥ 480px */
@media (min-width: 480px) {
  .content { padding: 20px; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .modal-overlay { align-items: center; padding: 20px; }
  .modal { border-radius: var(--radius-lg); max-height: 90dvh; animation: modalFadeIn .22s ease; }
  @keyframes modalFadeIn { from { opacity:0; transform:scale(.97); } to { opacity:1; transform:scale(1); } }
}

/* ≥ 640px */
@media (min-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .stat-value { font-size: 26px; }
}

/* ≥ 768px */
@media (min-width: 768px) {
  :root { --topbar-h: 64px; }
  .content { padding: 24px; }
  .page-title { font-size: 22px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .stat-value { font-size: 28px; }
  .topbar { padding: 0 24px; gap: 16px; }
  .topbar-user-info { display: block; }
  .modal { max-width: 560px; }
  .charts-grid { grid-template-columns: 1fr 1fr; }
}

/* ≥ 1024px — Sidebar fixa, hamburguer desaparece */
@media (min-width: 1024px) {
  .sidebar { transform: translateX(0) !important; box-shadow: none; border-right: 1px solid rgba(255,255,255,.05); }
  .sidebar-overlay { display: none !important; }
  .sidebar-close-btn { display: none; }
  .sidebar-close-mobile { display: none; }
  .sidebar-toggle { display: none; }
  .main-wrapper { margin-left: var(--sidebar-w); }
  .content { padding: 28px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); max-width: 100%; }
  .stats-grid.stats-sm { grid-template-columns: repeat(3, minmax(160px, 240px)); }
  .stat-value { font-size: 30px; }
  .ticket-layout { grid-template-columns: 1fr 300px; }
  .kanban-board { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .modal { max-width: 600px; }
}

/* ≥ 1280px */
@media (min-width: 1280px) {
  .content { padding: 32px; }
}

/* Dispositivos touch — remove hover animations que não fazem sentido */
@media (hover: none) {
  .stat-card:hover { transform: none; box-shadow: var(--shadow); }
  .btn:active { opacity: .85; }
}
