/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --wine:       #6B2737;
  --wine-dark:  #4E1A27;
  --wine-light: #8B3A4C;
  --gold:       #B8965A;
  --cream:      #F9F6F1;
  --border:     #E5DDD5;
  --text:       #2D2D2D;
  --muted:      #7A7A7A;
  --sidebar-w:  220px;
}

/* ── Reset & base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       background: var(--cream); color: var(--text); font-size: 0.92rem; }
a { color: var(--wine); text-decoration: none; }
a:hover { color: var(--wine-dark); text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--wine-dark);
  color: #F0E8E0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 100;
}
.sidebar-brand {
  padding: 20px 16px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand-icon { font-size: 1.5rem; }
.brand-name { font-weight: 700; font-size: 0.95rem; line-height: 1.2; color: #F0E8E0; }

.sidebar-nav { list-style: none; padding: 12px 0; margin: 0; flex: 1; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: rgba(240,232,224,0.8);
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
  font-size: 0.9rem;
}
.sidebar-nav li a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar-nav li a.active { background: rgba(255,255,255,0.15); color: #fff; font-weight: 600; }
.sidebar-nav li a i { font-size: 1rem; width: 18px; }
.sidebar-nav li a .badge { font-size: 0.7rem; padding: 2px 6px; }

.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-footer a { color: rgba(240,232,224,0.6); font-size: 0.85rem; display: flex; align-items: center; gap: 8px; }
.sidebar-footer a:hover { color: #fff; text-decoration: none; }

/* ── Top bar ────────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title { font-size: 1.15rem; font-weight: 700; margin: 0; flex: 1; color: var(--text); }
.topbar-actions { display: flex; gap: 8px; }
.sidebar-toggle { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text); padding: 0; }

/* ── Content body ───────────────────────────────────────────────────────────── */
.content-body { padding: 20px 24px; flex: 1; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn-primary { background: var(--wine); border-color: var(--wine); }
.btn-primary:hover, .btn-primary:focus { background: var(--wine-dark); border-color: var(--wine-dark); }
.btn-outline-secondary:hover { background: var(--cream); }
.btn-xs { padding: 2px 8px; font-size: 0.78rem; }

/* ── Stats row ──────────────────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; color: var(--wine); }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.stat-green .stat-value { color: #2E7D52; }
.stat-red .stat-value   { color: #c0392b; }
.stat-gold .stat-value  { color: var(--gold); }

/* ── Alert banners ──────────────────────────────────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 0.88rem;
}
.alert-urgent  { background: #fdecea; border: 1px solid #f5c6c6; color: #7b1e1e; }
.alert-warning { background: #fff8e1; border: 1px solid #ffe082; color: #5d4037; }

/* ── Dashboard grid ─────────────────────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.dash-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dash-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dash-card-header h2 { font-size: 0.95rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.see-all { font-size: 0.82rem; color: var(--muted); }
.empty-msg { color: var(--muted); font-size: 0.88rem; padding: 8px 0; }

/* ── Task list ──────────────────────────────────────────────────────────────── */
.task-list { list-style: none; padding: 0; margin: 0; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }
.task-urgent { background: #fff8f0; border-radius: 6px; padding: 10px 8px; margin-bottom: 4px; }
.task-done .task-text { text-decoration: line-through; color: var(--muted); }

.task-check {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.task-check:hover { color: var(--wine); }
.task-check .bi-check-circle-fill { color: #2E7D52; }

.task-body { flex: 1; min-width: 0; }
.task-text { font-size: 0.9rem; line-height: 1.4; }
.task-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 3px; font-size: 0.78rem; color: var(--muted); align-items: center; }
.task-meta i { font-size: 0.8rem; }
.task-link { color: var(--muted); font-size: 1rem; padding: 2px 4px; align-self: center; }
.task-link:hover { color: var(--wine); }

.task-section { margin-bottom: 28px; }
.task-section-title { font-size: 0.92rem; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }

.add-task-row { display: flex; gap: 8px; flex-wrap: wrap; }
.add-task-row .form-control, .add-task-row .form-select { flex: 1; min-width: 120px; }

/* ── Upcoming tours list ─────────────────────────────────────────────────────── */
.upcoming-list { list-style: none; padding: 0; margin: 0; }
.upcoming-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.upcoming-item:last-child { border-bottom: none; }
.upcoming-date {
  background: var(--wine);
  color: #fff;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.up-day   { font-size: 1.1rem; font-weight: 700; line-height: 1; }
.up-month { font-size: 0.65rem; text-transform: uppercase; opacity: 0.85; }
.upcoming-body { flex: 1; min-width: 0; }
.upcoming-name { font-weight: 600; font-size: 0.9rem; }
.upcoming-meta { font-size: 0.8rem; color: var(--muted); }
.upcoming-badge { font-size: 0.75rem; color: var(--muted); white-space: nowrap; background: var(--cream); padding: 3px 8px; border-radius: 12px; border: 1px solid var(--border); }
.upcoming-badge.badge-soon { background: #fdecea; color: #c0392b; border-color: #f5c6c6; }

/* ── Kanban ─────────────────────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 20px;
  align-items: flex-start;
  min-height: calc(100vh - 120px);
}
.kanban-col {
  min-width: 200px;
  width: 200px;
  flex-shrink: 0;
  border-radius: 10px;
  padding: 0 0 8px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 3px solid var(--border);
  position: sticky;
  top: 0;
}
.col-title   { font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
.col-count   { font-size: 0.78rem; background: var(--cream); border-radius: 10px; padding: 1px 7px; color: var(--muted); }

/* Column accent colours */
.col-new       .kanban-col-header { border-color: #3b82f6; }
.col-contacted .kanban-col-header { border-color: #f59e0b; }
.col-proposal  .kanban-col-header { border-color: #8b5cf6; }
.col-tentative .kanban-col-header { border-color: #6b7280; }
.col-confirmed .kanban-col-header { border-color: #10b981; }
.col-completed .kanban-col-header { border-color: #374151; }
.col-lost      .kanban-col-header { border-color: #ef4444; }

.kanban-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; flex: 1; }
.kanban-cards.drag-over { background: rgba(107,39,55,0.05); border-radius: 6px; }

.kanban-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: grab;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow 0.15s, transform 0.1s;
}
.kanban-card:hover { box-shadow: 0 3px 10px rgba(107,39,55,0.12); }
.kanban-card.dragging { opacity: 0.5; transform: rotate(2deg); }

.card-name { font-weight: 600; font-size: 0.88rem; margin-bottom: 5px; }
.card-name a { color: var(--text); }
.card-name a:hover { color: var(--wine); text-decoration: none; }
.card-date { font-size: 0.78rem; color: var(--muted); margin-bottom: 5px; display: flex; align-items: center; gap: 4px; }
.card-date.date-soon { color: #c0392b; font-weight: 600; }
.days-badge { background: #fdecea; color: #c0392b; border-radius: 4px; padding: 1px 5px; font-size: 0.72rem; }
.card-meta  { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 6px; font-size: 0.78rem; color: var(--muted); }
.card-payment-flag { font-size: 0.75rem; color: #e67e22; background: #fef3e2; padding: 3px 7px; border-radius: 4px; margin-bottom: 5px; }
.card-actions { display: flex; gap: 4px; margin-top: 4px; }
.kanban-add-btn { display: block; text-align: center; padding: 8px; font-size: 0.82rem; color: var(--muted); border-top: 1px dashed var(--border); margin: 4px 8px 0; border-radius: 0 0 6px 6px; }
.kanban-add-btn:hover { color: var(--wine); background: var(--cream); text-decoration: none; }

/* ── Group badges ────────────────────────────────────────────────────────────── */
.group-badge { font-size: 0.72rem; padding: 2px 7px; border-radius: 10px; font-weight: 500; white-space: nowrap; }
.badge-birthday  { background: #fce4ec; color: #880e4f; }
.badge-hens      { background: #fce4ec; color: #c2185b; }
.badge-couples   { background: #e3f2fd; color: #1565c0; }
.badge-family    { background: #e8f5e9; color: #2e7d32; }
.badge-corporate { background: #ede7f6; color: #4527a0; }
.badge-wine      { background: #fdf3e7; color: #6B2737; }
.badge-other     { background: #f5f5f5; color: #616161; }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.form-grid-narrow { grid-template-columns: 1.2fr 0.8fr; }
.form-col {}
.form-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.section-title {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.form-label { font-weight: 500; font-size: 0.85rem; margin-bottom: 4px; }
.form-control, .form-select { font-size: 0.88rem; border-color: var(--border); }
.form-control:focus, .form-select:focus { border-color: var(--wine-light); box-shadow: 0 0 0 0.15rem rgba(107,39,55,0.15); }

/* Stage selector */
.stage-selector { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-option { cursor: pointer; }
.stage-option input[type=radio] { display: none; }
.stage-option span {
  display: block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  border: 2px solid var(--border);
  color: var(--muted);
  transition: all 0.15s;
}
.stage-option:has(input:checked) span { border-color: var(--wine); color: var(--wine); font-weight: 600; background: #fdf5f6; }

/* Checklist */
.checklist-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.checklist-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer; }
.checklist-item input { accent-color: var(--wine); }

.form-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 0 4px;
}

/* ── Enquiry form full layout ────────────────────────────────────────────────── */
.enq-form {}

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table-card { background: #fff; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.crm-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.crm-table th { padding: 10px 14px; background: var(--cream); border-bottom: 1px solid var(--border); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); white-space: nowrap; }
.crm-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.crm-table tr:last-child td { border-bottom: none; }
.crm-table tr:hover td { background: #faf7f3; }

/* ── Filter bar ─────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.result-count { color: var(--muted); font-size: 0.82rem; margin-left: auto; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state i { font-size: 3rem; display: block; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { margin-bottom: 16px; }

/* ── Linked list ─────────────────────────────────────────────────────────────── */
.linked-list { list-style: none; padding: 0; margin: 0; }
.linked-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.linked-list li:last-child { border-bottom: none; }

/* ── Mobile ─────────────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    height: 100%;
    transition: left 0.25s ease;
    z-index: 200;
  }
  .sidebar.open { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,0.2); }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid-narrow { grid-template-columns: 1fr; }
  .content-body { padding: 16px; }
}
@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kanban-col { min-width: 180px; }
}
