/* ============================================================
   Átrio 360 — Design System
   Cores: #0D1B2A (navy) · #0FA79A (teal) · Poppins
   ============================================================ */

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

:root {
  --navy:        #0D1B2A;
  --navy-light:  #142233;
  --navy-border: #1e3448;
  --teal:        #0FA79A;
  --teal-hover:  #0c9088;
  --teal-light:  #E6F7F5;
  --gray:        #718096;
  --gray-light:  #F2F4F7;
  --white:       #ffffff;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --success:     #10b981;

  --sidebar-w:   248px;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 2px 8px rgba(0,0,0,.25);
  --transition:  .18s ease;
}

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

html { font-size: 15px; }

body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--navy);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

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

/* ── Layout ─────────────────────────────────────────────────── */
.atrio-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-light);
  border-right: 1px solid var(--navy-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--navy-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo svg { flex-shrink: 0; }

.sidebar-logo-text h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -.3px;
  line-height: 1.1;
}

.sidebar-logo-text h1 span { color: var(--teal); }
.sidebar-logo-text small { color: var(--text-muted); font-size: 10px; font-weight: 400; }

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

.nav-section {
  color: var(--gray);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 1px;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}

.nav-item:hover { background: var(--navy-border); color: var(--white); }
.nav-item.active { background: rgba(15,167,154,.15); color: var(--teal); }
.nav-item.active .nav-icon { color: var(--teal); }

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
  color: var(--gray);
  transition: color var(--transition);
}

.nav-item:hover .nav-icon { color: var(--white); }

/* ── Sidebar footer ──────────────────────────────────────────── */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--navy-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.sidebar-avatar {
  width: 34px; height: 34px;
  background: rgba(15,167,154,.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: var(--text-muted); }

.sidebar-logout {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.sidebar-logout:hover { color: var(--danger); }

/* ── Main content ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  background: var(--navy-light);
  border-bottom: 1px solid var(--navy-border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 15px; font-weight: 600; color: var(--white); }
.topbar-sub   { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

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

/* ── Page ───────────────────────────────────────────────────── */
.page { padding: 24px; flex: 1; }
.page-header { margin-bottom: 24px; }
.page-title { font-size: 20px; font-weight: 700; color: var(--white); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 16px;
}

/* ── KPI Cards ──────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }

.kpi-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition), transform var(--transition);
}

.kpi-card:hover { border-color: var(--teal); transform: translateY(-2px); }

.kpi-label { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--white); line-height: 1; }
.kpi-delta { font-size: 11px; color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-icon { font-size: 22px; }

/* ── Module cards (dashboard) ───────────────────────────────── */
.modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

.module-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition), transform var(--transition);
}

.module-card:hover { border-color: var(--teal); transform: translateY(-2px); }
.module-card-icon { font-size: 26px; }
.module-card-name { font-size: 14px; font-weight: 600; color: var(--white); }
.module-card-desc { font-size: 12px; color: var(--text-muted); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
}

.btn-primary   { background: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-hover); }
.btn-secondary { background: var(--navy-border); color: var(--text); }
.btn-secondary:hover { background: #2a4060; }
.btn-danger    { background: var(--danger); color: var(--white); }
.btn-danger:hover { opacity: .85; }
.btn-ghost     { background: transparent; color: var(--text-muted); border: 1px solid var(--navy-border); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn-sm        { padding: 5px 11px; font-size: 12px; }
.btn-lg        { padding: 11px 22px; font-size: 15px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-teal    { background: rgba(15,167,154,.15); color: var(--teal); }
.badge-success { background: rgba(16,185,129,.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,.15);  color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,.15);   color: var(--danger); }
.badge-gray    { background: rgba(113,128,150,.15); color: var(--gray); }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--navy-border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid rgba(30,52,72,.6); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(15,167,154,.04); }
tbody td { padding: 11px 14px; color: var(--text); vertical-align: middle; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--navy);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--transition);
}

.form-control:focus { border-color: var(--teal); }
.form-control::placeholder { color: #4a6077; }

select.form-control { cursor: pointer; }
select.form-control option { background: var(--navy-light); }

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

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success { background: rgba(16,185,129,.1);  border: 1px solid rgba(16,185,129,.3);  color: #6ee7b7; }
.alert-warning { background: rgba(245,158,11,.1);  border: 1px solid rgba(245,158,11,.3);  color: #fcd34d; }
.alert-danger  { background: rgba(239,68,68,.1);   border: 1px solid rgba(239,68,68,.3);   color: #fca5a5; }
.alert-info    { background: rgba(15,167,154,.1);  border: 1px solid rgba(15,167,154,.3);  color: var(--teal); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

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

.modal-title { font-size: 15px; font-weight: 700; color: var(--white); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--white); }
.modal-body    { padding: 20px; }
.modal-footer  { padding: 14px 20px; border-top: 1px solid var(--navy-border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Login page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 20px;
}

.login-card {
  background: var(--navy-light);
  border: 1px solid var(--navy-border);
  border-radius: 14px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 { font-size: 26px; font-weight: 700; color: var(--white); letter-spacing: -.5px; }
.login-logo h1 span { color: var(--teal); }
.login-logo p { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-menu-btn { display: flex; }
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

/* ── Divider ────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--navy-border); margin: 16px 0; }

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3   { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.empty-state p    { font-size: 13px; }

/* ── Teal accent line (top of card) ────────────────────────── */
.card-accent { border-top: 3px solid var(--teal); }

/* ── Tabela ──────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead tr { background: rgba(255,255,255,.04); border-bottom: 2px solid var(--border); }
.table th { padding: 11px 14px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; text-align: left; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }
.table tbody tr:last-child td { border-bottom: none; }
.table-empty { padding: 40px !important; text-align: center; color: var(--text-muted); }

/* ── page-header com flex ─────────────────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
