/* ============================================================
   AMA ONG - Design System 2026
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ================================================================
   COLOR TOKENS - light (default)
   ================================================================ */
:root {
  /* Brand */
  --primary:      #16a34a;
  --primary-dark: #15803d;

  /* Layout */
  --sidebar-bg:    #0f172a;
  --sidebar-w:     252px;
  --sidebar-mini:  64px;
  --card-radius:   14px;
  --ease:          cubic-bezier(0.4, 0, 0.2, 1);

  /* Surfaces */
  --body-bg:       #f1f5f9;
  --card-bg:       #ffffff;
  --card-border:   transparent;

  /* Text */
  --text-heading:  #0f172a;
  --text-body:     #334155;
  --text-muted:    #64748b;
  --text-subtle:   #94a3b8;

  /* Borders */
  --border:        #e2e8f0;
  --border-light:  #f1f5f9;

  /* Inputs */
  --input-bg:      #ffffff;
  --input-addon:   #f8fafc;

  /* Table */
  --table-hover:   #f8fafc;
  --thead-bg:      #f8fafc;
  --thead-text:    #64748b;

  /* Misc */
  --scrollbar:     #cbd5e1;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
}

/* ================================================================
   COLOR TOKENS - dark
   ================================================================ */
[data-theme="dark"] {
  --body-bg:      #0d1117;
  --card-bg:      #161b22;
  --card-border:  #30363d;

  --text-heading: #f0f6fc;
  --text-body:    #c9d1d9;
  --text-muted:   #8b949e;
  --text-subtle:  #484f58;

  --border:       #30363d;
  --border-light: #21262d;

  --input-bg:     #0d1117;
  --input-addon:  #161b22;

  --table-hover:  rgba(255,255,255,.04);
  --thead-bg:     #161b22;
  --thead-text:   #8b949e;

  --scrollbar:    #30363d;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.3);
}

/* ================================================================
   BASE
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

/* Suaviza troca de tema */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition:
    background-color .25s var(--ease),
    border-color .25s var(--ease),
    color .15s var(--ease),
    box-shadow .25s var(--ease) !important;
}

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--body-bg);
  color: var(--text-body);
  font-size: .925rem;
  -webkit-font-smoothing: antialiased;
}

/* ================================================================
   SIDEBAR
   ================================================================ */

#sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--sidebar-mini);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 300;
  transition: width .22s var(--ease), box-shadow .22s;
}

#sidebar:hover {
  width: var(--sidebar-w);
  box-shadow: 6px 0 32px rgba(0,0,0,.35);
}

body.sidebar-pinned #sidebar {
  width: var(--sidebar-w);
  box-shadow: none;
}

#sidebar * { white-space: nowrap; }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.1rem .9rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-decoration: none;
  flex-shrink: 0;
  position: relative;
  min-height: 64px;
}

.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), #22c55e);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(22,163,74,.4);
}

.sidebar-brand-text { font-size: .9rem; font-weight: 700; color: #f8fafc; letter-spacing: -.01em; line-height: 1.15; }
.sidebar-brand-sub  { font-size: .65rem; color: #64748b; font-weight: 400; text-transform: uppercase; letter-spacing: .06em; }

/* Pin button */
.sidebar-pin {
  position: absolute;
  right: .65rem; top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  background: rgba(255,255,255,.07);
  border: none; border-radius: 6px;
  color: #475569; font-size: .75rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
  opacity: 0;
  pointer-events: none;
}

#sidebar:hover .sidebar-pin,
body.sidebar-pinned #sidebar .sidebar-pin {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-pin:hover { background: rgba(255,255,255,.14); color: #cbd5e1; }
body.sidebar-pinned .sidebar-pin { color: #4ade80; background: rgba(22,163,74,.15); }

/* Section */
.sidebar-section { padding: 1.1rem .75rem .4rem; flex-grow: 1; }
.sidebar-section-label {
  font-size: .62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  color: #475569; padding: 0 .5rem; margin-bottom: .3rem; display: block;
}

/* Nav links */
#sidebar .nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .75rem;
  border-radius: 8px;
  font-size: .875rem; font-weight: 500;
  color: #94a3b8;
  transition: background .15s, color .15s;
  margin-bottom: .1rem;
  position: relative;
}

#sidebar .nav-link i {
  font-size: 1rem; width: 1.25rem;
  text-align: center; flex-shrink: 0;
}

#sidebar .nav-link:hover  { background: rgba(255,255,255,.07); color: #f1f5f9; }
#sidebar .nav-link.active { background: rgba(22,163,74,.18); color: #4ade80; }
#sidebar .nav-link.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

/* Texto da sidebar - opacidade em modo colapsado */
#sidebar .nav-text,
#sidebar .sidebar-brand-text,
#sidebar .sidebar-brand-sub,
#sidebar .sidebar-section-label,
#sidebar .sidebar-user-name {
  opacity: 0;
  transition: opacity .18s var(--ease);
}
#sidebar:hover .nav-text,
#sidebar:hover .sidebar-brand-text,
#sidebar:hover .sidebar-brand-sub,
#sidebar:hover .sidebar-section-label,
#sidebar:hover .sidebar-user-name,
body.sidebar-pinned #sidebar .nav-text,
body.sidebar-pinned #sidebar .sidebar-brand-text,
body.sidebar-pinned #sidebar .sidebar-brand-sub,
body.sidebar-pinned #sidebar .sidebar-section-label,
body.sidebar-pinned #sidebar .sidebar-user-name {
  opacity: 1;
}

/* Footer */
.sidebar-footer {
  padding: .85rem .9rem;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: .75rem;
  flex-shrink: 0;
}

.sidebar-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #334155, #475569);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; color: #94a3b8; flex-shrink: 0;
}

.sidebar-user-name { font-size: .8rem; font-weight: 500; color: #cbd5e1; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sidebar-logout    { color: #475569; font-size: .95rem; transition: color .15s; text-decoration: none; flex-shrink: 0; cursor: pointer; }
.sidebar-logout:hover { color: #ef4444; }
.sidebar-theme     { color: #475569; font-size: .95rem; transition: color .15s; flex-shrink: 0; cursor: pointer; }
.sidebar-theme:hover { color: #facc15; }

/* ================================================================
   LOGOS (redondas sem modificar a imagem)
   ================================================================ */

.logo-round {
  border-radius: 50%;
  object-fit: cover;
}

/* Login */
.login-logo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: .85rem;
  box-shadow: 0 8px 24px rgba(22,163,74,.4);
}

/* Sidebar */
.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(22,163,74,.4);
}

.sidebar-logo-mobile {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.navbar-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */

main {
  margin-left: var(--sidebar-mini);
  min-height: 100vh;
  padding: 2rem;
  transition: margin-left .22s var(--ease);
}

body.sidebar-pinned main { margin-left: var(--sidebar-w); }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-title  { font-size: 1.35rem; font-weight: 700; color: var(--text-heading); margin: 0; letter-spacing: -.02em; }

/* ================================================================
   CARDS
   ================================================================ */

.card {
  border: 1px solid var(--card-border) !important;
  border-radius: var(--card-radius) !important;
  box-shadow: var(--shadow-sm) !important;
  background: var(--card-bg) !important;
}

.card-header {
  background: var(--card-bg) !important;
  border-bottom: 1px solid var(--border-light) !important;
  border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
  padding: 1rem 1.25rem !important;
  font-weight: 600; color: var(--text-body); font-size: .9rem;
}

.card-footer {
  background: var(--card-bg) !important;
  border-top: 1px solid var(--border-light) !important;
}

/* Stat cards */
.stat-card {
  border-radius: var(--card-radius);
  padding: 1.4rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.amber  { background: #fef3c7; color: #d97706; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

[data-theme="dark"] .stat-icon.green  { background: rgba(22,163,74,.15);  color: #4ade80; }
[data-theme="dark"] .stat-icon.blue   { background: rgba(37,99,235,.15);   color: #60a5fa; }
[data-theme="dark"] .stat-icon.amber  { background: rgba(217,119,6,.15);   color: #fbbf24; }
[data-theme="dark"] .stat-icon.purple { background: rgba(124,58,237,.15);  color: #a78bfa; }

.stat-value { font-size: 2rem; font-weight: 700; color: var(--text-heading); line-height: 1; letter-spacing: -.03em; }
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; margin-top: .2rem; }

/* ================================================================
   BUTTONS
   ================================================================ */

.btn    { border-radius: 8px; font-weight: 500; font-size: .875rem; letter-spacing: -.01em; }
.btn-sm { border-radius: 6px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-outline-secondary {
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-outline-secondary:hover {
  background: var(--border-light);
  border-color: var(--border);
  color: var(--text-body);
}
.btn-outline-danger { color: #ef4444; border-color: #fca5a5; }
.btn-outline-danger:hover { background: #fef2f2; color: #dc2626; border-color: #f87171; }
[data-theme="dark"] .btn-outline-danger:hover { background: rgba(239,68,68,.1); }

/* ================================================================
   FORMS
   ================================================================ */

.form-control, .form-select {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text-body);
  border-radius: 8px;
  font-size: .875rem;
  padding: .5rem .75rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
  background: var(--input-bg);
  color: var(--text-body);
}
.form-control::placeholder { color: var(--text-subtle); }
.form-control:disabled, .form-select:disabled {
  background: var(--border-light);
  color: var(--text-muted);
}

.input-group-text {
  background: var(--input-addon);
  border-color: var(--border);
  color: var(--text-muted);
}
.form-label { font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: .4rem; }
.form-select option { background: var(--card-bg); color: var(--text-body); }

/* ================================================================
   TABLE
   ================================================================ */

.table { font-size: .875rem; color: var(--text-body); }
.table thead th {
  font-weight: 600; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--thead-text);
  border-bottom-width: 1px;
  border-color: var(--border);
  padding: .85rem 1rem;
  background: var(--thead-bg);
  position: sticky;
  top: 0;
  z-index: 2;
}
.table td {
  padding: .85rem 1rem;
  vertical-align: middle;
  color: var(--text-body);
  border-color: var(--border-light);
}
.table-hover tbody tr:hover td { background: var(--table-hover); }
.table-light { --bs-table-bg: var(--thead-bg) !important; }
.table-light th { background: var(--thead-bg) !important; color: var(--thead-text) !important; }

/* Links dentro de células de tabela sempre seguem a cor do tema */
.table td a { color: var(--text-body); }
.table td a:hover { color: var(--text-heading); }

/* ── Dark mode: sobrescreve variáveis internas do Bootstrap para tabelas ── */
[data-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-body);
  --bs-table-border-color: var(--border-light);
  --bs-table-hover-bg: var(--table-hover);
  --bs-table-hover-color: var(--text-body);
  --bs-table-striped-bg: rgba(255,255,255,.03);
  color: var(--text-body);
}

[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: var(--bs-table-bg, transparent);
  color: var(--text-body);
  border-bottom-color: var(--border-light);
}

[data-theme="dark"] .table-light {
  --bs-table-bg: var(--thead-bg);
  --bs-table-color: var(--thead-text);
  --bs-table-border-color: var(--border);
  color: var(--thead-text);
}

[data-theme="dark"] .table-light > * > * {
  background-color: var(--thead-bg) !important;
  color: var(--thead-text) !important;
  border-color: var(--border);
}

/* ================================================================
   BADGES
   ================================================================ */

.badge { border-radius: 6px; font-weight: 600; font-size: .7rem; padding: .35em .65em; letter-spacing: .02em; }

/* ================================================================
   BREADCRUMB
   ================================================================ */

.breadcrumb { font-size: .8rem; }
.breadcrumb-item a { color: var(--primary); text-decoration: none; }
.breadcrumb-item.active { color: var(--text-muted); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-subtle); }

/* ================================================================
   MODAL
   ================================================================ */

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
}
.modal-header {
  border-bottom-color: var(--border-light);
  color: var(--text-heading);
}
.modal-body  { color: var(--text-body); }
.modal-footer { border-top-color: var(--border-light); }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1); }

/* ================================================================
   LIST GROUP
   ================================================================ */

.list-group-item {
  background: var(--card-bg);
  border-color: var(--border-light);
  color: var(--text-body);
}

/* ================================================================
   PAGINATION
   ================================================================ */

.page-link {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--text-body);
}
.page-link:hover { background: var(--border-light); color: var(--text-heading); border-color: var(--border); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-item.disabled .page-link { background: var(--card-bg); color: var(--text-subtle); border-color: var(--border); }

/* ================================================================
   DASHBOARD - QUICK ACTIONS
   ================================================================ */

.quick-action-btn {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .85rem;
  border-radius: 10px;
  text-decoration: none;
  font-size: .85rem; font-weight: 500;
  color: var(--text-body);
  border: 1px solid var(--border);
  background: var(--card-bg);
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.quick-action-btn:hover {
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
  color: var(--text-body);
}
.quick-action-btn > i:first-child {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.quick-action-btn.green > i:first-child { background: #dcfce7; color: #16a34a; }
.quick-action-btn.blue  > i:first-child { background: #dbeafe; color: #2563eb; }
.quick-action-btn.amber > i:first-child { background: #fef3c7; color: #d97706; }

.quick-action-btn:hover.green { border-color: #86efac; background: #f0fdf4; }
.quick-action-btn:hover.blue  { border-color: #93c5fd; background: #eff6ff; }
.quick-action-btn:hover.amber { border-color: #fcd34d; background: #fffbeb; }

[data-theme="dark"] .quick-action-btn.green > i:first-child { background: rgba(22,163,74,.15);  color: #4ade80; }
[data-theme="dark"] .quick-action-btn.blue  > i:first-child { background: rgba(37,99,235,.15);   color: #60a5fa; }
[data-theme="dark"] .quick-action-btn.amber > i:first-child { background: rgba(217,119,6,.15);   color: #fbbf24; }
[data-theme="dark"] .quick-action-btn:hover.green { border-color: rgba(22,163,74,.35);  background: rgba(22,163,74,.07); }
[data-theme="dark"] .quick-action-btn:hover.blue  { border-color: rgba(37,99,235,.35);  background: rgba(37,99,235,.07); }
[data-theme="dark"] .quick-action-btn:hover.amber { border-color: rgba(217,119,6,.35);  background: rgba(217,119,6,.07); }

.qa-title { font-size: .82rem; font-weight: 600; color: var(--text-body); line-height: 1.2; }
.qa-sub   { font-size: .72rem; color: var(--text-muted); }

/* Status breakdown bars */
.status-bar-row {
  display: flex; align-items: center; gap: .5rem;
  font-size: .78rem; color: var(--text-body);
}
.status-bar-row .sb-label { width: 70px; color: var(--text-muted); }
.status-bar-row .sb-track {
  flex: 1; height: 6px; background: var(--border-light);
  border-radius: 3px; overflow: hidden;
}
.status-bar-row .sb-fill { height: 100%; border-radius: 3px; transition: width .6s var(--ease); }
.status-bar-row .sb-count { width: 28px; text-align: right; font-weight: 600; color: var(--text-heading); }

/* ================================================================
   MISC
   ================================================================ */

.text-muted { color: var(--text-muted) !important; }
.text-body  { color: var(--text-body) !important; }
.text-dark  { color: var(--text-heading) !important; }
.toast-container { z-index: 9999; }

/* ================================================================
   TABLE FULL-HEIGHT LAYOUT
   ================================================================ */

.layout-table {
  height: 100vh; overflow: hidden;
  display: flex; flex-direction: column;
  padding: .75rem 1.5rem;
}

/* #content precisa ser flex container para repassar a altura ao table-card */
.layout-table > #content {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
}

.layout-table .table-card { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.layout-table .table-card > .card-header { flex-shrink: 0; }
.layout-table .table-card > .card-footer { flex-shrink: 0; }
.layout-table .table-card .card-body { flex: 1; min-height: 0; overflow: hidden; padding: 0 !important; display: flex; flex-direction: column; }
.layout-table .table-card .table-responsive { flex: 1; overflow-y: auto; min-height: 0; }
.layout-table .table-responsive::-webkit-scrollbar { width: 4px; }
.layout-table .table-responsive::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ================================================================
   RESPONSIVO
   ================================================================ */

/* Tablets e abaixo (≤ 991px) */
@media (max-width: 991px) {
  #sidebar { display: none; }
  .offcanvas { background: var(--sidebar-bg) !important; }
  .offcanvas-body { background: var(--sidebar-bg) !important; }
  .offcanvas { --bs-offcanvas-width: 280px !important; }

  main { margin-left: 0 !important; padding-top: calc(56px + 1rem); padding-left: 1rem; padding-right: 1rem; padding-bottom: 1.5rem; }

  .page-title { font-size: 1.15rem; }
  .page-header { flex-wrap: wrap; gap: .5rem; }

  /* Dashboard stats - empilhar verticalmente em telas pequenas */
  .stat-card { padding: 1rem 1.25rem; }
  .stat-value { font-size: 1.5rem; }
  .stat-icon { width: 42px; height: 42px; font-size: 1.1rem; }

  /* Dashboard charts - altura reduzida */
  #activityChart, #speciesChart, #adoptionChart { max-height: 180px !important; }

  /* Tabelas - scroll horizontal + header fixo */
  .layout-table { height: auto; overflow: visible; padding: .75rem; }
  .layout-table .table-card { flex: none; max-height: none; }
  .layout-table .table-card .card-body { overflow: visible; }
  .layout-table .table-card .table-responsive {
    max-height: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .layout-table .table-card .table-responsive table { min-width: 650px; }

  .table thead th, .table td { padding: .6rem .5rem; font-size: .8rem; white-space: nowrap; }

  /* Barra de filtros - wrap */
  .card-header .d-flex.flex-wrap { gap: .35rem !important; }
  .card-header .input-group { max-width: 100% !important; flex: 1; min-width: 140px; }

  /* Form cards - sem margem lateral */
  .card[style*="max-width"] { max-width: 100% !important; }

  /* Quick actions no dashboard */
  .quick-action-btn { padding: .5rem .7rem; }
}

/* Mobile pequeno (≤ 576px) */
@media (max-width: 576px) {
  main { padding-left: .65rem; padding-right: .65rem; padding-top: calc(56px + .65rem); }

  .page-title { font-size: 1rem; }
  .breadcrumb { font-size: .7rem; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .breadcrumb::-webkit-scrollbar { display: none; }

  /* Dashboard - 1 coluna */
  .row.g-3 > [class*="col-"] { width: 100%; }

  /* Stat cards - layout mais compacto */
  .stat-card { padding: .85rem 1rem; gap: .75rem; }
  .stat-value { font-size: 1.35rem; }
  .stat-icon { width: 36px; height: 36px; font-size: 1rem; }

  /* Card body padding */
  .card-body.p-4 { padding: 1rem !important; }
  .card-body.p-3 { padding: .75rem !important; }
  .card-header { padding: .75rem 1rem !important; font-size: .82rem; }

  /* Tabela - fonte menor */
  .table thead th { font-size: .65rem; padding: .5rem .35rem; }
  .table td { font-size: .75rem; padding: .5rem .35rem; }

  /* Botões na tabela - compactar */
  .table td .btn-sm { padding: .2rem .35rem; font-size: .7rem; }
  .table td .btn-sm i { font-size: .7rem; }

  /* Forms no mobile */
  .row.g-3 > .col-md-6 { width: 100%; }
  .form-control, .form-select { font-size: .82rem; padding: .4rem .6rem; }
  .input-group-text { font-size: .82rem; padding: .4rem .6rem; }

  /* Filtros - ocupar largura total */
  .card-header .input-group { min-width: 100%; margin-bottom: .25rem; }
  .card-header .btn-sm { font-size: .72rem; padding: .25rem .5rem; }

  /* Modal - ocupar mais espaço */
  .modal-dialog { margin: .5rem; }
  .modal-body.p-0[style*="85vh"] { height: 70vh !important; }

  /* Quick actions */
  .quick-action-btn { font-size: .78rem; }
  .qa-title { font-size: .75rem; }
  .qa-sub { font-size: .65rem; }

  /* Dashboard gráficos */
  #activityChart, #speciesChart, #adoptionChart { max-height: 150px !important; }

  /* Paginação */
  .page-link { font-size: .72rem; padding: .25rem .5rem; }

  /* Nav mobile */
  .navbar { height: 48px !important; }
  .navbar .navbar-brand span { font-size: .82rem !important; }
  .navbar .navbar-toggler i { font-size: 1.3rem !important; }
}

/* ================================================================
   LOCATION AUTOCOMPLETE
   ================================================================ */

.location-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 500;
  list-style: none;
  margin: 0;
  padding: .3rem 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
}

.location-suggestions li {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .55rem .9rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background .1s;
}

.location-suggestions li:last-child { border-bottom: none; }
.location-suggestions li:hover { background: var(--border-light); }

.location-suggestions li strong {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-heading);
}

.location-suggestions li span {
  font-size: .75rem;
  color: var(--text-muted);
}

/* ================================================================
   SORT - colunas ordenáveis
   ================================================================ */

.table thead th[data-sort] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.table thead th[data-sort]:hover {
  color: var(--primary);
}

.table thead th[data-sort] .sort-icon {
  display: inline-block;
  margin-left: .3em;
  font-size: .75em;
  opacity: .35;
  transition: opacity .15s;
  vertical-align: middle;
}

.table thead th[data-sort]:hover .sort-icon {
  opacity: .7;
}

.table thead th[data-sort].sort-asc .sort-icon,
.table thead th[data-sort].sort-desc .sort-icon {
  opacity: 1;
  color: var(--primary);
}

.table thead th[data-sort].sort-asc,
.table thead th[data-sort].sort-desc {
  color: var(--primary);
}

/* Telas muito pequenas (≤ 400px) */
@media (max-width: 400px) {
  main { padding-left: .4rem; padding-right: .4rem; }
  .table thead th { font-size: .6rem; padding: .4rem .25rem; }
  .table td { font-size: .7rem; padding: .4rem .25rem; }
  .breadcrumb { font-size: .65rem; }
}

/* Página 404 responsiva */
@media (max-width: 576px) {
  body[style*="margin-left"] main[style*="margin-left"] { margin-left: 0 !important; }
  main > .text-center > div:first-child { font-size: 3.5rem !important; }
  main > .text-center h1 { font-size: 1.1rem !important; }
  main > .text-center p { font-size: .82rem; }
  main > .text-center .btn { font-size: .8rem; padding: .4rem .75rem; }
}

/* Login responsivo */
@media (max-width: 576px) {
  .login-header { padding: 1.5rem 1.25rem 1rem !important; }
  .login-body { padding: 1.25rem 1.25rem 1.5rem !important; }
  .login-logo { width: 72px; height: 72px; }
  .login-brand-title { font-size: 1.1rem !important; }
  .login-brand-sub { font-size: .7rem !important; }
  .login-title { font-size: .9rem !important; }
  .login-sub { font-size: .75rem !important; margin-bottom: 1rem !important; }
  .theme-btn-float { top: .6rem; right: .6rem; width: 34px; height: 34px; font-size: .85rem; }
}

/* Landscape em mobile - evitar corte vertical */
@media (max-height: 500px) {
  .layout-table .table-card .table-responsive { max-height: 45vh; }
  .modal-body.p-0[style*="85vh"] { height: 60vh !important; }
}

/* ================================================================
   SCROLLBAR
   ================================================================ */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 4px; }
