/* ── Identidade visual ──────────────────────────────────────────────────── */
:root {
  --picos-primary: #164b72;
  --picos-secondary: #287ca8;
  --picos-accent: #e08a4d;
  --ink: #203342;
  --muted: #687985;
  --paper: #f5f8fa;
  --line: #dce5eb;
  --caes-color: #c76645;
  --gatos-color: #367c91;
}

* { scrollbar-color: #b7cfc2 var(--paper); }

body {
  background:
    radial-gradient(circle at 8% 0%, rgba(224,122,95,.12), transparent 26rem),
    radial-gradient(circle at 96% 12%, rgba(40,124,168,.10), transparent 24rem),
    var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0;
}

h1, h2, h3, h4, h5, h6, .navbar-brand { font-family: 'Fraunces', serif; }

.text-muted { color: var(--muted) !important; }

.container-fluid { max-width: 1500px; }

/* ── App shell e sidebar ───────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  background: #174d73;
  box-shadow: 8px 0 24px rgba(18,61,91,.12);
  color: #fff;
  display: flex;
  flex: 0 0 224px;
  flex-direction: column;
  min-height: 100vh;
  padding: 1rem .7rem .75rem;
  position: sticky;
  top: 0;
}
.brand-lockup {
  align-items: center;
  color: #fff;
  display: flex;
  gap: .7rem;
  padding: .15rem .35rem 1.35rem;
  text-decoration: none;
}
.brand-lockup strong, .brand-lockup small { display: block; }
.brand-lockup strong { font-family: 'DM Sans', sans-serif; font-size: 1rem; }
.brand-lockup small { color: #b9daf0; font-size: .7rem; margin-top: -.1rem; }
.brand-logo {
  height: 46px;
  width: 46px;
  object-fit: contain;
  border-radius: 8px;
}
.side-nav { flex: 1; }
.side-nav li { list-style: none; }
.side-nav .nav-link {
  align-items: center;
  border-radius: 9px;
  color: rgba(255,255,255,.82);
  display: flex;
  font-size: .88rem;
  gap: .7rem;
  margin: .2rem 0;
  padding: .72rem .8rem;
  transition: background .2s ease, color .2s ease;
}
.side-nav .nav-link i { font-size: 1.05rem; width: 1.2rem; }
.side-nav .nav-link:hover, .side-nav .nav-link.active {
  background: rgba(255,255,255,.16);
  color: #fff;
}
.sidebar-user {
  align-items: center;
  border-top: 1px solid rgba(255,255,255,.2);
  display: flex;
  gap: .55rem;
  margin-top: 1rem;
  padding: .8rem .25rem 0;
}
.avatar {
  align-items: center;
  border-radius: 50%;
  display: inline-flex;
  font-size: .72rem;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  width: 30px;
}
.avatar-orange { background: #ffab54; color: #174d73; }
.user-name { flex: 1; font-size: .83rem; font-weight: 600; }
.logout-link { color: #b9daf0; }
.app-content { flex: 1; min-width: 0; padding: 2rem clamp(1rem, 4vw, 3.5rem); }
.page-heading h1 { color: #102f47; font-family: 'DM Sans', sans-serif; font-size: 1.65rem; font-weight: 700; }
.page-heading p { font-size: .84rem; }
.btn-new-visit { padding-inline: 1rem; }

/* ── Login ──────────────────────────────────────────────────────────────── */
#loginHeader {
  background: linear-gradient(135deg, var(--picos-primary), var(--picos-secondary));
  border-radius: .375rem .375rem 0 0;
}

.card {
  border-color: var(--line) !important;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(32,52,45,.06) !important;
}
.card-header { border-color: var(--line); }
.btn { border-radius: 9px; font-weight: 600; }
.btn-primary { background: var(--picos-primary); border-color: var(--picos-primary); }
.btn-primary:hover, .btn-primary:focus { background: #103a2d; border-color: #103a2d; }
.btn-success { background: var(--picos-secondary); border-color: var(--picos-secondary); }
.btn-outline-primary { color: var(--picos-primary); border-color: var(--picos-primary); }
.btn-outline-primary:hover { background: var(--picos-primary); border-color: var(--picos-primary); }
.form-control, .form-select {
  border-color: #cbd9d1;
  border-radius: 9px;
  padding: .65rem .8rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--picos-secondary);
  box-shadow: 0 0 0 .2rem rgba(40,116,91,.14);
}

/* ── Section cards ──────────────────────────────────────────────────────── */
.section-header {
  background: #edf4f8;
  font-weight: 600;
  color: var(--picos-primary);
  border-bottom: 2px solid #cedfe9;
}

.caes-header {
  background: #fef3e7;
  color: var(--caes-color);
  border-bottom-color: #f5cba7;
}

.gatos-header {
  background: #e8f4fd;
  color: var(--gatos-color);
  border-bottom-color: #aed6f1;
}

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.stat-card {
  overflow: hidden;
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card .fs-2 { color: #0f3653 !important; font-size: 1.65rem !important; margin-top: .45rem; }
.stat-card .text-muted { font-size: .78rem; line-height: 1.2; }
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 28px rgba(32,52,45,.12) !important;
}
.stat-card::after {
  background: var(--picos-accent);
  content: '';
  height: 4px;
  inset: auto 0 0;
  position: absolute;
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.nav-tabs .nav-link {
  color: #6c757d;
  border-bottom: 3px solid transparent;
  font-size: .875rem;
}
.nav-tabs .nav-link.active {
  color: var(--picos-primary);
  border-bottom-color: var(--picos-primary);
  font-weight: 600;
}
.nav-tabs .nav-link:hover {
  color: var(--picos-secondary);
  border-bottom-color: var(--picos-secondary);
}

/* ── Form ───────────────────────────────────────────────────────────────── */
.form-check-inline {
  margin-right: 1rem;
  margin-bottom: .25rem;
}
.form-check-inline .form-check-input {
  cursor: pointer;
}
.form-check-inline .form-check-label {
  cursor: pointer;
}

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-hover tbody tr:hover {
  background-color: #edf5f9;
}
.table thead th {
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
  #mainNav,
  .btn,
  .modal,
  .alert { display: none !important; }

  .card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }
  .section-header {
    background: #eee !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body { font-size: 12px; }
}

/* ── Responsividade ─────────────────────────────────────────────────────── */
@media (max-width: 576px) {
  .form-check-inline {
    display: block;
    margin-bottom: .4rem;
  }
  .app-shell { display: block; }
  .sidebar { min-height: auto; padding: .7rem; position: relative; }
  .brand-lockup { padding-bottom: .65rem; }
  .side-nav { display: flex; gap: .2rem; overflow-x: auto; }
  .side-nav .nav-link { flex-direction: column; font-size: .65rem; gap: .2rem; min-width: 68px; padding: .5rem .35rem; text-align: center; }
  .side-nav .nav-link i { width: auto; }
  .sidebar-user { display: none; }
  .app-content { padding: 1.25rem .8rem; }
  .page-heading h1 { font-size: 1.35rem; }
  .card-body { padding: 1rem; }
}
