:root {
  --ink: #1f2430; --muted: #667085; --line: #e4e7ec; --card: #ffffff;
  --brand: #714b67; --brand-dark: #5b3a52; --accent: #017e84;
  --bg1: #eef0f7; --bg2: #e6e3f3;
  --c1: #f4a261; --c2: #e76f51; --c3: #2a9d8f; --c4: #4a7fd1; --c5: #9b5de5; --c6: #e9a800;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
  background: linear-gradient(135deg, var(--bg1), var(--bg2)); min-height: 100vh;
}
a { color: var(--brand); }
.top { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: var(--brand); color: #fff; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #fff; color: var(--brand); font-weight: 800; }
.who { display: flex; align-items: center; gap: 14px; font-size: .95rem; }
.who form { margin: 0; }
button.link { background: none; border: 1px solid rgba(255,255,255,.6); color: #fff; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.wrap { max-width: 980px; margin: 0 auto; padding: 24px 16px 60px; }
.narrow { max-width: 460px; margin: 0 auto; }
.card { background: var(--card); border-radius: 16px; padding: 24px; box-shadow: 0 4px 18px rgba(31,36,48,.08); margin-bottom: 18px; }
h1 { margin: 0 0 6px; font-size: 1.6rem; } h2 { margin: 0 0 10px; font-size: 1.2rem; }
.muted { color: var(--muted); }
.msg { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; background: #eef4ff; border: 1px solid #cfdcf7; }
.msg.success { background: #e9f8ef; border-color: #bfe8cf; } .msg.warning, .msg.error { background: #fff3e6; border-color: #f6d3a8; }
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%; padding: 12px; border: 1px solid #cdd2dc; border-radius: 10px; font-size: 1rem; background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--brand); border-color: transparent; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-top: 10px; }
.check input { width: auto; }
.errors { color: #b42318; font-size: .88rem; margin-top: 4px; }
.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; padding: 13px 20px; border-radius: 12px; font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; }
.btn:hover { background: var(--brand-dark); }
.btn.alt { background: #fff; color: var(--brand); border: 2px solid var(--brand); }
.btn.green { background: #1a9d57; } .btn.block { display: block; width: 100%; margin-top: 18px; }
.btn-row { display: grid; gap: 12px; margin-top: 22px; }
.center { text-align: center; }
.big-icon { font-size: 3rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 22px 16px; margin-top: 20px; }
.tile { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--ink); text-align: center; gap: 8px; }
.tile .icon { display: grid; place-items: center; width: 88px; height: 88px; border-radius: 22px; background: #fff; font-size: 2.4rem; box-shadow: 0 4px 14px rgba(31,36,48,.12); border-bottom: 5px solid var(--c1); }
.tile.c1 .icon { border-color: var(--c1); } .tile.c2 .icon { border-color: var(--c2); } .tile.c3 .icon { border-color: var(--c3); }
.tile.c4 .icon { border-color: var(--c4); } .tile.c5 .icon { border-color: var(--c5); } .tile.c6 .icon { border-color: var(--c6); }
.tile .label { font-weight: 600; font-size: .95rem; } .tile small { color: var(--muted); }
.tile.locked .icon { filter: grayscale(.8); opacity: .65; position: relative; }
.tile:hover .icon { transform: translateY(-2px); }
.status { display: inline-block; padding: 6px 12px; border-radius: 999px; font-size: .88rem; font-weight: 600; }
.status.ok { background: #e3f6ea; color: #137a3f; } .status.no { background: #fff0e0; color: #a85a00; }
.steps { padding-left: 20px; } .steps li { margin-bottom: 8px; }
.pay-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 10px 0; }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: .93rem; }
.list a.item { display: block; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.list a.item:hover { background: #f7f5fa; } .list small { color: var(--muted); display: block; }
.receipt { max-width: 560px; margin: 0 auto; border: 2px solid var(--brand); }
.receipt dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; } .receipt dt { color: var(--muted); }
.receipt .stamp { margin-top: 18px; padding: 12px; border: 2px dashed #1a9d57; border-radius: 10px; color: #137a3f; font-weight: 700; text-align: center; }
.back { display: inline-block; margin-bottom: 12px; text-decoration: none; }
@media print { .top, .no-print, .back { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }

/* ---------- Phone-friendly layer (keeps everything inside the screen width) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
img, svg, video { max-width: 100%; height: auto; }
h1, h2, p, li, dd, dt, td, th, label, .muted, .label, small { overflow-wrap: anywhere; }
.top { flex-wrap: wrap; gap: 8px 12px; }
.brand { min-width: 0; }
.who { min-width: 0; }
.who span { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table { table-layout: fixed; }
.btn { min-height: 48px; display: flex; align-items: center; justify-content: center; }
.btn.block { width: 100%; }
.receipt dl { grid-template-columns: minmax(0, 130px) minmax(0, 1fr); }

@media (max-width: 560px) {
  .top { padding: 10px 14px; }
  .brand { font-size: 1.05rem; gap: 8px; }
  .logo { width: 30px; height: 30px; }
  .wrap { padding: 14px 10px 48px; }
  .card { padding: 18px 16px; border-radius: 14px; margin-bottom: 14px; }
  h1 { font-size: 1.4rem; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 8px; }
  .tile .icon { width: 70px; height: 70px; border-radius: 18px; font-size: 2rem; border-bottom-width: 4px; }
  .tile .label { font-size: .84rem; line-height: 1.25; }
  .tile small { font-size: .72rem; }
  th, td { padding: 8px 4px; font-size: .84rem; }
  .receipt dl { grid-template-columns: 1fr; gap: 2px; }
  .receipt dt { margin-top: 8px; font-size: .8rem; }
  .receipt dd { margin: 0; }
}
@media (max-width: 360px) {
  .who span { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* medicinePro logo */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: block; height: 33px; width: auto; }
.brand-name { font-weight: 700; font-size: 1.35rem; letter-spacing: -0.5px; color: #ffffff; line-height: 1; }
.brand-pro { color: #9fd1ff; }

@media (max-width: 480px) {
  .brand { gap: 8px; }
  .brand-mark { height: 26px; }
  .brand-name { font-size: 1.1rem; }
}