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

:root {
  --lm1: #00296b;
  --lm2: #003f88;
  --lm3: #00509d;
  --lm4: #ffd500;
  --lm-light: #dce8f5;
  --lm-lighter: #f0f5fb;
  --lm-lightest: #f7f9fc;
  --white: #ffffff;
  --text: #00296b;
  --text-sec: #4a6080;
  --border: rgba(0,80,157,0.12);
  --border-soft: rgba(0,80,157,0.07);
  --radius: 10px;
  --radius-sm: 6px;
}

body {
  font-family: 'Barlow', sans-serif;
  background: var(--lm-lighter);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--lm1);
  height: 54px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid rgba(255,213,0,0.3);
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo-box {
  width: 40px; height: 40px;
  background: var(--lm4);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-lm {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px; font-weight: 700;
  color: var(--lm1); letter-spacing: -0.5px;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { color: white; font-size: 14px; font-weight: 600; line-height: 1.2; }
.brand-sub { color: rgba(255,213,0,0.6); font-size: 10px; font-weight: 400; }

.topnav { display: flex; gap: 2px; }
.nav-link {
  color: rgba(255,255,255,0.6);
  font-size: 12px; font-weight: 500;
  padding: 6px 14px; border-radius: 4px;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none; user-select: none;
}
.nav-link:hover { background: rgba(255,213,0,0.12); color: white; }
.nav-link.active { background: rgba(255,213,0,0.18); color: var(--lm4); }

.topbar-user { display: flex; align-items: center; gap: 8px; }
.user-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--lm4); color: var(--lm1);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.user-name { color: rgba(255,255,255,0.7); font-size: 12px; }

/* ── HERO ── */
.hero {
  background: var(--lm2);
  padding: 20px 28px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--lm4);
}
.hero-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px; font-weight: 700;
  color: white; letter-spacing: 0.3px;
}
.hero-accent { color: var(--lm4); }
.hero-sub { color: rgba(255,255,255,0.4); font-size: 11px; margin-top: 4px; }

.hero-stats { display: flex; gap: 10px; }
.stat-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,213,0,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 16px; min-width: 80px;
  text-align: center;
}
.stat-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px; font-weight: 700;
  color: var(--lm4); line-height: 1;
}
.stat-num.ok { color: #4ade80; }
.stat-num.warn { color: #fb923c; }
.stat-lbl { font-size: 9px; color: rgba(255,255,255,0.4); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── SEARCHBAR ── */
.searchbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 10px 28px;
  display: flex; align-items: center; gap: 10px;
}
.search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--lm-lighter); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 12px; flex: 1;
  transition: border-color 0.2s;
}
.search-wrap:focus-within { border-color: var(--lm3); }
.search-wrap svg { color: var(--text-sec); flex-shrink: 0; }
.search-wrap input {
  border: none; background: transparent; outline: none;
  font-family: 'Barlow', sans-serif; font-size: 13px;
  color: var(--text); width: 100%;
}
.search-wrap input::placeholder { color: var(--text-sec); }

.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 11px; font-weight: 500; padding: 5px 12px;
  border-radius: 20px; cursor: pointer;
  border: 1px solid var(--border); background: white;
  color: var(--text-sec); transition: all 0.15s; user-select: none;
}
.chip:hover { border-color: var(--lm3); color: var(--lm3); }
.chip.active { background: var(--lm3); color: white; border-color: var(--lm3); }

.btn-primary {
  background: var(--lm3); color: white;
  border: none; border-radius: var(--radius-sm);
  padding: 8px 18px; font-size: 12px; font-weight: 600;
  font-family: 'Barlow', sans-serif;
  cursor: pointer; white-space: nowrap; transition: background 0.15s;
}
.btn-primary:hover { background: var(--lm2); }

/* ── MAIN GRID ── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  padding: 16px 24px;
  align-items: start;
}

/* ── CARDS ── */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 14px;
}
.card:last-child { margin-bottom: 0; }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border-soft);
}
.card-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--lm1);
}
.card-title svg { color: var(--lm3); }
.card-link { font-size: 11px; color: var(--lm3); cursor: pointer; font-weight: 500; }
.card-header-right { display: flex; align-items: center; gap: 8px; }

.systec-badge {
  font-size: 10px; font-weight: 600; color: #059669;
  background: #d1fae5; padding: 3px 8px; border-radius: 20px;
}
.btn-refresh {
  background: var(--lm-lighter); border: 1px solid var(--border);
  border-radius: 5px; padding: 5px 7px; cursor: pointer;
  display: flex; align-items: center; color: var(--text-sec);
  transition: all 0.15s;
}
.btn-refresh:hover { background: var(--lm-light); color: var(--lm3); }

/* ── OS TABLE ── */
.os-card { margin-bottom: 0; }

.os-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-soft);
  padding: 0 4px;
}
.os-tab {
  font-family: 'Barlow', sans-serif;
  font-size: 12px; font-weight: 500;
  padding: 8px 16px; cursor: pointer;
  color: var(--text-sec);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all 0.15s;
  display: flex; align-items: center; gap: 6px;
}
.os-tab:hover { color: var(--lm2); }
.os-tab.active { color: var(--lm2); border-bottom-color: var(--lm4); }

.tab-count {
  font-size: 10px; font-weight: 700;
  background: var(--lm-light); color: var(--lm3);
  padding: 1px 6px; border-radius: 20px;
}
.tab-count.ok { background: #d1fae5; color: #059669; }

.table-wrap { overflow-x: auto; }
.os-table {
  width: 100%; border-collapse: collapse;
  table-layout: fixed;
}
.os-table th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-sec); font-weight: 600; text-align: left;
  padding: 7px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--border-soft);
  background: var(--lm-lightest);
}
.os-table td {
  font-size: 12px; padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.os-table tr:last-child td { border-bottom: none; }
.os-table tbody tr { transition: background 0.1s; cursor: pointer; }
.os-table tbody tr:hover td { background: var(--lm-lighter); }
.os-table tbody tr.hidden { display: none; }

.os-num { font-weight: 700; color: var(--lm3); font-size: 12px; }
.os-client { font-weight: 500; font-size: 12px; }
.os-phone { font-size: 10px; color: var(--text-sec); margin-top: 1px; }

.badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 20px; white-space: nowrap;
}
.badge-ab { background: #fff3b0; color: #7a5c00; }
.badge-ma { background: #dbeafe; color: #1e40af; }
.badge-pr { background: #d1fae5; color: #065f46; }
.badge-urg { background: #fee2e2; color: #991b1b; }
.badge-vis { background: #ede9fe; color: #5b21b6; }
.badge-ent { background: #d1fae5; color: #065f46; }
.badge-int { background: #fee2e2; color: #991b1b; }

.tech-av {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--lm-light); color: var(--lm2);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}

/* ── AGENDA ── */
.agenda-list { padding: 0; }
.agenda-item {
  display: flex; gap: 10px; padding: 9px 14px;
  border-bottom: 1px solid var(--border-soft);
  align-items: flex-start;
}
.agenda-item:last-child { border-bottom: none; }

.day-box {
  text-align: center; background: var(--lm-light);
  border-radius: 6px; padding: 4px 7px; min-width: 36px;
  flex-shrink: 0;
}
.day-box.today { background: var(--lm3); }
.day-box.today .day-num { color: white; }
.day-box.today .day-name { color: var(--lm4); }
.day-num { font-family: 'Barlow Condensed', sans-serif; font-size: 18px; font-weight: 700; color: var(--lm2); line-height: 1; }
.day-name { font-size: 8px; color: var(--text-sec); text-transform: uppercase; letter-spacing: 0.5px; }

.ev-list { flex: 1; }
.ev-item { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 5px; }
.ev-item:last-child { margin-bottom: 0; }
.ev-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.ev-content { flex: 1; }
.ev-title { font-size: 12px; color: var(--text); line-height: 1.3; }
.ev-time { font-size: 10px; color: var(--text-sec); margin-top: 1px; }

/* ── KPIs ── */
.kpi-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; padding: 12px;
}
.kpi {
  background: var(--lm-lighter); border-radius: 8px;
  padding: 10px 12px; text-align: center;
  border: 1px solid var(--border-soft);
}
.kpi-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px; font-weight: 700;
  color: var(--lm3); line-height: 1;
}
.kpi.ok .kpi-num { color: #059669; }
.kpi.warn .kpi-num { color: #d97706; }
.kpi.urg .kpi-num { color: #dc2626; }
.kpi-lbl { font-size: 10px; color: var(--text-sec); margin-top: 3px; }

/* ── TÉCNICOS ── */
.tecnicos-list { padding: 0; }
.tec-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid var(--border-soft);
}
.tec-item:last-child { border-bottom: none; }
.tec-av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--lm-light); color: var(--lm2);
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.tec-info { flex: 1; min-width: 0; }
.tec-name { font-size: 12px; font-weight: 600; color: var(--text); }
.tec-detail { font-size: 10px; color: var(--text-sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tec-bar { height: 3px; background: var(--lm-light); border-radius: 2px; margin-top: 5px; }
.tec-bar-fill { height: 3px; background: var(--lm3); border-radius: 2px; transition: width 0.6s ease; }

/* ── RESPONSIVO ── */
@media (max-width: 900px) {
  .main-grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  .hero-stats { flex-wrap: wrap; }
  .topnav { display: none; }
  .searchbar { flex-wrap: wrap; }
}

/* ── BOTÃO LOGOUT ── */
.btn-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  font-family: 'Barlow', sans-serif;
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.15s;
}
.btn-logout:hover {
  background: rgba(220,38,38,0.25);
  border-color: rgba(220,38,38,0.4);
  color: #fca5a5;
}

/* ══════════════════════════════════════════════════
   TELA DE LOGIN
══════════════════════════════════════════════════ */
#login-screen { position:fixed;inset:0;z-index:9999;background:var(--lm1); }
.login-bg { display:flex;height:100vh;width:100vw; }
.login-left { flex:1;background:linear-gradient(145deg,#00296b 0%,#003f88 50%,#00509d 100%);display:flex;flex-direction:column;justify-content:space-between;padding:48px;position:relative;overflow:hidden; }
.login-left::before { content:'';position:absolute;width:400px;height:400px;background:rgba(255,213,0,0.05);border-radius:50%;top:-100px;right:-100px; }
.login-left-content { position:relative;z-index:1; }
.login-logo { width:80px;height:80px;object-fit:contain;border-radius:16px;background:white;padding:6px;margin-bottom:24px;box-shadow:0 8px 32px rgba(0,0,0,0.2); }
.login-brand { font-family:'Barlow Condensed',sans-serif;font-size:36px;font-weight:700;color:white;margin:0 0 6px; }
.login-tagline { font-size:14px;color:var(--lm4);font-weight:600;margin:0 0 40px;letter-spacing:1px;text-transform:uppercase; }
.login-features { display:flex;flex-direction:column;gap:16px; }
.login-feature { display:flex;align-items:center;gap:12px;color:rgba(255,255,255,0.75);font-size:14px; }
.login-feature-icon { font-size:18px;width:36px;height:36px;background:rgba(255,255,255,0.08);border-radius:8px;display:flex;align-items:center;justify-content:center;flex-shrink:0; }
.login-left-footer { position:relative;z-index:1;font-size:11px;color:rgba(255,255,255,0.35);border-top:1px solid rgba(255,255,255,0.1);padding-top:20px; }
.login-right { width:460px;background:#f0f4f9;display:flex;align-items:center;justify-content:center;padding:40px 32px; }
.login-card { width:100%;max-width:360px; }
.login-mobile-logo { display:none;align-items:center;gap:10px;margin-bottom:28px;font-weight:700;color:var(--lm1);font-size:16px; }
.login-mobile-img { width:36px;height:36px;object-fit:contain;border-radius:6px; }
.login-title { font-family:'Barlow Condensed',sans-serif;font-size:28px;font-weight:700;color:var(--lm1);margin:0 0 8px; }
.login-subtitle { font-size:13px;color:var(--text-sec);margin:0 0 32px;line-height:1.5; }
.btn-ms-login { width:100%;display:flex;align-items:center;justify-content:center;gap:12px;background:var(--lm1);color:white;border:none;border-radius:8px;padding:14px 20px;font-size:14px;font-weight:600;font-family:'Barlow',sans-serif;cursor:pointer;transition:all 0.2s;box-shadow:0 4px 14px rgba(0,41,107,0.3); }
.btn-ms-login:hover { background:var(--lm2);transform:translateY(-1px); }
.login-loading { display:none;align-items:center;justify-content:center;gap:10px;margin-top:16px;color:var(--text-sec);font-size:13px; }
.login-loading.visible { display:flex; }
.login-spinner { width:18px;height:18px;border:2px solid var(--border);border-top-color:var(--lm3);border-radius:50%;animation:spin 0.8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.login-error { display:none;align-items:flex-start;gap:10px;background:#fee2e2;border:1px solid #fca5a5;border-radius:8px;padding:12px 14px;margin-top:16px;font-size:13px;color:#991b1b; }
.login-error.visible { display:flex; }
.login-error-icon { font-size:16px;flex-shrink:0;margin-top:1px; }
.login-error strong { display:block;margin-bottom:2px; }
.login-error p { margin:0;font-size:12px;opacity:0.85; }
.login-divider { display:flex;align-items:center;gap:12px;margin:24px 0 16px;color:var(--text-sec);font-size:11px; }
.login-divider::before,.login-divider::after { content:'';flex:1;height:1px;background:var(--border); }
.login-ms-badge { display:flex;align-items:center;justify-content:center;gap:8px;background:white;border:1px solid var(--border);border-radius:6px;padding:8px 14px;font-size:12px;font-weight:500;color:var(--text-sec); }
.login-info { text-align:center;font-size:11px;color:var(--text-sec);margin:16px 0 0;line-height:1.6; }
.login-domain-badge { margin-top:20px;text-align:center;background:var(--lm-light);border:1px solid var(--border);border-radius:6px;padding:8px;font-size:12px;color:var(--lm2); }
@media (max-width:700px) { .login-left{display:none;} .login-right{width:100%;padding:32px 24px;} .login-mobile-logo{display:flex;} }
