@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:        #0f1117;
  --bg2:       #161820;
  --bg3:       #1e2030;
  --border:    #2a2d3e;
  --accent:    #e63946;
  --accent2:   #ff6b6b;
  --text:      #e8eaf0;
  --text2:     #8b8fa8;
  --text3:     #555870;
  --success:   #2ecc71;
  --warning:   #f39c12;
  --info:      #3498db;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Sora', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; line-height: 1.6; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; height: 100vh; z-index: 100; transition: transform .3s; }
.main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { background: var(--bg2); border-bottom: 1px solid var(--border); padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.content { padding: 28px 32px; flex: 1; }

/* ── Sidebar ── */
.sidebar-logo { padding: 24px 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo h1 { font-size: 18px; font-weight: 700; color: var(--accent); letter-spacing: -0.5px; }
.sidebar-logo span { font-size: 11px; color: var(--text3); font-family: 'JetBrains Mono', monospace; }
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section { padding: 8px 16px 4px; font-size: 10px; font-weight: 600; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: var(--text2); text-decoration: none; cursor: pointer; transition: all .2s; border-left: 3px solid transparent; font-size: 13px; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(230,57,70,0.1); color: var(--accent2); border-left-color: var(--accent); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-user { padding: 16px 20px; border-top: 1px solid var(--border); }
.sidebar-user .user-name { font-size: 13px; font-weight: 500; }
.sidebar-user .user-role { font-size: 11px; color: var(--text3); }

/* ── Cards ── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card-sm { padding: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 600; }

/* ── Stats grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.stat-card.red::before { background: var(--accent); }
.stat-card.green::before { background: var(--success); }
.stat-card.blue::before { background: var(--info); }
.stat-card.orange::before { background: var(--warning); }
.stat-value { font-size: 32px; font-weight: 700; font-family: 'JetBrains Mono', monospace; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 6px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid rgba(42,45,62,0.5); font-size: 13px; }
tr:hover td { background: rgba(255,255,255,0.02); }
tr:last-child td { border-bottom: none; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-aberto { background: rgba(52,152,219,0.15); color: #3498db; }
.badge-em_analise { background: rgba(243,156,18,0.15); color: #f39c12; }
.badge-aguardando_distribuidor { background: rgba(155,89,182,0.15); color: #9b59b6; }
.badge-resolvido { background: rgba(46,204,113,0.15); color: #2ecc71; }
.badge-fechado { background: rgba(127,140,141,0.15); color: #7f8c8d; }
.badge-reaberto { background: rgba(230,57,70,0.15); color: var(--accent2); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius); font-size: 13px; font-weight: 500; border: none; cursor: pointer; transition: all .2s; font-family: 'Sora', sans-serif; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--text3); }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { color: var(--text); background: var(--bg3); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: rgba(230,57,70,0.1); color: var(--accent2); border: 1px solid rgba(230,57,70,0.3); }
.btn-danger:hover { background: var(--accent); color: #fff; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-control { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 10px 14px; font-size: 13px; font-family: 'Sora', sans-serif; outline: none; transition: border-color .2s; }
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.conditional-fields { background: rgba(230,57,70,0.05); border: 1px solid rgba(230,57,70,0.2); border-radius: var(--radius); padding: 16px; margin-top: 10px; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity .25s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 680px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); transform: translateY(20px); transition: transform .25s; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Timeline ── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 14px; padding-bottom: 20px; position: relative; }
.timeline-item:not(:last-child)::before { content:''; position:absolute; left: 15px; top: 32px; bottom: 0; width: 1px; background: var(--border); }
.timeline-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--bg3); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; }
.timeline-dot.status { border-color: var(--accent); background: rgba(230,57,70,0.1); }
.timeline-dot.comment { border-color: var(--info); background: rgba(52,152,219,0.1); }
.timeline-dot.attach { border-color: var(--warning); background: rgba(243,156,18,0.1); }
.timeline-content { flex: 1; padding-top: 4px; }
.timeline-meta { font-size: 11px; color: var(--text3); margin-top: 3px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab { padding: 10px 20px; font-size: 13px; color: var(--text2); cursor: pointer; border-bottom: 2px solid transparent; transition: all .2s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent2); border-bottom-color: var(--accent); }

/* ── Login ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.login-box { width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 28px; font-weight: 700; color: var(--accent); }
.login-logo p { color: var(--text3); font-size: 13px; margin-top: 4px; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-error { background: rgba(230,57,70,0.1); border: 1px solid rgba(230,57,70,0.3); color: var(--accent2); }
.alert-success { background: rgba(46,204,113,0.1); border: 1px solid rgba(46,204,113,0.3); color: var(--success); }

/* ── Item de chamado (formulário) ── */
.chamado-item { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; position: relative; }
.item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.item-number { font-size: 12px; font-weight: 600; color: var(--accent2); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Protocolo ── */
.protocolo { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 500; color: var(--accent2); background: rgba(230,57,70,0.1); padding: 2px 8px; border-radius: 4px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* ── Loader ── */
.loader { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .content { padding: 16px; }
}
