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

/* ===== CSS Variables (Design Tokens) ===== */
:root {
  --background: #f5f7fa;
  --foreground: #1a2332;
  --card: #ffffff;
  --card-foreground: #1a2332;
  --primary: #0f4e80;
  --primary-foreground: #ffffff;
  --secondary: #eef1f5;
  --secondary-foreground: #0f4e80;
  --muted: #f0f2f5;
  --muted-foreground: #6b7a8d;
  --accent: #e9555c;
  --accent-foreground: #ffffff;
  --border: #e2e6eb;
  --input: #e2e6eb;
  --ring: #0f4e80;
  --success: #2d9d6f;
  --success-foreground: #ffffff;
  --warning: #f59e0b;
  --warning-foreground: #ffffff;
  --radius: 0.625rem;
  --destructive: #e9555c;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; border-color: var(--border); }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ===== Layout ===== */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.col-span-2 { grid-column: span 2; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.min-h-screen { min-height: 100vh; }
.hidden { display: none !important; }
.relative { position: relative; }
.absolute { position: absolute; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shrink-0 { flex-shrink: 0; }
.cursor-pointer { cursor: pointer; }
.overflow-auto { overflow: auto; }
.overflow-y-auto { overflow-y: auto; }

/* ===== Spacing Utilities ===== */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }

/* ===== Typography ===== */
h1 { font-size: 1.875rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.italic { font-style: italic; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-tight { letter-spacing: -0.025em; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.625; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.font-sans { font-family: 'Inter', sans-serif; }
.font-serif { font-family: Georgia, 'Times New Roman', serif; }

/* ===== Colors ===== */
.text-foreground { color: var(--foreground); }
.text-muted-foreground { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-destructive { color: var(--destructive); }
.bg-background { background-color: var(--background); }
.bg-card { background-color: var(--card); }
.bg-muted { background-color: var(--muted); }
.bg-primary { background-color: var(--primary); }
.bg-secondary { background-color: var(--secondary); }

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.header .container {
  display: flex;
  height: 4rem;
  align-items: center;
  justify-content: space-between;
}
.header-logo { height: 2rem; }

/* ===== Badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  transition: background-color 0.15s;
}
.badge-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge-outline { background: transparent; border: 1px solid var(--border); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-success { background: rgba(45,157,111,0.15); color: var(--success); border: 1px solid rgba(45,157,111,0.3); }
.badge-muted { background: var(--muted); color: var(--muted-foreground); }

/* ===== Button ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  height: 2.5rem;
  padding: 0.5rem 1rem;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn svg { width: 1rem; height: 1rem; flex-shrink: 0; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { opacity: 0.9; }
.btn-accent { background: var(--accent); color: var(--accent-foreground); font-weight: 600; }
.btn-accent:hover { opacity: 0.9; }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { opacity: 0.8; }
.btn-outline { background: var(--card); color: var(--foreground); border: 1px solid var(--input); }
.btn-outline:hover { background: var(--muted); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--muted); }
.btn-success { background: var(--success); color: var(--success-foreground); }
.btn-sm { height: 2.25rem; padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { height: 2.75rem; padding: 0.5rem 2rem; font-size: 1rem; }
.btn-icon { height: 2.5rem; width: 2.5rem; padding: 0; }
.btn-icon.btn-sm { height: 1.5rem; width: 1.5rem; }

/* ===== Card ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--card-foreground);
}
.card-shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06); }
.card-shadow-md { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06); }
.card-header { padding: 1.5rem 1.5rem 1rem; }
.card-content { padding: 0 1.5rem 1.5rem; }
.card-title { font-size: 1.125rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }

/* ===== Input / Form ===== */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  margin-bottom: 0.5rem;
}
.form-input {
  display: flex;
  width: 100%;
  height: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background: var(--card);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  outline: none;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.form-input::placeholder { color: var(--muted-foreground); }
.form-input:focus { border-color: var(--ring); box-shadow: 0 0 0 2px rgba(15,78,128,0.15); }
.form-input:disabled { opacity: 0.5; cursor: not-allowed; }
textarea.form-input { height: auto; min-height: 4rem; resize: vertical; }

/* ===== Select ===== */
.form-select {
  display: flex;
  width: 100%;
  height: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background: var(--card);
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7a8d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.form-select:focus { border-color: var(--ring); box-shadow: 0 0 0 2px rgba(15,78,128,0.15); }

/* ===== Switch ===== */
.switch-container { display: flex; align-items: center; gap: 0.75rem; }
.switch {
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  background: var(--muted);
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.switch.active { background: var(--primary); border-color: var(--primary); }
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.125rem;
  height: 1.125rem;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch.active .switch-thumb { transform: translateX(1.25rem); }

/* ===== Tabs ===== */
.tabs-list {
  display: inline-flex;
  background: var(--muted);
  border-radius: var(--radius);
  padding: 0.25rem;
  gap: 0.125rem;
}
.tab-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-trigger:hover { color: var(--foreground); }
.tab-trigger.active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Table ===== */
.table-wrapper { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr { border-bottom: 1px solid var(--border); }
th { padding: 0.75rem 1rem; text-align: left; font-weight: 500; color: var(--muted-foreground); font-size: 0.8125rem; }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: rgba(0,0,0,0.02); }
tbody tr.cursor-pointer { cursor: pointer; }

/* ===== Progress Bar (Onboarding Steps) ===== */
.progress-bar { display: flex; align-items: flex-start; padding: 1.5rem 0; }
.progress-step { display: flex; flex: 1; align-items: flex-start; }
.progress-step-inner { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 80px; }
.progress-circle {
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
}
.progress-circle.completed { background: var(--primary); color: var(--primary-foreground); }
.progress-circle.active { border: 2px solid var(--primary); color: var(--primary); background: rgba(15,78,128,0.1); }
.progress-circle.pending { background: var(--muted); color: var(--muted-foreground); }
.progress-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-align: center;
  margin-top: 0.5rem;
  line-height: 1.25;
  width: 100%;
}
.progress-label.active { color: var(--primary); }
.progress-label.inactive { color: var(--muted-foreground); }
.progress-line { height: 2px; flex: 1; border-radius: 1px; margin-top: 1.25rem; margin-left: 0.25rem; margin-right: 0.25rem; }
.progress-line.completed { background: var(--primary); }
.progress-line.pending { background: var(--border); }

/* ===== Toast ===== */
.toast-container { position: fixed; bottom: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 0.3s ease;
  max-width: 24rem;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--destructive); }
.toast-info { border-left: 3px solid var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }
@keyframes fadeIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn 0.3s ease; }

/* ===== Dialog / Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: fadeInOverlay 0.2s ease;
}
@keyframes fadeInOverlay { from { opacity:0; } to { opacity:1; } }
.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 28rem;
  margin: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  animation: fadeIn 0.2s ease;
}
.modal-header { padding: 1.5rem 1.5rem 0; }
.modal-title { font-size: 1.125rem; font-weight: 600; }
.modal-body { padding: 1rem 1.5rem 1.5rem; }

/* ===== Drag Drop Zone ===== */
.drop-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  transition: all 0.15s;
  background: rgba(0,0,0,0.01);
}
.drop-zone.drag-active { border-color: var(--primary); background: rgba(15,78,128,0.05); }
.drop-zone input[type="file"] { position: absolute; inset: 0; cursor: pointer; opacity: 0; }

/* ===== Signature Canvas ===== */
.signature-canvas-wrapper { position: relative; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); }
.signature-canvas { width: 100%; cursor: crosshair; display: block; }
.signature-preview { border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); padding: 1rem; text-align: center; }
.signature-text { font-size: 1.5rem; font-style: italic; color: var(--primary); font-family: Georgia, serif; }

/* ===== OTP Input ===== */
.otp-input {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  text-align: center;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  outline: none;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.otp-input:focus { border-color: var(--ring); box-shadow: 0 0 0 2px rgba(15,78,128,0.15); }

/* ===== Empty State ===== */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 5rem 1rem; }
.empty-state-icon { border-radius: 50%; background: var(--secondary); padding: 1.5rem; margin-bottom: 1.5rem; }
.empty-state-icon svg { width: 3rem; height: 3rem; color: var(--primary); }

/* ===== Rounded Info Box ===== */
.info-box {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem;
}
.info-box-muted { background: rgba(0,0,0,0.015); }
.info-box-primary { background: rgba(15,78,128,0.05); }
.info-box-success { background: rgba(45,157,111,0.1); }

/* ===== Product Badge ===== */
.product-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-radius: var(--radius);
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}
.product-badge button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: inherit;
  transition: color 0.15s;
}
.product-badge button:hover { color: var(--destructive); }

/* ===== Popover / Calendar ===== */
.popover-trigger { position: relative; }
.calendar-popover {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 60;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  padding: 0.75rem;
  margin-top: 0.25rem;
}
.calendar-popover table { font-size: 0.8125rem; }
.calendar-popover th { padding: 0.25rem 0.5rem; font-weight: 500; color: var(--muted-foreground); text-align: center; }
.calendar-popover td { padding: 0.125rem; }
.calendar-popover td button {
  width: 2rem; height: 2rem; border: none; background: transparent; border-radius: var(--radius);
  cursor: pointer; font-size: 0.8125rem; color: var(--foreground); transition: all 0.1s;
}
.calendar-popover td button:hover { background: var(--muted); }
.calendar-popover td button.today { border: 1px solid var(--primary); }
.calendar-popover td button.selected { background: var(--primary); color: var(--primary-foreground); }
.calendar-popover td button.other-month { color: var(--muted-foreground); opacity: 0.5; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.calendar-header button { background: none; border: none; cursor: pointer; padding: 0.25rem; color: var(--muted-foreground); }
.calendar-header button:hover { color: var(--foreground); }
.calendar-header span { font-size: 0.875rem; font-weight: 600; }

/* ===== Landing Page Cards ===== */
.landing-card {
  cursor: pointer;
  border: 2px solid var(--border);
  transition: border-color 0.2s;
}
.landing-card:hover { border-color: var(--primary); }
.landing-card.accent-card:hover { border-color: var(--accent); }
.icon-circle { border-radius: 50%; padding: 1rem; display: inline-flex; }
.icon-circle-primary { background: rgba(15,78,128,0.1); }
.icon-circle-accent { background: rgba(233,85,92,0.1); }

/* ===== Client Toggle ===== */
.client-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem;
  background: rgba(0,0,0,0.015);
}

/* ===== Share Button (Fixed) ===== */
.share-btn {
  position: fixed;
  top: 5rem;
  right: 1.5rem;
  z-index: 40;
}

/* ===== Section separator ===== */
.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.75rem;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .grid-cols-2 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .tabs-list { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
  .tab-trigger { font-size: 0.75rem; padding: 0.5rem 0.25rem; }
  .progress-step-inner { width: 60px; }
  .progress-circle { width: 2rem; height: 2rem; font-size: 0.75rem; }
  .progress-label { font-size: 0.5625rem; }
  .otp-input { width: 2.5rem; height: 2.5rem; }
  .share-btn { top: 4.5rem; right: 0.5rem; }
  .landing-cards { grid-template-columns: 1fr !important; }
}
