/* MedStore Hub — clean medical SaaS UI */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --brand-soft: #ccfbf1;
  --accent: #2563eb;
  --warn: #d97706;
  --danger: #dc2626;
  --ok: #16a34a;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --sidebar: 260px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); min-height: 100%; }
button, input, select, textarea { font: inherit; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* Landing */
.landing {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, #99f6e4 0%, transparent 50%),
    radial-gradient(900px 400px at 100% 0%, #bfdbfe 0%, transparent 45%),
    var(--bg);
}
.topbar {
  max-width: 1120px; margin: 0 auto; padding: 1.1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.logo { display: flex; align-items: center; gap: .65rem; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #0891b2);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .95rem;
}
.hero { max-width: 1120px; margin: 0 auto; padding: 2rem 1.25rem 3rem; display: grid; grid-template-columns: 1.15fr .85fr; gap: 2rem; align-items: center; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.15; margin: 0 0 1rem; letter-spacing: -0.02em; }
.hero p.lead { color: var(--muted); font-size: 1.08rem; line-height: 1.6; margin: 0 0 1.5rem; }
.pill-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.pill { background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: .35rem .75rem; font-size: .82rem; font-weight: 600; }
.btn {
  border: none; border-radius: 10px; padding: .7rem 1.1rem; font-weight: 650; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  transition: .15s ease; background: var(--line); color: var(--ink);
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-danger { background: #fef2f2; color: var(--danger); }
.btn-sm { padding: .4rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }

.login-card {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: 1.4rem;
}
.login-card h2 { margin: 0 0 .25rem; font-size: 1.25rem; }
.login-card .sub { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 1rem; }
.tab {
  flex: 1; border: none; background: transparent; padding: .55rem; border-radius: 8px;
  font-weight: 650; color: var(--muted); cursor: pointer;
}
.tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.field { margin-bottom: .85rem; }
.field label { display: block; font-size: .82rem; font-weight: 650; margin-bottom: .3rem; color: #334155; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: .65rem .75rem;
  background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid #99f6e4; border-color: var(--brand);
}
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.demo-box {
  margin-top: 1rem; background: #f8fafc; border: 1px dashed var(--line); border-radius: 10px;
  padding: .75rem; font-size: .8rem; color: var(--muted); line-height: 1.45;
}
.demo-box strong { color: var(--ink); }
.alert {
  border-radius: 10px; padding: .7rem .85rem; font-size: .9rem; margin-bottom: .85rem;
}
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.features {
  max-width: 1120px; margin: 0 auto; padding: 0 1.25rem 3rem;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
}
.feature {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; box-shadow: 0 4px 14px rgba(15,23,42,.04);
}
.feature h3 { margin: 0 0 .4rem; font-size: 1rem; }
.feature p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.feature .ico { font-size: 1.4rem; margin-bottom: .4rem; }

.pricing {
  max-width: 1120px; margin: 0 auto; padding: 0 1.25rem 4rem;
}
.pricing h2 { text-align: center; margin-bottom: .4rem; }
.pricing .sub { text-align: center; color: var(--muted); margin-bottom: 1.5rem; }
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.price-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; position: relative;
}
.price-card.featured { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.price-card h3 { margin: 0; }
.price-card .price { font-size: 1.8rem; font-weight: 800; margin: .5rem 0; }
.price-card .price span { font-size: .9rem; font-weight: 500; color: var(--muted); }
.price-card ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: .9rem; line-height: 1.7; }

/* App shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar {
  background: #0f172a; color: #e2e8f0; padding: 1rem .85rem; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: center; gap: .6rem; padding: .5rem .55rem 1rem; font-weight: 800; }
.sidebar .brand .logo-mark { width: 34px; height: 34px; font-size: .85rem; }
.nav-btn {
  width: 100%; text-align: left; background: transparent; border: none; color: #cbd5e1;
  padding: .7rem .75rem; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .92rem;
  margin-bottom: .2rem;
}
.nav-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-btn.active { background: rgba(13,148,136,.25); color: #5eead4; }
.sidebar .spacer { flex: 1; }
.sidebar .user-box {
  border-top: 1px solid rgba(255,255,255,.08); padding-top: .85rem; margin-top: .5rem;
  font-size: .82rem; color: #94a3b8;
}
.sidebar .user-box strong { display: block; color: #f8fafc; font-size: .9rem; margin-bottom: .15rem; }

.main { padding: 1.25rem 1.4rem 2.5rem; min-width: 0; }
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.15rem;
}
.page-head h1 { margin: 0; font-size: 1.45rem; letter-spacing: -0.02em; }
.page-head p { margin: .25rem 0 0; color: var(--muted); font-size: .92rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.1rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem;
}
.stat .label { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.45rem; font-weight: 800; margin-top: .2rem; }
.stat .value.ok { color: var(--ok); }
.stat .value.warn { color: var(--warn); }
.stat .value.danger { color: var(--danger); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem; box-shadow: 0 4px 14px rgba(15,23,42,.03);
}
.card h2 { margin: 0 0 .85rem; font-size: 1.05rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.card-head h2 { margin: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
th, td { padding: .7rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f8fafc; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafcff; }

.badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: .15rem .55rem;
  font-size: .75rem; font-weight: 700;
}
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-muted { background: #f1f5f9; color: #475569; }

.toolbar { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: .9rem; align-items: center; }
.toolbar input, .toolbar select {
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; background: #fff; min-width: 180px;
}

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center;
  z-index: 50; padding: 1rem;
}
.modal {
  background: #fff; border-radius: 16px; width: min(640px, 100%); max-height: 90vh; overflow: auto;
  box-shadow: 0 25px 50px rgba(0,0,0,.2); padding: 1.2rem;
}
.modal.wide { width: min(920px, 100%); }
.modal h3 { margin: 0 0 .25rem; }
.modal .sub { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }

.split-form { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.split-form .full { grid-column: 1 / -1; }

.dropzone {
  border: 2px dashed #99f6e4; background: #f0fdfa; border-radius: 14px; padding: 1.25rem;
  text-align: center; cursor: pointer; color: var(--brand-dark);
}
.dropzone:hover { background: #ccfbf1; }
.dropzone input { display: none; }
.preview-img { max-width: 100%; max-height: 220px; border-radius: 10px; margin-top: .75rem; border: 1px solid var(--line); }

.rx-item {
  border: 1px solid var(--line); border-radius: 12px; padding: .85rem; margin-bottom: .65rem; background: #fff;
}
.rx-item h4 { margin: 0 0 .25rem; font-size: .98rem; }
.rx-meta { color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.alts { margin-top: .5rem; padding: .55rem .7rem; background: #f8fafc; border-radius: 8px; font-size: .85rem; }
.alts strong { color: var(--brand-dark); }

/* Printable bill */
.bill-print {
  background: #fff; color: #000; border: 1px solid #cbd5e1; border-radius: 8px; padding: 1.25rem;
  max-width: 800px; margin: 0 auto; font-size: 13px;
}
.bill-print .store-head { text-align: center; border-bottom: 2px solid #0f172a; padding-bottom: .75rem; margin-bottom: .75rem; }
.bill-print .store-head h2 { margin: 0; font-size: 1.3rem; }
.bill-print .meta { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; font-size: 12px; }
.bill-print table { width: 100%; border-collapse: collapse; }
.bill-print th, .bill-print td { border: 1px solid #94a3b8; padding: 6px; font-size: 12px; }
.bill-print th { background: #f1f5f9; }
.bill-print .totals { margin-top: .75rem; text-align: right; }
.bill-print .totals div { margin: .15rem 0; }
.bill-print .grand { font-size: 1.1rem; font-weight: 800; }

.empty {
  text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .95rem;
}

@media (max-width: 960px) {
  .hero, .features, .price-grid, .grid-2, .grid-3, .split-form { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: .35rem; padding: .75rem;
  }
  .sidebar .brand { padding: .25rem; }
  .sidebar .spacer, .sidebar .user-box .muted-only { display: none; }
  .nav-btn { width: auto; padding: .45rem .65rem; font-size: .8rem; }
  .main { padding: 1rem; }
}

@media print {
  body * { visibility: hidden; }
  #print-root, #print-root * { visibility: visible; }
  #print-root { position: absolute; left: 0; top: 0; width: 100%; }
  .no-print { display: none !important; }
}
