/* ── portal-specific styles ─────────────────────────────────────────── */
.hidden { display: none !important; }
.portal-body { min-height: 100vh; }
.btn-sm { padding: 9px 20px; font-size: 12.5px; }

/* auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 30px 4%; }
.auth-card {
  width: min(430px, 100%); background: var(--cream); border-radius: 28px;
  box-shadow: var(--shadow-lift); border: 1px solid rgba(201,162,75,.2);
  padding: 40px 38px; text-align: center;
}
.auth-logo { width: 130px; margin: 0 auto 18px; border-radius: 50%; box-shadow: 0 8px 26px rgba(201,162,75,.35); }
.auth-card h1 { font-family: var(--font-display); font-size: 27px; margin-bottom: 6px; }
.auth-sub { color: var(--ink-soft); font-size: 14.5px; margin-bottom: 26px; }
.auth-card form { text-align: left; }
.auth-btn { width: 100%; margin-top: 6px; }
.turnstile-box { display: flex; justify-content: center; margin: 8px 0 4px; }
.turnstile-box:empty { margin: 0; }
.or-divider { align-items: center; gap: 12px; margin: 18px 0; color: var(--ink-soft); font-size: 13px; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: rgba(33,26,23,.12); }
.google-btn { justify-content: center; margin-bottom: 6px; }
.auth-toggle { margin-top: 22px; font-size: 14px; color: var(--ink-soft); }
.auth-toggle a { color: var(--gold-deep); font-weight: 600; margin-left: 6px; }
.auth-back { margin-top: 14px; font-size: 13px; }
.auth-back a:hover { color: var(--gold-deep); }
.auth-forgot { margin-top: 14px; font-size: 13.5px; text-align: center; }
.auth-forgot a { color: var(--gold-deep); font-weight: 500; }
.forgot-note {
  margin-top: 12px; font-size: 13px; line-height: 1.55; color: var(--ink-soft);
  background: var(--blush-deep); border-radius: 12px; padding: 14px 16px; text-align: left;
}
.forgot-note a { color: var(--gold-deep); font-weight: 600; word-break: break-all; }

/* forced MFA enrollment on the auth card */
.setup-qr { display: block; margin: 4px auto 14px; border-radius: 14px; border: 1px solid rgba(201,162,75,.3); }
.setup-hint { font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.setup-secret { font-family: monospace; font-size: 13px; background: var(--blush-deep); padding: 8px 12px; border-radius: 10px; word-break: break-all; margin-bottom: 16px; text-align: center; }
.sec-div { border: none; border-top: 1px solid rgba(201,162,75,.2); margin: 24px 0; }
.client-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* app frame */
.portal-main { padding: 34px 0 90px; }
.user-chip { font-size: 14px; color: var(--ink-soft); }
.page-title { font-family: var(--font-display); font-size: clamp(24px, 3.4vw, 32px); }
.page-sub { color: var(--ink-soft); font-size: 14.5px; margin-top: 4px; }
.list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 8px 0 26px; }
.list-actions { display: flex; gap: 10px; }
.back-btn { margin-bottom: 22px; }

/* admin stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 30px; }
.stat {
  background: var(--cream); border-radius: 18px; padding: 20px 22px;
  border: 1px solid rgba(201,162,75,.16); box-shadow: var(--shadow);
}
.stat .n { font-family: var(--font-display); font-size: 32px; color: var(--gold-deep); }
.stat .l { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }

/* events grid */
.events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.event-card {
  background: var(--cream); border-radius: var(--radius); padding: 24px;
  border: 1px solid rgba(201,162,75,.16); box-shadow: var(--shadow);
  cursor: pointer; transition: transform .2s ease, box-shadow .2s ease;
}
.event-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.event-card h3 { font-family: var(--font-display); font-size: 19px; margin: 10px 0 6px; }
.event-card .meta { font-size: 13.5px; color: var(--ink-soft); }
.event-card .client { font-size: 13px; color: var(--rose); margin-top: 8px; font-weight: 500; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.badge {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.badge.pending    { background: rgba(201,162,75,.16); color: var(--gold-deep); }
.badge.planning   { background: rgba(183,110,121,.15); color: var(--rose); }
.badge.confirmed  { background: rgba(122,155,118,.16); color: #587a54; }
.badge.completed  { background: rgba(93,80,74,.12); color: var(--ink-soft); }
.badge.cancelled  { background: rgba(192,92,92,.14); color: var(--red); }
.badge.type { background: var(--blush-deep); color: var(--ink-soft); }

/* empty state */
.empty { text-align: center; padding: 70px 20px; }
.empty-icon { font-size: 54px; margin-bottom: 12px; }
.empty h3 { font-family: var(--font-display); font-size: 24px; margin-bottom: 6px; }
.empty p { color: var(--ink-soft); margin-bottom: 22px; }

/* event detail */
.event-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.event-head-actions { display: flex; align-items: center; gap: 10px; }
.status-select { padding: 10px 14px; border-radius: 12px; border: 1.5px solid rgba(33,26,23,.15); font-family: inherit; background: #fff; }
.tabs { display: flex; gap: 6px; border-bottom: 1.5px solid rgba(201,162,75,.25); margin-bottom: 24px; overflow-x: auto; }
.tab {
  background: none; border: none; padding: 12px 18px; font-size: 14.5px; color: var(--ink-soft);
  border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; white-space: nowrap;
}
.tab.active { color: var(--gold-deep); border-bottom-color: var(--gold); font-weight: 600; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.detail-item { background: var(--cream); border-radius: 16px; padding: 16px 18px; border: 1px solid rgba(201,162,75,.14); }
.detail-item .l { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.detail-item .v { font-size: 16.5px; margin-top: 4px; font-weight: 500; }
.notes-box { background: var(--cream); border-radius: 16px; padding: 20px 22px; border: 1px solid rgba(201,162,75,.14); white-space: pre-wrap; color: var(--ink-soft); }
.detail-actions { margin-top: 22px; display: flex; gap: 12px; flex-wrap: wrap; }

/* messages thread */
.thread {
  background: var(--cream); border: 1px solid rgba(201,162,75,.16); border-radius: 20px;
  height: 420px; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.thread .chat-msg .who { display: block; font-size: 11px; opacity: .65; margin-bottom: 3px; letter-spacing: .06em; }
.thread-input { border: 1px solid rgba(201,162,75,.2); border-radius: 999px; margin-top: 14px; background: #fff; }
.thread-empty { margin: auto; text-align: center; color: var(--ink-soft); }

/* checklist */
.task-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.task {
  display: flex; align-items: center; gap: 14px; background: var(--cream);
  border: 1px solid rgba(201,162,75,.14); border-radius: 14px; padding: 14px 18px;
}
.task input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--gold); cursor: pointer; }
.task .t { flex: 1; }
.task.done .t { text-decoration: line-through; color: var(--ink-soft); }
.task .due { font-size: 12.5px; color: var(--rose); white-space: nowrap; }
.task .del { background: none; border: none; color: var(--red); font-size: 17px; opacity: .6; }
.task .del:hover { opacity: 1; }
.task-form { display: flex; gap: 10px; flex-wrap: wrap; }
.task-form input[type="text"] { flex: 1 1 220px; padding: 12px 16px; border: 1.5px solid rgba(33,26,23,.14); border-radius: 12px; font-family: inherit; }
.task-form input[type="date"] { padding: 12px; border: 1.5px solid rgba(33,26,23,.14); border-radius: 12px; font-family: inherit; }

/* photos */
.photo-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; align-items: center; }
.photo-form input[type="file"] { flex: 1 1 200px; font-size: 13.5px; }
.photo-form input[type="text"] { flex: 1 1 180px; padding: 11px 15px; border: 1.5px solid rgba(33,26,23,.14); border-radius: 12px; font-family: inherit; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.photo-card { position: relative; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); background: var(--cream); }
.photo-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-card .cap { font-size: 12.5px; padding: 8px 12px; color: var(--ink-soft); }
.photo-card .del {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%;
  border: none; background: rgba(33,26,23,.55); color: #fff; font-size: 14px;
}

/* clients (admin) */
.clients-list { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.client-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--cream); border: 1px solid rgba(201,162,75,.14); border-radius: 16px; padding: 18px 22px;
}
.client-row .nm { font-weight: 600; }
.client-row .em { color: var(--ink-soft); font-size: 14px; }
.client-row .ct { color: var(--gold-deep); font-size: 13.5px; font-weight: 600; }

/* security */
.security-card {
  max-width: 520px; margin-top: 24px; background: var(--cream); border: 1px solid rgba(201,162,75,.16);
  border-radius: 24px; padding: 30px; box-shadow: var(--shadow);
}
.security-card h3 { font-family: var(--font-display); font-size: 20px; margin-bottom: 10px; }
.security-card p { color: var(--ink-soft); font-size: 14.5px; margin-bottom: 16px; }
.security-card img.qr { margin: 6px auto 16px; border-radius: 12px; border: 1px solid rgba(201,162,75,.3); }
.security-card .secret { font-family: monospace; font-size: 13px; background: var(--blush-deep); padding: 8px 12px; border-radius: 10px; word-break: break-all; margin-bottom: 16px; }
.mfa-on { color: #587a54; font-weight: 600; }
.mfa-off { color: var(--gold-deep); font-weight: 600; }

/* event form */
.event-form { max-width: 640px; background: var(--cream); border: 1px solid rgba(201,162,75,.16); border-radius: 24px; padding: 30px; box-shadow: var(--shadow); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ── responsive header — keep the brand, name chip & buttons from colliding ── */
.user-chip { white-space: nowrap; }
@media (max-width: 700px) {
  .portal-body .nav-inner { flex-wrap: wrap; gap: 8px 12px; padding: 12px 0; }
  .portal-body .nav-brand { gap: 10px; }
  .portal-body .nav-brand img { width: 40px; height: 40px; }
  .portal-body .nav-brand .brand-name { font-size: 21px; }
  .portal-body .nav-links { gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
  .portal-body .user-chip { font-size: 12.5px; }
  .portal-body .btn-sm { padding: 8px 13px; font-size: 12px; }
}
@media (max-width: 470px) {
  /* Put the name on its own full-width row under the brand so nothing overlaps */
  .portal-body .user-chip { order: 3; flex-basis: 100%; text-align: left; color: var(--gold-deep); font-weight: 600; }
}

/* ── countdown pill on event cards ── */
.cd-pill {
  display: inline-block; margin-top: 12px; padding: 5px 13px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
}
.cd-pill.soon   { background: rgba(183,110,121,.15); color: var(--rose); }
.cd-pill.today  { background: rgba(201,162,75,.22); color: var(--gold-deep); }
.cd-pill.future { background: rgba(122,155,118,.16); color: #587a54; }
.cd-pill.past   { background: rgba(93,80,74,.1);   color: var(--ink-soft); }
.cd-pill.tbd    { background: var(--blush-deep);    color: var(--ink-soft); }

/* ── countdown hero on the event detail (Details tab) ── */
.countdown {
  border-radius: 22px; padding: 28px 26px; margin-bottom: 22px; text-align: center;
  background: linear-gradient(135deg, #fff, var(--blush-deep));
  border: 1px solid rgba(201,162,75,.22); box-shadow: var(--shadow);
}
.countdown.today { background: linear-gradient(135deg, #fff, rgba(201,162,75,.28)); }
.countdown.past  { background: linear-gradient(135deg, #fff, rgba(93,80,74,.08)); }
.countdown .cd-num {
  font-family: var(--font-display); font-size: clamp(48px, 12vw, 68px); line-height: 1;
  color: var(--gold-deep); font-weight: 700;
}
.countdown.past .cd-num { color: var(--ink-soft); }
.countdown .cd-sub { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); margin-top: 8px; }

/* planning-progress bar (updates live as checklist items are ticked) */
.plan-progress { max-width: 380px; margin: 20px auto 0; }
.plan-progress .pp-label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 7px; }
.plan-progress .pp-bar { height: 10px; border-radius: 999px; background: rgba(33,26,23,.1); overflow: hidden; }
.plan-progress .pp-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--rose)); transition: width .8s cubic-bezier(.22,1,.36,1); }
.plan-progress .pp-pct { font-size: 12.5px; color: var(--ink-soft); margin-top: 7px; }

/* client dashboard stat cards animate in the same style as admin */
.stat .n[data-count] { transition: none; }

/* ── AI helpers (admin) ── */
.ai-reply-bar { margin-top: 12px; }
.ai-plan-bar { margin-bottom: 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ai-plan-hint { font-size: 12.5px; color: var(--ink-soft); }

.ai-modal { position: fixed; inset: 0; z-index: 120; background: rgba(33,26,23,.5); display: grid; place-items: center; padding: 20px; }
.ai-modal-card {
  width: min(560px, 100%); max-height: 86vh; overflow-y: auto; background: var(--cream);
  border-radius: 22px; padding: 28px; box-shadow: var(--shadow-lift); position: relative;
}
.ai-modal-close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 18px; color: var(--ink-soft); cursor: pointer; }
.ai-modal h3 { font-family: var(--font-display); font-size: 21px; margin-bottom: 10px; }
.ai-summary { background: var(--blush-deep); border-radius: 14px; padding: 14px 16px; font-size: 14px; line-height: 1.55; color: var(--ink); margin: 6px 0 18px; white-space: pre-wrap; }
.ai-check-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.ai-check { display: flex; align-items: flex-start; gap: 10px; background: #fff; border: 1px solid rgba(201,162,75,.16); border-radius: 12px; padding: 11px 14px; cursor: pointer; }
.ai-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--gold); flex-shrink: 0; }
.ai-check .ttl { flex: 1; font-size: 14px; line-height: 1.4; }
.ai-check .due { font-size: 12px; color: var(--rose); white-space: nowrap; }
.ai-modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ai-loading { text-align: center; padding: 34px 10px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; }

/* ── budget / items tracker ── */
.budget-summary { margin-bottom: 20px; }
.bs-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.bs-stat { background: var(--cream); border: 1px solid rgba(201,162,75,.16); border-radius: 16px; padding: 14px 16px; text-align: center; }
.bs-l { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.bs-n { font-family: var(--font-display); font-size: 24px; color: var(--gold-deep); margin-top: 4px; }
.bs-n.over { color: var(--red); }
.bs-bar { height: 12px; border-radius: 999px; background: rgba(33,26,23,.1); overflow: hidden; }
.bs-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--rose)); transition: width .6s cubic-bezier(.22,1,.36,1); }
.bs-fill.over { background: linear-gradient(90deg, var(--rose), var(--red)); }
.bs-hint { color: var(--ink-soft); font-size: 13px; }

.item-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.item-form input[type="text"], .item-form input[type="url"] { flex: 1 1 180px; padding: 11px 15px; border: 1.5px solid rgba(33,26,23,.14); border-radius: 12px; font-family: inherit; }
.item-form input[type="number"] { width: 110px; padding: 11px 15px; border: 1.5px solid rgba(33,26,23,.14); border-radius: 12px; font-family: inherit; }

.item-list { display: flex; flex-direction: column; gap: 10px; }
.item-row { display: flex; align-items: center; gap: 14px; background: var(--cream); border: 1px solid rgba(201,162,75,.14); border-radius: 14px; padding: 12px 16px; }
.item-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--gold); cursor: pointer; flex-shrink: 0; }
.item-row.bought .item-name { text-decoration: line-through; color: var(--ink-soft); }
.item-main { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.item-name { font-weight: 500; color: var(--ink); text-decoration: none; }
a.item-name:hover { color: var(--gold-deep); text-decoration: underline; }
.item-sub { font-size: 12.5px; color: var(--ink-soft); }
.item-cat { color: var(--rose); }
.item-cost { font-weight: 600; color: var(--gold-deep); white-space: nowrap; }
.item-row .del { background: none; border: none; color: var(--red); font-size: 16px; opacity: .6; cursor: pointer; }
.item-row .del:hover { opacity: 1; }

.budget-breakdown { margin-top: 22px; }
.bb-title { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 10px; }
.bb-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.bb-cat { flex: 0 0 110px; font-size: 13.5px; color: var(--ink); }
.bb-bar { flex: 1; height: 8px; border-radius: 999px; background: rgba(33,26,23,.08); overflow: hidden; }
.bb-fill { height: 100%; background: var(--gold); border-radius: 999px; }
.bb-amt { flex: 0 0 auto; font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
