/* mariee.css — Mariée Avenue CRM shared styles */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Sarabun:wght@300;400;500;600&display=swap');

/* ── Brand Tokens ─────────────────────────────────────────── */
:root {
  --navy:       #2B3A5B;
  --blush:      #C89A95;
  --cream:      #FDFAF3;
  --gold:       #B89968;
  --gold-light: #D4B896;
  --navy-light: #3D5080;
  --text-dark:  #1A1A2E;
  --text-mid:   #4A4A6A;
  --text-muted: #8A8A9A;
  --white:      #FFFFFF;
  --danger:     #C0392B;
  --warning:    #E67E22;
  --success:    #27AE60;

  --font-display: 'Cinzel', 'Sarabun', serif;
  --font-body:    'Cormorant Garamond', 'Sarabun', serif;
  --font-ui:      'Sarabun', sans-serif;

  --radius:    8px;
  --radius-lg: 12px;
  --shadow:      0 2px 12px rgba(43, 58, 91, 0.12);
  --shadow-hover:0 6px 24px rgba(43, 58, 91, 0.20);
  --transition:  0.2s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-ui);
  background: var(--cream);
  color: var(--text-dark);
  min-height: 100vh;
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-display); color: var(--navy); letter-spacing: 0.04em; }
h1 { font-size: 1.8rem; font-weight: 600; }
h2 { font-size: 1.3rem; font-weight: 600; }
h3 { font-size: 1rem;   font-weight: 600; }
p, label, td, th { font-family: var(--font-ui); }
.serif { font-family: var(--font-body); }

/* ── App Shell ──────────────────────────────────────────────── */
.app-header {
  background: var(--navy);
  color: var(--cream);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.app-header .brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  text-decoration: none;
  white-space: nowrap;
}
.app-header .brand span {
  color: var(--cream);
  opacity: 0.65;
  font-size: 0.85rem;
  margin-left: 0.4rem;
}
.app-nav {
  display: flex;
  gap: 0.2rem;
  align-items: center;
}
.app-nav a {
  color: var(--cream);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  opacity: 0.75;
  transition: var(--transition);
  white-space: nowrap;
}
.app-nav a:hover, .app-nav a.active { background: rgba(255,255,255,0.15); opacity: 1; }
.app-main { padding: 1.5rem; max-width: 1600px; margin: 0 auto; }

/* ── Role Switcher ──────────────────────────────────────────── */
.role-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  white-space: nowrap;
}
.role-switcher select {
  background: rgba(255,255,255,0.15);
  color: var(--cream);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  cursor: pointer;
}
.role-switcher select option { background: var(--navy); color: var(--cream); }
.role-label { color: var(--gold-light); opacity: 0.9; }
.role-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.role-badge--owner    { background: var(--gold);  color: var(--navy); }
.role-badge--team     { background: var(--blush); color: var(--navy); }
.role-badge--customer { background: #5A9A6F;      color: white; }

/* ── Stage Colors ───────────────────────────────────────────── */
.kanban-column[data-column="inquiry"]      { --stage-color: #78716C; --stage-bg: #F5F4F2; }
.kanban-column[data-column="chapter_i"]    { --stage-color: #C89A95; --stage-bg: #FDF0EF; }
.kanban-column[data-column="chapter_ii"]   { --stage-color: #B89968; --stage-bg: #FEF8EC; }
.kanban-column[data-column="chapter_iii"]  { --stage-color: #4A9E78; --stage-bg: #EFF8F2; }
.kanban-column[data-column="chapter_iv"]   { --stage-color: #8B6DB8; --stage-bg: #F3EEFB; }
.kanban-column[data-column="wedding_day"]  { --stage-color: #2B3A5B; --stage-bg: #EBF0FA; }
.kanban-column[data-column="post_event"]   { --stage-color: #6B7280; --stage-bg: #F3F4F6; }

/* ── Kanban Board ───────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  align-items: flex-start;
}
.kanban-column {
  flex: 0 0 230px;
  min-width: 210px;
  background: var(--stage-bg, rgba(43,58,91,0.04));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(43,58,91,0.08);
  display: flex;
  flex-direction: column;
}
.kanban-column-header {
  padding: 0.65rem 0.9rem;
  border-bottom: 2px solid rgba(255,255,255,0.18);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--stage-color, var(--navy));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kanban-column-header h3 {
  color: #fff;
  font-size: 0.7rem;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.column-count {
  background: rgba(255,255,255,0.22);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.kanban-cards {
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 80px;
  transition: background var(--transition);
}
.kanban-cards.drag-over {
  background: rgba(184, 153, 104, 0.1);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Couple Card ────────────────────────────────────────────── */
.couple-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  box-shadow: var(--shadow);
  cursor: grab;
  border-left: 3px solid var(--blush);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  text-decoration: none;
  display: block;
  color: inherit;
  user-select: none;
}
.couple-card:hover     { box-shadow: var(--shadow-hover); transform: translateY(-1px); border-left-color: var(--gold); }
.couple-card.dragging  { opacity: 0.45; cursor: grabbing; }
.couple-card.has-flags { border-left-color: var(--warning); }

.card-names {
  font-family: var(--font-ui);
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.2rem;
  line-height: 1.3;
}
.card-date     { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.card-meta     { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.card-countdown { font-size: 0.68rem; color: var(--text-muted); font-style: italic; }
.card-countdown.urgent { color: var(--danger); font-weight: 600; font-style: normal; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  font-size: 0.63rem;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge--meeting  { background: #EBF0FA; color: var(--navy); }
.badge--docs     { background: #F5EDF5; color: #6A3A7C; }
.badge--payment  { background: #F0FAF0; color: #2A7A3A; }
.badge--warning  { background: #FEF3E2; color: var(--warning); }
.badge--flag     { background: #FEE8E6; color: var(--danger); }
.badge--owner    { background: #FEF8EC; color: #8A6A20; }
.badge--team     { background: #FDF0EF; color: #8A4A47; }
.badge--customer { background: #EFF8F2; color: #2A7A4A; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1;
}
.btn-primary  { background: var(--navy);   color: var(--cream); }
.btn-primary:hover { background: var(--navy-light); }
.btn-gold     { background: var(--gold);   color: var(--navy);  }
.btn-gold:hover    { background: var(--gold-light); }
.btn-ghost    { background: transparent;   color: var(--navy); border: 1px solid rgba(43,58,91,0.3); }
.btn-ghost:hover   { background: var(--navy); color: var(--cream); }
.btn-sm       { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
.btn-danger   { background: var(--danger); color: white; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group   { margin-bottom: 1rem; }
.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-mid);
  font-weight: 500;
}
.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(43,58,91,0.2);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  background: var(--white);
  color: var(--text-dark);
  transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 2px rgba(43,58,91,0.12); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control   { cursor: pointer; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(43,58,91,0.08);
}
.card-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table  { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th     { background: var(--navy); color: var(--cream); padding: 0.6rem 0.75rem; text-align: left; font-family: var(--font-display); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
td     { padding: 0.6rem 0.75rem; border-bottom: 1px solid rgba(43,58,91,0.07); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(43,58,91,0.025); }
td a   { color: var(--navy); }
td a:hover { color: var(--gold); }

/* ── Visibility Toggles ─────────────────────────────────────── */
.vis-toggle { display: inline-flex; gap: 0.3rem; align-items: center; }
.vis-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.5rem;
  font-size: 0.65rem;
  border-radius: 10px;
  border: 1px solid;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 700;
  background: transparent;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}
.vis-btn--owner    { border-color: var(--gold);  color: #8A6A20; }
.vis-btn--owner.active  { background: var(--gold);  color: var(--navy); }
.vis-btn--team     { border-color: var(--blush); color: #8A4A47; }
.vis-btn--team.active   { background: var(--blush); color: var(--navy); }
.vis-btn--customer { border-color: #5A9A6F;      color: #2A7A4A; }
.vis-btn--customer.active{ background: #5A9A6F;      color: white; }

/* ── Copy Link Button ───────────────────────────────────────── */
.copy-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-family: var(--font-ui);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(184,153,104,0.4);
  background: transparent;
  color: var(--gold);
  transition: var(--transition);
  min-height: 32px;
  touch-action: manipulation;
  white-space: nowrap;
}
.copy-link-btn:hover { background: var(--gold); color: var(--navy); }
.copy-link-btn.copied { background: var(--success); color: white; border-color: var(--success); }

/* ── External Link Icon ─────────────────────────────────────── */
.ext-link-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 3px;
  opacity: 0.5;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Toast Notification ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--navy);
  color: var(--cream);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font-ui);
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(43,58,91,0.35);
  transition: transform 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Page Title Bar ─────────────────────────────────────────── */
.page-title-bar {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-title-bar h1 { flex: 1; }
.gold-divider {
  height: 2px;
  background: linear-gradient(90deg, var(--gold), rgba(184,153,104,0.1));
  margin-bottom: 1.5rem;
  border-radius: 1px;
}

/* ── Meetings ────────────────────────────────────────────────── */
.meetings-list { display: flex; flex-direction: column; gap: 0.45rem; }
.meeting-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(43,58,91,0.03);
  border: 1px solid transparent;
  transition: var(--transition);
}
.meeting-item.completed { background: rgba(39,174,96,0.06); border-color: rgba(39,174,96,0.2); }
.meeting-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(43,58,91,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.65rem;
  cursor: pointer;
  transition: var(--transition);
}
.meeting-check:hover { border-color: var(--navy); }
.meeting-item.completed .meeting-check { background: var(--success); border-color: var(--success); color: white; }
.meeting-label { font-size: 0.875rem; font-weight: 500; flex: 1; color: var(--text-dark); }
.meeting-date  { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }

/* ── Filters Bar ────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  align-items: flex-end;
}
.filters-bar .form-group { margin-bottom: 0; min-width: 150px; }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.empty-state .empty-icon { font-size: 1.75rem; margin-bottom: 0.4rem; opacity: 0.5; }

/* ── Progress Bar ────────────────────────────────────────────── */
.progress-bar-track {
  background: rgba(43,58,91,0.1);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.progress-bar-fill {
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  height: 100%;
  border-radius: 20px;
  transition: width 0.6s ease;
}

/* ── Responsive ─────────────────────────────────────────────── */

/* Desktop: fit all 7 columns to viewport width, no horizontal scroll */
@media (min-width: 1024px) {
  .kanban-board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    overflow-x: visible;
    padding-bottom: 0;
    gap: 0.65rem;
  }
  .kanban-column {
    flex: none;    /* grid overrides flex sizing */
    min-width: 0;  /* allow columns to shrink below previous min */
  }
  .kanban-column-header h3 {
    font-size: 0.62rem;
    white-space: normal;
    line-height: 1.25;
    letter-spacing: 0.04em;
  }
  .copy-link-btn { font-size: 0.65rem; }
}

@media (max-width: 1023px) and (min-width: 601px) {
  .app-header { padding: 0.6rem 1rem; flex-wrap: wrap; gap: 0.6rem; }
  .app-header .brand span { display: none; }
  .app-main { padding: 1rem; }
  .kanban-board { gap: 0.65rem; }
  .kanban-column { flex: 0 0 195px; min-width: 180px; }
  /* Docs table: hide less-critical columns on tablet */
  .docs-col-date, .docs-col-by { display: none; }
}

/* Mobile: vertical stack — one column per row, no side scroll */
@media (max-width: 600px) {
  .app-header { padding: 0.6rem 1rem; flex-wrap: wrap; gap: 0.6rem; }
  .app-header .brand span { display: none; }
  .app-main { padding: 1rem; }
  h1 { font-size: 1.4rem; }
  .page-title-bar { flex-direction: column; gap: 0.4rem; }
  .filters-bar { flex-direction: column; }
  .filters-bar .form-group { min-width: 100%; }
  .docs-col-stage, .docs-col-date, .docs-col-by { display: none; }

  /* Kanban becomes a vertical list */
  .kanban-board {
    flex-direction: column;
    overflow-x: visible;
    padding-bottom: 0;
    gap: 0.75rem;
  }
  .kanban-column {
    flex: none;
    width: 100%;
    min-width: 0;
  }
}

/* ── Utilities ──────────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); font-size: 0.875rem; }
.text-right   { text-align: right; }
.mt-1         { margin-top: 0.5rem; }
.mt-2         { margin-top: 1rem; }
.d-flex       { display: flex; }
.gap-1        { gap: 0.5rem; }
.align-center { align-items: center; }
.flex-1       { flex: 1; }
.fw-600       { font-weight: 600; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27,34,50,0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
}
.modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(27,34,50,0.3);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(43,58,91,0.1);
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-muted);
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: var(--transition);
  touch-action: manipulation;
}
.modal-close:hover { background: rgba(43,58,91,0.08); color: var(--navy); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
