:root {
  --brand: #0d9488;
  --brand-2: #14b8a6;
  --brand-dark: #0f5e57;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e6edf0;
  --bg: #f3f7f8;
  --soft: #eef7f6;
  --field: #f8fafc;
  --warn-bg: #fff6e5;
  --warn: #b45309;
  --bad-bg: #fff1f1;
  --bad: #dc2626;
  --ok-bg: #e3f5f1;
  --blue-bg: #eaf0ff;
  --blue: #2f5bd3;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px rgba(15, 23, 42, 0.06);
  --glow: 0 8px 20px rgba(13, 148, 136, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Cairo", "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  background:
    radial-gradient(1100px 560px at 100% -10%, #d6f2ec 0%, transparent 60%),
    radial-gradient(900px 520px at -10% 110%, #e2edff 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

/* ------------------------------------------------------------ shell */

.shell { display: flex; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; }
main { max-width: 1000px; margin: 0 auto; padding: 28px 28px 90px; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 236px;
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  border-inline-end: 1px solid var(--line);
}
body.guest .sidebar { display: none; }

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 24px; color: var(--ink); text-decoration: none; }
.brand strong { display: block; font-size: 21px; font-weight: 800; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: 13px; }
.brand-mark {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-dark));
  box-shadow: var(--glow);
}

#nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
#nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
#nav a svg { width: 21px; height: 21px; flex: none; }
#nav a:hover { background: var(--soft); color: var(--brand-dark); }
#nav a.active { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: var(--glow); }
#nav a.logout { margin-top: auto; }
#nav a.logout:hover { background: var(--bad-bg); color: var(--bad); }

.login-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 9vh auto 0; text-align: center; }
.login-brand .brand-mark { width: 60px; height: 60px; font-size: 30px; border-radius: 18px; }
.login-brand strong { font-size: 28px; font-weight: 800; }
.card.narrow { max-width: 420px; margin: 22px auto 40px; }

.banner { max-width: 1000px; margin: 16px auto 0; padding: 10px 16px; border-radius: 14px; font-size: 14px; }
.main-col > #banner .banner { margin: 16px 28px 0; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.ok { background: var(--ok-bg); color: var(--brand-dark); }
.banner.plan-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.banner.plan-strip .button { text-decoration: none; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ plan and balance */
.pay-flow .step { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; }
.pay-flow h2 + .step { margin-top: 4px; }
.pay-flow .step h3 { margin: 0; color: var(--ink); }
.step-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
}
.pay-flow .hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

.options { display: grid; gap: 12px; }
.options.two { grid-template-columns: repeat(2, 1fr); }
.options.methods { grid-template-columns: repeat(4, 1fr); }
.options.amounts { grid-template-columns: repeat(5, 1fr); }
.plans-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.option:hover { border-color: #b9e3dc; }
.option input[type=radio] { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.option:has(input:checked) { border-color: var(--brand-2); background: #f5fbfa; box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14); }
.option:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.option-icon {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--brand-dark);
}
.option-icon svg { width: 22px; height: 22px; }
.option:has(input:checked) .option-icon { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; }
.option-icon.logo { background: #f4eefa; }
.option:has(input:checked) .option-icon.logo { background: #500b75; }
.option-icon.logo img { display: block; width: 24px; height: 24px; }
.option-text { display: flex; flex-direction: column; min-width: 0; }
.option-text strong { font-weight: 800; }
.option small { color: var(--muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.option .tick {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: #fff;
}
.option:has(input:checked) .tick { border-color: var(--brand); background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 14px no-repeat; }

.options.methods .option { flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 16px; }
.options.amounts .option { flex-direction: column; align-items: flex-start; gap: 0; }
.options.amounts strong { font-size: 20px; font-weight: 800; color: var(--brand-dark); }
.options.amounts .option:last-child strong { font-size: 16px; line-height: 30px; }
.custom-amount { margin-top: 10px; max-width: 260px; }

.plan-card { flex-direction: column; align-items: stretch; gap: 4px; padding: 16px 18px; }
.plan-card .plan-name { font-weight: 800; font-size: 17px; padding-inline-end: 28px; }
.plan-card .plan-price { font-size: 22px; font-weight: 800; color: var(--brand-dark); }
.plan-card .plan-price small { font-size: 13px; font-weight: 600; color: var(--muted); }
.plan-card .muted { font-size: 14px; }

.pay-to {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--ok-bg);
  color: var(--brand-dark);
}

.dropzone {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 16px;
  border: 2px dashed #b9e3dc;
  border-radius: 18px;
  background: #fafdfc;
  color: var(--ink);
  box-shadow: none;
  font-weight: 600;
}
.dropzone:hover, .dropzone.over { background: var(--soft); border-color: var(--brand-2); filter: none; transform: none; }
.dropzone strong { font-size: 16px; font-weight: 800; }
.dropzone small { color: var(--muted); font-size: 13px; }
.receipt-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1.5px solid var(--brand-2);
  border-radius: 18px;
  background: #f5fbfa;
}
.receipt-preview img { width: 96px; height: 128px; object-fit: cover; object-position: top; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.receipt-preview strong, .receipt-preview small { display: block; }
.receipt-preview .actions { margin-top: 10px; }
.pay-flow .grid.extra { margin-top: 14px; }

.pay-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px -22px -22px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: #f8fbfb;
}
.pay-summary small { display: block; color: var(--muted); font-size: 13px; }
.pay-summary strong { font-size: 18px; font-weight: 800; }
.pay-summary button { padding-inline: 28px; }
.pay-flow .error-text:empty { display: none; }
.pay-flow .error-text { margin: 14px 0 0; color: var(--bad); font-weight: 600; }
.requests { list-style: none; margin: 0; padding: 0; }
.requests li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.requests li:first-child { border-top: 0; }

/* ------------------------------------------------------------ dashboard */

.hero { margin: 0 0 18px; }
.hero .hello { margin: 0; color: var(--brand); font-weight: 700; }
.hero h1 { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.3; }
.hero .today { margin: 2px 0 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-icon { flex: none; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; }
.stat-icon svg { width: 23px; height: 23px; }
.stat-num { display: block; font-size: 26px; font-weight: 800; line-height: 1.15; }
.stat-label { display: block; color: var(--muted); font-size: 13px; }
.stat.teal .stat-icon { background: var(--ok-bg); color: var(--brand); }
.stat.slate .stat-icon { background: #eef2f6; color: #475569; }
.stat.amber .stat-icon { background: var(--warn-bg); color: #d97706; }
.stat.blue .stat-icon { background: var(--blue-bg); color: var(--blue); }

/* ------------------------------------------------------------ cards and forms */

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 14px; font-size: 19px; font-weight: 700; }
.card h3 { margin: 20px 0 8px; font-size: 16px; color: var(--brand-dark); }
details.card > summary { font-size: 17px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }

input, select, textarea {
  width: 100%;
  font: inherit;
  padding: 10px 13px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input:not([type="checkbox"]), select { height: 46px; padding-block: 0; }
table.rx input { height: 40px; }
textarea { min-height: 70px; resize: vertical; unicode-bidi: plaintext; }
input:focus, select:focus, textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.16);
}
input::placeholder, textarea::placeholder { color: #a0aec0; }
[dir="ltr"] { text-align: left; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; color: var(--ink); font-size: 15px; }
.check input { width: 18px; height: 18px; margin-top: 5px; accent-color: var(--brand); box-shadow: none; }

button, .button {
  font: inherit;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  box-shadow: 0 6px 14px rgba(13, 148, 136, 0.22);
  text-decoration: none;
  display: inline-block;
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s, background 0.15s;
}
button:hover, .button:hover { filter: brightness(1.05); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled, button:disabled:hover {
  background: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
  filter: none;
}
button.secondary, .button.secondary { background: var(--soft); color: var(--brand-dark); box-shadow: none; }
button.secondary:hover, .button.secondary:hover { background: #dff1ee; filter: none; }
button.secondary:disabled { background: #f1f5f9; color: #a0aec0; }
button.danger { background: var(--bad-bg); color: var(--bad); box-shadow: none; }
button.danger:hover { background: #ffe2e2; filter: none; }
button.big { width: 100%; padding: 15px; font-size: 18px; border-radius: 16px; }
button.small, .button.small { padding: 6px 12px; font-size: 14px; }
button.with-icon { display: inline-flex; align-items: center; gap: 8px; }
button.with-icon svg { width: 19px; height: 19px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.page-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
button.back {
  background: #fff;
  color: var(--brand-dark);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 6px 16px;
  font-size: 15px;
  border-radius: 99px;
}
button.back:hover { background: var(--soft); filter: none; }
.page-title { color: var(--muted); font-size: 15px; }

.suggestions {
  position: absolute;
  z-index: 5;
  inset-inline: 0;
  top: 100%;
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}
.suggestions button {
  width: 100%;
  text-align: right;
  background: none;
  box-shadow: none;
  color: var(--ink);
  font-weight: 400;
  padding: 8px 10px;
  border-radius: 10px;
}
.suggestions button:hover { background: var(--soft); transform: none; }

/* ------------------------------------------------------------ lists */

.list { list-style: none; margin: 0; padding: 0; }
.list li a {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  border-radius: 12px;
  transition: background 0.15s;
}
.list li a:hover { background: var(--soft); }
.list li:last-child a { border-bottom: 0; }
.muted { color: var(--muted); font-size: 14px; }
.nowrap { white-space: nowrap; }

.badge {
  font-size: 12.5px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 99px;
  background: #eef2f6;
  color: #475569;
  white-space: nowrap;
  flex: none;
  line-height: 1.6;
}
.badge.recording { background: var(--bad-bg); color: var(--bad); }
.badge.writing { background: var(--warn-bg); color: var(--warn); }
.badge.ready { background: var(--blue-bg); color: var(--blue); }
.badge.approved, .badge.arrived { background: var(--ok-bg); color: var(--brand-dark); }
.badge.failed { background: var(--bad-bg); color: var(--bad); }

/* ------------------------------------------------------------ queue and bookings */

.queue-row, .appointment {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--line);
}
.queue-row:last-child, .appointment:last-child { border-bottom: 0; }
.num {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--ok-bg);
  color: var(--brand-dark);
  font-weight: 800;
  display: grid;
  place-items: center;
}
.who { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.queue-section { font-size: 13px; font-weight: 700; color: var(--muted); padding: 16px 4px 6px; letter-spacing: 0.2px; }
.queue-section:first-child { padding-top: 0; }
.queue .queue-row {
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.queue .queue-row:last-child { border-bottom: 1px solid var(--line); }
.queue .queue-row:hover { border-color: #b7e4dd; box-shadow: var(--shadow); }
.queue .queue-row.open { border-color: var(--brand-2); box-shadow: var(--shadow); }
.queue .queue-row.next { background: linear-gradient(135deg, #f1fbf9, #fff); border-color: #9fded3; }
.queue .queue-row.next .num { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: var(--glow); }
.queue .queue-row.booked .num { background: #eef2f6; color: var(--muted); }
.queue .queue-row.booked strong { color: var(--muted); }
.chev { color: var(--muted); font-size: 14px; white-space: nowrap; }
.allergy-chip {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--bad);
  background: var(--bad-bg);
  border-radius: 99px;
  padding: 2px 10px;
}
.queue-detail { border-radius: 16px; padding: 14px 16px; margin: -2px 0 12px; background: var(--soft); }
.queue-detail .actions { margin-top: 12px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.row-actions button { padding: 6px 12px; font-size: 14px; }
.appointment.cancelled, .appointment.no_show, .appointment.done { opacity: 0.55; }
.warn-text { color: var(--warn); }
.day-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.day-bar input { width: auto; }

/* ------------------------------------------------------------ patient file */

.allergy-alert {
  background: var(--bad-bg);
  color: var(--bad);
  border: 1px solid #fecaca;
  border-radius: 14px;
  padding: 9px 14px;
  margin: 8px 0;
  font-weight: 700;
}
.history-card { border-radius: 16px; padding: 14px 16px; margin-bottom: 16px; background: linear-gradient(135deg, #f4fbfa, #f8fafc); border: 1px solid var(--line); }
.history-card h3 { margin: 0; }
.history-card > div { margin: 3px 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.card-head h3 { white-space: nowrap; }
.hlabel { color: var(--muted); font-size: 14px; }
.history-form label { margin-top: 12px; }
.pair { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 6px; }
.pair button { padding: 6px 12px; }

.patient-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.patient-head h2 { margin: 0; }
.avatar {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-dark));
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: var(--glow);
}
.list.visits li a.visit-item { align-items: stretch; gap: 14px; padding: 12px 8px; }
.visit-date {
  flex: none;
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--soft);
  border-radius: 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.visit-date strong { color: var(--brand-dark); font-size: 14px; white-space: nowrap; }
.visit-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.visit-top { display: flex; align-items: center; gap: 8px; }
.list.visits .chev { align-self: center; font-size: 20px; }

/* ------------------------------------------------------------ visit */

.recording-box { text-align: center; background: linear-gradient(180deg, #fff, #f4fbfa); }
.timer { font-size: 58px; font-weight: 800; letter-spacing: 2px; direction: ltr; color: var(--brand-dark); }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--bad); margin-left: 10px; box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.15); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.meter { height: 10px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin: 14px auto 20px; max-width: 380px; }
.meter div { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transition: width 0.08s; }
.live-text { text-align: right; max-height: 240px; overflow: auto; background: var(--soft); border-radius: 14px; padding: 12px 16px; font-size: 15px; }
.live-text p { margin: 0 0 6px; }

.spinner { width: 44px; height: 44px; border: 4px solid #d8eeea; border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 10px auto; }
.spinner.small { width: 16px; height: 16px; border-width: 2px; display: inline-block; vertical-align: middle; margin: 0 0 0 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.review { border-radius: 16px; padding: 12px 16px; margin-bottom: 16px; }
.review.warn { background: var(--warn-bg); border-inline-start: 4px solid #f59e0b; }
.review h3 { margin: 0 0 6px; color: var(--warn); font-size: 15px; }
.review ul { margin: 0; padding-inline-start: 20px; }
.review li { margin: 4px 0; }
.review li.bad { color: var(--bad); font-weight: 600; }

.approved-bar { background: var(--ok-bg); color: var(--brand-dark); border-radius: 14px; padding: 10px 16px; margin-bottom: 16px; font-weight: 700; border-inline-start: 4px solid var(--brand); }

table.rx { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0 6px; table-layout: fixed; }
table.rx th { font-size: 13px; color: var(--muted); text-align: start; font-weight: 600; padding: 0 4px; }
table.rx td { padding: 0 3px; }
table.rx th:nth-child(1) { width: 21%; }
table.rx th:nth-child(2) { width: 11%; }
table.rx th:nth-child(3) { width: 13%; }
table.rx th:nth-child(4) { width: 18%; }
table.rx th:nth-child(5) { width: 12%; }
table.rx th:nth-child(7) { width: 48px; }
table.rx input { padding: 8px 10px; font-size: 15px; }
table.rx td:first-child input { font-weight: 700; color: var(--brand-dark); }
table.rx td.del button { padding: 7px 10px; }
.rx-wrap { overflow-x: auto; }

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  margin: 18px -22px -22px;
  padding: 0 22px 8px;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.05);
}
.sticky-actions .actions { margin-top: 12px; align-items: center; }
.sticky-actions p { margin: 6px 0 0; }
.actions-gap { flex: 1; }

.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px; align-items: center; }
.kv span { font-size: 14px; color: var(--muted); }

details summary { cursor: pointer; color: var(--brand-dark); font-weight: 700; }
.transcript { white-space: pre-wrap; background: var(--soft); padding: 12px 14px; border-radius: 14px; margin-top: 8px; }
audio.recording { width: 100%; margin-bottom: 12px; }

/* ------------------------------------------------------------ print */

#print-area { display: none; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  #print-area { display: block; padding: 10mm 14mm; font-size: 14px; }
  .rx-head { display: flex; justify-content: space-between; border-bottom: 2px solid var(--brand); padding-bottom: 8px; margin-bottom: 12px; }
  .rx-head h1 { margin: 0; font-size: 22px; }
  .rx-patient { display: flex; justify-content: space-between; margin-bottom: 14px; }
  .rx-symbol { font-size: 30px; font-weight: 700; direction: ltr; text-align: left; }
  .rx-items { padding-right: 22px; }
  .rx-items li { margin-bottom: 10px; }
  .rx-foot { margin-top: 40px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; }
}

/* ------------------------------------------------------------ tablet and phone */

@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .options.methods { grid-template-columns: repeat(2, 1fr); }
  .options.amounts { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .options.two, .plans-grid { grid-template-columns: 1fr; }
  .pay-summary { margin: 18px -16px -16px; padding: 14px 16px; flex-wrap: wrap; }
  .pay-summary button { flex: 1; }
}

@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    top: auto;
    height: auto;
    width: 100%;
    z-index: 20;
    flex-direction: row;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-inline-end: 0;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
  }
  .sidebar .brand { display: none; }
  #nav { flex-direction: row; justify-content: space-around; }
  #nav a { flex-direction: column; gap: 2px; padding: 6px 10px; font-size: 12px; border-radius: 12px; }
  #nav a.logout { margin-top: 0; }
  main { padding: 18px 14px 120px; }
  .main-col > #banner .banner { margin: 12px 14px 0; }
  .hero h1 { font-size: 24px; }
  .stat { padding: 12px; }
  .stat-icon { width: 40px; height: 40px; border-radius: 13px; }
  .stat-num { font-size: 22px; }
  .card { padding: 16px; border-radius: 18px; }
  .sticky-actions { bottom: 64px; margin: 16px -16px -16px; padding: 0 16px 6px; border-radius: 0 0 18px 18px; }
  .actions-gap { display: none; }
  .sticky-actions .actions { gap: 6px; margin-top: 8px; }
  .sticky-actions .actions button { flex: 1 1 30%; padding: 8px 4px; font-size: 13px; white-space: nowrap; }
  .sticky-actions p { font-size: 13px; }
  table.rx { min-width: 0; border-spacing: 0; }
  table.rx thead { display: none; }
  table.rx, table.rx tbody, table.rx td { display: block; width: auto; padding: 0; }
  table.rx tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 8px;
    background: var(--soft);
  }
  table.rx td:first-child, table.rx td.del { grid-column: 1 / -1; }
  table.rx td.del button { width: 100%; }
  .visit-date { width: 78px; }
  .kv { grid-template-columns: 1fr; }
  .appointment { flex-wrap: wrap; }
  .row-actions { width: 100%; justify-content: flex-start; }
  .timer { font-size: 46px; }
}
