/* ==========================================
   ROOT VARIABLES
   ========================================== */
:root {
  --navy:      #003087;
  --navy-dark: #001f5b;
  --gold:      #C8A951;
  --green:     #2E8B57;
  --red:       #C0392B;
  --white:     #FFFFFF;
  --off-white: #F7F8FA;
  --gray-100:  #F0F2F5;
  --gray-200:  #E2E6EA;
  --gray-400:  #9AA5B4;
  --gray-500:  #718096;
  --gray-600:  #4A5568;
  --gray-800:  #1A202C;
  --gray-900:  #171923;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.10);
  --shadow-md: 0 4px 12px rgba(0,0,0,.14);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.18);
  --radius:    10px;
  --radius-sm: 6px;
}

/* ==========================================
   RESET & BASE
   ========================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--off-white);
  color: var(--gray-800);
  line-height: 1.6;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==========================================
   RIPPLE EFFECT
   ========================================== */
.ripple { position: relative; overflow: hidden; }
.ripple-wave {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
  transform: scale(0);
  animation: ripple-anim .5s linear;
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

/* ==========================================
   HEADER
   ========================================== */
header {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
  color: var(--white);
  padding: .8rem 1.25rem;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}
.header-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.header-badge { display: flex; align-items: center; gap: .65rem; }
.badge-cross  { font-size: 1.75rem; color: var(--gold); line-height: 1; }
.badge-title  { font-size: 1rem; font-weight: 700; letter-spacing: .02em; }
.badge-sub    { font-size: .72rem; color: rgba(255,255,255,.65); letter-spacing: .04em; text-transform: uppercase; }
.header-tag   {
  font-size: .72rem; font-weight: 700;
  background: var(--gold); color: var(--navy-dark);
  padding: .22rem .65rem; border-radius: 20px;
  letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}

/* ==========================================
   QUICK-START SHORTCUTS
   ========================================== */
.quickstart {
  background: linear-gradient(90deg, var(--navy-dark) 0%, #0a2a6e 100%);
  padding: .55rem 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.quickstart::-webkit-scrollbar { display: none; }

.qs-prompt {
  color: rgba(255,255,255,.5);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: .25rem;
}

.qs-btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .38rem .75rem;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 20px;
  color: rgba(255,255,255,.9);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s, transform .1s, border-color .15s;
}
.qs-btn:hover  { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.4); transform: translateY(-1px); }
.qs-btn:active { transform: translateY(0) scale(.97); }
.qs-icon { font-size: 1rem; line-height: 1; }
.qs-lbl  { font-size: .75rem; }

/* ==========================================
   TAB BAR
   ========================================== */
.tab-bar {
  display: flex;
  background: var(--white);
  border-bottom: 2px solid var(--gray-200);
  overflow-x: auto;
  position: sticky;
  top: 0;
  z-index: 100;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: none;
  padding: .72rem 1.05rem;
  border: none;
  background: none;
  color: var(--gray-600);
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
  letter-spacing: .01em;
}
.tab-btn:hover  { color: var(--navy); background: var(--gray-100); }
.tab-btn.active { color: var(--navy); border-bottom-color: var(--gold); background: #F5F7FF; }
.tab-btn-avail  { margin-left: auto; border-left: 1px solid var(--gray-200); }

/* ==========================================
   TAB PANELS
   ========================================== */
.tab-panels {
  flex: 1; max-width: 960px; width: 100%;
  margin: 0 auto; padding: 1.1rem 1.25rem 2rem;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeSlideIn .18s ease; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.panel-title { font-size: 1.3rem; color: var(--navy); font-weight: 800; margin-bottom: .3rem; }
.panel-sub   { color: var(--gray-600); margin-bottom: 1rem; font-size: .93rem; }

/* ==========================================
   PCM CHECKER
   ========================================== */
.pcm-checker {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
  margin-bottom: 1rem;
  text-align: center;
}
.pcm-question {
  font-weight: 700; color: var(--navy);
  margin-bottom: .7rem; font-size: .95rem;
}
.pcm-btns { display: flex; gap: .45rem; justify-content: center; flex-wrap: wrap; }

.pcm-btn {
  padding: .45rem 1.1rem;
  border: 2px solid transparent;
  border-radius: 20px;
  font-size: .85rem; font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s, transform .1s, box-shadow .15s;
}
.pcm-btn:active { transform: scale(.96); }
.pcm-yes    { background: #E8F5E9; color: #2E7D32; border-color: #A5D6A7; }
.pcm-no     { background: #FFEBEE; color: #C62828; border-color: #FFCDD2; }
.pcm-unsure { background: #FFF8E1; color: #F57F17; border-color: #FFE082; }
.pcm-yes:hover    { background: #2E7D32; color: white; box-shadow: 0 2px 8px rgba(46,125,50,.35); }
.pcm-no:hover     { background: #C62828; color: white; box-shadow: 0 2px 8px rgba(198,40,40,.35); }
.pcm-unsure:hover { background: #F57F17; color: white; box-shadow: 0 2px 8px rgba(245,127,23,.35); }
.pcm-btn.selected { box-shadow: 0 0 0 3px rgba(0,0,0,.12); }

.pcm-result {
  margin-top: .7rem; font-size: .88rem;
  border-radius: var(--radius-sm); padding: .6rem .85rem;
  text-align: left; display: none; transition: all .2s;
}
.pcm-result.show    { display: block; animation: fadeSlideIn .2s ease; }
.pcm-result.success { background: #E8F5E9; color: #1B5E20; border-left: 4px solid #4CAF50; }
.pcm-result.warning { background: #FFF3E0; color: #E65100; border-left: 4px solid #FF9800; }

/* ==========================================
   COLLAPSIBLE (details/summary)
   ========================================== */
details.collapsible { border-radius: var(--radius-sm); margin-bottom: 1rem; overflow: hidden; }

details.collapsible > summary {
  cursor: pointer; padding: .7rem 1rem;
  font-weight: 600; font-size: .88rem;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none; list-style: none; gap: .5rem;
  transition: opacity .15s;
}
details.collapsible > summary:hover { opacity: .85; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::after {
  content: '▼'; font-size: .62rem; flex-shrink: 0; transition: transform .2s;
}
details.collapsible[open] > summary::after { transform: rotate(180deg); }

.collapsible-body { padding: .85rem 1rem 1rem; font-size: .88rem; line-height: 1.65; }

.collapsible-danger > summary { background: #FEF0F0; color: #922B21; border: 1px solid #F5B7B1; }
.collapsible-danger .collapsible-body {
  background: #FEF0F0; border: 1px solid #F5B7B1; border-top: none; color: var(--gray-800);
}
.collapsible-danger .collapsible-body a { color: #922B21; font-weight: 600; }

.collapsible-info > summary { background: #EAF4FB; color: #1A5276; border: 1px solid #AED6F1; }
.collapsible-info .collapsible-body {
  background: #EAF4FB; border: 1px solid #AED6F1; border-top: none; color: var(--gray-800);
}
.collapsible-info .collapsible-body a { color: #1A5276; font-weight: 600; }

.box-link { display: inline-block; margin-top: .3rem; font-size: .83rem; }
.box-link-desc { display: block; font-size: .76rem; color: var(--gray-400); margin: .15rem 0 .55rem .1rem; line-height: 1.45; }
.pcm-steps { margin: .6rem 0 .75rem 1.2rem; line-height: 1.9; font-size: .87rem; }
.pcm-steps li { margin-bottom: .1rem; }

/* ==========================================
   RESOURCE CARDS
   ========================================== */
.resource-cards { display: grid; gap: .9rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
.resource-cards.two-col   { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.resource-cards.three-col { grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); }

.card {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: .95rem 1.05rem;
  transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.card-primary { background: #EEF3FF; border-color: #B3C8F5; border-left: 4px solid var(--navy); }

.card-label {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--gold); background: var(--navy);
  display: inline-block; padding: .1rem .42rem; border-radius: 3px; margin-bottom: .42rem;
}
.card-title  { font-size: .96rem; font-weight: 700; color: var(--navy); margin-bottom: .4rem; }
.card-detail {
  font-size: .86rem; color: var(--gray-600);
  margin-bottom: .26rem; display: flex; align-items: center; gap: .38rem; flex-wrap: wrap;
}
.card-detail a { color: var(--navy); font-weight: 500; }
.card-detail a:hover { text-decoration: underline; }
.card-note {
  font-size: .76rem; color: var(--gray-400);
  margin-top: .5rem; border-top: 1px solid var(--gray-200); padding-top: .42rem; font-style: italic;
}
.card-note-warn {
  color: #922B21; background: #FDEDEC; border-top-color: #F5B7B1;
  font-style: normal; font-weight: 600; border-radius: 4px; padding: .32rem .42rem;
}

/* ==========================================
   PHONE COPY
   ========================================== */
.phone-wrapper { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.copy-phone-btn {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: .08rem .35rem;
  font-size: .66rem;
  font-weight: 700;
  color: var(--gray-400);
  cursor: pointer;
  transition: all .15s;
  line-height: 1.4;
  letter-spacing: .03em;
}
.copy-phone-btn:hover  { border-color: var(--navy); color: var(--navy); background: #EEF3FF; }
.copy-phone-btn:active { transform: scale(.93); }
.copy-phone-btn.copied { background: #E8F5E9; border-color: #4CAF50; color: #2E7D32; }

.icon { flex-shrink: 0; }

/* ==========================================
   INTERACTIVE CHECKLIST
   ========================================== */
.checklist-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem;
}
.checklist-progress {
  font-size: .8rem; font-weight: 700; color: var(--navy);
  background: var(--gray-100); padding: .18rem .6rem;
  border-radius: 20px; border: 1px solid var(--gray-200);
  transition: all .25s;
}
.checklist-progress.all-done { background: #E8F5E9; color: #2E7D32; border-color: #A5D6A7; }
.btn-text {
  background: none; border: none; color: var(--gray-400);
  font-size: .8rem; cursor: pointer; padding: .18rem .4rem;
  border-radius: 4px; transition: color .15s;
}
.btn-text:hover { color: var(--red); }

.checklist { list-style: none; margin-bottom: 1rem; }
.checklist-item {
  border-radius: var(--radius-sm);
  transition: background .2s;
  padding: .08rem 0;
}
.checklist-item:nth-child(odd) { background: var(--gray-100); }
.checklist-item.done           { background: #F0FFF4 !important; }

.check-label {
  display: flex; align-items: flex-start; gap: .65rem;
  cursor: pointer; width: 100%; padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  transition: background .15s;
  user-select: none;
}
.check-label:hover { background: rgba(0,48,135,.05); }

.check-box { display: none; }

.check-custom {
  width: 20px; height: 20px; min-width: 20px;
  border: 2px solid var(--gray-400); border-radius: 4px;
  margin-top: .05rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .18s, border-color .18s, transform .1s;
  background: white;
}
.check-box:checked + .check-custom {
  background: var(--green); border-color: var(--green); transform: scale(1.08);
}
.check-box:checked + .check-custom::after {
  content: '✓'; color: white; font-size: .78rem; font-weight: 800;
}
.check-text {
  font-size: .91rem; line-height: 1.45; transition: color .2s;
}
.check-box:checked ~ .check-text,
.check-label.done .check-text {
  text-decoration: line-through; color: var(--gray-400);
}

/* ==========================================
   CITY FINDER
   ========================================== */
.city-finder {
  background: var(--gray-100); border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: 1rem;
}
.city-finder-label {
  font-size: .76rem; font-weight: 700; color: var(--gray-600);
  margin-bottom: .5rem; text-transform: uppercase; letter-spacing: .07em;
}
.city-btns { display: flex; flex-wrap: wrap; gap: .38rem; }

.city-btn {
  padding: .28rem .65rem;
  border: 1px solid var(--gray-200); border-radius: 20px;
  background: white; color: var(--gray-600);
  font-size: .78rem; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.city-btn:hover { border-color: var(--navy); color: var(--navy); background: #EEF3FF; }
.city-btn.active { background: var(--navy); color: white; border-color: var(--navy); }
.city-btn.active-santarosa { background: var(--green); border-color: var(--green); }

.city-result {
  margin-top: .6rem; font-size: .83rem; font-weight: 600;
  min-height: 1.2rem; transition: opacity .2s;
}
.city-result.okaloosa  { color: var(--navy); }
.city-result.santarosa { color: var(--green); }

/* District card highlight */
.district-card { transition: transform .18s, box-shadow .18s, border-color .25s; }
.district-card.highlight-okaloosa {
  border-color: var(--navy) !important;
  box-shadow: 0 0 0 3px rgba(0,48,135,.18), var(--shadow-md) !important;
  transform: translateY(-3px);
}
.district-card.highlight-santarosa {
  border-color: var(--green) !important;
  box-shadow: 0 0 0 3px rgba(46,139,87,.18), var(--shadow-md) !important;
  transform: translateY(-3px);
}

/* ==========================================
   INFO BOXES
   ========================================== */
.info-box {
  background: #EEF3FF; border-left: 4px solid var(--navy);
  border-radius: var(--radius-sm); padding: .78rem 1rem;
  font-size: .86rem; color: var(--gray-600); line-height: 1.55;
  margin-bottom: .5rem;
}
.info-box strong { color: var(--navy); }
.info-box a { color: var(--navy); font-weight: 500; }
.info-box-warning { background: #FEF9EC; border-left-color: var(--gold); }
.info-box-warning strong { color: #7A5C00; }

/* ==========================================
   QR SECTION
   ========================================== */
#tab-share { text-align: center; }
#tab-share .panel-sub { max-width: 480px; margin: 0 auto 1.25rem; }
#qr-container {
  display: inline-flex; flex-direction: column; align-items: center;
  gap: .6rem; padding: 1rem; border: 2px solid var(--gray-200);
  border-radius: var(--radius); background: var(--white); margin-bottom: 1rem;
}
#qr-code { line-height: 0; }
#qr-code canvas, #qr-code img { border-radius: 4px; }
.qr-label { font-size: .76rem; color: var(--gray-400); font-family: monospace; }
.qr-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1rem; }

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  padding: .58rem 1.25rem; border: none; border-radius: var(--radius-sm);
  font-size: .91rem; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .1s, box-shadow .15s;
}
.btn:hover  { opacity: .88; box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--navy); color: var(--white); }
.btn-secondary { background: var(--gray-200); color: var(--gray-800); }

/* ==========================================
   TOAST NOTIFICATION
   ========================================== */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%);
  background: #1A202C; color: white;
  padding: .45rem 1.1rem; border-radius: 20px;
  font-size: .83rem; font-weight: 600;
  z-index: 10001; opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none; white-space: nowrap;
  transform: translateX(-50%) translateY(8px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================
   FOOTER
   ========================================== */
footer { background: var(--navy-dark); color: rgba(255,255,255,.75); padding: 1rem 1.25rem; text-align: center; flex-shrink: 0; }
.footer-inner { max-width: 960px; margin: 0 auto; }
.footer-main  { font-size: .86rem; font-weight: 600; margin-bottom: .28rem; color: var(--white); }
.footer-small { font-size: .71rem; line-height: 1.5; }

/* ==========================================
   DIAGNOSTIC PANEL
   ========================================== */
.diag-hidden { display: none !important; }
#diagnostic-panel {
  position: fixed; top: 0; right: 0;
  width: 480px; max-width: 98vw; height: 100vh;
  background: #0d1117; color: #c9d1d9;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: .8rem; z-index: 9999;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,.5); overflow: hidden;
}
.diag-header { background: #161b22; border-bottom: 1px solid #30363d; padding: .75rem 1rem; flex-shrink: 0; }
.diag-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.diag-title   { font-size: .95rem; font-weight: 700; color: #58a6ff; letter-spacing: .04em; }
.diag-hint    { font-size: .7rem; color: #484f58; }
.diag-controls { display: flex; gap: .5rem; }
.diag-btn { background: #21262d; color: #c9d1d9; border: 1px solid #30363d; border-radius: 4px; padding: .35rem .75rem; font-size: .78rem; font-family: inherit; cursor: pointer; transition: background .15s; }
.diag-btn:hover       { background: #30363d; }
.diag-btn-close:hover { background: #3d1e1e; color: #ff7b72; border-color: #ff7b72; }
.diag-summary { background: #161b22; border-bottom: 1px solid #30363d; padding: .6rem 1rem; font-size: .78rem; flex-shrink: 0; min-height: 2.5rem; }
.diag-body    { flex: 1; overflow-y: auto; padding: .75rem; }
.diag-test    { border: 1px solid #21262d; border-radius: 6px; margin-bottom: .6rem; overflow: hidden; }
.diag-test-header { display: flex; align-items: center; gap: .6rem; padding: .45rem .75rem; background: #161b22; cursor: pointer; user-select: none; }
.diag-status  { font-size: .72rem; font-weight: 700; padding: .1rem .4rem; border-radius: 3px; flex-shrink: 0; }
.diag-status.pass { background: #1a4731; color: #3fb950; }
.diag-status.fail { background: #3d1e1e; color: #ff7b72; }
.diag-test-name   { flex: 1; color: #e6edf3; font-size: .8rem; }
.diag-category    { font-size: .68rem; color: #484f58; }
.diag-test-detail { padding: .5rem .75rem; background: #0d1117; border-top: 1px solid #21262d; display: none; }
.diag-test-detail.open { display: block; }
.diag-row       { display: grid; grid-template-columns: 90px 1fr; gap: .25rem .5rem; margin-bottom: .3rem; font-size: .75rem; }
.diag-row-label { color: #484f58; }
.diag-row-val   { color: #c9d1d9; word-break: break-all; }
.diag-row-val.good { color: #3fb950; }
.diag-row-val.bad  { color: #ff7b72; }
.diag-section-title { color: #8b949e; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; margin: .8rem 0 .35rem; border-bottom: 1px solid #21262d; padding-bottom: .2rem; }
.diag-section-title:first-child { margin-top: 0; }
.diag-score-bar  { height: 4px; border-radius: 2px; background: #21262d; margin-top: .4rem; overflow: hidden; }
.diag-score-fill { height: 100%; border-radius: 2px; transition: width .4s ease; }
.diag-score-fill.high { background: #3fb950; }
.diag-score-fill.mid  { background: #d29922; }
.diag-score-fill.low  { background: #ff7b72; }
#diag-toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%);
  background: #161b22; color: #58a6ff;
  border: 1px solid #30363d; border-radius: 6px;
  padding: .5rem 1rem; font-size: .8rem; font-family: monospace;
  z-index: 10000; animation: fadeInOut 2.5s forwards;
}
@keyframes fadeInOut {
  0%   { opacity: 0; transform: translateX(-50%) translateY(8px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* QR PRINT AREA — hidden at screen, shown only when printing QR code */
#qr-print-area { display: none; }

/* ==========================================
   PRINT
   ========================================== */
@media print {
  /* Normal page print — hide UI chrome */
  .tab-bar, .quickstart, .btn, #diagnostic-panel, #diag-toast,
  .copy-phone-btn, .pcm-checker, .city-finder, .checklist-header, .btn-text,
  .qr-icon-btn, .survey-overlay, .qr-modal-overlay,
  .feedback-fab, .feedback-overlay, .feedback-panel, #fb-toast,
  .confirm-overlay, .admin-panel, #admin-toast, #qr-print-area,
  #offline-banner, #due-calc-section, #age-router-section { display: none !important; }
  .tab-panel { display: block !important; page-break-inside: avoid; margin-bottom: 1.5rem; }
  header { background: #003087 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  footer { background: #001f5b !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { font-size: 12px; }
  .tab-panels { padding: 0; }
  details.collapsible .collapsible-body { display: block; }
  details.collapsible > summary::after { display: none; }
  .check-text { text-decoration: none !important; color: var(--gray-800) !important; }

  /* QR-code print mode — triggered by body.qr-print-mode, hides everything except the QR area */
  body.qr-print-mode > *:not(#qr-print-area) { display: none !important; }
  body.qr-print-mode #qr-print-area {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .qr-pa-clinic { font-size: 20px; font-weight: 800; color: #003087; text-align: center; margin-bottom: .25rem; }
  .qr-pa-sub    { font-size: 11px; color: #555; text-align: center; margin-bottom: 1.5rem; }
  #qr-pa-img img { width: 220px; height: 220px; display: block; }
  .qr-pa-url    { font-family: monospace; font-size: 13px; color: #003087; font-weight: 700; margin-top: 1rem; }
  .qr-pa-hint   { font-size: 10px; color: #555; margin-top: .3rem; }
  .qr-pa-label  { font-size: 10px; color: #888; margin-top: .5rem; }
}

/* ==========================================
   QR ICON BUTTON (header)
   ========================================== */
.header-right {
  display: flex; align-items: center; gap: .6rem;
}
.qr-icon-btn {
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.35);
  color: white; border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .18s, border-color .18s, transform .15s;
  position: relative; overflow: hidden;
}
.qr-icon-btn:hover {
  background: rgba(255,255,255,.28); border-color: rgba(255,255,255,.7);
  transform: scale(1.08);
}
.qr-icon-btn:active { transform: scale(.96); }

/* ==========================================
   QR CODE MODAL
   ========================================== */
.qr-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,16,48,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 4500;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.qr-modal-overlay.qr-modal-open  { animation: qrOverlayIn  .22s ease; }
.qr-modal-overlay.qr-modal-hiding { animation: qrOverlayOut .2s ease forwards; pointer-events: none; }
@keyframes qrOverlayIn  { from { opacity:0; } to { opacity:1; } }
@keyframes qrOverlayOut { from { opacity:1; } to { opacity:0; } }

.qr-modal-card {
  background: white; border-radius: 20px;
  width: 100%; max-width: 340px;
  box-shadow: 0 28px 72px rgba(0,0,0,.38);
  position: relative; overflow: hidden;
  animation: qrCardIn .3s cubic-bezier(.34,1.38,.64,1);
}
.qr-modal-overlay.qr-modal-hiding .qr-modal-card {
  animation: qrCardOut .2s ease forwards;
}
@keyframes qrCardIn  { from { opacity:0; transform: scale(.82) translateY(20px); } to { opacity:1; transform: scale(1) translateY(0); } }
@keyframes qrCardOut { from { opacity:1; transform: scale(1); } to { opacity:0; transform: scale(.88); } }

.qr-modal-close {
  position: absolute; top: .75rem; right: .75rem;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gray-100); border: none;
  font-size: .8rem; font-weight: 700; color: var(--gray-600);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s; z-index: 2;
}
.qr-modal-close:hover { background: var(--gray-200); color: var(--gray-900); }

.qr-modal-header { text-align: center; padding: 1.6rem 1.4rem .6rem; }
.qr-modal-badge { font-size: 2rem; margin-bottom: .5rem; }
.qr-modal-title { font-size: 1.15rem; font-weight: 800; color: var(--navy); margin-bottom: .25rem; }
.qr-modal-sub   { font-size: .78rem; color: var(--gray-400); }

.qr-modal-code-wrap {
  display: flex; justify-content: center; padding: 1rem 1.4rem .5rem;
}
.qr-modal-code-wrap canvas,
.qr-modal-code-wrap img { border-radius: 10px; border: 3px solid var(--gray-100); }

.qr-modal-url {
  text-align: center; font-size: .7rem; color: var(--gray-400);
  padding: .3rem 1rem .5rem; word-break: break-all;
}

.qr-modal-actions {
  display: flex; gap: .6rem; padding: .6rem 1.2rem 1.4rem;
}
.qr-modal-actions .btn { flex: 1; padding: .6rem .5rem; font-size: .85rem; }

/* ==========================================
   SURVEY MODAL — playful kid-friendly
   ========================================== */
.survey-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(145deg, rgba(99,56,176,.82) 0%, rgba(0,80,180,.78) 55%, rgba(0,160,140,.72) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: surveyOverlayIn .3s ease;
}
.survey-overlay.hiding {
  animation: surveyOverlayOut .22s ease forwards;
  pointer-events: none;
}
@keyframes surveyOverlayIn  { from { opacity:0; } to { opacity:1; } }
@keyframes surveyOverlayOut { from { opacity:1; } to { opacity:0; } }

.survey-modal {
  background: #fff;
  border-radius: 24px;
  width: 100%; max-width: 420px; max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.35), 0 0 0 4px rgba(255,255,255,.18);
  position: relative;
  animation: surveyModalIn .38s cubic-bezier(.34,1.52,.64,1);
}
.survey-modal::before {
  content: '';
  display: block; height: 6px;
  background: linear-gradient(90deg, #FF6B6B, #FFD93D, #06D6A0, #4ECDC4, #9B5DE5, #FF6B6B);
  background-size: 200% 100%;
  border-radius: 24px 24px 0 0;
  animation: rainbowShift 3s linear infinite;
}
@keyframes rainbowShift { to { background-position: 200% 0; } }

.survey-overlay.hiding .survey-modal {
  animation: surveyModalOut .22s ease forwards;
}
@keyframes surveyModalIn  { from { opacity:0; transform: scale(.8) translateY(30px); } to { opacity:1; transform: scale(1) translateY(0); } }
@keyframes surveyModalOut { from { opacity:1; transform: scale(1); } to { opacity:0; transform: scale(.88) translateY(16px); } }

/* Skip / close */
.survey-skip {
  position: absolute; top: 1rem; right: .9rem;
  background: var(--gray-100); border: none;
  color: var(--gray-500); font-size: .73rem; font-weight: 700;
  cursor: pointer; padding: .28rem .6rem; border-radius: 20px; z-index: 2;
  transition: color .15s, background .15s;
}
.survey-skip:hover { color: var(--gray-800); background: var(--gray-200); }

/* Content area */
.survey-content { padding: 1.5rem 1.4rem 1.6rem; }

/* Progress dots */
.survey-progress {
  display: flex; justify-content: center; gap: .4rem; margin-bottom: 1.2rem;
}
.survey-dot {
  height: 8px; width: 8px; border-radius: 4px;
  background: var(--gray-200); transition: all .3s cubic-bezier(.34,1.4,.64,1);
}
.survey-dot.active { width: 24px; background: linear-gradient(90deg,#9B5DE5,#4ECDC4); }
.survey-dot.done   { background: #06D6A0; }

/* Back button */
.survey-back {
  background: var(--gray-100); border: none; border-radius: 20px;
  color: var(--gray-500); font-size: .78rem; font-weight: 700;
  cursor: pointer; padding: .28rem .75rem; margin-bottom: 1rem;
  display: inline-flex; align-items: center; gap: .3rem;
  transition: background .15s, color .15s;
}
.survey-back:hover { background: var(--gray-200); color: var(--navy); }

/* ---- WELCOME SLIDE ---- */
.survey-welcome { text-align: center; padding: .5rem 0 .25rem; }

.survey-welcome-badge {
  width: 86px; height: 86px; border-radius: 50%;
  background: linear-gradient(135deg, #9B5DE5 0%, #4ECDC4 50%, #06D6A0 100%);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.1rem; font-size: 2.6rem;
  box-shadow: 0 8px 28px rgba(155,93,229,.35);
  animation: badgeBounce 2.4s ease-in-out infinite;
}
@keyframes badgeBounce {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-6px) scale(1.04); }
}

.survey-welcome-tag {
  display: inline-block;
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
  color: white;
  background: linear-gradient(90deg, #9B5DE5, #4ECDC4);
  padding: .18rem .65rem; border-radius: 20px; margin-bottom: .65rem;
}

.survey-welcome h1 {
  font-size: 1.55rem; font-weight: 900; line-height: 1.15;
  margin-bottom: .55rem;
  background: linear-gradient(135deg, var(--navy-dark), #9B5DE5);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.survey-welcome p {
  font-size: .9rem; color: var(--gray-500); line-height: 1.6;
  margin-bottom: 1.5rem; max-width: 290px;
  margin-left: auto; margin-right: auto;
}

.survey-stars {
  display: flex; justify-content: center; gap: .3rem;
  font-size: 1.1rem; margin-bottom: 1.2rem; letter-spacing: .1em;
}

.survey-start-btn {
  background: linear-gradient(135deg, #9B5DE5 0%, #4ECDC4 100%);
  color: white; border: none; border-radius: 30px;
  padding: .85rem 2.5rem; font-size: 1.02rem; font-weight: 800;
  cursor: pointer; transition: all .2s;
  box-shadow: 0 6px 20px rgba(155,93,229,.4);
  letter-spacing: .03em;
}
.survey-start-btn:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 28px rgba(155,93,229,.5); }
.survey-start-btn:active { transform: translateY(0) scale(.97); }

/* ---- QUESTION SLIDES ---- */
.survey-step-label {
  display: inline-block;
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
  color: white;
  background: linear-gradient(90deg, #FF6B6B, #FFD93D);
  padding: .15rem .55rem; border-radius: 20px; margin-bottom: .65rem;
}

.survey-question h2 {
  font-size: 1.18rem; font-weight: 900; color: var(--navy);
  margin-bottom: .3rem; line-height: 1.3;
}
.survey-hint {
  font-size: .8rem; color: var(--gray-400); margin-bottom: 1rem; line-height: 1.5;
}

.survey-options { display: flex; flex-direction: column; gap: .5rem; }

.survey-option {
  display: flex; align-items: center; gap: .85rem;
  padding: .8rem 1rem;
  border: 2.5px solid var(--gray-200);
  border-radius: 14px;
  background: var(--white);
  cursor: pointer; text-align: left; width: 100%;
  transition: border-color .18s, background .18s, transform .16s cubic-bezier(.34,1.4,.64,1), box-shadow .18s;
}
.survey-option:nth-child(1):hover { border-color: #9B5DE5; background: #F5F0FF; }
.survey-option:nth-child(1):hover .survey-opt-label { color: #9B5DE5; }
.survey-option:nth-child(2):hover { border-color: #FF6B6B; background: #FFF3F3; }
.survey-option:nth-child(2):hover .survey-opt-label { color: #CC3D3D; }
.survey-option:nth-child(3):hover { border-color: #06D6A0; background: #EDFFF9; }
.survey-option:nth-child(3):hover .survey-opt-label { color: #048A67; }
.survey-option:nth-child(4):hover { border-color: #FFD93D; background: #FFFBEA; }
.survey-option:nth-child(4):hover .survey-opt-label { color: #9A7200; }
.survey-option:nth-child(5):hover { border-color: #4ECDC4; background: #EDFFFE; }
.survey-option:nth-child(5):hover .survey-opt-label { color: #2A8A85; }
.survey-option:hover { transform: translateX(5px) scale(1.01); box-shadow: 0 4px 14px rgba(0,0,0,.09); }
.survey-option:active { transform: translateX(3px) scale(.99); }

.survey-opt-icon {
  font-size: 1.6rem; line-height: 1; flex-shrink: 0;
  width: 38px; text-align: center;
}
.survey-opt-text { display: flex; flex-direction: column; gap: .06rem; }
.survey-opt-label { font-size: .93rem; font-weight: 800; color: var(--navy); transition: color .18s; }
.survey-opt-desc  { font-size: .75rem; color: var(--gray-400); }

/* PCM option color variants */
.survey-option.opt-yes:hover    { border-color: #06D6A0 !important; background: #EDFFF9 !important; }
.survey-option.opt-yes:hover .survey-opt-label { color: #048A67 !important; }
.survey-option.opt-no:hover     { border-color: #FF6B6B !important; background: #FFF3F3 !important; }
.survey-option.opt-no:hover .survey-opt-label  { color: #CC3D3D !important; }
.survey-option.opt-unsure:hover { border-color: #FFD93D !important; background: #FFFBEA !important; }
.survey-option.opt-unsure:hover .survey-opt-label { color: #9A7200 !important; }

/* Slide transition */
.survey-slide-exit  { animation: surveySlideOut .18s ease forwards; }
.survey-slide-enter { animation: surveySlideIn  .22s cubic-bezier(.34,1.3,.64,1); }
@keyframes surveySlideOut { to   { opacity:0; transform: translateX(-32px) scale(.97); } }
@keyframes surveySlideIn  { from { opacity:0; transform: translateX(32px)  scale(.97); } }

/* ==========================================
   FEEDBACK FAB (floating bottom-left)
   ========================================== */
.feedback-fab {
  position: fixed; bottom: 1.4rem; left: 1.1rem; z-index: 3000;
  display: flex; align-items: center; gap: .45rem;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
  color: white; border: none; border-radius: 30px;
  padding: .6rem 1.1rem .6rem .8rem;
  font-size: .85rem; font-weight: 800;
  cursor: pointer; box-shadow: 0 6px 22px rgba(255,107,107,.45);
  transition: transform .2s cubic-bezier(.34,1.4,.64,1), box-shadow .2s;
  position: fixed; overflow: visible;
}
.feedback-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 10px 28px rgba(255,107,107,.55); }
.feedback-fab:active { transform: scale(.96); }
.fab-icon { font-size: 1.15rem; }
.fab-lbl  { letter-spacing: .02em; }
.fab-pulse {
  position: absolute; inset: -4px; border-radius: 34px;
  border: 2px solid rgba(255,107,107,.55);
  animation: fabPulse 2.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes fabPulse {
  0%,100% { transform: scale(1);   opacity: .6; }
  50%      { transform: scale(1.12); opacity: 0;  }
}

/* ==========================================
   FEEDBACK MODAL
   ========================================== */
.feedback-overlay {
  position: fixed; inset: 0;
  background: rgba(0,16,60,.75);
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  z-index: 4800;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.feedback-overlay.fb-open    { animation: fbOverlayIn  .22s ease; }
.feedback-overlay.fb-hiding  { animation: fbOverlayOut .2s ease forwards; pointer-events: none; }
@keyframes fbOverlayIn  { from { opacity:0; } to { opacity:1; } }
@keyframes fbOverlayOut { from { opacity:1; } to { opacity:0; } }

.feedback-modal {
  background: white; border-radius: 22px;
  width: 100%; max-width: 500px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.38);
  position: relative; overflow: hidden;
  animation: fbModalIn .34s cubic-bezier(.34,1.44,.64,1);
}
.feedback-overlay.fb-hiding .feedback-modal { animation: fbModalOut .2s ease forwards; }
@keyframes fbModalIn  { from { transform: scale(.82) translateY(20px); opacity:0; } to { transform: none; opacity:1; } }
@keyframes fbModalOut { from { transform: none; opacity:1; } to { transform: scale(.88); opacity:0; } }

.feedback-modal::before {
  content: ''; display: block; height: 5px;
  background: linear-gradient(90deg, #FF6B6B, #FFD93D, #06D6A0, #4ECDC4, #9B5DE5, #FF6B6B);
  background-size: 200%;
  animation: rainbowShift 3s linear infinite;
}
.feedback-close {
  position: absolute; top: .85rem; right: .85rem;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gray-100); border: none;
  font-size: .78rem; font-weight: 800; color: var(--gray-600);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s; z-index: 2;
}
.feedback-close:hover { background: var(--gray-200); }

.feedback-header {
  text-align: center; padding: 1.6rem 1.5rem .7rem;
}
.feedback-header-emoji { font-size: 2.4rem; margin-bottom: .45rem; }
.feedback-header h2 {
  font-size: 1.18rem; font-weight: 900; color: var(--navy); margin-bottom: .2rem;
}
.feedback-header p { font-size: .72rem; color: var(--gray-400); }

.feedback-cats {
  display: flex; gap: .4rem; padding: .55rem 1.2rem;
  justify-content: center; flex-wrap: nowrap;
}
.cat-btn {
  display: flex; flex-direction: column; align-items: center; gap: .12rem;
  padding: .4rem .3rem; border-radius: 12px;
  border: 2px solid var(--gray-200);
  background: white; cursor: pointer;
  font-weight: 700; color: var(--gray-500);
  transition: border-color .15s, background .15s, transform .15s;
  flex: 1; min-width: 0; overflow: hidden;
}
.cat-btn span { font-size: .58rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cat-btn > :first-child { font-size: 1.25rem; }
.cat-btn:hover  { border-color: #9B5DE5; background: #F5F0FF; transform: scale(1.05); }
.cat-btn.active { border-color: #9B5DE5; background: linear-gradient(135deg,#F5F0FF,#EDF9F8); color: #9B5DE5; box-shadow: 0 3px 10px rgba(155,93,229,.2); }
.cat-btn[data-cat="great"].active    { border-color: #06D6A0; background: #EDFFF9; color: #048A67; box-shadow: 0 3px 10px rgba(6,214,160,.2); }
.cat-btn[data-cat="confusing"].active{ border-color: #FFD93D; background: #FFFBEA; color: #9A7200; box-shadow: 0 3px 10px rgba(255,217,61,.2); }
.cat-btn[data-cat="question"].active { border-color: #4ECDC4; background: #EDFFFE; color: #2A8A85; box-shadow: 0 3px 10px rgba(78,205,196,.2); }
.cat-btn[data-cat="suggestion"].active{ border-color: #FF6B6B; background: #FFF3F3; color: #CC3D3D; box-shadow: 0 3px 10px rgba(255,107,107,.2); }

.feedback-textarea {
  display: block; width: calc(100% - 2.4rem);
  margin: .5rem 1.2rem; padding: .65rem .85rem;
  border: 2px solid var(--gray-200); border-radius: 12px;
  font-family: inherit; font-size: .78rem; color: var(--gray-800);
  resize: none; outline: none;
  transition: border-color .18s, box-shadow .18s;
  box-sizing: border-box;
}
.feedback-textarea:focus { border-color: #9B5DE5; box-shadow: 0 0 0 3px rgba(155,93,229,.12); }

.feedback-submit {
  display: block; width: calc(100% - 2.4rem);
  margin: .5rem 1.2rem 1.4rem;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
  color: white; border: none; border-radius: 25px;
  padding: .72rem 1rem; font-size: .88rem; font-weight: 800;
  cursor: pointer; transition: all .2s;
  box-shadow: 0 5px 16px rgba(255,107,107,.4);
}
.feedback-submit:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(255,107,107,.5); }
.feedback-submit:active { transform: scale(.97); }

.feedback-thanks {
  padding: 1.4rem; text-align: center; flex-direction: column;
  align-items: center; gap: .5rem;
  position: absolute; inset: 5px 0 0; background: white; z-index: 3;
  border-radius: 0 0 18px 18px;
  animation: thanksIn .3s cubic-bezier(.34,1.4,.64,1);
}
@keyframes thanksIn { from { opacity:0; transform: scale(.9); } to { opacity:1; transform: scale(1); } }
.thanks-emoji { font-size: 3rem; animation: badgeBounce 1s ease-in-out 2; }
.thanks-msg   { font-size: 1.1rem; font-weight: 800; color: var(--navy); }

/* ==========================================
   FEEDBACK VIEWER PANEL
   ========================================== */
.feedback-panel {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 360px; max-width: 95vw;
  background: #0d1117; color: #e6edf3;
  display: flex; flex-direction: column;
  z-index: 4200;
  box-shadow: -6px 0 32px rgba(0,0,0,.55);
  transition: transform .25s cubic-bezier(.34,1.2,.64,1);
}
.feedback-panel.diag-hidden { transform: translateX(100%); }

.fb-panel-header {
  background: #161b22; border-bottom: 1px solid #30363d;
  padding: .85rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  flex-shrink: 0;
}
.fb-panel-title { font-size: .95rem; font-weight: 800; color: #FF6B6B; flex: 1; min-width: 120px; }
.fb-panel-meta  { font-size: .72rem; color: #8b949e; }
.fb-panel-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.fb-hint {
  font-size: .68rem; color: #484f58; background: #161b22;
  border-bottom: 1px solid #21262d; padding: .35rem 1rem;
  flex-shrink: 0;
}

.fb-feed { flex: 1; overflow-y: auto; padding: .75rem; display: flex; flex-direction: column; gap: .6rem; }

.fb-card {
  border-radius: 10px; padding: .7rem .9rem;
  background: #161b22; border: 1px solid #21262d;
  border-left: 4px solid #30363d;
  animation: fbCardIn .25s ease;
}
@keyframes fbCardIn { from { opacity:0; transform: translateY(-8px); } to { opacity:1; transform: none; } }
.fb-cat-great      { border-left-color: #06D6A0; }
.fb-cat-confusing  { border-left-color: #FFD93D; }
.fb-cat-question   { border-left-color: #4ECDC4; }
.fb-cat-suggestion { border-left-color: #FF6B6B; }

.fb-card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .4rem; gap: .5rem; flex-wrap: wrap;
}
.fb-cat-badge  { display: flex; align-items: center; gap: .3rem; }
.fb-cat-emoji  { font-size: 1.35rem; line-height: 1; }
.fb-cat-label  { font-size: .68rem; font-weight: 700; color: #e6edf3; }
.fb-ts         { font-size: .62rem; color: #8b949e; }
.fb-text       { font-size: .73rem; color: #c9d1d9; line-height: 1.5; word-break: break-word; }
.fb-no-text   { color: #484f58; }
.fb-empty     { text-align: center; color: #484f58; font-size: .85rem; padding: 2rem 1rem; }

/* ==========================================
   CUSTOM CONFIRM DIALOG
   ========================================== */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,16,60,.7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 6000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: confirmIn .2s ease;
}
@keyframes confirmIn  { from { opacity:0; } to { opacity:1; } }

.confirm-modal {
  background: white; border-radius: 20px;
  width: 100%; max-width: 320px;
  padding: 1.8rem 1.5rem 1.4rem;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
  animation: confirmPop .28s cubic-bezier(.34,1.5,.64,1);
}
@keyframes confirmPop { from { opacity:0; transform: scale(.8) translateY(16px); } to { opacity:1; transform: none; } }

.confirm-icon  { font-size: 2.6rem; margin-bottom: .6rem; animation: badgeBounce 1s ease-in-out 2; }
.confirm-title { font-size: 1.1rem; font-weight: 900; color: var(--navy); margin-bottom: .35rem; }
.confirm-msg   { font-size: .82rem; color: var(--gray-500); line-height: 1.5; margin-bottom: 1.2rem; }

.confirm-btns { display: flex; gap: .6rem; }
.confirm-cancel {
  flex: 1; padding: .65rem; border-radius: 25px;
  background: var(--gray-100); border: none;
  font-size: .88rem; font-weight: 700; color: var(--gray-600);
  cursor: pointer; transition: background .15s;
}
.confirm-cancel:hover { background: var(--gray-200); }
.confirm-ok {
  flex: 1; padding: .65rem; border-radius: 25px;
  background: linear-gradient(135deg, #FF6B6B, #e53d3d);
  border: none; color: white;
  font-size: .88rem; font-weight: 800;
  cursor: pointer; transition: all .18s;
  box-shadow: 0 4px 12px rgba(229,61,61,.35);
}
.confirm-ok:hover { transform: translateY(-2px); box-shadow: 0 7px 18px rgba(229,61,61,.45); }
.confirm-ok:active { transform: scale(.97); }

/* ==========================================
   LANG TOGGLE BUTTON
   ========================================== */
.lang-toggle {
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.35);
  color: white; border-radius: 20px;
  padding: .3rem .7rem; font-size: .78rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: .3rem;
  transition: background .18s, border-color .18s, transform .15s;
  white-space: nowrap; position: relative; overflow: hidden;
}
.lang-toggle:hover  { background: rgba(255,255,255,.28); border-color: rgba(255,255,255,.7); transform: scale(1.05); }
.lang-toggle:active { transform: scale(.96); }
.lang-toggle.lang-flip { animation: langFlip .35s cubic-bezier(.34,1.4,.64,1); }
@keyframes langFlip { 0%{transform:rotateY(0)} 50%{transform:rotateY(90deg)} 100%{transform:rotateY(0)} }

/* ==========================================
   AVAILABILITY BANNER
   ========================================== */
.avail-banner {
  position: relative; overflow: hidden;
  padding: .65rem 1rem;
  text-align: center;
  transition: background .4s;
}
.avail-banner[data-status="open"] {
  background: linear-gradient(90deg, #0a7a3e, #13a857, #06D6A0, #13a857, #0a7a3e);
  background-size: 300% 100%;
  animation: availShift 4s linear infinite;
}
.avail-banner[data-status="full"] {
  background: linear-gradient(90deg, #b34000, #e65100, #FF6B35, #e65100, #b34000);
  background-size: 300% 100%;
  animation: availShift 4s linear infinite;
}
.avail-banner[data-status="limited"] {
  background: linear-gradient(90deg, #9a6400, #c08000, #d4920a, #c08000, #9a6400);
  background-size: 300% 100%;
  animation: availShift 4s linear infinite;
}
.avail-banner[data-status="closed"] {
  background: linear-gradient(90deg, #0d1117, #1c2333, #263445, #1c2333, #0d1117);
  background-size: 300% 100%;
  animation: availShift 3s linear infinite;
}
@keyframes availShift { to { background-position: 300% 0; } }

.avail-particles {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: space-around;
  font-size: .85rem; opacity: .5;
}
.avail-particles span { animation: floatStar 2.8s ease-in-out infinite; }
.avail-particles span:nth-child(1) { animation-delay: 0s; }
.avail-particles span:nth-child(2) { animation-delay: .4s; }
.avail-particles span:nth-child(3) { animation-delay: .8s; }
.avail-particles span:nth-child(4) { animation-delay: 1.2s; }
.avail-particles span:nth-child(5) { animation-delay: 1.6s; }
@keyframes floatStar { 0%,100%{transform:translateY(0) rotate(0deg)} 50%{transform:translateY(-5px) rotate(15deg)} }

.avail-inner {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: .6rem;
}
.avail-icon   { font-size: 1.1rem; animation: iconPulse 1.6s ease-in-out infinite; }
@keyframes iconPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.2)} }
.avail-copy   { display: flex; flex-direction: column; gap: .05rem; }
.avail-text   { color: white; font-size: .88rem; font-weight: 800; letter-spacing: .02em; }
.avail-sub    { color: rgba(255,255,255,.88); font-size: .72rem; }
.avail-banner[data-status="full"]    .avail-icon { animation: iconShake 1s ease-in-out infinite; }
.avail-banner[data-status="limited"] .avail-icon { animation: iconShake 2s ease-in-out infinite; }
.avail-banner[data-status="closed"]  .avail-icon { animation: none; opacity: .7; }
@keyframes iconShake { 0%,100%{transform:rotate(0)} 20%{transform:rotate(-8deg)} 40%{transform:rotate(8deg)} 60%{transform:rotate(-4deg)} 80%{transform:rotate(4deg)} }

/* ==========================================
   WHAT TO EXPECT — collapsible fun
   ========================================== */
.collapsible-fun > summary {
  background: linear-gradient(135deg, #9B5DE5, #4ECDC4) !important;
  color: white !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 800 !important;
}
.collapsible-fun > summary::marker,
.collapsible-fun > summary::-webkit-details-marker { color: white; }
.collapsible-fun[open] > summary { border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important; }

.expect-steps { padding: .75rem; display: flex; flex-direction: column; gap: .5rem; background: #FAFBFF; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

.expect-step {
  display: flex; align-items: center; gap: .85rem;
  padding: .65rem .9rem;
  background: white;
  border-left: 4px solid var(--step-color);
  border-radius: 0 10px 10px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  animation: expectIn .3s ease both;
  transition: transform .15s, box-shadow .15s;
}
.expect-step:hover { transform: translateX(4px); box-shadow: 0 4px 14px rgba(0,0,0,.1); }
@keyframes expectIn { from { opacity:0; transform: translateX(-16px); } to { opacity:1; transform: translateX(0); } }

.expect-icon  { font-size: 1.6rem; width: 36px; text-align: center; flex-shrink: 0; }
.expect-body  { display: flex; flex-direction: column; gap: .1rem; }
.expect-label { font-size: .88rem; font-weight: 800; color: var(--step-color); }
.expect-desc  { font-size: .78rem; color: var(--gray-600); line-height: 1.45; }

/* ==========================================
   RESPONSIVE
   ========================================== */
/* ==========================================
   SECURITY ADMIN PANEL
   ========================================== */
.admin-panel {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: 620px; max-width: 96vw;
  background: #0d1117; color: #c9d1d9;
  font-family: 'Cascadia Code','Fira Code','Consolas',monospace;
  font-size: .8rem; z-index: 9998;
  display: flex; flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,.55); overflow: hidden;
  transition: transform .25s cubic-bezier(.34,1.2,.64,1);
}
.admin-panel.diag-hidden { transform: translateX(-100%); }

.admin-header {
  background: #161b22; border-bottom: 1px solid #30363d;
  padding: .75rem 1rem; flex-shrink: 0;
}
.admin-title-row {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: .45rem;
}
.admin-title { font-size: .95rem; font-weight: 700; color: #3fb950; }
.admin-hint  { font-size: .7rem; color: #484f58; }
.admin-controls { margin-bottom: .45rem; }
.admin-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.admin-tab-btn {
  background: #21262d; color: #8b949e;
  border: 1px solid #30363d; border-radius: 4px;
  padding: .3rem .65rem; font-size: .75rem;
  font-family: inherit; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.admin-tab-btn:hover  { background: #30363d; color: #c9d1d9; }
.admin-tab-btn.active { background: #1a4731; color: #3fb950; border-color: #3fb950; }

.admin-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.admin-tab-panel { display: none; flex: 1; overflow-y: auto; flex-direction: column; }
.admin-tab-panel.active { display: flex; }

.audit-controls {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .6rem .75rem; border-bottom: 1px solid #21262d; flex-shrink: 0;
}
.audit-feed { flex: 1; overflow-y: auto; padding: .65rem .75rem; }

/* ==========================================
   OFFLINE BANNER
   ========================================== */
#offline-banner {
  background: #1a1a2e;
  border-bottom: 2px solid #FFD93D;
  color: #FFD93D;
  text-align: center;
  padding: .55rem 1rem;
  font-size: .83rem;
  font-weight: 600;
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

/* ==========================================
   DATE CALCULATOR
   ========================================== */
.calc-wrap { display: flex; flex-direction: column; gap: .6rem; }
.calc-label { font-size: .88rem; font-weight: 600; color: var(--gray-800); }
.calc-input {
  padding: .55rem .75rem;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-800);
  font-size: .9rem;
  width: 100%; max-width: 260px;
  transition: border-color .18s;
}
.calc-input:focus { outline: none; border-color: var(--navy); }
.calc-result {
  padding: .7rem .9rem;
  border-radius: 10px;
  font-size: .87rem;
  line-height: 1.5;
  display: none;
}
.calc-result.visible { display: block; }
.calc-go-state    { background: #E8F5E9; border: 1.5px solid #4CAF50; color: #1B5E20; }
.calc-wait-state  { background: #FFF8E1; border: 1.5px solid #FFC107; color: #7B5800; }
.calc-over-state  { background: #FFEBEE; border: 1.5px solid #E53935; color: #B71C1C; }
.calc-note { font-size: .76rem; color: var(--gray-400); margin-top: .4rem; line-height: 1.45; }

/* ==========================================
   AGE ROUTER
   ========================================== */
.age-router-grid { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .75rem; }
.age-btn {
  padding: .45rem .85rem;
  background: #EEF2FF;
  border: 1.5px solid #C7D2FE;
  border-radius: 22px;
  color: #1e3a8a;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.age-btn:hover, .age-btn.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.age-router-result {
  padding: .75rem 1rem;
  border-radius: 10px;
  background: #F5F7FF;
  border: 1.5px solid #C7D2FE;
  color: var(--gray-800);
  font-size: .87rem;
  line-height: 1.55;
  display: none;
}
.age-router-result.visible { display: block; }

/* ==========================================
   DIRECTIONS BUTTON
   ========================================== */
.btn-directions {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-top: .5rem;
  padding: .38rem .75rem;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  color: var(--gray-600);
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.btn-directions:hover { background: var(--navy); border-color: var(--navy); color: #fff; text-decoration: none; }

.card-portal { border-left: 4px solid var(--navy); }
.btn-portal {
  display: inline-flex;
  align-items: center;
  margin-top: .6rem;
  padding: .45rem .9rem;
  background: var(--navy);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s, transform .1s;
}
.btn-portal:hover { background: var(--navy-dark); color: #fff; text-decoration: none; transform: translateY(-1px); }

/* ==========================================
   LANGUAGE DUAL-CONTENT BLOCKS
   ========================================== */
.lang-es { display: none; }
body.lang-es-active .lang-en { display: none; }
body.lang-es-active .lang-es { display: block; }

/* ==========================================
   AVAILABILITY TAB PANEL
   ========================================== */
.avail-status-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 2px solid;
  margin-bottom: 1.1rem;
}
.avail-status-icon { font-size: 2rem; line-height: 1; }
.avail-status-label { font-size: 1.15rem; font-weight: 800; }
.avail-status-sub   { font-size: .8rem; color: var(--gray-600); margin-top: .15rem; }
.avail-months-list { display: flex; flex-direction: column; border: 1.5px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.avail-month-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: .88rem;
}
.avail-month-row:last-child { border-bottom: none; }
.avail-month-current { background: #F5F7FF; }
.avail-month-name { color: var(--gray-800); flex: 1; font-weight: 500; }
.avail-month-name em { font-size: .73rem; color: var(--gray-400); font-style: normal; font-weight: 400; }
.avail-month-chip {
  font-size: .75rem;
  font-weight: 700;
  padding: .22rem .6rem;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==========================================
   AVAILABILITY ADMIN TAB
   ========================================== */
.avail-admin-wrap { display: flex; flex-direction: column; gap: .85rem; padding: .75rem; }
.avail-admin-rows { display: flex; flex-direction: column; gap: .4rem; }
.avail-admin-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .55rem;
  background: rgba(255,255,255,.04);
  border-radius: 6px;
  border: 1px solid #21262d;
}
.avail-admin-month { font-size: .8rem; color: #c9d1d9; min-width: 130px; flex-shrink: 0; }
.avail-admin-btns { display: flex; gap: .35rem; flex-wrap: wrap; }
.avail-status-btn {
  padding: .28rem .6rem;
  font-size: .73rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #30363d;
  background: transparent;
  color: #8b949e;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.avail-status-btn:hover { border-color: #58a6ff; color: #58a6ff; }
.avail-status-btn.active { font-weight: 800; }
.avail-admin-actions { display: flex; gap: .5rem; padding-top: .5rem; border-top: 1px solid #21262d; flex-wrap: wrap; }

/* Firebase sync UI */
.fb-sync-box {
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: .75rem .85rem;
  background: rgba(255,255,255,.04);
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.fb-sync-box.fb-connected { border-color: #238636; background: rgba(35,134,54,.08); }
.fb-sync-status { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: #c9d1d9; }
.fb-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #8b949e;
  flex-shrink: 0;
}
.fb-dot.fb-dot-on { background: #3fb950; box-shadow: 0 0 6px #3fb950; }
.fb-sync-note { font-size: .76rem; color: #8b949e; margin: 0; line-height: 1.5; }
.fb-url-label { font-size: .74rem; color: #8b949e; }
.fb-url-input {
  width: 100%;
  padding: .45rem .6rem;
  font-size: .78rem;
  background: #0d1117;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 6px;
  box-sizing: border-box;
  outline: none;
}
.fb-url-input:focus { border-color: #58a6ff; }
.fb-connect-row { display: flex; align-items: center; gap: .75rem; }
.fb-help-link { font-size: .73rem; color: #58a6ff; text-decoration: none; }
.fb-help-link:hover { text-decoration: underline; }
.fb-url-display { font-size: .72rem; color: #8b949e; word-break: break-all; }
.fb-help-panel {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 6px;
  padding: .7rem .85rem;
  font-size: .75rem;
  color: #c9d1d9;
  line-height: 1.6;
}
.fb-help-steps ol { margin: .4rem 0 .4rem 1.1rem; padding: 0; }
.fb-help-steps li { margin-bottom: .3rem; }
.fb-help-steps code { background: #161b22; padding: .1rem .3rem; border-radius: 4px; color: #79c0ff; font-size: .72rem; }
.fb-help-note { color: #8b949e; margin: .5rem 0 0; }
.fb-publish-btn { background: #238636 !important; border-color: #2ea043 !important; color: #fff !important; font-weight: 700 !important; }
.fb-publish-btn:hover { background: #2ea043 !important; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 600px) {
  .header-tag  { display: none; }
  .badge-title { font-size: .9rem; }
  .resource-cards.two-col,
  .resource-cards.three-col { grid-template-columns: 1fr; }
  #diagnostic-panel { width: 100vw; }
  .admin-panel { width: 100vw; }
  .tab-btn    { padding: .68rem .7rem; font-size: .82rem; }
  .tab-lbl    { display: none; }
  .qs-lbl     { display: none; }
  .qs-btn     { padding: .38rem .55rem; }
  .qs-icon    { font-size: 1.2rem; }
  .lang-toggle span { display: none; }
  .lang-toggle { padding: .3rem .45rem; }
}
