/* ============================================================
   Velvet Venues — Client Portal Design System (v1)
   Luxury wedding brand: deep plum, gold, blush.
   Mobile-first. No frameworks — hand-crafted CSS.
   ============================================================ */

:root {
  --plum: #2F0638;
  --plum-deep: #1E0624;
  --plum-2: #2B0A33;
  --plum-3: #3A1343;
  --gold: #C6A45E;
  --gold-light: #D4B574;
  --gold-pale: #E9CB8B;
  --blush: #F3E9EE;
  --blush-deep: #CDB9C4;
  --paper: #ffffff;
  --paper-2: #f5f5f5;
  --ink: #2B0A33;
  --ink-soft: #5c4a63;
  --ink-faint: #8a7a90;
  --line: #e7dfe8;
  --success: #3f7a4e;
  --warn: #9a6b1f;
  --danger: #a33434;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(30, 6, 36, 0.10);
  --shadow-soft: 0 4px 14px rgba(30, 6, 36, 0.07);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper-2);
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 0.6em;
  color: var(--ink);
}

p { margin: 0 0 1em; }

a { color: var(--plum); }

img { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding: 28px 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  padding: 13px 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  min-height: 48px;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--plum-deep);
  box-shadow: 0 6px 18px rgba(198, 164, 94, 0.35);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(198, 164, 94, 0.45); }
.btn-gold:disabled { opacity: 0.55; cursor: wait; transform: none; }

.btn-outline {
  background: transparent;
  color: var(--paper);
  border-color: rgba(233, 203, 139, 0.6);
}
.btn-outline:hover { border-color: var(--gold-pale); background: rgba(233, 203, 139, 0.08); }

.btn-plum {
  background: var(--plum);
  color: var(--paper);
}
.btn-plum:hover { background: var(--plum-3); }

.btn-quiet {
  background: transparent;
  color: var(--plum);
  border-color: var(--line);
  min-height: 44px;
  padding: 10px 22px;
}
.btn-quiet:hover { border-color: var(--gold); }

.btn-sm { padding: 9px 20px; min-height: 40px; font-size: 14px; }

.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }

.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.input, .textarea, select.input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(198, 164, 94, 0.18);
}
.textarea { min-height: 96px; resize: vertical; }

/* ---------- Login page ---------- */
.login-stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(198, 164, 94, 0.14), transparent 60%),
    linear-gradient(160deg, var(--plum-deep) 0%, var(--plum) 55%, var(--plum-3) 100%);
  color: var(--paper);
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(233, 203, 139, 0.28);
  border-radius: 20px;
  padding: 44px 36px 36px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold-pale);
  margin-bottom: 18px;
}

.login-card h1 {
  color: var(--paper);
  font-size: 40px;
  margin-bottom: 10px;
}

.login-card .tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 19px;
  color: var(--blush-deep);
  margin-bottom: 30px;
}

.login-card .field { text-align: left; }
.login-card .label { color: var(--gold-pale); }

.login-card .input {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(233, 203, 139, 0.35);
  color: var(--paper);
}
.login-card .input::placeholder { color: rgba(233, 203, 139, 0.45); }
.login-card .input:focus { border-color: var(--gold-pale); box-shadow: 0 0 0 3px rgba(233, 203, 139, 0.16); }

.login-note {
  margin-top: 22px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.62);
}

.login-foot {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid rgba(233, 203, 139, 0.18);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.form-error, .form-ok {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14.5px;
  margin-bottom: 18px;
  text-align: left;
}
.form-error {
  background: rgba(163, 52, 52, 0.18);
  border: 1px solid rgba(255, 150, 150, 0.4);
  color: #ffd9d9;
}
.form-ok {
  background: rgba(198, 164, 94, 0.14);
  border: 1px solid rgba(233, 203, 139, 0.4);
  color: var(--gold-pale);
}

/* ---------- Portal shell ---------- */
/* ---------- Full-bleed masthead banner ---------- */
.masthead {
  position: relative;
  overflow: hidden;
  background: var(--plum-deep);
  color: var(--paper);
}

.masthead .hero-bg {
  background-image: url("/img/hero-ballroom.jpg");
  opacity: 1;
}

.masthead .hero-shade {
  background: linear-gradient(180deg, rgba(30,6,36,0.55) 0%, rgba(30,6,36,0.72) 55%, rgba(30,6,36,0.96) 100%);
}

.masthead-inner {
  position: relative;
  z-index: 2;
  padding-top: 20px;
}

.masthead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid rgba(198, 164, 94, 0.6);
}

.masthead-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 64px 0 34px;
  min-height: 120px;
}

.masthead-copy h1 {
  color: var(--paper);
  font-size: clamp(34px, 6vw, 54px);
  margin-bottom: 8px;
}

.masthead-copy .masthead-sub {
  color: var(--gold-pale);
  font-size: 16.5px;
  letter-spacing: 0.02em;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-pale);
  white-space: nowrap;
}

.couple-name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  flex: 1;
  min-width: 0;
}

.masthead .btn { min-height: 40px; padding: 8px 18px; font-size: 13.5px; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--plum-deep);
  border-bottom: 1px solid rgba(198, 164, 94, 0.25);
  box-shadow: 0 4px 16px rgba(30, 6, 36, 0.25);
}

.tabs-inner {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 12px;
}
.tabs-inner::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: 1 0 auto;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.62);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.06em;
  padding: 15px 14px 13px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab-btn:hover { color: var(--gold-pale); }
.tab-btn[aria-selected="true"] {
  color: var(--gold-pale);
  border-bottom-color: var(--gold);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.25s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.footer {
  margin-top: 40px;
  background: var(--plum-deep);
  color: rgba(255, 255, 255, 0.7);
  padding: 34px 0;
  text-align: center;
  font-size: 14.5px;
}
.footer .brand-mark { margin-bottom: 10px; }
.footer a { color: var(--gold-pale); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer .foot-tag { font-family: var(--font-display); font-style: italic; color: var(--blush-deep); margin-top: 8px; }

/* ---------- Cards & grids ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 24px;
  margin-bottom: 20px;
}

.card-plum {
  background: linear-gradient(150deg, var(--plum-deep), var(--plum) 70%);
  border: 1px solid rgba(198, 164, 94, 0.35);
  color: var(--paper);
  box-shadow: var(--shadow);
}
.card-plum h2, .card-plum h3 { color: var(--gold-pale); }
.card-plum .eyebrow { color: var(--gold-light); }

.eyebrow {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}

.hero-title { font-size: clamp(30px, 5vw, 44px); margin-bottom: 6px; }

.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 18px;
}
@media (min-width: 720px) {
  .fact-grid { grid-template-columns: repeat(3, 1fr); }
}

.fact {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.fact .k {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.fact .v {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.25;
}
.fact .v small { font-family: var(--font-body); font-size: 14px; color: var(--ink-soft); }

.kv {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15.5px;
}
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-soft); }
.kv .v { text-align: right; font-weight: 500; }

.totals .kv .v { font-weight: 600; }
.grand-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 16px 0 4px;
  margin-top: 6px;
  border-top: 2px solid var(--gold);
}
.grand-total .k {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
}
.grand-total .v {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--plum);
}

.upgrade-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.upgrade-row:last-child { border-bottom: none; }
.upgrade-row .name { font-weight: 600; }
.upgrade-row .sel { color: var(--ink-soft); font-size: 14px; display: block; }
.upgrade-row .amt { font-weight: 600; white-space: nowrap; }

/* ---------- Invoices ---------- */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
@media (min-width: 640px) {
  .summary-cards { grid-template-columns: repeat(3, 1fr); }
}
.summary-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}
.summary-card .k {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.summary-card .v {
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--plum);
}
.summary-card.paid .v { color: var(--success); }
.summary-card.balance .v { color: var(--plum); }

.invoice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}
.invoice-main { flex: 1 1 220px; min-width: 0; }
.invoice-main .name { font-family: var(--font-display); font-size: 21px; margin-bottom: 2px; }
.invoice-main .meta { font-size: 14px; color: var(--ink-soft); }
.invoice-amount {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--plum);
  white-space: nowrap;
}

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill-draft    { background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--line); }
.pill-sent     { background: #fdf3df; color: var(--warn); border: 1px solid #ecd9a8; }
.pill-viewed   { background: var(--blush); color: var(--plum); border: 1px solid var(--blush-deep); }
.pill-signed   { background: #e6f2e8; color: var(--success); border: 1px solid #bcd9c2; }
.pill-paid     { background: #e6f2e8; color: var(--success); border: 1px solid #bcd9c2; }
.pill-pending  { background: #fdf3df; color: var(--warn); border: 1px solid #ecd9a8; }
.pill-overdue  { background: #f9e3e3; color: var(--danger); border: 1px solid #eec0c0; }
.pill-default  { background: var(--blush); color: var(--plum); border: 1px solid var(--blush-deep); }

/* ---------- Documents ---------- */
.doc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}
.doc-main { flex: 1 1 220px; min-width: 0; }
.doc-main .name { font-family: var(--font-display); font-size: 21px; margin-bottom: 2px; }
.doc-main .meta { font-size: 14px; color: var(--ink-soft); }
.doc-icon {
  width: 48px; height: 48px; flex: 0 0 48px;
  border-radius: 12px;
  background: var(--blush);
  color: var(--plum);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 22px;
}
.doc-thumb {
  width: 64px; height: 64px; flex: 0 0 64px;
  border-radius: 12px; overflow: hidden;
  background: var(--blush);
  display: block;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.upload-zone {
  border: 2px dashed var(--blush-deep);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
  background: #fbf8fa;
  margin-top: 8px;
}
.upload-zone.dragover { border-color: var(--gold); background: #fffdf6; }
.upload-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.file-name { font-size: 14px; color: var(--ink-soft); margin-top: 10px; min-height: 1.2em; }

.link-inline {
  background: none; border: none; padding: 0;
  color: var(--plum); font-weight: 600; font-size: inherit;
  text-decoration: underline; cursor: pointer;
  font-family: var(--font-body);
}

/* ---------- Messages ---------- */
.msg-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 820px) {
  .msg-layout { grid-template-columns: 300px 1fr; align-items: start; }
}

.thread-list { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 819px) {
  .thread-list { flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
  .thread-item { min-width: 240px; }
}

.thread-item {
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}
.thread-item:hover { border-color: var(--gold); }
.thread-item[aria-current="true"] {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(198, 164, 94, 0.25);
  background: #fffdf7;
}
.thread-item .t-name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.thread-item .t-snippet {
  font-size: 13.5px; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thread-item .t-time { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
.thread-item .t-unread {
  display: inline-block; min-width: 22px; text-align: center;
  background: var(--gold); color: var(--plum-deep);
  font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 7px; margin-left: 8px;
}

.chat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 420px;
}
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 56vh;
  background:
    radial-gradient(600px 200px at 50% 0%, rgba(243, 233, 238, 0.7), transparent),
    var(--paper);
}

.bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.55;
  word-wrap: break-word;
}
.bubble .who { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; opacity: 0.7; }
.bubble .when { display: block; font-size: 11.5px; margin-top: 6px; opacity: 0.6; }

.bubble-in {
  align-self: flex-start;
  background: var(--blush);
  color: var(--ink);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--blush-deep);
}
.bubble-out {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--plum-3), var(--plum));
  color: var(--paper);
  border-bottom-right-radius: 6px;
}

.composer {
  border-top: 1px solid var(--line);
  padding: 14px;
  background: var(--paper);
}
.composer-row { display: flex; gap: 10px; }
.composer .textarea { min-height: 52px; flex: 1; }
.composer .btn { flex: 0 0 auto; }
.composer-hint {
  font-size: 13px;
  color: var(--ink-soft);
  background: #fffdf6;
  border: 1px solid #ecd9a8;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

/* ---------- States ---------- */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px dashed var(--blush-deep);
  border-radius: var(--radius);
}
.empty .empty-title {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--plum);
  margin-bottom: 8px;
}
.empty p { margin-bottom: 0; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--ink-soft);
  font-size: 15px;
}
.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--blush-deep);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.banner {
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 15px;
  margin-bottom: 18px;
}
.banner-error { background: #f9e9e9; border: 1px solid #eec0c0; color: #7c2424; }
.banner-info  { background: #fdf6e7; border: 1px solid #ecd9a8; color: #6d4d14; }

.skeleton {
  background: linear-gradient(90deg, var(--paper-2) 25%, #ece6ee 50%, var(--paper-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 10px;
  min-height: 120px;
  margin-bottom: 16px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .login-card { padding: 36px 24px 28px; }
  .login-card h1 { font-size: 32px; }
  .card { padding: 18px; }
  .wordmark { font-size: 17px; letter-spacing: 0.16em; }
  .couple-name { font-size: 15px; }
  .masthead .btn { padding: 7px 14px; }
  .invoice, .doc { padding: 16px; }
  .invoice-amount { font-size: 22px; }
  .bubble { max-width: 92%; }
  .fact .v { font-size: 19px; }
}
