* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 .4em;
}
a { color: var(--gold-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 .8em; }
.icon { width: 20px; height: 20px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.icon-lg { width: 32px; height: 32px; }
.icon-sm { width: 15px; height: 15px; }

/* ---- App shell ---- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--beige-dark);
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-brand {
  font-family: var(--font-heading);
  font-size: 23px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-brand .amp { color: var(--gold); }
.brand-logo-img { height: 72px; max-width: 320px; object-fit: contain; display: block; }
.topbar-links { display: flex; align-items: center; gap: 24px; }
.topbar-links a { color: var(--ink-soft); font-size: 15px; }
.topbar-links a:hover { color: var(--gold-deep); }

@media (max-width: 780px) {
  .topbar { padding: 12px 16px; }
  .brand-logo-img { height: 40px; }
  .topbar-brand { font-size: 17px; }
  .topbar-links { gap: 14px; }
  .topbar-links a { font-size: 13px; }
  .wedding-header-inner { padding: 14px 16px 0; }
  .wedding-header-inner h1 { font-size: 20px; margin-bottom: 12px; }
}

.page { max-width: 1760px; margin: 0 auto; padding: 40px 40px 90px; }
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 36px; }
.page-subtitle { color: var(--ink-soft); font-size: 15px; margin-top: 4px; }

@media (max-width: 780px) {
  .page { padding: 20px 16px 24px; }
  .page-header { align-items: flex-start; }
  .page-header h1 { font-size: 24px; }
  .page-header > .btn, .page-header > button { width: 100%; justify-content: center; }
  .page-header > .utility-row { width: 100%; flex-wrap: wrap; }
  .page-header > .utility-row > .btn { flex: 1; justify-content: center; white-space: nowrap; }
}

/* ---- Wedding nav tabs ---- */
.wedding-header {
  background: var(--surface);
  border-bottom: 1px solid var(--beige-dark);
}
.wedding-header-inner {
  max-width: 1760px;
  margin: 0 auto;
  padding: 22px 40px 0;
}
.wedding-header-inner h1 { font-size: 28px; margin-bottom: 16px; }
.wedding-tabs { display: flex; gap: 6px; }
.wedding-tabs a {
  padding: 12px 18px;
  font-size: 15px;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wedding-tabs a:hover { color: var(--gold-deep); text-decoration: none; }
.wedding-tabs a.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
  font-weight: 600;
}
.wedding-tabs a .icon { width: 18px; height: 18px; }
.wedding-tabs a span.tab-label { }

/* ---- Mobile bottom tab bar (replaces .wedding-tabs on narrow viewports) ---- */
.bottom-tab-bar { display: none; }

@media (max-width: 780px) {
  body { padding-bottom: 64px; }

  .wedding-header-inner .wedding-tabs { display: none; }

  .bottom-tab-bar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 90;
    background: var(--surface);
    border-top: 1px solid var(--beige-dark);
    box-shadow: 0 -2px 10px rgba(58, 52, 43, .06);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-tab-bar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px 7px;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--ink-soft);
    min-height: 52px;
  }
  .bottom-tab-bar a:hover { text-decoration: none; }
  .bottom-tab-bar a .icon { width: 21px; height: 21px; }
  .bottom-tab-bar a.active { color: var(--gold-deep); }
  .bottom-tab-bar a.active .icon { color: var(--gold-deep); }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--beige-dark);
  background: var(--surface);
  color: var(--ink);
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--gold); text-decoration: none; }
.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}
.btn-primary:hover { background: var(--gold-deep); border-color: var(--gold-deep); }
.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--surface);
}
.btn-gold:hover { background: var(--gold-deep); border-color: var(--gold-deep); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--beige); border-color: transparent; }
.btn-danger-ghost { border-color: transparent; background: transparent; color: var(--danger-text); }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-sm { padding: 7px 13px; font-size: 14px; }
.btn-icon { padding: 8px; border-radius: 50%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Forms ---- */
label { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=tel], input[type=email], input[type=number],
input[type=date], input[type=time], input[type=password], textarea, select {
  width: 100%;
  border: 1px solid var(--beige-dark);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-bg);
}
textarea { resize: vertical; min-height: 60px; }
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* ---- Cards / lists ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--beige-dark);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 20px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-soft);
  border: 1px dashed var(--beige-dark);
  border-radius: var(--radius-lg);
  background: var(--surface);
  font-size: 16px;
}
.empty-state .icon-lg { color: var(--gold); margin-bottom: 10px; }

/* ---- Badges / chips ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-gold { background: var(--gold-bg); color: var(--gold-deep); }
.badge-neutral { background: var(--beige); color: var(--ink-soft); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--beige);
  color: var(--ink);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.note-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--danger-bg);
  border: 1px solid rgba(181, 100, 90, .3);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.note-box-icon { color: var(--danger-text); flex-shrink: 0; margin-top: 1px; }
.note-box-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--danger-text);
  margin-bottom: 3px;
}
.note-box-text { font-size: 15px; color: var(--ink); margin: 0; }

.whatsapp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #3f7f56;
  font-weight: 500;
  font-size: 14px;
}
.whatsapp-link .icon { color: #3f7f56; width: 16px; height: 16px; }
.whatsapp-link:hover { text-decoration: underline; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(58, 52, 43, .35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 34px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-wide { max-width: 780px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { margin: 0; font-size: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 780px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal, .modal-wide {
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1; justify-content: center; }
  .modal-header { flex-wrap: wrap; gap: 10px; }
  .modal-header > .utility-row { flex-shrink: 0; }
}

/* ---- Category picker ---- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}
.category-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid var(--beige-dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  text-align: center;
}
.category-option .icon { color: var(--gold-deep); }
.category-option span { font-size: 11px; color: var(--ink-soft); line-height: 1.2; }
.category-option:hover { border-color: var(--gold); }
.category-option.selected { border-color: var(--gold); background: var(--gold-bg); }

.utility-row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.text-soft { color: var(--ink-soft); font-size: 13px; }
.hidden { display: none !important; }

@media (max-width: 780px) {
  /* iOS Safari auto-zooms on focus if a form field's computed font-size is under 16px */
  input[type=text], input[type=tel], input[type=email], input[type=number],
  input[type=date], input[type=time], input[type=password], textarea, select {
    font-size: 16px;
  }
  .btn { min-height: 44px; }
  .btn-icon { min-height: 40px; min-width: 40px; }
  .field-row { flex-direction: column; gap: 0; }
}

.print-only { display: none; }

@media print {
  .topbar, .wedding-header, .bottom-tab-bar, .no-print { display: none !important; }
  .print-only { display: block !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
}

.login-wrap {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--beige-dark);
  border-radius: var(--radius-lg);
  padding: 32px 56px 56px;
  width: 100%;
  max-width: 480px;
  text-align: center;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 1;
}
.login-bg-img {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  max-width: 100vw;
  display: block;
  object-fit: contain;
  z-index: 0;
  pointer-events: none;
}
.login-logo { max-width: 100%; width: 280px; margin: 0 auto 24px; display: block; }
.login-card h1 { font-size: 38px; margin-bottom: 6px; }
.login-card .subtitle { font-size: 16px; margin-bottom: 36px; }
.login-card label { text-align: left; font-size: 15px; }
.login-card input { font-size: 17px; padding: 14px 16px; }
.login-card .btn { font-size: 16px; padding: 14px 20px; }
.login-card .error { color: var(--danger-text); font-size: 14px; margin-top: 14px; }
.login-tabs { display: flex; gap: 8px; margin-bottom: 28px; background: var(--beige); border-radius: var(--radius-sm); padding: 4px; }
.login-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--font-body);
}
.login-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

@media (max-width: 480px) {
  .login-wrap { padding: 24px 14px; }
  .login-card { padding: 26px 22px 40px; }
  .login-logo { width: 210px; margin-bottom: 16px; }
  .login-tabs button { font-size: 12.5px; padding: 10px 4px; white-space: nowrap; }
  .login-card input { font-size: 16px; padding: 13px 14px; }
}
@media (max-height: 700px) {
  .login-bg-img { opacity: .5; max-height: 40vh; object-fit: cover; }
}
