/* ============================================================
   css/style.css — Gestão de Ativos TI
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f5f5f3;
  --surface-0:   #f5f5f3;
  --surface-1:   #eeede9;
  --surface-2:   #ffffff;
  --border:      #e1e0d9;
  --border-strong: #c8c7be;
  --text-primary: #1a1917;
  --text-secondary: #4a4844;
  --text-muted:  #898781;
  --accent:      #2a78d6;
  --accent-bg:   #dbeafe;
  --accent-text: #1d4ed8;
  --success:     #0ca30c;
  --success-bg:  #d1fae5;
  --success-text:#065f46;
  --warning:     #fab219;
  --warning-bg:  #fef3c7;
  --warning-text:#92400e;
  --danger:      #d03b3b;
  --danger-bg:   #fde8e8;
  --danger-text: #b91c1c;
  --radius:      8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body { font-family: var(--font); background: var(--bg); color: var(--text-primary); min-height: 100vh; }

/* ── TELA DE LOGIN ── */
.screen { display: none; }
#screen-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
#screen-app   { display: none; }

.login-card {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%; max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,.08);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-logo-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-bg); display: flex; align-items: center; justify-content: center; }
.login-logo-icon i { font-size: 22px; color: var(--accent); }
.login-logo-title { font-size: 17px; font-weight: 600; color: var(--text-primary); }
.login-logo-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.login-error { display: none; background: var(--danger-bg); color: var(--danger-text); border: 0.5px solid #fca5a5; border-radius: var(--radius); padding: 10px 12px; font-size: 13px; margin-bottom: 14px; align-items: center; gap: 8px; }
.login-error.show { display: flex; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; font-weight: 500; }
.form-group input {
  width: 100%; border: 0.5px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; font-size: 14px; background: var(--surface-1);
  color: var(--text-primary); outline: none; transition: border .15s;
}
.form-group input:focus { border-color: var(--accent); background: var(--surface-2); }
.form-group input.error { border-color: var(--danger); }

.login-btn {
  width: 100%; padding: 11px; border: none; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 500;
  cursor: pointer; margin-top: 4px; transition: opacity .15s;
}
.login-btn:hover { opacity: .9; }
.login-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── APP ── */
.app { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }

.top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.top-bar h1 { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.top-bar h1 i { font-size: 17px; vertical-align: -2px; margin-right: 6px; color: var(--accent); }
.top-bar-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.user-bar { display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.user-role-tag { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 500; margin-top: 2px; display: inline-block; }
.logout-btn { height: 30px; padding: 0 10px; border: 0.5px solid var(--border-strong); border-radius: var(--radius); font-size: 12px; background: var(--surface-2); color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; gap: 4px; }
.logout-btn:hover { background: var(--surface-1); }

/* ── NAV ── */
.nav { display: flex; gap: 0; margin-bottom: 18px; border-bottom: 0.5px solid var(--border); overflow-x: auto; }
.nav-btn { padding: 9px 16px; font-size: 13px; color: var(--text-secondary); cursor: pointer; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: all .15s; }
.nav-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.nav-btn:hover:not(.active) { color: var(--text-primary); }

/* ── TAB CONTENT ── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── KPIs ── */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--surface-2); border-radius: 12px; padding: 16px; border: 0.5px solid var(--border); }
.kpi-label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.kpi-val { font-size: 28px; font-weight: 600; color: var(--text-primary); line-height: 1; }
.kpi-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.kpi-accent  { border-left: 3px solid var(--accent); }
.kpi-success { border-left: 3px solid var(--success); }
.kpi-warning { border-left: 3px solid var(--warning); }
.kpi-danger  { border-left: 3px solid var(--danger); }

/* ── GRID ── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ── CARD ── */
.card { background: var(--surface-2); border-radius: 12px; border: 0.5px solid var(--border); padding: 18px; }
.card-title { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-text);  }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.dot-ok   { background: var(--success); }
.dot-warn { background: var(--warning); }
.dot-err  { background: var(--danger); }

/* ── BOTÕES ── */
.action-btn { height: 32px; padding: 0 12px; border: 0.5px solid var(--border-strong); border-radius: var(--radius); font-size: 12px; background: var(--surface-2); color: var(--text-primary); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; transition: background .1s; }
.action-btn:hover { background: var(--surface-1); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { opacity: .9; }

/* ── FILTROS ── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filter-bar input, .filter-bar select { height: 34px; border: 0.5px solid var(--border); border-radius: var(--radius); padding: 0 10px; font-size: 13px; background: var(--surface-2); color: var(--text-primary); outline: none; }
.filter-bar input { flex: 1; min-width: 160px; }
.filter-bar select { min-width: 140px; }

/* ── TABELA ── */
.full-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.full-table th { color: var(--text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 0 8px 10px 0; text-align: left; border-bottom: 0.5px solid var(--border); white-space: nowrap; }
.full-table td { padding: 10px 8px 10px 0; border-bottom: 0.5px solid var(--border); color: var(--text-primary); vertical-align: middle; }
.full-table tr:last-child td { border-bottom: none; }
.full-table tbody tr { cursor: pointer; transition: background .1s; }
.full-table tbody tr:hover { background: var(--surface-1); }

/* ── PROGRESS ── */
.progress-bar { height: 6px; border-radius: 3px; background: var(--surface-1); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.progress-green { background: var(--success); }
.progress-amber { background: var(--warning); }
.progress-red   { background: var(--danger); }
.progress-blue  { background: var(--accent); }

/* ── TIMELINE ── */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 0; width: 1px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-dot { position: absolute; left: -17px; top: 4px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface-2); }
.tl-dot-blue  { background: var(--accent); }
.tl-dot-green { background: var(--success); }
.tl-dot-amber { background: var(--warning); }
.tl-dot-red   { background: var(--danger); }
.tl-dot-gray  { background: var(--text-muted); }
.tl-date  { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.tl-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.tl-desc  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.tl-tag { display: inline-flex; align-items: center; font-size: 10px; padding: 1px 7px; border-radius: 20px; margin-top: 4px; font-weight: 500; }
.tl-tag-blue  { background: var(--accent-bg);  color: var(--accent-text); }
.tl-tag-green { background: var(--success-bg); color: var(--success-text); }
.tl-tag-amber { background: var(--warning-bg); color: var(--warning-text); }
.tl-tag-red   { background: var(--danger-bg);  color: var(--danger-text); }

/* ── MODAL ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface-2); border-radius: 14px; border: 0.5px solid var(--border); padding: 24px; width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.modal h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 20px; line-height: 1; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fgroup { display: flex; flex-direction: column; gap: 4px; }
.fgroup.full { grid-column: 1/-1; }
.fgroup label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.fgroup input, .fgroup select, .fgroup textarea { border: 0.5px solid var(--border); border-radius: var(--radius); padding: 8px 10px; font-size: 13px; background: var(--surface-1); color: var(--text-primary); outline: none; transition: border .15s; }
.fgroup input:focus, .fgroup select:focus, .fgroup textarea:focus { border-color: var(--accent); }
.fgroup textarea { resize: vertical; min-height: 72px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; padding-top: 14px; border-top: 0.5px solid var(--border); }

/* ── DETALHES ── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.info-item { background: var(--surface-1); border-radius: 8px; padding: 10px 12px; }
.info-item-label { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.info-item-val { font-size: 13px; font-weight: 500; color: var(--text-primary); }

/* ── MISC ── */
.renov-item { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 0.5px solid var(--border); font-size: 13px; }
.renov-item:last-child { border-bottom: none; }
.dias-badge { font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: 20px; }
.dias-red   { background: var(--danger-bg);  color: var(--danger-text); }
.dias-amber { background: var(--warning-bg); color: var(--warning-text); }
.dias-green { background: var(--success-bg); color: var(--success-text); }
.alert-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 0.5px solid var(--border); }
.alert-row:last-child { border-bottom: none; }
.alert-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert-icon.danger  { background: var(--danger-bg);  color: var(--danger-text); }
.alert-icon.warning { background: var(--warning-bg); color: var(--warning-text); }
.license-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 0.5px solid var(--border); }
.license-row:last-child { border-bottom: none; }
.sparkline { display: flex; align-items: flex-end; gap: 2px; height: 24px; margin-top: 8px; }
.bar-sp { width: 6px; border-radius: 2px 2px 0 0; background: var(--accent); opacity: .4; }
.bar-sp:last-child { opacity: 1; }
#toast { display: none; }
