:root {
  --navy: #12306b; --green: #0f7040; --ink: #16202e; --muted: #4a5568;
  --bg: #fff; --soft: #f1f5fb; --line: #d5deec; --radius: 12px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 150px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1.125rem/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif; }
img { max-width: 100%; display: block; }
a { color: var(--navy); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #f0a500; outline-offset: 2px; }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 20; background: #fff; padding: 10px; }

.top { position: -webkit-sticky; position: sticky; top: 0; z-index: 10; background: #fff; border-top: 5px solid var(--green); box-shadow: 0 2px 8px rgba(18, 48, 107, .12); padding-top: env(safe-area-inset-top); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; line-height: 1.25; }
.brand strong { display: block; font-size: 1.2rem; }
.brand small { display: block; color: var(--muted); font-size: .82rem; }
.lang { min-height: 48px; min-width: 84px; font-family: inherit; font-weight: 600; font-size: 1rem; line-height: 1; color: var(--navy); background: #fff; border: 2px solid var(--navy); border-radius: var(--radius); cursor: pointer; }
nav { position: -webkit-sticky; position: sticky; top: calc(77px + env(safe-area-inset-top)); z-index: 9; background: var(--navy); }
nav .wrap { display: flex; }
nav a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; color: #fff; text-decoration: none; font-weight: 600; }
nav a:hover { background: rgba(255, 255, 255, .15); }
nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

section { padding: 40px 0; }
section.alt { background: var(--soft); }
h1, h2, h3 { color: var(--navy); line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: clamp(1.9rem, 6vw, 2.8rem); }
h2 { font-size: clamp(1.45rem, 4.5vw, 1.9rem); padding-bottom: 8px; border-bottom: 4px solid var(--green); }
h3 { font-size: 1.2rem; }

.hero { background: linear-gradient(135deg, var(--navy), #1d4a9e); color: #fff; }
.hero h1 { color: #fff; }
.badge { display: inline-block; background: var(--green); margin: 0 0 12px; padding: 6px 16px; border-radius: 99px; font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35em; min-height: 52px; padding: 10px 22px; border: 2px solid var(--green); border-radius: var(--radius); background: var(--green); color: #fff; font-family: inherit; font-weight: 700; font-size: 1.05rem; line-height: 1.2; text-decoration: none; cursor: pointer; }
.btn.light { background: #fff; border-color: #fff; color: var(--navy); }
.btn.ghost { background: #fff; color: var(--green); }

label { display: block; font-weight: 700; margin-bottom: 6px; }
input[type="search"] { width: 100%; min-height: 56px; padding: 10px 16px; font: inherit; font-size: 1.15rem; border: 2px solid var(--navy); border-radius: var(--radius); -webkit-appearance: none; appearance: none; background: #fff; color: var(--ink); }
.status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; color: var(--muted); font-size: 1rem; }
.warn { background: #fff4d6; border-left: 5px solid #c98a00; padding: 10px 14px; }
.note { color: var(--muted); font-size: .95rem; }

.tools { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 12px; }
select { width: 100%; min-height: 56px; padding: 10px 40px 10px 14px; font-family: inherit; font-size: 1.1rem; color: var(--ink); border: 2px solid var(--navy); border-radius: var(--radius); -webkit-appearance: none; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10'%3E%3Cpath d='M1 1l7 7 7-7' fill='none' stroke='%2312306b' stroke-width='2.5'/%3E%3C/svg%3E") no-repeat right 14px center; }

/* The list scrolls inside its own box; headings stay on top */
.list { max-height: 70vh; max-height: 70dvh; overflow: auto; -webkit-overflow-scrolling: touch; border: 2px solid var(--navy); border-radius: var(--radius); margin-bottom: 16px; background: #fff; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 1.02rem; }
th, td { border-bottom: 1px solid var(--line); padding: 11px 12px; text-align: left; vertical-align: middle; }
th { position: -webkit-sticky; position: sticky; top: 0; background: var(--navy); color: #fff; font-size: .9rem; }
tbody tr:nth-child(even) { background: var(--soft); }
tbody tr:hover { background: #e3f1e9; }
td.colBrand { font-weight: 700; color: var(--navy); }
.colPtr, .colPtc { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th.colPtr, th.colPtc { white-space: normal; }
td.colPtc { font-weight: 700; color: var(--green); font-size: 1.15rem; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px; margin: 0 0 20px; }
dl > div { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: 4px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
dl > div:last-child { border-bottom: 0; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.person { display: flex; gap: 24px; padding: 20px; align-items: flex-start; }
.person img { width: 180px; height: auto; border: 3px solid var(--navy); border-radius: var(--radius); }
.person > div { flex: 1; min-width: 0; }

.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 200px)); gap: 14px; margin-bottom: 14px; }
.page { text-align: center; text-decoration: none; font-size: .95rem; }
.page img { width: 100%; height: auto; border: 1px solid var(--line); margin-bottom: 4px; }

dialog { width: min(900px, 100%); max-width: 100%; height: 100%; max-height: 100%; padding: 0; border: 0; background: #fff; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(0, 0, 0, .75); }
.vbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: var(--navy); color: #fff; }
.vbar button { min-height: 48px; min-width: 90px; font-family: inherit; font-weight: 700; font-size: 1rem; line-height: 1; border: 0; border-radius: var(--radius); background: #fff; color: var(--navy); cursor: pointer; }
.vbody { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 8px; }
.vbody img { width: 100%; height: auto; }

footer { background: var(--navy); color: #fff; padding: 24px 0 calc(24px + env(safe-area-inset-bottom)); font-size: .95rem; }

.stock { display: inline-block; padding: 3px 10px; border: 2px solid var(--green); border-radius: 8px; background: #e3f4ea; color: var(--green); font-size: .9rem; font-weight: 700; white-space: nowrap; }
.stock.out { border-color: #a61b1b; background: #fdeaea; color: #a61b1b; }

/* Wide screens: long names wrap, so the table never scrolls sideways */
@media (min-width: 861px) {
  th, td { padding-left: 8px; padding-right: 8px; }
  td.colManufacturer, td.colBrand, td.colGeneric, td.colPacking { overflow-wrap: anywhere; }
  td.colManufacturer, td.colGeneric { font-size: .9rem; }
}

/* Tablets and phones: table rows become compact cards */
@media (max-width: 860px) {
  .tools { grid-template-columns: minmax(0, 1fr); }
  .list { background: var(--soft); padding: 8px; }
  table, tbody, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr, tbody tr:nth-child(even), tbody tr:hover { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; padding: 10px 12px; content-visibility: auto; contain-intrinsic-size: auto 150px; }
  tbody tr:last-child { margin-bottom: 0; }
  td { border: 0; padding: 4px 0; overflow-wrap: anywhere; }
  td.colPtr, td.colPtc { text-align: left; }
  td::before { content: attr(data-label); display: block; color: var(--muted); font-size: .8rem; font-weight: 400; white-space: normal; }
  td.colBrand { order: -1; font-size: 1.15rem; border-bottom: 1px solid var(--line); padding: 0 0 6px; margin-bottom: 2px; }
  td.colBrand, td.colManufacturer, td.colGeneric { grid-column: 1 / -1; }
  td.colBrand::before { content: none; }
  td.empty { display: none; }
}

/* Phones: menu moves to the bottom, within thumb reach */
@media (max-width: 700px) {
  html { scroll-padding-top: calc(90px + env(safe-area-inset-top)); }
  nav { position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
  nav .wrap { padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  nav a { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; min-height: 60px; font-size: .75rem; }
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .brand strong { font-size: 1.05rem; }
  .brand small { font-size: .75rem; }
  dl > div { grid-template-columns: minmax(0, 1fr); }
  .person { flex-direction: column; align-items: center; }
  .person > div { width: 100%; }
  .actions .btn { width: 100%; }
  .pages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Very small phones (iPhone SE, mini) */
@media (max-width: 360px) {
  .brand img { width: 40px; height: 40px; }
  .brand strong { font-size: .95rem; }
  .brand small { font-size: .68rem; }
  .lang { min-width: 64px; }
  nav a { font-size: .68rem; }
}
/* Medicine-only page: no menu, so no space is kept for it */
body.meds-only { padding-bottom: 0; }
.meds-only section { padding-top: 24px; }
.meds-only h1 { color: var(--navy); font-size: clamp(1.45rem, 4.5vw, 1.9rem); padding-bottom: 8px; border-bottom: 4px solid var(--green); }
footer a { color: #fff; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Longer shop name: keep the header compact on phones */
@media (max-width: 480px) {
  .brand strong { font-size: .94rem; }
  .brand small { font-size: .68rem; }
  .brand img { width: 40px; height: 40px; }
  .lang { min-width: 70px; }
}

/* ===== Delhi Ortho theme ===== */
/* --navy is the main colour, --green is kept for "Available" and patient price */
:root { --navy: #0b4a4f; --green: #12703a; --accent: #a8480c; --ink: #20211f; --muted: #55584f; --bg: #fbf8f3; --soft: #f1ebe0; --line: #e2d9c8; --radius: 18px; --shadow: 0 6px 20px rgba(60, 45, 20, .09); }
h1, h2, h3, .brand strong { font-family: Georgia, "Times New Roman", "Noto Serif Devanagari", serif; }

/* Header: solid teal */
.top { background: var(--navy); border-top: 0; box-shadow: none; }
.bar { min-height: 77px; }
.brand, .brand strong { color: #fff; }
.brand small { color: #cfe5e2; }
.brand img { border-radius: 50%; }
.lang { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .75); border-radius: 99px; }

/* Menu: white strip with pill buttons */
nav { background: #fff; box-shadow: 0 4px 14px rgba(60, 45, 20, .1); }
nav .wrap { gap: 6px; padding-top: 6px; padding-bottom: 6px; }
nav a { color: var(--navy); border-radius: 99px; min-height: 46px; }
nav a:hover { background: var(--soft); }

/* Opening block: light, centred card */
.hero { background: var(--bg); color: var(--ink); padding: 28px 0 8px; }
.hero .wrap > * { margin-left: auto; margin-right: auto; }
.hero .wrap { text-align: center; }
.hero h1 { color: var(--navy); }
.hero p { max-width: 38rem; }
.hero .actions { justify-content: center; }
.badge { background: #fbe9dc; color: var(--accent); border: 2px solid var(--accent); }

.btn { background: var(--accent); border-color: var(--accent); border-radius: 99px; }
.btn.light { background: #fff; border-color: var(--navy); color: var(--navy); }
.btn.ghost { background: #fff; border-color: var(--accent); color: var(--accent); }

/* Headings: centred with a short orange mark */
section > .wrap > h2, .meds-only h1 { text-align: center; border-bottom: 0; padding-bottom: 0; }
section > .wrap > h2::after, .meds-only h1::after { content: ""; display: block; width: 64px; height: 5px; margin: 10px auto 0; border-radius: 99px; background: var(--accent); }
section.alt { background: var(--soft); }

.card, .doc { border: 0; box-shadow: var(--shadow); }
.person img { border: 4px solid var(--accent); border-radius: 50%; width: 190px; height: 190px; object-fit: cover; object-position: top; }
.page img { border-radius: 8px; }

/* Search and list */
input[type="search"], select { border-color: var(--line); box-shadow: var(--shadow); }
input[type="search"] { border-radius: 99px; padding-left: 22px; }
select { border-radius: 99px; padding-left: 20px; background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2716%27%20height%3D%2710%27%3E%3Cpath%20d%3D%27M1%201l7%207%207-7%27%20fill%3D%27none%27%20stroke%3D%27%230b4a4f%27%20stroke-width%3D%272.5%27/%3E%3C/svg%3E"); }
.list { border: 1px solid var(--line); box-shadow: var(--shadow); }
th { background: #dcebe8; color: var(--navy); }
tbody tr:nth-child(even) { background: #faf6ee; }
tbody tr:hover { background: #fbe9dc; }
.stock { border-radius: 99px; }

footer { background: #073337; }
dialog .vbar { background: var(--navy); }

@media (max-width: 860px) {
  .list { background: var(--soft); }
  tbody tr, tbody tr:nth-child(even), tbody tr:hover { background: #fff; border: 0; box-shadow: 0 2px 8px rgba(60, 45, 20, .1); }
}
@media (max-width: 700px) {
  nav { box-shadow: 0 -4px 14px rgba(60, 45, 20, .12); }
  nav .wrap { gap: 2px; padding-top: 4px; padding-bottom: 4px; }
  nav a { border-radius: 14px; min-height: 56px; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.meds-only { padding-bottom: 0; }
}
