/* ─────────────────────────────────────────────────────────────
   VitalDocSafe design system
   Fonts: Sora (display) + Space Grotesk (body) — distinctive, modern.
   Light theme, bold facet colors, rounded buttons, soft drop shadows.
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --ink: #16182b;
  --ink-soft: #515571;
  --muted: #8a8fab;
  --line: #e7eaf3;
  --primary: #0091ff;
  --primary-ink: #006fd6;
  --accent: #8e4ec6;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(22, 24, 43, 0.06);
  --shadow: 0 10px 30px rgba(22, 24, 43, 0.10);
  --shadow-lg: 0 24px 60px rgba(22, 24, 43, 0.16);
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: clamp(2rem, 4vw, 3.3rem); margin: 0 0 0.5em; font-weight: 800; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; margin: 0 0 0.3em; }
a { color: var(--primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 1em; }

.container { width: min(1140px, 92vw); margin: 0 auto; }
.section { padding: 64px 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 60ch; }
.eyebrow { display: inline-block; font-weight: 600; color: var(--primary-ink); background: #e3f1ff; padding: 6px 14px; border-radius: var(--radius-pill); font-size: 0.85rem; margin-bottom: 18px; }
.section-title { text-align: center; margin-bottom: 6px; }
.section-sub { text-align: center; color: var(--ink-soft); margin-bottom: 36px; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.98rem;
  padding: 11px 20px; border-radius: var(--radius-pill); border: 1.5px solid transparent;
  cursor: pointer; transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(0, 145, 255, 0.32); }
.btn-primary:hover { background: var(--primary-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-ink); }
.btn-danger { background: #fff0f1; color: #c8232c; border-color: #f7c9cd; }
.btn-danger:hover { background: #c8232c; color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }

/* ── Header / nav ──────────────────────────────────────── */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(246, 248, 252, 0.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: 24px; padding: 14px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.3rem; color: var(--ink); }
.brand img { border-radius: 8px; }
.nav-links { display: flex; gap: 22px; margin-left: 12px; }
.nav-link { color: var(--ink-soft); font-weight: 500; }
.nav-link:hover { color: var(--ink); text-decoration: none; }
.nav-actions { margin-left: auto; display: flex; gap: 12px; align-items: center; }

/* ── Hero ──────────────────────────────────────────────── */
.hero { padding: 72px 0 40px; background: radial-gradient(1100px 500px at 80% -10%, #e3f1ff 0%, transparent 60%); }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center; }
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 28px 0 14px; }
.hero-art .tile-grid.mini { grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mini-tile { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; font-weight: 600; font-size: 0.9rem; border-top: 4px solid var(--c); }
.mini-ico { width: 30px; height: 30px; border-radius: 9px; opacity: 0.9; }

/* ── Chips ─────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 8px 16px; font-weight: 600; font-size: 0.9rem; box-shadow: var(--shadow-sm); }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ── Feature cards ─────────────────────────────────────── */
.features-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature-card { background: var(--surface); border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.section-cta { background: linear-gradient(135deg, #0091ff, #8e4ec6); color: #fff; text-align: center; padding: 72px 0; }
.section-cta h2 { color: #fff; margin-bottom: 24px; }

/* ── Tile grids (facets) ───────────────────────────────── */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.info-tile { position: relative; background: var(--surface); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.info-tile-bar { position: absolute; inset: 0 0 auto 0; height: 5px; }

/* ── Pricing ───────────────────────────────────────────── */
.pricing-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; max-width: 820px; margin: 36px auto 0; }
.price-card { background: var(--surface); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); border: 1px solid var(--line); position: relative; }
.price-card-featured { border: 2px solid var(--primary); box-shadow: var(--shadow-lg); }
.badge { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; padding: 5px 14px; border-radius: var(--radius-pill); font-size: 0.8rem; font-weight: 600; }
.price { font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; margin: 6px 0 16px; }
.check-list { list-style: none; padding: 0; margin: 0 0 24px; }
.check-list li { padding: 8px 0 8px 28px; position: relative; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: #30a46c; font-weight: 800; }

/* ── Prose / footer ────────────────────────────────────── */
.prose { max-width: 760px; }
.prose h2 { margin-top: 32px; }
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 48px 0 24px; margin-top: 48px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 24px; }
.footer-grid h4 { margin: 0 0 10px; }
.footer-grid nav a { display: block; color: var(--ink-soft); padding: 4px 0; }
.brand-footer { font-size: 1.1rem; }
.footer-bottom { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ── Forms ─────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.form label, .field label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9rem; color: var(--ink-soft); }
input, select, textarea {
  font-family: var(--font-body); font-size: 1rem; padding: 11px 14px; border: 1.5px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,145,255,0.15); }
textarea { resize: vertical; min-height: 76px; }
.form-error { color: #c8232c; font-size: 0.9rem; min-height: 1.1em; }

/* ── Auth pages ────────────────────────────────────────── */
.page-auth { background: radial-gradient(900px 500px at 50% -10%, #e3f1ff 0%, var(--bg) 55%); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 36px; width: min(440px, 92vw); text-align: center; border: 1px solid var(--line); }
.auth-card.wide { width: min(820px, 94vw); text-align: left; }
.auth-card h1 { font-size: 1.7rem; }
.auth-card .form { text-align: left; }
.center-brand { justify-content: center; margin-bottom: 18px; }

.kv { width: 100%; border-collapse: collapse; margin-top: 10px; }
.kv th { text-align: left; text-transform: capitalize; color: var(--muted); font-weight: 600; padding: 6px 12px 6px 0; vertical-align: top; width: 40%; font-size: 0.85rem; }
.kv td { padding: 6px 0; }

/* ─────────────────────────────────────────────────────────
   App / dashboard
   ───────────────────────────────────────────────────────── */
.page-app { background: var(--bg); }
.app-loading { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }
.app-shell { min-height: 100vh; }

.app-header { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,0.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.app-header-inner { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.app-nav-btn { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.plan-pill { font-size: 0.78rem; font-weight: 700; padding: 5px 12px; border-radius: var(--radius-pill); }
.plan-trial { background: #fff4e0; color: #b5660a; }
.plan-active { background: #e4f7ec; color: #1c7a48; }

.app-main { padding: 28px 0 80px; }
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); margin-bottom: 18px; font-size: 0.9rem; }
.crumbs a { color: var(--muted); }

.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }

/* Facet tiles on the main dashboard */
.facet-tile {
  position: relative; display: block; background: var(--surface); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--line);
  cursor: pointer; transition: transform .12s ease, box-shadow .18s ease; text-align: left; color: var(--ink);
  border-top: 5px solid var(--c);
}
.facet-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.facet-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.2rem; margin-bottom: 14px; background: var(--c); }
.facet-tile h3 { margin: 0; }
.facet-tile .tagline { color: var(--ink-soft); font-size: 0.9rem; margin: 4px 0 14px; }
.facet-count { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.85rem; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); padding: 5px 12px; border-radius: var(--radius-pill); }

.special-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-top: 20px; }

/* Sub-dashboard */
.sub-toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.record-card { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--line); border-left: 5px solid var(--c); }
.record-card h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.record-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.tag { font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-ico { font-size: 2.4rem; margin-bottom: 8px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(22,24,43,0.45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(560px, 95vw); max-height: 90vh; overflow: auto; padding: 28px; }
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.field { margin-bottom: 14px; }
.field input, .field select, .field textarea { width: 100%; }
.save-state { font-size: 0.82rem; color: var(--muted); }
.save-state.saved { color: #1c7a48; }

/* Toast */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: #fff; padding: 13px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; max-width: 340px; animation: slideIn .2s ease; }
.toast.success { background: #1c7a48; }
.toast.error { background: #c8232c; }
.toast.info { background: var(--primary-ink); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Account / settings */
.settings-grid { display: grid; grid-template-columns: 220px 1fr; gap: 28px; }
.settings-nav { display: flex; flex-direction: column; gap: 4px; }
.settings-nav button { text-align: left; background: none; border: none; padding: 11px 14px; border-radius: 12px; font-family: var(--font-body); font-size: 0.95rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.settings-nav button.active { background: #e3f1ff; color: var(--primary-ink); }
.panel { background: var(--surface); border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow); border: 1px solid var(--line); margin-bottom: 20px; }
.panel.danger { border-color: #f7c9cd; }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.danger-row:last-child { border-bottom: none; }

/* Upload dropzone */
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius-lg); padding: 36px; text-align: center; cursor: pointer; transition: border-color .15s ease, background .15s ease; background: var(--surface); }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: #f3f9ff; }

/* AI assistant */
.chat-wrap { display: flex; flex-direction: column; height: 60vh; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 8px; }
.bubble { max-width: 80%; padding: 12px 16px; border-radius: 16px; white-space: pre-wrap; line-height: 1.5; }
.bubble.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.bubble.assistant { align-self: flex-start; background: #eef1f8; color: var(--ink); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 10px; margin-top: 12px; }
.chat-input input { flex: 1; }

/* Upsell banner */
.upsell { background: linear-gradient(135deg, #fff7e8, #ffeede); border: 1px solid #ffd9a8; border-radius: var(--radius-lg); padding: 18px 22px; display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 22px; }

@media (max-width: 860px) {
  .hero-grid, .features-3, .pricing-grid, .footer-grid, .settings-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .hero-art { display: none; }
}
