/* =====================================================
   ZERA KIDS — Design System (Ionic-inspired, sem framework)
   Fontes: Fredoka (brand/títulos) + Outfit (corpo)
   ===================================================== */

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

/* ── Variáveis ─────────────────────────────────────── */
:root {
  /* Marca */
  --c-primary:        #4ADE80;
  --c-primary-dark:   #22C55E;
  --c-primary-light:  #DCFCE7;
  --c-secondary:      #FACC15;
  --c-secondary-dark: #EAB308;
  --c-accent:         #60A5FA;
  --c-accent-dark:    #3B82F6;
  --c-dark:           #1E293B;
  --c-medium:         #64748B;
  --c-medium-light:   #94A3B8;
  --c-border:         #E2E8F0;
  --c-bg:             #F0FDF4;
  --c-white:          #FFFFFF;
  --c-danger:         #EF4444;
  --c-danger-light:   #FEE2E2;
  --c-success:        #22C55E;
  --c-warning:        #F59E0B;
  --c-warning-light:  #FEF3C7;
  --c-info:           #3B82F6;
  --c-info-light:     #EFF6FF;

  /* Tipografia */
  --font-body:  'Outfit', system-ui, -apple-system, sans-serif;
  --font-brand: 'Fredoka', system-ui, sans-serif;

  /* Espaçamento */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Bordas */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Sombras */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --shadow-green: 0 4px 20px rgba(74,222,128,.35);

  /* Layout */
  --header-h:   56px;
  --tab-bar-h:  64px;
  --max-w:      540px;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--c-dark);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--c-primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }

/* ── App Shell ─────────────────────────────────────── */
.zk-app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: var(--max-w);
  margin: 0 auto;
  position: relative;
  background: var(--c-white);
  box-shadow: 0 0 60px rgba(0,0,0,.08);
}

/* ── Header ────────────────────────────────────────── */
.zk-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  height: var(--header-h);
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,.95);
}
.zk-toolbar {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  gap: var(--space-sm);
}
.zk-toolbar__title {
  flex: 1;
  font-family: var(--font-brand);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--c-dark);
  text-align: center;
}
.zk-toolbar__btn {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--c-medium);
  transition: background .15s;
  flex-shrink: 0;
}
.zk-toolbar__btn:hover,
.zk-toolbar__btn:active { background: var(--c-primary-light); color: var(--c-primary-dark); }
.zk-toolbar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}
.zk-toolbar__logo-icon {
  width: 36px; height: 36px;
  background: var(--c-primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.zk-toolbar__logo-text {
  font-family: var(--font-brand);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--c-dark);
}
.zk-toolbar__logo-text span { color: var(--c-primary-dark); }

/* ── Content ────────────────────────────────────────── */
.zk-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-md);
}
.zk-content.has-header  { padding-top: calc(var(--header-h) + var(--space-md)); }
.zk-content.has-tabs    { padding-bottom: calc(var(--tab-bar-h) + var(--space-md)); }

/* ── Tab Bar ────────────────────────────────────────── */
.zk-tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  height: var(--tab-bar-h);
  background: var(--c-white);
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: stretch;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.zk-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--c-medium-light);
  font-size: 10px;
  font-weight: 500;
  transition: color .2s;
  border: none;
  background: none;
  cursor: pointer;
}
.zk-tab-btn svg { width: 22px; height: 22px; }
.zk-tab-btn.active { color: var(--c-primary-dark); }
.zk-tab-btn.active svg { stroke: var(--c-primary-dark); }

/* ── Cards ──────────────────────────────────────────── */
.zk-card {
  background: var(--c-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--c-border);
}
.zk-card--green {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
  border-color: transparent;
  color: var(--c-white);
}
.zk-card--yellow {
  background: linear-gradient(135deg, #FDE68A 0%, var(--c-secondary) 100%);
  border-color: transparent;
}
.zk-card--dark {
  background: var(--c-dark);
  border-color: transparent;
  color: var(--c-white);
}
.zk-card__header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.zk-card__body { padding: var(--space-md); }
.zk-card__footer {
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--c-border);
  background: var(--c-bg);
}

/* ── Buttons ────────────────────────────────────────── */
.zk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px var(--space-lg);
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.zk-btn:disabled { opacity: .5; cursor: not-allowed; }
.zk-btn--full { width: 100%; }
.zk-btn--primary {
  background: var(--c-primary);
  color: var(--c-dark);
  box-shadow: var(--shadow-green);
}
.zk-btn--primary:hover, .zk-btn--primary:active {
  background: var(--c-primary-dark);
  color: var(--c-white);
}
.zk-btn--secondary {
  background: var(--c-secondary);
  color: var(--c-dark);
}
.zk-btn--secondary:hover { background: var(--c-secondary-dark); }
.zk-btn--outline {
  background: transparent;
  border-color: var(--c-primary);
  color: var(--c-primary-dark);
}
.zk-btn--outline:hover { background: var(--c-primary-light); }
.zk-btn--outline-dark {
  background: transparent;
  border-color: var(--c-border);
  color: var(--c-medium);
}
.zk-btn--danger {
  background: var(--c-danger);
  color: var(--c-white);
}
.zk-btn--ghost {
  background: transparent;
  color: var(--c-medium);
  border-color: transparent;
}
.zk-btn--ghost:hover { background: var(--c-primary-light); color: var(--c-primary-dark); }
.zk-btn--sm { padding: 8px var(--space-md); font-size: 13px; }
.zk-btn--lg { padding: 15px var(--space-xl); font-size: 17px; }
.zk-btn--icon {
  padding: 10px;
  border-radius: var(--radius-full);
  width: 44px; height: 44px;
}
.zk-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Spinner no botão */
.zk-btn.loading { pointer-events: none; }
.zk-btn.loading::after {
  content: '';
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: zk-spin .7s linear infinite;
  margin-left: var(--space-sm);
}

/* ── Inputs ─────────────────────────────────────────── */
.zk-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-md);
}
.zk-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-medium);
  display: flex;
  align-items: center;
  gap: 4px;
}
.zk-label .required { color: var(--c-danger); }
.zk-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.zk-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--c-bg);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--c-dark);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
}
.zk-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(74,222,128,.15);
  background: var(--c-white);
}
.zk-input::placeholder { color: var(--c-medium-light); }
.zk-input--error { border-color: var(--c-danger) !important; }
.zk-input.has-icon { padding-left: 44px; }
.zk-input.has-action { padding-right: 48px; }
.zk-input-icon {
  position: absolute;
  left: 14px;
  color: var(--c-medium-light);
  pointer-events: none;
  display: flex;
  align-items: center;
}
.zk-input-icon svg { width: 18px; height: 18px; }
.zk-input-action {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--c-medium);
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color .15s;
}
.zk-input-action:hover { color: var(--c-primary-dark); }
.zk-input-action svg { width: 18px; height: 18px; }
.zk-input-error {
  font-size: 12px;
  color: var(--c-danger);
  display: flex;
  align-items: center;
  gap: 4px;
}
.zk-input-hint { font-size: 12px; color: var(--c-medium-light); }

/* Select */
.zk-select {
  width: 100%;
  padding: 12px 16px;
  padding-right: 36px;
  background: var(--c-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--c-dark);
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: border-color .2s;
}
.zk-select:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(74,222,128,.15);
}

/* Textarea */
.zk-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--c-bg);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--c-dark);
  outline: none;
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
  transition: border-color .2s;
}
.zk-textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(74,222,128,.15);
  background: var(--c-white);
}

/* ── Avatar / Foto ──────────────────────────────────── */
.zk-avatar-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.zk-avatar {
  position: relative;
  width: 90px; height: 90px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--c-primary-light);
  border: 3px solid var(--c-primary);
  cursor: pointer;
  flex-shrink: 0;
}
.zk-avatar img { width: 100%; height: 100%; object-fit: cover; }
.zk-avatar--sm { width: 48px; height: 48px; border-width: 2px; }
.zk-avatar--lg { width: 120px; height: 120px; border-width: 3px; }
.zk-avatar__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
}
.zk-avatar:hover .zk-avatar__overlay { opacity: 1; }
.zk-avatar__overlay svg { width: 24px; height: 24px; color: white; }

/* ── Items (listas) ─────────────────────────────────── */
.zk-list { list-style: none; }
.zk-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  transition: background .15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.zk-item:last-child { border-bottom: none; }
.zk-item:hover, .zk-item:active { background: var(--c-bg); }
.zk-item__start { flex-shrink: 0; }
.zk-item__content { flex: 1; min-width: 0; }
.zk-item__title { font-weight: 600; color: var(--c-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zk-item__subtitle { font-size: 13px; color: var(--c-medium); }
.zk-item__end { flex-shrink: 0; color: var(--c-medium-light); }
.zk-item__end svg { width: 16px; height: 16px; }

/* ── Chips / Tags ───────────────────────────────────── */
.zk-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--c-primary-light);
  color: var(--c-primary-dark);
  border: 1px solid var(--c-primary);
}
.zk-chip--yellow { background: var(--c-warning-light); color: #92400E; border-color: var(--c-warning); }
.zk-chip--blue   { background: var(--c-info-light); color: var(--c-accent-dark); border-color: var(--c-accent); }
.zk-chip--red    { background: var(--c-danger-light); color: var(--c-danger); border-color: var(--c-danger); }
.zk-chip--gray   { background: #F1F5F9; color: var(--c-medium); border-color: var(--c-border); }

/* ── Badge ──────────────────────────────────────────── */
.zk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  background: var(--c-danger);
  color: white;
}

/* ── Divider ─────────────────────────────────────────── */
.zk-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--c-medium-light);
  font-size: 13px;
  margin: var(--space-md) 0;
}
.zk-divider::before,
.zk-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-border);
}

/* ── Section título ─────────────────────────────────── */
.zk-section-title {
  font-family: var(--font-brand);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--c-dark);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.zk-section-title a { font-size: 13px; font-family: var(--font-body); font-weight: 600; color: var(--c-primary-dark); }

/* ── Alertas ─────────────────────────────────────────── */
.zk-alert {
  padding: 12px var(--space-md);
  border-radius: var(--radius-md);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.zk-alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.zk-alert--success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.zk-alert--error   { background: var(--c-danger-light); color: #991B1B; border: 1px solid #FECACA; }
.zk-alert--warning { background: var(--c-warning-light); color: #92400E; border: 1px solid #FDE68A; }
.zk-alert--info    { background: var(--c-info-light); color: #1E40AF; border: 1px solid #BFDBFE; }

/* ── Toast ───────────────────────────────────────────── */
#zk-toast {
  position: fixed;
  bottom: calc(var(--tab-bar-h) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--c-dark);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  max-width: calc(var(--max-w) - 32px);
}
#zk-toast.show { transform: translateX(-50%) translateY(0); }
#zk-toast.success { background: var(--c-success); }
#zk-toast.error   { background: var(--c-danger); }

/* ── Modal ───────────────────────────────────────────── */
.zk-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.6);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.zk-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.zk-modal {
  background: var(--c-white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: var(--max-w);
  max-height: 92dvh;
  overflow-y: auto;
  padding: var(--space-lg) var(--space-md);
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,0,.67,0);
}
.zk-modal-backdrop.open .zk-modal { transform: translateY(0); }
.zk-modal__handle {
  width: 40px; height: 4px;
  background: var(--c-border);
  border-radius: 2px;
  margin: 0 auto var(--space-lg);
}
.zk-modal__title {
  font-family: var(--font-brand);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  text-align: center;
}

/* ── Multi-step form ─────────────────────────────────── */
.zk-steps {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.zk-step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-border);
  transition: all .3s;
}
.zk-step-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--c-primary);
}
.zk-step-dot.done { background: var(--c-primary-dark); }

.zk-step-panel { display: none; }
.zk-step-panel.active { display: block; }

/* ── Cropper ─────────────────────────────────────────── */
.zk-cropper-modal .zk-modal { padding-bottom: var(--space-xl); }
#cropperCanvas {
  display: block;
  border-radius: var(--radius-md);
  max-width: 100%;
  cursor: grab;
  touch-action: none;
}
#cropperCanvas:active { cursor: grabbing; }
.cropper-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* ── Auth pages ──────────────────────────────────────── */
.zk-auth {
  min-height: 100dvh;
  background: linear-gradient(160deg, var(--c-primary-light) 0%, var(--c-white) 50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: var(--space-xl) var(--space-md) var(--space-2xl);
  max-width: var(--max-w);
  margin: 0 auto;
}
.zk-auth__logo {
  margin-bottom: var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}
.zk-auth__logo-icon {
  width: 80px; height: 80px;
  background: var(--c-primary);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-green);
}
.zk-auth__brand {
  font-family: var(--font-brand);
  font-size: 2rem;
  font-weight: 700;
  color: var(--c-dark);
  line-height: 1;
}
.zk-auth__brand span { color: var(--c-primary-dark); }
.zk-auth__slogan {
  font-size: 13px;
  color: var(--c-medium);
  font-style: italic;
  text-align: center;
}
.zk-auth__card {
  background: var(--c-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-xl);
  width: 100%;
  border: 1px solid var(--c-border);
}
.zk-auth__title {
  font-family: var(--font-brand);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--c-dark);
}
.zk-auth__subtitle {
  font-size: 14px;
  color: var(--c-medium);
  margin-bottom: var(--space-lg);
}

/* ── Dashboard ───────────────────────────────────────── */
.zk-hero-card {
  background: linear-gradient(135deg, var(--c-primary) 0%, #16A34A 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  color: white;
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-md);
}
.zk-hero-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
}
.zk-hero-card::after {
  content: '';
  position: absolute;
  bottom: -40px; right: 20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.zk-hero-greeting {
  font-family: var(--font-brand);
  font-size: 1.5rem;
  font-weight: 600;
}
.zk-hero-sub {
  font-size: 13px;
  opacity: .85;
  margin-top: 2px;
}

/* ── Story card ──────────────────────────────────────── */
.zk-story-card {
  background: var(--c-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  transition: box-shadow .2s;
  text-decoration: none;
  color: inherit;
}
.zk-story-card:hover { box-shadow: var(--shadow-md); }
.zk-story-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #FDE68A, var(--c-secondary));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.5rem;
}
.zk-story-title { font-weight: 600; font-size: 15px; color: var(--c-dark); }
.zk-story-age   { font-size: 12px; color: var(--c-medium); margin-top: 2px; }

/* ── Child selector ──────────────────────────────────── */
.zk-child-selector {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  scrollbar-width: none;
}
.zk-child-selector::-webkit-scrollbar { display: none; }
.zk-child-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-lg);
  transition: background .15s;
  text-decoration: none;
}
.zk-child-btn:hover, .zk-child-btn.active { background: var(--c-primary-light); }
.zk-child-btn .avatar-wrap {
  width: 56px; height: 56px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--c-border);
  transition: border-color .15s;
}
.zk-child-btn.active .avatar-wrap { border-color: var(--c-primary); }
.zk-child-btn .avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.zk-child-btn span { font-size: 11px; font-weight: 600; color: var(--c-medium); max-width: 64px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zk-child-btn.active span { color: var(--c-primary-dark); }

/* ── Leitura (story) ─────────────────────────────────── */
.zk-reading-body {
  font-size: 16px;
  line-height: 1.8;
  color: var(--c-dark);
  white-space: pre-wrap;
}
.zk-reading-faixa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--c-primary-light);
  color: var(--c-primary-dark);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

/* ── Admin ───────────────────────────────────────────── */
.zk-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--c-dark);
  color: var(--c-primary);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.zk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.zk-table th {
  text-align: left;
  padding: 10px var(--space-md);
  background: var(--c-bg);
  border-bottom: 2px solid var(--c-border);
  font-size: 12px;
  font-weight: 700;
  color: var(--c-medium);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.zk-table td {
  padding: 12px var(--space-md);
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.zk-table tr:last-child td { border-bottom: none; }
.zk-table tr:hover td { background: var(--c-bg); }

/* ── Utilities ───────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-brand   { font-family: var(--font-brand); }
.text-primary { color: var(--c-primary-dark); }
.text-medium  { color: var(--c-medium); }
.text-danger  { color: var(--c-danger); }
.text-sm      { font-size: 13px; }
.text-xs      { font-size: 11px; }
.fw-bold      { font-weight: 700; }
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Animações ───────────────────────────────────────── */
@keyframes zk-spin {
  to { transform: rotate(360deg); }
}
@keyframes zk-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: zk-fadeIn .3s ease; }

/* ── Dark / high contrast media ─────────────────────── */
@media (prefers-color-scheme: dark) {
  /* Mantém tema claro por padrão (app infantil) */
}

/* ── Scrollbar styling ───────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 2px; }

/* ══ ADDITIONS ══════════════════════════════════════════ */

/* ── Consistent App Header ──────────────────────────── */
.zk-header-page-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-medium);
  text-align: right;
  padding-right: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── QR Tab Button ───────────────────────────────────── */
.zk-tab-qr {
  position: relative;
}
.zk-tab-qr-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--c-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(74,222,128,.45);
  margin-bottom: 2px;
  margin-top: -16px;
}
.zk-tab-qr-icon svg { stroke: #14532d; }
.zk-tab-qr span { font-size: 10px; font-weight: 700; color: var(--c-primary-dark); }

/* ── QR Scanner Overlay ──────────────────────────────── */
#zkQROverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9000;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
#zkQROverlay.open { display: flex; }

.zk-qr-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: max(env(safe-area-inset-top, 0px), 16px) 16px 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,.7), transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}
.zk-qr-header-title {
  color: #fff;
  font-family: var(--font-brand);
  font-size: 1.1rem;
  font-weight: 700;
}
.zk-qr-close {
  width: 40px; height: 40px;
  border: none;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

#zkQRVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.zk-qr-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  width: min(70vw, 260px);
  height: min(70vw, 260px);
  border: 3px solid var(--c-primary);
  border-radius: 20px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
  z-index: 5;
}
.zk-qr-frame::before,
.zk-qr-frame::after {
  content: '';
  position: absolute;
  width: 28px; height: 28px;
  border-color: var(--c-primary);
  border-style: solid;
}
.zk-qr-frame::before { top: -3px; left: -3px; border-width: 4px 0 0 4px; border-radius: 20px 0 0 0; }
.zk-qr-frame::after  { bottom: -3px; right: -3px; border-width: 0 4px 4px 0; border-radius: 0 0 20px 0; }

.zk-qr-scan-line {
  position: absolute;
  left: 0; right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--c-primary), transparent);
  animation: qrScanAnim 2s ease-in-out infinite;
  border-radius: 2px;
}
@keyframes qrScanAnim {
  0%   { top: 0; opacity: 1; }
  50%  { top: calc(100% - 3px); opacity: 1; }
  100% { top: 0; opacity: 1; }
}

.zk-qr-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px 24px max(env(safe-area-inset-bottom, 0px), 24px);
  background: linear-gradient(to top, rgba(0,0,0,.8), transparent);
  text-align: center;
  z-index: 10;
}
.zk-qr-hint {
  color: rgba(255,255,255,.8);
  font-size: 14px;
  margin-bottom: 16px;
}
.zk-qr-result {
  background: rgba(255,255,255,.95);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  display: none;
}
.zk-qr-result.show { display: block; }
.zk-qr-result-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--c-dark);
}
.zk-qr-result-btns {
  display: flex;
  gap: 8px;
}
.zk-qr-result-btns a {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  text-decoration: none;
}
.zk-qr-btn-ler   { background: var(--c-primary); color: #14532d; }
.zk-qr-btn-ouvir { background: var(--c-accent); color: #fff; }

/* ── Busca de histórias ───────────────────────────────── */
.zk-search-bar {
  display: flex;
  align-items: center;
  background: var(--c-bg);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-full);
  padding: 10px 16px;
  gap: 10px;
  margin-bottom: var(--space-md);
  transition: border-color .2s, box-shadow .2s;
}
.zk-search-bar:focus-within {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(74,222,128,.15);
  background: var(--c-white);
}
.zk-search-bar svg { color: var(--c-medium-light); flex-shrink: 0; }
.zk-search-bar input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--c-dark);
}
.zk-search-bar input::placeholder { color: var(--c-medium-light); }

/* ── Seção Testamento ────────────────────────────────── */
.zk-testamento-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: var(--space-md) 0 var(--space-sm);
  padding: 10px 14px;
  background: linear-gradient(135deg, #fef9c3, #fde68a);
  border-radius: var(--radius-md);
  font-family: var(--font-brand);
  font-size: 15px;
  font-weight: 700;
  color: #78350f;
}
.zk-testamento-header.novo {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1e3a8a;
}

/* ── Story cards (melhorado) ─────────────────────────── */
.zk-story-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: background .15s, transform .1s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.zk-story-card:hover,
.zk-story-card:active {
  background: var(--c-bg);
  transform: translateX(2px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.zk-story-card.hidden { display: none; }
.zk-story-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  width: 44px;
  text-align: center;
}
.zk-story-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--c-dark);
}
.zk-story-age {
  font-size: 12px;
  color: var(--c-medium);
  margin-top: 2px;
}
.zk-story-badges {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

/* ── Logout melhorado ────────────────────────────────── */
.zk-danger-zone {
  border: 1.5px solid var(--c-danger-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  background: #fff5f5;
  margin-bottom: var(--space-xl);
}
.zk-danger-zone__title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-danger);
  margin-bottom: var(--space-sm);
}
.zk-logout-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 14px var(--space-md);
  background: #fff;
  border: 1.5px solid var(--c-danger);
  border-radius: var(--radius-md);
  color: var(--c-danger);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
}
.zk-logout-btn:hover,
.zk-logout-btn:active { background: var(--c-danger-light); text-decoration: none; }
.zk-logout-btn svg { width: 20px; height: 20px; }
