
.app-header {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  display: flex; align-items: center; gap: 1.6rem;
  padding: 0 clamp(1rem, 4vw, 2.2rem);
  background: var(--bg); border-bottom: 1px solid var(--border);
  transition: background .35s var(--ease);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--primary); }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font: 700 1.15rem var(--font-display); color: var(--text); letter-spacing: -.01em; }
.brand-name em { font-style: normal; color: var(--primary); }

.app-nav { display: none; gap: 1.4rem; margin-left: .5rem; }
body.authed .app-nav { display: flex; }
.nav-link {
  position: relative; padding: .45rem .1rem;
  color: var(--text-muted); font-weight: 600; font-size: .92rem;
  transition: color .2s;
}
.nav-link::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--primary); transform: scaleX(0); transform-origin: left;
  transition: transform .25s var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  transition: transform .25s var(--ease), border-color .2s, background .2s;
}
.icon-btn:hover { transform: rotate(14deg) scale(1.06); border-color: var(--primary); }
.theme-toggle svg { position: absolute; transition: transform .45s var(--ease), opacity .3s; }
.ic-sun { opacity: 0; transform: rotate(-90deg) scale(.4); }
[data-theme="light"] .ic-sun { opacity: 1; transform: none; }
[data-theme="light"] .ic-moon { opacity: 0; transform: rotate(90deg) scale(.4); }

.user-chip {
  display: flex; align-items: center; gap: .55rem;
  padding: .28rem .8rem .28rem .32rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink);
  font: 700 .78rem var(--font-display);
}
.user-name { font-size: .86rem; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.3rem; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; line-height: 1;
  position: relative; overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s, background .18s, border-color .18s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-sm { padding: .5rem .95rem; font-size: .84rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none !important; }

.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow-sm); }
.btn-primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .38) 50%, transparent 60%);
  transform: translateX(-130%); transition: transform .55s var(--ease);
}
.btn-primary:hover { background: var(--primary-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-primary:hover::after { transform: translateX(130%); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-3); transform: translateY(-1px); }

.btn.loading { pointer-events: none; color: transparent !important; }
.btn.loading::before {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(0, 0, 0, .25); border-top-color: var(--primary-ink);
  animation: spin .7s linear infinite;
}
.btn-ghost.loading::before { border-color: var(--border-strong); border-top-color: var(--text); }

.link-btn {
  color: var(--text-muted); font-weight: 600; font-size: .88rem;
  border-bottom: 1px dashed var(--border-strong); padding-bottom: 1px;
  transition: color .2s, border-color .2s;
}
.link-btn:hover { color: var(--primary); border-color: var(--primary); }


.field { margin-bottom: 1.2rem; min-width: 0; }
.field-label {
  display: flex; align-items: baseline; gap: .5rem;
  font-weight: 600; font-size: .92rem; margin-bottom: .45rem;
}
.field-label .req { color: var(--primary); font-weight: 800; }
.field-label .opt {
  font: 400 .66rem var(--font-mono); color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .1em;
}
.input, .select select, .textarea {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: .68rem .85rem; font-size: .95rem;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .select select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select select:focus, .textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--focus-ring);
}
.select { position: relative; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 2.4rem; cursor: pointer; }
.select select:disabled { opacity: .55; cursor: not-allowed; }
.select::after {
  content: ""; position: absolute; right: 15px; top: 50%;
  width: 8px; height: 8px; pointer-events: none;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg); transition: transform .25s var(--ease);
}
.select:focus-within::after { transform: translateY(-30%) rotate(225deg); }
.select-sm select { padding: .5rem 2.2rem .5rem .8rem; font-size: .86rem; }

.input-affix { position: relative; }
.input-affix .affix {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); font-family: var(--font-mono); font-size: .9rem; pointer-events: none;
}
.input-affix .input { padding-left: 2.1rem; }
.textarea { resize: vertical; min-height: 110px; line-height: 1.55; }

.field-hint { margin-top: .4rem; font-size: .78rem; color: var(--text-faint); }
.field-error {
  margin-top: .4rem; font-size: .8rem; font-weight: 600; color: var(--danger);
  animation: errIn .25s var(--ease);
}
@keyframes errIn { from { opacity: 0; transform: translateY(-3px); } }
.field.invalid .input, .field.invalid .select select, .field.invalid .textarea,
.field.invalid .file-upload-zone, .field.invalid .map-picker-container {
  border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft);
}
.shake { animation: shake .4s; }


.option-grid { display: flex; flex-wrap: wrap; gap: .55rem; }
.option-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem 1rem; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text-muted); font-weight: 600; font-size: .87rem;
  transition: all .18s var(--ease);
}
.option-chip:hover { transform: translateY(-2px); border-color: var(--primary); color: var(--text); }
.option-chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }
.option-chip[aria-pressed="true"]::before { content: "✓"; color: var(--primary); font-weight: 800; }


.range-row { display: flex; align-items: flex-end; gap: .7rem; }
.range-cell { flex: 1; display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.range-cell > label {
  font: 400 .64rem var(--font-mono); text-transform: uppercase;
  letter-spacing: .12em; color: var(--text-faint);
}
.range-sep { padding-bottom: .75rem; color: var(--text-faint); font-family: var(--font-mono); }


.file-upload-zone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-md);
  background: var(--surface-2); padding: 1.5rem 1rem; text-align: center; cursor: pointer;
  transition: all .2s var(--ease);
}
.file-upload-zone:hover, .file-upload-zone.dragover {
  border-color: var(--primary); background: var(--primary-soft); transform: translateY(-2px);
}
.fz-ic { font-size: 1.7rem; margin-bottom: .35rem; }
.file-upload-zone strong { display: block; font-size: .95rem; }
.fz-sub { display: block; margin-top: .3rem; font-size: .68rem; color: var(--text-faint); letter-spacing: .05em; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: .6rem; margin-top: .75rem; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); animation: popIn .3s var(--ease);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-remove {
  position: absolute; top: 5px; right: 5px; width: 24px; height: 24px;
  border-radius: 50%; background: rgba(8, 12, 18, .78); color: #fff;
  display: grid; place-items: center; font-size: .72rem;
  opacity: 0; transition: opacity .15s, transform .15s, background .15s;
}
.thumb:hover .thumb-remove, .thumb:focus-within .thumb-remove { opacity: 1; }
.thumb-remove:hover { transform: scale(1.15); background: var(--danger); }
.existing-tag {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 0; text-align: center;
  background: rgba(8, 12, 18, .72); color: var(--accent);
  font: 700 .56rem var(--font-mono); letter-spacing: .1em;
}
.photo-count { margin-top: .55rem; font-size: .7rem; color: var(--text-faint); letter-spacing: .08em; }


.toast-root {
  position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 1000;
  display: flex; flex-direction: column; gap: .6rem; max-width: min(370px, 90vw);
}
.toast {
  display: flex; gap: .65rem; align-items: flex-start;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--primary);
  padding: .8rem 1rem; border-radius: 10px; box-shadow: var(--shadow-md);
  font-size: .9rem; transform: translateX(120%); opacity: 0;
  transition: transform .4s var(--ease), opacity .3s;
}
.toast.show { transform: none; opacity: 1; }
.toast.success { border-left-color: var(--accent); }
.toast.danger { border-left-color: var(--danger); }
.t-ic { flex: none; font-weight: 800; color: var(--primary); }
.toast.success .t-ic { color: var(--accent); }
.toast.danger .t-ic { color: var(--danger); }


.modal-backdrop {
  position: fixed; inset: 0; z-index: 900; padding: 1rem;
  background: rgba(4, 8, 13, .68); display: grid; place-items: center;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: min(640px, 100%); max-height: 88vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lift);
  animation: modalIn .3s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.modal-close {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px;
  border-radius: 50%; background: rgba(8, 12, 18, .75); color: #fff;
  display: grid; place-items: center; font-size: .9rem; z-index: 2;
  transition: transform .15s, background .15s;
}
.modal-close:hover { transform: rotate(90deg); background: var(--danger); }


.badge {
  display: inline-flex; align-items: center; padding: .3rem .7rem;
  border-radius: var(--r-pill); font: 700 .66rem var(--font-mono);
  letter-spacing: .08em; text-transform: uppercase;
}
.badge.amber { background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary); }
.badge.teal { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }

.spinner {
  display: inline-block; width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--border-strong); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2.5px; }
.boot-loader, .profile-loading {
  min-height: 55vh; display: grid; place-content: center; justify-items: center;
  gap: 1rem; color: var(--text-muted); font-size: .8rem; letter-spacing: .1em;
}
.skeleton {
  position: relative; overflow: hidden;
  background: var(--surface-2) !important; color: transparent !important;
  border-color: var(--border) !important;
}
.skeleton * { visibility: hidden; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .055), transparent);
  animation: shimmer 1.4s infinite;
}
.form-alert {
  background: var(--danger-soft); border: 1px solid var(--danger); color: var(--danger);
  border-radius: 10px; padding: .7rem .95rem; font-size: .86rem; font-weight: 600;
  margin-bottom: 1.1rem; animation: errIn .25s var(--ease);
}

@media (max-width: 640px) {
  .user-name { display: none; }
  .brand-name { font-size: 1rem; }
}


.app-footer {
  margin-top: 4rem;
  padding: 2.5rem 1rem;
  text-align: center;
  border-top: 1px solid var(--border, #23303d);
  background: var(--surface-2, #16202b);
}
.footer-tagline {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text, #e8edf2);
  margin-bottom: 0.8rem;
  font-style: italic;
  letter-spacing: 0.02em;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.footer-links a {
  color: var(--text-muted, #8a98a8);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.footer-links a:hover {
  color: var(--primary, #f5b547);
  text-decoration: underline;
}
.footer-links .divider {
  color: var(--border-strong, #3a4654);
}
.footer-copy {
  font-size: 0.75rem;
  color: var(--text-faint, #5b6675);
}


@media (max-width: 768px) {
  .app-footer {
    margin-bottom: 70px; 
  }
}

/* ══════════ FOOTER ══════════ */
.app-footer {
  margin-top: 4rem;
  padding: 2.5rem 1rem;
  text-align: center;
  border-top: 1px solid var(--border, #23303d);
  background: var(--surface-2, #16202b);
}
.footer-tagline {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text, #e8edf2);
  margin-bottom: 1rem;
  font-style: italic;
  letter-spacing: 0.02em;
}

/* Social Icons */
.footer-social {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-3, #1e2a38);
  color: var(--text-muted, #8a98a8);
  transition: all 0.2s ease;
  border: 1px solid var(--border, #23303d);
}
.social-link:hover {
  color: var(--primary, #f5b547);
  background: rgba(245, 181, 71, 0.1);
  border-color: var(--primary, #f5b547);
  transform: translateY(-2px);
}
.social-link svg {
  width: 20px;
  height: 20px;
}

/* Links */
.footer-links {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}
.footer-links a {
  color: var(--text-muted, #8a98a8);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.footer-links a:hover {
  color: var(--primary, #f5b547);
  text-decoration: underline;
}
.footer-links .divider {
  color: var(--border-strong, #3a4654);
}
.footer-copy {
  font-size: 0.75rem;
  color: var(--text-faint, #5b6675);
}

/* Mobile */
@media (max-width: 768px) {
  .app-footer {
    margin-bottom: 70px;
  }
  .footer-social {
    gap: 0.8rem;
  }
  .social-link {
    width: 36px;
    height: 36px;
  }
}