/* ═══════════════════════════════════════════════════════════
   BASE.CSS — Travel Itinerary Maker UI
   Design system: tokens → components → layout → pages
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--brand-font-body); background: #F7F8FA; color: #1A202C; line-height: 1.6; }
img  { display: block; max-width: 100%; }
a    { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ── Design Tokens ──────────────────────────────────────── */
:root {
  /* Neutrals */
  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Feedback */
  --color-success:  #059669;
  --color-success-bg: #D1FAE5;
  --color-error:    #DC2626;
  --color-error-bg: #FEE2E2;
  --color-warning:  #D97706;
  --color-warning-bg: #FEF3C7;
  --color-info:     #2563EB;
  --color-info-bg:  #DBEAFE;

  /* Status colors */
  --status-draft:     #6B7280;
  --status-sent:      #2563EB;
  --status-confirmed: #059669;
  --status-cancelled: #DC2626;

  /* Spacing scale */
  --s-1:  0.25rem;
  --s-2:  0.5rem;
  --s-3:  0.75rem;
  --s-4:  1rem;
  --s-5:  1.25rem;
  --s-6:  1.5rem;
  --s-8:  2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 28px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 48px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.06);

  /* Transitions */
  --transition: 150ms ease;
  --transition-md: 250ms ease;

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h:  64px;
  --content-max: 1100px;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Typography ─────────────────────────────────────────── */
h1,h2,h3,h4,h5 {
  font-family: var(--brand-font-heading);
  font-weight: 600;
  line-height: 1.25;
  color: var(--gray-900);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.625rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }
h5 { font-size: 0.9375rem; }
p  { color: var(--gray-600); }
small { font-size: 0.8125rem; }

/* ── Layout Shell ───────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--brand-primary-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-6) var(--s-5);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: var(--r-sm);
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}
.sidebar-brand-name {
  font-family: var(--brand-font-heading);
  font-size: 1.0625rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.sidebar-brand-tagline {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  flex: 1;
  padding: var(--s-4) var(--s-3);
}

.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  padding: var(--s-4) var(--s-3) var(--s-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3);
  border-radius: var(--r-md);
  color: rgba(255,255,255,0.65);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover {
  background: rgba(255,255,255,0.09);
  color: #fff;
}
.nav-item.active {
  background: var(--brand-accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(201,168,76,0.35);
}
.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.85;
  flex-shrink: 0;
}
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: var(--s-4) var(--s-3);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
}
.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  background: var(--brand-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  text-transform: capitalize;
}
.sidebar-logout {
  color: rgba(255,255,255,0.4);
  transition: color var(--transition);
  flex-shrink: 0;
}
.sidebar-logout:hover { color: rgba(255,255,255,0.8); }

/* ── Main Content ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s-8);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}
.topbar-left {
  display: flex;
  flex-direction: column;
}
.topbar-title {
  font-family: var(--brand-font-heading);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.2;
}
.topbar-breadcrumb {
  font-size: 0.8rem;
  color: var(--gray-400);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.page-body {
  flex: 1;
  padding: var(--s-8);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  align-self: stretch;
}
.page-body.wide { max-width: 100%; }

/* ── Flash Messages ─────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: var(--s-6);
  animation: slideDown 0.2s ease;
}
.flash-success { background: var(--color-success-bg); color: var(--color-success); }
.flash-error   { background: var(--color-error-bg);   color: var(--color-error); }
.flash-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.flash-info    { background: var(--color-info-bg);    color: var(--color-info); }
.flash-close   { margin-left: auto; cursor: pointer; opacity: 0.6; font-size: 1.1rem; }
.flash-close:hover { opacity: 1; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0.5625rem var(--s-5);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(27,79,114,0.25);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-primary-light);
  box-shadow: 0 4px 12px rgba(27,79,114,0.35);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--brand-accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(201,168,76,0.30);
}
.btn-accent:hover:not(:disabled) {
  background: var(--brand-accent-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.btn-danger {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1.5px solid #FECACA;
}
.btn-danger:hover:not(:disabled) {
  background: var(--color-error);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--gray-500);
  padding: 0.5rem;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-700); }

.btn-sm { padding: 0.375rem var(--s-3); font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem var(--s-8); font-size: 1rem; }
.btn-icon { padding: 0.5625rem; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--gray-100);
}
.card-title {
  font-family: var(--brand-font-heading);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--gray-800);
}
.card-body { padding: var(--s-6); }
.card-footer {
  padding: var(--s-4) var(--s-6);
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-3);
}

/* ── Stat Cards ─────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-5);
  margin-bottom: var(--s-8);
}
.stat-card {
  background: #fff;
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand-primary);
}
.stat-card.accent::before { background: var(--brand-accent); }
.stat-card.success::before { background: var(--color-success); }
.stat-card.info::before { background: var(--color-info); }

.stat-label { font-size: 0.8rem; color: var(--gray-400); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-family: var(--brand-font-heading); font-size: 2.25rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-sub   { font-size: 0.8rem; color: var(--gray-400); }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: var(--s-5); }
.form-label {
  display: block;
  font-size: 0.8375rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--s-2);
}
.form-label .required { color: var(--color-error); margin-left: 2px; }
.form-hint { font-size: 0.78rem; color: var(--gray-400); margin-top: var(--s-1); }

.form-control {
  display: block;
  width: 100%;
  padding: 0.5625rem var(--s-4);
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  color: var(--gray-800);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-size: 0.9rem;
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand-primary-light);
  box-shadow: 0 0 0 3px rgba(46,134,193,0.12);
}
.form-control::placeholder { color: var(--gray-300); }
.form-control:disabled { background: var(--gray-50); color: var(--gray-400); cursor: not-allowed; }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.25rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-5);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid var(--gray-100);
  margin-top: var(--s-6);
}

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
thead tr {
  background: var(--gray-50);
}
thead th {
  padding: var(--s-3) var(--s-5);
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  border-bottom: 1px solid var(--gray-200);
}
tbody td {
  padding: var(--s-4) var(--s-5);
  font-size: 0.9rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
.td-actions { display: flex; gap: var(--s-2); align-items: center; }

/* ── Badges / Statuses ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-draft     { background: var(--gray-100);          color: var(--status-draft); }
.badge-sent      { background: var(--color-info-bg);     color: var(--status-sent); }
.badge-confirmed { background: var(--color-success-bg);  color: var(--status-confirmed); }
.badge-cancelled { background: var(--color-error-bg);    color: var(--status-cancelled); }
.badge-admin     { background: #EDE9FE; color: #7C3AED; }
.badge-agent     { background: var(--color-info-bg); color: var(--color-info); }

/* ── Section Headers ────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-6);
  flex-wrap: wrap;
  gap: var(--s-4);
}
.section-title {
  font-family: var(--brand-font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
}
.section-subtitle {
  font-size: 0.9rem;
  color: var(--gray-400);
  margin-top: 2px;
}

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--s-16) var(--s-8);
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--s-5);
  color: var(--gray-300);
}
.empty-state-title {
  font-family: var(--brand-font-heading);
  font-size: 1.25rem;
  color: var(--gray-600);
  margin-bottom: var(--s-2);
}
.empty-state-text { font-size: 0.9rem; color: var(--gray-400); margin-bottom: var(--s-6); }

/* ── Modals ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-md);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px) scale(0.98);
  transition: transform var(--transition-md);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal.modal-lg { max-width: 860px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-6) var(--s-6) var(--s-5);
}
.modal-title {
  font-family: var(--brand-font-heading);
  font-size: 1.25rem;
  font-weight: 600;
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r-full);
  background: var(--gray-100);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  transition: background var(--transition);
  font-size: 1rem;
}
.modal-close:hover { background: var(--gray-200); }
.modal-body { padding: 0 var(--s-6) var(--s-6); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--gray-100);
}

/* ── Photo Grid (Library) ───────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--s-4);
}
.photo-card {
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--gray-100);
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.photo-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.photo-card.selected { border-color: var(--brand-accent); }
.photo-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.photo-card-info {
  padding: var(--s-2) var(--s-3);
  background: #fff;
}
.photo-card-name { font-size: 0.78rem; color: var(--gray-600); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-card-tag  { font-size: 0.7rem; color: var(--gray-400); }
.photo-card-actions {
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  display: flex;
  gap: var(--s-1);
  opacity: 0;
  transition: opacity var(--transition);
}
.photo-card:hover .photo-card-actions { opacity: 1; }

/* ── Upload Zone ────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--r-lg);
  padding: var(--s-10) var(--s-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--gray-50);
  position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--brand-primary-light);
  background: var(--color-info-bg);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-zone-icon { font-size: 2.5rem; margin-bottom: var(--s-3); }
.upload-zone-text { font-size: 0.95rem; color: var(--gray-500); }
.upload-zone-hint { font-size: 0.8rem; color: var(--gray-400); margin-top: var(--s-1); }

/* ── Star Rating ────────────────────────────────────────── */
.stars { color: var(--brand-accent); letter-spacing: 1px; font-size: 0.9rem; }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--gray-100);
  border-radius: var(--r-md);
  padding: 4px;
  width: fit-content;
  margin-bottom: var(--s-6);
}
.tab-btn {
  padding: var(--s-2) var(--s-5);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all var(--transition);
}
.tab-btn.active {
  background: #fff;
  color: var(--brand-primary);
  box-shadow: var(--shadow-xs);
}

/* ── Builder Specific ───────────────────────────────────── */
.builder-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--s-6);
  align-items: start;
}
.builder-days { display: flex; flex-direction: column; gap: var(--s-4); }

.day-card {
  background: #fff;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--gray-200);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.day-card.dragging { box-shadow: var(--shadow-xl); opacity: 0.9; }
.day-card-header {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}
.day-card.open .day-card-header {
  border-bottom-color: var(--gray-100);
  background: var(--gray-50);
}
.day-number {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--brand-font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  flex-shrink: 0;
}
.day-card-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--gray-800);
}
.day-card-meta { font-size: 0.8rem; color: var(--gray-400); margin-top: 2px; }
.day-drag-handle {
  color: var(--gray-300);
  cursor: grab;
  padding: var(--s-2);
}
.day-toggle-icon {
  color: var(--gray-400);
  transition: transform var(--transition);
}
.day-card.open .day-toggle-icon { transform: rotate(180deg); }

.day-card-body { padding: var(--s-5); display: none; }
.day-card.open .day-card-body { display: block; }

.activity-list { display: flex; flex-direction: column; gap: var(--s-3); }
.activity-item {
  display: grid;
  grid-template-columns: auto 36px 1fr 1fr auto;
  gap: var(--s-2);
  align-items: center;
  background: var(--gray-50);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--gray-200);
}
.activity-drag { color: var(--gray-300); cursor: grab; }

.icon-picker {
  width: 36px; height: 36px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-sm);
  background: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.photos-selected {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.photo-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid var(--gray-200);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb-remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  background: rgba(220,38,38,0.85);
  color: #fff;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Sidebar sticky panel */
.builder-sidebar-panel {
  position: sticky;
  top: calc(var(--topbar-h) + var(--s-8));
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

/* Pricing rows */
.pricing-rows { display: flex; flex-direction: column; gap: var(--s-3); }
.pricing-row {
  display: grid;
  grid-template-columns: 1fr 120px auto auto;
  gap: var(--s-2);
  align-items: center;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3);
}
.pricing-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-3) var(--s-4);
  background: var(--brand-primary);
  border-radius: var(--r-md);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  margin-top: var(--s-2);
}

/* ── Template Picker (PDF) ──────────────────────────────── */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
  margin: var(--s-4) 0;
}
.template-option {
  border: 2.5px solid var(--gray-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.template-option:hover { border-color: var(--brand-primary-light); box-shadow: var(--shadow-md); }
.template-option.selected { border-color: var(--brand-accent); box-shadow: 0 0 0 4px rgba(201,168,76,0.2); }
.template-option input { position: absolute; opacity: 0; pointer-events: none; }
.template-preview {
  height: 140px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.template-preview img { width: 100%; height: 100%; object-fit: cover; }
.template-label {
  padding: var(--s-3);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-700);
}
.template-sublabel { font-size: 0.72rem; color: var(--gray-400); font-weight: 400; }
.template-check {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  background: var(--brand-accent);
  border-radius: 50%;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity var(--transition);
}
.template-option.selected .template-check { opacity: 1; }

/* ── Login Page ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-visual {
  background: var(--brand-primary-dark);
  background-image: linear-gradient(135deg, var(--brand-primary-dark) 0%, var(--brand-primary) 60%, var(--brand-primary-light) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-12);
  position: relative;
  overflow: hidden;
}
.login-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-visual-content { position: relative; text-align: center; max-width: 380px; }
.login-visual-logo {
  width: 72px; height: 72px;
  background: rgba(255,255,255,0.12);
  border-radius: var(--r-xl);
  margin: 0 auto var(--s-6);
  display: flex; align-items: center; justify-content: center;
}
.login-visual-title {
  font-family: var(--brand-font-heading);
  font-size: 2.25rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: var(--s-3);
}
.login-visual-text { color: rgba(255,255,255,0.6); font-size: 1rem; line-height: 1.7; }
.login-visual-dots {
  display: flex;
  gap: var(--s-2);
  justify-content: center;
  margin-top: var(--s-8);
}
.login-visual-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
}
.login-visual-dots span:first-child { background: var(--brand-accent); width: 24px; border-radius: var(--r-full); }

.login-form-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-12);
  background: #fff;
}
.login-form-wrap { width: 100%; max-width: 380px; }
.login-heading {
  font-family: var(--brand-font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: var(--s-2);
}
.login-subheading { color: var(--gray-400); margin-bottom: var(--s-8); font-size: 0.95rem; }
.login-form .form-label { font-size: 0.875rem; }
.login-form .form-control { padding: 0.75rem var(--s-4); font-size: 0.95rem; }

/* ── Dashboard ──────────────────────────────────────────── */
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--s-5);
}
.itin-card {
  background: #fff;
  border-radius: var(--r-lg);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}
.itin-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.itin-card-cover {
  height: 120px;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-light) 100%);
  position: relative;
  overflow: hidden;
}
.itin-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.itin-card-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 60%);
}
.itin-card-cover-status {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
}
.itin-card-body {
  padding: var(--s-4) var(--s-5);
  flex: 1;
}
.itin-card-title {
  font-family: var(--brand-font-heading);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--s-1);
}
.itin-card-client { font-size: 0.825rem; color: var(--gray-400); margin-bottom: var(--s-3); }
.itin-card-meta {
  display: flex;
  gap: var(--s-4);
  font-size: 0.8rem;
  color: var(--gray-500);
}
.itin-card-footer {
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: var(--s-2);
}

/* ── Utility ────────────────────────────────────────────── */
.text-muted   { color: var(--gray-400); }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.78rem; }
.font-heading { font-family: var(--brand-font-heading); }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-2        { gap: var(--s-2); }
.gap-3        { gap: var(--s-3); }
.gap-4        { gap: var(--s-4); }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-4  { margin-top: var(--s-4); }
.mt-6  { margin-top: var(--s-6); }
.mt-8  { margin-top: var(--s-8); }
.mb-4  { margin-bottom: var(--s-4); }
.mb-6  { margin-bottom: var(--s-6); }
.mb-8  { margin-bottom: var(--s-8); }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Tooltip ────────────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: #fff;
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 999;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
