/* =========================================================
   SocioKids — Design System
   ========================================================= */

@font-face {
  font-family: 'AldoPC';
  src: url('../fonts/Aldo%20PC.ttf') format('truetype');
  font-display: swap;
}

:root {
  --primary:       #f77f00;
  --primary-dark:  #d96500;
  --primary-light: #fff1e6;
  --secondary:     #457b9d;
  --dark:          #1d3557;
  --text:          #2b2d42;
  --text-muted:    #6c757d;
  --bg:            #f8f9fa;
  --white:         #ffffff;
  --border:        #dee2e6;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow:        0 4px 16px rgba(0,0,0,.10);
  --radius:        12px;
  --radius-sm:     8px;
  --transition:    .2s ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---- Typography ---- */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.2rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(230,57,70,.35); }
.btn-secondary { background: var(--secondary); color: var(--white); }
.btn-secondary:hover { background: var(--dark); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-sm { padding: .4rem 1rem; font-size: .85rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-danger { background: #dc3545; color: var(--white); }
.btn-danger:hover { background: #b02a37; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  margin-bottom: .4rem;
  color: var(--dark);
}
.form-control {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  background: var(--white);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230,57,70,.15);
}
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

/* ---- Alerts ---- */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
}
.alert-error   { background: #fde8ea; border-color: var(--primary); color: #721c24; }
.alert-success { background: #d1e7dd; border-color: #0f5132; color: #0f5132; }
.alert-info    { background: #cff4fc; border-color: #055160; color: #055160; }
.alert-warning { background: #fff3cd; border-color: #664d03; color: #664d03; }

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--bg); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--dark); color: var(--white); }
thead th { padding: .75rem 1rem; text-align: left; font-size: .85rem; font-weight: 600; }
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:hover { background: var(--primary-light); }
tbody td { padding: .75rem 1rem; font-size: .9rem; vertical-align: middle; }

/* ---- Badge ---- */
.badge {
  display: inline-block;
  padding: .25em .65em;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 700;
}
.badge-success { background: #d1e7dd; color: #0f5132; }
.badge-warning { background: #fff3cd; color: #664d03; }
.badge-danger  { background: #fde8ea; color: #721c24; }
.badge-info    { background: #cff4fc; color: #055160; }
.badge-secondary { background: #e2e3e5; color: #41464b; }

/* ---- Utilities ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 480px; margin: 0 auto; padding: 0 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.w-100 { width: 100%; }

/* ---- PUBLIC LAYOUT ---- */
.public-header {
  background: var(--white);
  box-shadow: var(--shadow-sm);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.public-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--primary);
  letter-spacing: -.5px;
}
.logo .logo-icon {
  width: 38px;
  height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1.2rem;
}
.public-main { min-height: calc(100vh - 130px); }
.public-footer {
  background: var(--dark);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 1.5rem;
  font-size: .85rem;
  margin-top: 4rem;
}
.public-footer a { color: rgba(255,255,255,.8); }
.public-footer a:hover { color: var(--white); }

/* ---- HOME HERO ---- */
.hero {
  padding: 5rem 0 4rem;
  background: linear-gradient(135deg, var(--dark) 0%, var(--secondary) 100%);
  color: var(--white);
  text-align: center;
}
.hero h1 { color: var(--white); margin-bottom: 1rem; }
.hero p { font-size: 1.15rem; opacity: .85; max-width: 560px; margin: 0 auto 2rem; }
.hero .btn-primary { font-size: 1.05rem; padding: .8rem 2rem; }
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: var(--white);
  border-radius: 50px;
  padding: .3rem .9rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  padding: 4rem 0;
}
.feature-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}
.feature-card h3 { margin-bottom: .5rem; color: var(--dark); }
.feature-card p { font-size: .9rem; color: var(--text-muted); }

/* ---- ADMIN LAYOUT ---- */
.admin-wrapper { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 260px;
  background: var(--dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -.3px;
}
.sidebar-logo .logo-icon { background: var(--primary); }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-section {
  padding: .5rem 1.5rem .25rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.5rem;
  font-size: .9rem;
  color: rgba(255,255,255,.75);
  transition: background var(--transition), color var(--transition);
  border-radius: 0;
  cursor: pointer;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,.08);
  color: var(--white);
}
.nav-item.active { border-left: 3px solid var(--primary); background: rgba(230,57,70,.15); }
.nav-item .nav-icon { font-size: 1rem; opacity: .8; }
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .8rem;
  color: rgba(255,255,255,.5);
}

.admin-content { margin-left: 260px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.admin-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: .85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-weight: 700; font-size: 1.05rem; }
.topbar-user { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.topbar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
}
.admin-main { padding: 2rem; flex: 1; }
.page-header { margin-bottom: 1.75rem; }
.page-header h1 { font-size: 1.5rem; color: var(--dark); }
.page-header p { color: var(--text-muted); font-size: .9rem; margin-top: .25rem; }

/* Stats row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.red    { background: var(--primary-light); color: var(--primary); }
.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green  { background: #d1fae5; color: #065f46; }
.stat-icon.orange { background: #fef3c7; color: #92400e; }
.stat-label { font-size: .8rem; color: var(--text-muted); }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--dark); line-height: 1.1; }

/* Login page */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--dark) 0%, var(--secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}
.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo .logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto .75rem;
}
.login-logo h2 { color: var(--dark); margin-bottom: .25rem; }
.login-logo p { color: var(--text-muted); font-size: .9rem; }

/* ---- ACESSO PÚBLICO (CPF / verificar / cadastro) ---- */
.access-page {
  min-height: calc(100vh - 130px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.access-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--border);
}
.access-box-wide  { max-width: 700px; }
.access-page-wide { align-items: flex-start; padding-top: 3rem; }

.access-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.access-logo .logo-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--primary);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto .75rem;
}
.access-logo h2 { color: var(--dark); margin-bottom: .25rem; }
.access-logo p  { color: var(--text-muted); font-size: .9rem; }

.form-control-lg { font-size: 1.1rem; padding: .75rem 1rem; }
.field-error      { display: block; color: var(--primary); font-size: .8rem; margin-top: .3rem; }
.required         { color: var(--primary); }

.form-section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: .4rem;
  margin-bottom: 1rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-row .form-group { flex: 1 1 140px; }
.form-col-1 { flex: 1 1 160px; }
.form-col-2 { flex: 2 1 240px; }

.access-footer-note {
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
  line-height: 1.7;
}
.access-footer-note a { color: var(--secondary); text-decoration: underline; }

/* ---- PAINEL DO RESPONSÁVEL ---- */
.guardian-layout {
  display: flex;
  min-height: 100vh;
}
.guardian-sidebar {
  width: 240px;
  background: var(--dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--transition);
}
.guardian-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.guardian-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-toggle { display: none; }
.topbar-name   { font-size: .9rem; font-weight: 600; }
.guardian-main { padding: 2rem 1.5rem; flex: 1; }

/* Nav items desabilitados */
.nav-item-disabled {
  opacity: .5;
  pointer-events: none;
  cursor: not-allowed;
}
.nav-badge-soon {
  margin-left: auto;
  font-size: .65rem;
  font-weight: 700;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
  border-radius: 50px;
  padding: .1rem .5rem;
  letter-spacing: .3px;
}

/* Cards de ação do responsável */
.guardian-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}
.guardian-action-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  cursor: pointer;
}
.guardian-action-card:hover:not(.guardian-action-card--disabled) {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.guardian-action-card--disabled { opacity: .65; cursor: default; }
.gac-icon { font-size: 1.8rem; line-height: 1; flex-shrink: 0; }
.gac-body h3 { font-size: 1rem; color: var(--dark); margin-bottom: .25rem; }
.gac-body p  { font-size: .82rem; color: var(--text-muted); }
.gac-badge {
  position: absolute;
  top: .75rem; right: .75rem;
  font-size: .65rem;
  font-weight: 700;
  background: var(--border);
  color: var(--text-muted);
  border-radius: 50px;
  padding: .15rem .55rem;
  letter-spacing: .3px;
}

/* Como funciona */
.how-it-works {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.how-it-works li {
  counter-increment: step;
  display: flex;
  align-items: flex-start;
  gap: .9rem;
}
.how-it-works li::before {
  content: counter(step);
  min-width: 28px; height: 28px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 800;
  flex-shrink: 0;
  margin-top: .1rem;
}
.how-it-works li strong { display: block; font-size: .95rem; color: var(--dark); }
.how-it-works li span   { font-size: .85rem; color: var(--text-muted); }

/* ---- CHILDREN — listagem e formulário ---- */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { color: var(--dark); margin-bottom: .5rem; }
.empty-state p  { color: var(--text-muted); font-size: .9rem; }

.children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.child-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition);
}
.child-card:hover { box-shadow: var(--shadow); }

.child-card-avatar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  font-size: 2rem;
  font-weight: 800;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -1px;
}

.child-card-body {
  padding: 1.25rem 1.25rem .75rem;
  flex: 1;
}
.child-name {
  font-size: 1.05rem;
  color: var(--dark);
  margin-bottom: .6rem;
}
.child-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .6rem;
}
.child-meta-item {
  font-size: .8rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: .15rem .65rem;
}
.child-allergy {
  font-size: .8rem;
  color: #92400e;
  background: #fef3c7;
  border-radius: var(--radius-sm);
  padding: .35rem .65rem;
  margin-top: .5rem;
}
.child-notes {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .5rem;
  font-style: italic;
}

.child-card-actions {
  padding: .75rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}
.child-card-action--disabled {
  opacity: .45;
  cursor: not-allowed;
}
.text-danger { color: #dc3545; }

/* Contador de filhos no card do painel */
.gac-count {
  position: absolute;
  top: .75rem; right: .75rem;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 800;
}

/* ---- SOLICITAÇÕES DE CARTEIRINHA ---- */

/* Listagem */
.requests-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.request-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.request-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.request-child-info {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.request-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: .9rem;
  flex-shrink: 0;
}
.request-child-name { font-weight: 700; font-size: .95rem; color: var(--dark); }
.request-protocol   { font-size: .75rem; color: var(--text-muted); font-family: monospace; }

.request-card-body { padding: 1rem 1.25rem; }
.request-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
}
.request-meta-item {
  display: flex;
  flex-direction: column;
  font-size: .82rem;
}
.request-meta-label {
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: .1rem;
}
.request-rejection {
  margin-top: .75rem;
  background: #fde8ea;
  border-left: 3px solid var(--primary);
  padding: .6rem .9rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .85rem;
  color: #721c24;
}
.request-card-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

/* Formulário */
.request-form-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}
.request-form-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}
.request-form-side {
  display: flex;
  flex-direction: column;
}

/* Prévia da carteirinha */
.card-preview-wrapper {
  width: 100%;
}
.card-preview {
  width: 100%;
  aspect-ratio: 2520 / 1610;
  max-width: 100%;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.card-preview-photo {
  position: absolute;
  left: 8.5%;
  top: 21.5%;
  width: 27%;
  height: 56%;
  border-radius: 2px;
  border: 1px solid rgba(94,52,38,.25);
  background: rgba(255,255,255,.75);
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;
}

.card-preview-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.card-preview-photo img.is-visible {
  display: block;
}

.card-preview-photo span {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;

  font-size: .66rem;
  font-weight: 600;
  color: #5e3426;
  opacity: .72;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-family: 'AldoPC', sans-serif;
  text-align: center;
}

.card-preview-photo span.is-hidden {
  display: none;
}
.card-preview-name,
.card-preview-birth-date,
.card-preview-member-since {
  position: absolute;
  color: #5e3426;
  font-family: 'AldoPC', sans-serif;
  line-height: 1;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-preview-name {
  left: 41%;
  top: 51%;
  width: 48%;
  height: 8%;
  font-size: clamp(.58rem, 1.15vw, .84rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .2px;
}
.card-preview-birth-date {
  left: 41%;
  top: 69%;
  width: 22%;
  height: 8%;
  font-size: clamp(.52rem, 1vw, .72rem);
  font-weight: 700;
}
.card-preview-member-since {
  left: 68%;
  top: 69%;
  width: 22%;
  height: 8%;
  font-size: clamp(.52rem, 1vw, .72rem);
  font-weight: 700;
}

/* Templates */
.template-options {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.template-option {
  display: block;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.template-option input[type="radio"] { display: none; }
.template-option:hover { border-color: var(--secondary); }
.template-option--selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(230,57,70,.15); }
.template-option-inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem;
}
.template-preview-img {
  width: 64px; height: 44px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.template-preview-placeholder {
  width: 64px; height: 44px;
  background: var(--bg);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.template-option-name { font-size: .9rem; font-weight: 700; color: var(--dark); }
.template-option-desc { font-size: .78rem; color: var(--text-muted); }

/* Upload de foto */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--bg);
}
.file-upload-area:hover, .file-upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.file-upload-input { display: none; }
.file-upload-placeholder { display: flex; flex-direction: column; gap: .3rem; align-items: center; }
.file-upload-icon { font-size: 1.8rem; }
.file-upload-placeholder span { font-size: .85rem; color: var(--text-muted); }
.file-upload-placeholder span:first-of-type { color: var(--dark); font-weight: 600; }
.file-upload-preview {
  display: flex;
  align-items: center;
  gap: .75rem;
  justify-content: center;
}
.file-upload-preview img {
  width: 80px; height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--primary);
}
.file-upload-preview span { font-size: .82rem; color: var(--text-muted); }

.photo-preview-current {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .5rem;
}
.photo-preview-current img {
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Aceite */
.consent-label {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  cursor: pointer;
  font-size: .88rem;
  line-height: 1.5;
}
.consent-label input { margin-top: .2rem; flex-shrink: 0; accent-color: var(--primary); }

/* ---- ADMIN — SOLICITAÇÕES ---- */

/* Filtros */
.request-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .25rem;
}
.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .9rem;
  border-radius: 50px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--white);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.filter-tab:hover         { border-color: var(--secondary); color: var(--dark); }
.filter-tab--active       { background: var(--dark); color: var(--white); border-color: var(--dark); }
.filter-count {
  background: rgba(0,0,0,.12);
  color: inherit;
  border-radius: 50px;
  padding: .05rem .45rem;
  font-size: .72rem;
}
.filter-count--warning { background: #fef3c7; color: #92400e; }
.filter-count--success { background: #d1fae5; color: #065f46; }
.filter-count--danger  { background: #fde8ea; color: #721c24; }
.filter-count--info    { background: #cff4fc; color: #055160; }

/* Protocolo badge */
.protocol-badge {
  font-family: monospace;
  font-size: .78rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1rem .4rem;
  color: var(--dark);
}
.protocol-badge--lg { font-size: .9rem; padding: .2rem .6rem; }

/* Detail grid (show) */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}
.detail-fields { display: flex; flex-direction: column; gap: .85rem; }
.detail-field  { display: flex; flex-direction: column; }
.detail-label  {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: .15rem;
}
.detail-allergy  { color: #92400e; }
.detail-rejection { color: #721c24; font-style: italic; }

/* Foto detalhe */
.detail-photo {
  max-width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
}
.detail-photo-placeholder {
  width: 100%; height: 140px;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 1.6rem;
  color: var(--text-muted);
  gap: .3rem;
}

.card-header--with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.detail-edit-form {
  display: none;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.detail-edit-form--visible {
  display: block;
}

.detail-edit-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}

.timeline-diff {
  margin: .4rem 0 0 1rem;
  padding-left: 1.2rem;
}

.timeline-diff li {
  font-size: .85rem;
  color: var(--text-muted);
}

/* Card de ação (decisão) */
.card--action { border: 2px solid var(--primary); }

/* Opções de validade */
.validity-options { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.validity-option {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  transition: border-color var(--transition), background var(--transition);
}
.validity-option:hover         { border-color: var(--secondary); background: var(--bg); }
.validity-option--selected     { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.validity-option input         { accent-color: var(--primary); }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* Timeline do histórico */
.timeline { padding: 1rem 1.5rem; display: flex; flex-direction: column; gap: .1rem; }
.timeline-item {
  display: flex;
  gap: .9rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: .35rem;
}
.timeline-action { font-size: .88rem; font-weight: 700; color: var(--dark); font-family: monospace; }
.timeline-meta   { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }
.timeline-detail { font-size: .82rem; color: var(--text); margin-top: .2rem; font-style: italic; }

/* Responsive */
@media (max-width: 768px) {
  .admin-sidebar    { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-content    { margin-left: 0; }
  .features         { grid-template-columns: 1fr; }
  .stats-grid       { grid-template-columns: repeat(2, 1fr); }

  .guardian-sidebar { transform: translateX(-100%); }
  .guardian-sidebar.open { transform: translateX(0); }
  .guardian-content { margin-left: 0; }
  .topbar-toggle    { display: flex; }
  .guardian-cards   { grid-template-columns: 1fr; }
  .children-grid    { grid-template-columns: 1fr; }
  .request-form-grid { grid-template-columns: 1fr; }
  .request-meta-grid { flex-direction: column; gap: .4rem; }
  .form-row         { flex-direction: column; gap: 0; }
  .access-page-wide { padding-top: 1.5rem; }
}
