* { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  background: #f5f6f8;
  color: #1f2937;
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: #013b4a;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  padding: 24px 20px 20px;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  line-height: 1.3;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand span { color: #02A897; }
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #cfe9e6;
  text-decoration: none;
  font-weight: 600;
  font-size: .92rem;
  transition: background .15s;
}
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link.active { background: rgba(2,168,151,.25); color: #fff; }
.sidebar-bottom {
  padding: 16px 12px 24px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.btn-logout {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,.35);
  color: #cfe9e6;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: .88rem;
}
.btn-logout:hover { background: rgba(255,255,255,.08); color: #fff; }

.page-content { flex: 1; overflow: auto; min-height: 100vh; }
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* ── Cards & Tables ──────────────────────────────── */
.card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 20px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.toolbar select, .toolbar input { padding: 8px 10px; border-radius: 8px; border: 1px solid #d0d5dd; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eef0f2; font-size: .9rem; }
th { color: #667085; font-weight: 700; text-transform: uppercase; font-size: .75rem; }

.btn { padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-weight: 700; font-size: .88rem; }
.btn-primary { background: #00537a; color: #fff; }
.btn-primary:hover { background: #0073a6; }
.btn-danger { background: #fde0e0; color: #a03333; }
.btn-danger:hover { background: #fbc7c7; }
.btn-link { background: transparent; color: #00537a; padding: 4px 8px; }

/* ── Metric Cards ─────────────────────────────────── */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.metric-card h3 { margin: 0 0 4px; font-size: .85rem; color: #667085; text-transform: uppercase; }
.metric-card .value { font-size: 1.8rem; font-weight: 800; color: #013b4a; }
.metric-card .nota { font-size: .78rem; color: #98a2b3; margin-top: 6px; }

/* ── Modals ───────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 999; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 480px; }
.modal h2 { margin-top: 0; }
.form-group { margin-bottom: 14px; text-align: left; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .88rem; }
.form-group input, .form-group select { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #d0d5dd; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ── Login ────────────────────────────────────────── */
.login-wrap { flex: 1; height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at center, #02A897 0%, #017C76 25%, #013B4A 70%); }
.login-box { background: #fff; padding: 36px; border-radius: 12px; width: 100%; max-width: 380px; text-align: center; box-shadow: 0 10px 28px rgba(0,0,0,.25); }
.login-box h1 { font-size: 1.5rem; margin-bottom: 4px; }
.login-box p { color: #667085; font-size: .9rem; margin-bottom: 20px; }

/* ── Tabelas com overflow ────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Responsivo (mobile) ──────────────────────────── */
@media (max-width: 768px) {
  body { flex-direction: column; }

  /* Sidebar vira uma barra superior compacta em vez de coluna lateral */
  .sidebar {
    width: 100%;
    height: auto;
    min-height: auto;
    position: sticky;
    top: 0;
    flex-direction: row;
    align-items: center;
    z-index: 50;
  }
  .sidebar-brand {
    padding: 12px 14px;
    border-bottom: none;
    font-size: .92rem;
    white-space: nowrap;
    line-height: 1.1;
  }
  .sidebar-nav {
    flex: 1;
    flex-direction: row;
    padding: 0 8px;
    gap: 4px;
    overflow-x: auto;
  }
  .sidebar-link {
    white-space: nowrap;
    padding: 8px 10px;
    font-size: .82rem;
  }
  .sidebar-bottom {
    padding: 8px 12px;
    border-top: none;
  }
  .btn-logout {
    width: auto;
    padding: 8px 14px;
    font-size: .8rem;
    white-space: nowrap;
  }

  .container { padding: 14px; }
  .card { padding: 16px; }

  .toolbar { flex-wrap: wrap; }
  .toolbar select, .toolbar input, .toolbar button { width: 100%; }

  .metric-grid { grid-template-columns: 1fr; }

  th, td { padding: 8px 6px; font-size: .82rem; }

  .modal { max-width: calc(100% - 32px); padding: 18px; max-height: calc(100vh - 32px); overflow-y: auto; }
  .login-box { padding: 28px 24px; }
}
