/* ==========================================================================
   Cove Dental — practice portal (staff)
   Shares its palette with styles.css so the two feel like one product.
   ========================================================================== */

:root{
  --ink:#0d1b2a;
  --ink-2:#243b4d;
  --muted:#63768a;
  --line:#e6edf2;
  --line-2:#eff4f7;
  --surface:#ffffff;
  --bg:#f7fafb;

  --brand:#0e7c74;
  /* Everything below is worked out from --brand, so one colour picker in the
     portal re-paints the whole portal (and the booking site) at once. */
  --brand-dark:color-mix(in srgb, var(--brand) 76%, #000);
  --brand-100:color-mix(in srgb, var(--brand) 16%, #fff);
  --brand-50:color-mix(in srgb, var(--brand) 7%, #fff);

  --accent:#f0805a;
  --sky:#3a8fd4;
  --sky-100:#e6f1fb;
  --peach:var(--accent);
  --peach-100:color-mix(in srgb, var(--peach) 16%, #fff);

  --ok:#14976f;
  --warn:#d9822b;
  --danger:#d9534f;

  --r-sm:10px;
  --r-md:14px;
  --r-lg:20px;
  --r-pill:999px;

  --sh-xs:0 1px 2px rgba(13,27,42,.05);
  --sh-sm:0 2px 6px rgba(13,27,42,.05), 0 1px 2px rgba(13,27,42,.04);
  --sh-md:0 10px 24px -12px rgba(13,27,42,.16), 0 2px 6px rgba(13,27,42,.04);
}

*,*::before,*::after{ box-sizing:border-box; }

/* The `hidden` attribute is only a UA-stylesheet rule, so any component rule
   below that sets `display:` would outrank it and keep the element on screen.
   The sign-in gate hit exactly that. Author rules always win — pin it here. */
[hidden]{ display:none !important; }

html,body{ height:100%; }

body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:"Plus Jakarta Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
  font-size:15px;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
}

h1,h2,h3{ margin:0; line-height:1.2; letter-spacing:-.02em; }
h1{ font-size:26px; font-weight:800; }
h2{ font-size:21px; font-weight:800; }
h3{ font-size:16px; font-weight:700; }
p{ margin:0; }
code{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:.86em;
  background:var(--line-2);
  border-radius:6px;
  padding:.1em .35em;
}

/* ------------------------------------------------------------- buttons -- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font:inherit; font-weight:650; font-size:14px;
  border:1px solid transparent;
  border-radius:var(--r-pill);
  padding:10px 18px;
  cursor:pointer;
  transition:background .15s, color .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:active{ transform:translateY(1px); }
.btn:disabled{ opacity:.55; cursor:not-allowed; }
.btn-sm{ padding:7px 14px; font-size:13px; }
.btn-block{ width:100%; }

.btn-primary{
  background:var(--brand); color:#fff;
  box-shadow:0 8px 18px -10px rgba(14,124,116,.7);
}
.btn-primary:hover{ background:var(--brand-dark); }

.btn-soft{
  background:var(--brand-100); color:var(--brand-dark);
}
.btn-soft:hover{ background:#cdeae6; }

.btn-ghost{
  background:transparent; color:var(--muted); border-color:var(--line);
}
.btn-ghost:hover{ color:var(--ink); border-color:#cfdde6; background:#fff; }

.btn-danger{
  background:#fdecec; color:#b7342f;
}
.btn-danger:hover{ background:#f9d9d7; }

/* --------------------------------------------------------------- fields -- */
.field{ display:block; margin-bottom:14px; }
.field > span{
  display:block;
  font-size:12px; font-weight:700; letter-spacing:.04em;
  text-transform:uppercase; color:var(--muted);
  margin-bottom:6px;
}
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=time], select, textarea{
  width:100%;
  font:inherit; font-size:15px; color:var(--ink);
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-sm);
  padding:10px 12px;
  transition:border-color .15s, box-shadow .15s;
}
textarea{ resize:vertical; line-height:1.5; }
input:focus, select:focus, textarea:focus{
  outline:none;
  border-color:var(--brand);
  box-shadow:0 0 0 3px rgba(14,124,116,.14);
}
input[readonly]{ background:var(--line-2); color:var(--muted); }

.check{
  display:flex; align-items:center; gap:9px;
  font-size:14px; color:var(--ink-2);
  padding:11px 2px; cursor:pointer;
}
.check input{ width:17px; height:17px; accent-color:var(--brand); }

.grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }

.status{
  font-size:13.5px; font-weight:600;
  border-radius:var(--r-sm);
  padding:9px 12px;
  margin-bottom:14px;
}
.status.is-error{ background:#fdecec; color:#b7342f; }
.status.is-ok{ background:var(--brand-50); color:var(--brand-dark); }

.hint{ font-size:13.5px; color:var(--muted); margin-top:14px; }
.muted{ color:var(--muted); font-size:14px; }

/* ----------------------------------------------------------- sign-in -- */
.gate{
  min-height:100dvh;
  display:grid; place-items:center;
  padding:24px;
  background:
    radial-gradient(60% 55% at 15% 8%, #e6f4f2 0%, transparent 60%),
    radial-gradient(55% 50% at 88% 92%, #fdeee7 0%, transparent 62%),
    var(--bg);
}
.gate-card{
  width:100%; max-width:390px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  box-shadow:var(--sh-md);
  padding:34px 30px 26px;
}
.gate-mark{
  display:grid; place-items:center;
  width:46px; height:46px;
  border-radius:14px;
  background:var(--brand-100); color:var(--brand-dark);
  margin-bottom:16px;
}
.gate-mark svg{ width:26px; height:26px; }
.gate-sub{ color:var(--muted); font-size:14px; margin:6px 0 22px; }
.gate-back{
  display:block; text-align:center;
  margin-top:18px;
  font-size:13.5px; color:var(--muted); text-decoration:none;
}
.gate-back:hover{ color:var(--brand); }

/* ------------------------------------------------------------- shell -- */
/* The whole navigation header is a fixed vertical sidebar on the left
   (was a horizontal top bar); #app is padded by the same width so page
   content never slides underneath it. */
.sidebar{
  position:fixed; top:0; left:0; bottom:0; z-index:30;
  display:flex; flex-direction:column; align-items:stretch; gap:16px;
  width:232px; padding:18px 14px;
  background:rgba(255,255,255,.96);
  backdrop-filter:blur(8px);
  border-right:1px solid var(--line);
  overflow-y:auto; -webkit-overflow-scrolling:touch;
}
#app{ padding-left:232px; }
.brand{
  display:flex; align-items:center; gap:9px;
  font-weight:800; font-size:15px; letter-spacing:-.01em;
  color:var(--ink); text-decoration:none;
}
.brand em{ font-style:normal; color:var(--muted); font-weight:600; }
.brand-dot{
  flex:none;
  width:11px; height:11px; border-radius:50%;
  background:var(--brand);
  box-shadow:0 0 0 4px var(--brand-100);
}

.nav{ display:flex; flex-direction:column; gap:3px; flex:1; }
.nav-btn{
  font:inherit; font-size:14px; font-weight:650;
  color:var(--muted);
  background:transparent; border:1px solid transparent;
  border-radius:10px;
  padding:9px 12px;
  cursor:pointer;
  white-space:nowrap;
  text-align:left;
  transition:background .15s, color .15s;
}
.nav-btn:hover{ background:var(--line-2); color:var(--ink); }
.nav-btn.is-active{ background:var(--brand-100); color:var(--brand-dark); }

.top-right{ display:flex; flex-direction:column; align-items:stretch; gap:10px; }
.top-right .btn{ width:100%; }
#langSwitch{ width:100%; max-width:none; box-sizing:border-box; }
.who{
  font-size:13px; color:var(--muted); font-weight:600;
  max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

.wrap{ max-width:1140px; margin:0 auto; padding:28px 24px 70px; }

.banner{
  font-size:14px; font-weight:650;
  background:#fff5e6; color:#8a5a12;
  border:1px solid #f3ddb9;
  border-radius:var(--r-md);
  padding:12px 16px;
  margin-bottom:20px;
}

.panel{ display:none; }
.panel.is-active{ display:block; }

.panel-head{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:16px; margin-bottom:20px;
}
/* Heads whose second child is a .filters bar let it drop under the heading
   instead of squeezing the controls into a clipped column. Bare action buttons
   (Refresh, Add …) stay top-right. */
.panel-head.has-filters{ flex-wrap:wrap; }
.panel-head p{ color:var(--muted); font-size:14.5px; margin-top:5px; }

/* --------------------------------------------------------------- cards -- */
.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  box-shadow:var(--sh-xs);
  padding:22px;
}
.card + .card{ margin-top:14px; }
.card h3 + .muted{ margin-top:6px; }

.split{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,420px);
  gap:20px;
  align-items:start;
}

.stack{ display:flex; flex-direction:column; gap:14px; }

/* ------------------------------------------------------- dentist cards -- */
.person{
  display:flex; align-items:center; gap:15px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  box-shadow:var(--sh-xs);
  padding:16px 18px;
}
.person.is-off{ opacity:.62; }
.person.is-selected{
  border-color:var(--brand);
  box-shadow:0 0 0 3px rgba(14,124,116,.13);
}
.person-body{ flex:1; min-width:0; }
.person-name{ font-weight:750; font-size:15.5px; }
.person-role{ font-size:13.5px; color:var(--muted); }
.person-bio{
  font-size:13.5px; color:var(--ink-2);
  margin-top:6px;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden;
}
.person-tags{ display:flex; gap:6px; margin-top:9px; flex-wrap:wrap; }
.tag{
  font-size:11.5px; font-weight:700; letter-spacing:.03em;
  border-radius:var(--r-pill);
  padding:3px 9px;
  background:var(--line-2); color:var(--muted);
}
.tag.on{ background:var(--brand-100); color:var(--brand-dark); }
.tag.off{ background:#fdecec; color:#b7342f; }

.avatar{
  width:52px; height:52px; flex:none;
  border-radius:50%;
  display:grid; place-items:center;
  font-weight:800; font-size:16px;
  overflow:hidden;
  background:var(--brand-100); color:var(--brand-dark);
}
.avatar img{ width:100%; height:100%; object-fit:cover; }
.avatar.dc-sky{ background:var(--sky-100); color:#215f96; }
.avatar.dc-peach{ background:var(--peach-100); color:#a34a29; }

.person-actions{ display:flex; gap:8px; flex:none; }

/* ------------------------------------------------------ calendar rows -- */
.cal-meta{ font-size:13px; color:var(--muted); text-align:right; max-width:240px; }
.cal-head{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.cal-error{ color:var(--danger); font-size:13.5px; margin-top:5px; }

.pill{
  display:inline-flex; align-items:center; gap:6px;
  font-size:11.5px; font-weight:750; letter-spacing:.03em;
  border-radius:var(--r-pill); padding:3px 10px;
  background:var(--line-2); color:var(--muted);
}
.pill::before{ content:''; width:6px; height:6px; border-radius:50%; background:currentColor; }
.pill.on{ background:rgba(20,151,111,.13); color:#0f7a5c; }
.pill.warn{ background:rgba(217,130,43,.16); color:#a7651c; }
.pill.off{ background:var(--line-2); color:var(--muted); }

.setup{ border-color:#f3dcc4; margin-bottom:16px; }
.setup h3{ margin-bottom:6px; }
.setup .code{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:12.5px; color:var(--muted); margin-top:10px;
  word-break:break-word;
}

/* ---------------------------------------------------------------- form -- */
.form{ position:sticky; top:78px; }
.form h3{ margin-bottom:16px; }
.form-actions{ display:flex; gap:10px; margin-top:6px; }

.photo-row{ display:flex; gap:14px; align-items:flex-start; }
.photo-preview{
  width:76px; height:76px; flex:none;
  border-radius:var(--r-md);
  border:1px dashed var(--line);
  background:var(--line-2);
  display:grid; place-items:center;
  font-size:11px; color:var(--muted); text-align:center;
  overflow:hidden;
}
.photo-preview img{ width:100%; height:100%; object-fit:cover; }
.photo-actions{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.photo-actions small{ width:100%; color:var(--muted); font-size:12.5px; word-break:break-all; }

/* -------------------------------------------------------------- table -- */
.table{ width:100%; border-collapse:collapse; }
.table th{
  font-size:11.5px; font-weight:800; letter-spacing:.05em;
  text-transform:uppercase; color:var(--muted);
  text-align:left;
  padding:0 14px 11px;
  border-bottom:1px solid var(--line);
}
.table td{
  padding:11px 14px;
  border-bottom:1px solid var(--line-2);
  vertical-align:middle;
}
.table tr:last-child td{ border-bottom:none; }
.table input[type=time]{ max-width:130px; }
.ta-r{ text-align:right; }
.day-name{ font-weight:700; font-size:14.5px; }
.day-name.is-closed{ color:var(--muted); font-weight:600; }

.row-warn{
  display:block;
  font-size:13px; color:#8a5a12;
  background:#fff5e6;
  border-radius:8px;
  padding:7px 10px;
  margin-top:8px;
}
td .status{ margin:8px 0 0; }

/* ------------------------------------------------------------ settings -- */
.setting{
  display:grid;
  grid-template-columns:minmax(0,1fr) 210px auto;
  gap:16px; align-items:center;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-md);
  box-shadow:var(--sh-xs);
  padding:16px 18px;
}
.setting-label{ font-weight:700; font-size:15px; }
.setting-help{ font-size:13.5px; color:var(--muted); margin-top:3px; }
.setting-flag{
  display:inline-block; margin-left:8px;
  font-size:11px; font-weight:800; letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--muted); background:var(--line-2);
  border-radius:var(--r-pill); padding:2px 8px;
  vertical-align:middle;
}
.setting-flag.stored{ background:var(--brand-100); color:var(--brand-dark); }

/* -------------------------------------------------------------- images -- */
.banner-preview{
  height:190px;
  border:1px dashed var(--line);
  border-radius:var(--r-md);
  background:
    radial-gradient(60% 70% at 18% 15%, #dcf1ee 0%, transparent 62%),
    radial-gradient(55% 65% at 85% 90%, #fdeee7 0%, transparent 60%),
    var(--brand-50);
  display:grid; place-items:center;
  overflow:hidden;
  margin:16px 0;
  color:var(--muted); font-size:14px; font-weight:650;
}
.banner-preview img{ width:100%; height:100%; object-fit:cover; }

.bullets{ margin:14px 0 0; padding-left:20px; }
.bullets li{ font-size:14px; color:var(--ink-2); margin-bottom:9px; }

.muted{ color:var(--muted); font-size:13.5px; }

/* ------------------------------------------------------------ bookings -- */
.filters{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.filters input[type=date],
.filters input[type=search],
.filters select{
  border:1px solid var(--line); border-radius:var(--r-pill);
  padding:8px 13px; font:inherit; font-size:13.5px;
  background:var(--surface); color:var(--ink);
}
.filters input[type=search]{ min-width:220px; }   /* fits the full placeholder */
.filters select{ width:auto; }                   /* the global select{width:100%}
     would stretch this to the whole bar and wrap every control onto its row */
.filters .check{ font-size:13.5px; }

.booking-row{
  display:grid;
  grid-template-columns:70px minmax(0,1fr) auto auto;
  gap:12px; align-items:center;
  padding:11px 13px;
  border:1px solid var(--line); border-radius:var(--r-md);
  background:var(--surface);
  box-shadow:var(--sh-xs);
}
.booking-row.is-block{ background:var(--line-2); box-shadow:none; border-style:dashed; }
.bk-time{ font-weight:800; font-size:14px; font-variant-numeric:tabular-nums; }
.bk-who{ min-width:0; font-size:14.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.row-actions{ display:flex; gap:6px; justify-content:flex-end; flex-wrap:wrap; }

.detail-head{ display:flex; gap:12px; align-items:center; margin:2px 0 14px; }
.facts{ display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:12px 18px; }
.fact span{
  display:block; margin-bottom:3px;
  font-size:11px; font-weight:800; letter-spacing:.07em; text-transform:uppercase;
  color:var(--muted);
}
.fact strong{ font-weight:650; font-size:14.5px; word-break:break-word; }
.detail-actions{ margin-top:18px; }
.detail-h{
  margin:22px 0 10px;
  font-size:11.5px; font-weight:800; letter-spacing:.09em; text-transform:uppercase;
  color:var(--muted);
}
.reschedule-row{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.reschedule-row input{
  border:1px solid var(--line); border-radius:var(--r-sm);
  padding:9px 11px; font:inherit; font-size:14px; background:var(--surface);
}

.timeline{ display:flex; flex-direction:column; }
.tl-item{ display:flex; gap:11px; padding:8px 0; border-bottom:1px dashed var(--line); }
.tl-item:last-child{ border-bottom:none; }
.tl-dot{
  width:9px; height:9px; border-radius:50%; background:var(--brand);
  margin-top:6px; flex:none; box-shadow:0 0 0 3px var(--brand-50);
}
.tl-type{ font-weight:700; font-size:14px; }
.tl-item .muted{ font-size:12.5px; }

/* ------------------------------------------------------------ reminders -- */
.rem-stats{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-bottom:16px; }
.stat{
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-md); padding:14px 16px; box-shadow:var(--sh-xs);
}
.stat strong{ display:block; font-size:26px; font-weight:800; letter-spacing:-.02em; }
.stat span{ font-size:12.5px; font-weight:650; color:var(--muted); }

/* ------------------------------------------------------ setting controls -- */
.setting-actions{ display:flex; gap:6px; align-items:center; justify-content:flex-end; }
.setting-template,
.setting-enumlist{ grid-template-columns:minmax(0,1fr) minmax(0,1.15fr) auto; }
.setting-color{ grid-template-columns:minmax(0,1fr) auto auto; }
.setting textarea{
  width:100%; min-height:96px;
  border:1px solid var(--line); border-radius:var(--r-sm);
  padding:10px 12px; font:inherit; font-size:14px; line-height:1.5;
  resize:vertical; background:var(--surface); color:var(--ink);
}
.setting textarea:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-100); }
.chip-row{ display:flex; gap:16px; flex-wrap:wrap; align-items:center; font-size:14px; }
.color-swatch{
  width:66px; height:40px; padding:3px;
  border:1px solid var(--line); border-radius:var(--r-sm);
  background:var(--surface); cursor:pointer;
}
.setting-bool input[type=checkbox]{ width:20px; height:20px; accent-color:var(--brand); }

/* ---------------------------------------------------- reception inbox -- */
.inbox-split{ grid-template-columns:minmax(0,340px) minmax(0,1fr); }
.inbox-list-wrap{ display:flex; flex-direction:column; gap:10px; }
.inbox-tabs{ display:flex; gap:6px; }
.itab{
  font:inherit; font-size:12px; font-weight:700; cursor:pointer;
  border:1px solid var(--line); background:var(--surface); color:var(--muted);
  border-radius:var(--r-pill); padding:4px 13px;
}
.itab.is-on{ background:var(--brand); border-color:var(--brand); color:#fff; }
.inbox-list{ display:flex; flex-direction:column; gap:6px; max-height:560px; overflow-y:auto; }
.inbox-row{
  position:relative; text-align:left; font:inherit; cursor:pointer;
  border:1px solid var(--line); background:var(--surface); color:var(--ink);
  border-radius:var(--r-sm); padding:10px 12px;
  display:flex; flex-direction:column; gap:3px;
}
.inbox-row:hover{ border-color:var(--brand); }
.inbox-row.is-on{ border-color:var(--brand); background:var(--brand-50); }
.inbox-top{ display:flex; justify-content:space-between; gap:8px; align-items:baseline; }
.inbox-top strong{ font-size:14px; }
.inbox-meta{ display:flex; gap:8px; align-items:baseline; flex-shrink:0; }
.inbox-ch{
  font-size:10.5px; font-weight:750; letter-spacing:.04em; text-transform:uppercase;
  color:var(--brand); background:var(--brand-50); border-radius:var(--r-pill);
  padding:1px 7px;
}
.inbox-when{ font-size:11.5px; color:var(--muted); }
.inbox-prev{
  font-size:13px; color:var(--muted); line-height:1.4;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.inbox-badge{
  position:absolute; top:-6px; right:-6px; min-width:20px; height:20px;
  display:grid; place-items:center; padding:0 5px;
  background:var(--peach); color:#fff; font-size:11px; font-weight:800;
  border-radius:var(--r-pill);
}
.inbox-thread-wrap{ display:flex; flex-direction:column; min-height:360px; }
.inbox-head{
  display:flex; justify-content:space-between; align-items:center; gap:12px;
  padding-bottom:12px; border-bottom:1px solid var(--line); margin-bottom:12px;
}
.inbox-head h3{ font-size:16px; }
.inbox-head .muted{ font-size:12.5px; }
.inbox-stream{
  flex:1; max-height:420px; overflow-y:auto;
  display:flex; flex-direction:column; gap:8px;
  background:var(--bg); border:1px solid var(--line-2);
  border-radius:var(--r-sm); padding:14px;
}
.inbox-msg{
  max-width:82%; padding:9px 13px; border-radius:14px;
  font-size:14px; line-height:1.5; white-space:pre-wrap; word-break:break-word;
}
/* The sender label rides above its bubble on its own line (same class the
   site's chat widget uses, styled here for the portal). */
.inbox-msg .chat-who{
  display:block; font-size:10.5px; text-transform:uppercase; letter-spacing:.06em;
  opacity:.72; margin-bottom:3px; font-weight:750;
}
.inbox-msg.is-in{ align-self:flex-start; background:var(--surface); border:1px solid var(--line); border-bottom-left-radius:5px; }
.inbox-msg.is-out{ align-self:flex-end; background:var(--brand); color:#fff; border-bottom-right-radius:5px; }
.inbox-msg.is-ai.is-out{ background:var(--sky-100); color:var(--ink); border:1px solid var(--sky); }
.inbox-reply{ display:flex; gap:9px; margin-top:12px; }
.inbox-reply input{
  flex:1; min-width:0; padding:10px 13px; font:inherit; font-size:14px;
  border:1px solid var(--line); border-radius:var(--r-sm); background:var(--surface);
}
.inbox-reply input:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-100); }

/* --------------------------------------------------------------- toast -- */
.toast{
  position:fixed; left:50%; bottom:26px; transform:translateX(-50%);
  z-index:60;
  background:var(--ink); color:#fff;
  font-size:14px; font-weight:650;
  border-radius:var(--r-pill);
  padding:11px 20px;
  box-shadow:var(--sh-md);
  animation:pop .18s ease-out;
}
@keyframes pop{ from{ opacity:0; transform:translate(-50%,8px); } }

/* ---------------------------------------------------------- responsive -- */
@media (max-width:940px){
  .split{ grid-template-columns:1fr; }
  .form{ position:static; }
  .setting{ grid-template-columns:1fr; gap:10px; }
}
@media (max-width:640px){
  .wrap{ padding:22px 16px 60px; }
  .grid-2{ grid-template-columns:1fr; }
  .panel-head{ flex-direction:column; }
  .who{ display:none; }
  .table th:nth-child(4), .table td:nth-child(4){ text-align:left; }
}

/* ------------------------------------------------- responsive (mobile) ----
   ADDITIVE PASS for phones (360–430px) and tablets (~768px). Every rule below
   is inside a media query, so nothing above was edited. The 940px / 640px
   queries further up still apply (split panels stack at 940px, forms and
   panel heads collapse at 640px).
   Breakpoints: 900 (tablet) · 700 (phone) · 560 (small phone)
   -------------------------------------------------------------------------- */

@media (max-width:900px){
  /* filters sit under the panel heading instead of beside it */
  .panel-head{ flex-wrap:wrap; }
  .filters{ justify-content:flex-start; }
  .split{ gap:16px; }
  .sidebar{ gap:12px; }
  .nav{ gap:3px; }
  .card{ padding:20px; }
}

@media (max-width:700px){
  /* ---- sidebar narrows so phones keep usable content width ---- */
  .sidebar{ width:176px; padding:14px 10px; gap:12px; }
  #app{ padding-left:176px; }
  .brand{ font-size:14px; }
  .nav-btn{ padding:9px 10px; min-height:40px; font-size:13.5px; }

  /* ---- tap targets: small buttons grow to ≥40px ---- */
  .btn-sm{ padding:10px 15px; font-size:14px; }
  .check{ padding:12px 2px; min-height:40px; }

  /* ---- cards & forms ---- */
  .card{ padding:18px; }
  .form-actions{ flex-wrap:wrap; gap:8px; }
  .form-actions .btn{ flex:1 1 140px; min-height:40px; }
  .filters{ width:100%; justify-content:flex-start; }
  .filters input[type=date],
  .filters input[type=search],
  .filters select{ flex:1 1 150px; min-width:0; min-height:40px; }
  .setting{ padding:14px 16px; }
  .setting-actions{ justify-content:flex-start; }

  /* ---- diary rows: time + status, then who, then the action buttons ---- */
  .booking-row{ grid-template-columns:auto minmax(0,1fr); gap:8px 12px; padding:13px; }
  .booking-row .bk-time{ grid-column:1; grid-row:1; }
  .booking-row .pill{ grid-column:2; grid-row:1; justify-self:end; }
  .booking-row .bk-who{
    grid-column:1 / -1; grid-row:2;
    white-space:normal; overflow:visible; text-overflow:clip;
  }
  .booking-row .row-actions{ grid-column:1 / -1; grid-row:3; justify-content:flex-start; }
  .row-actions{ gap:8px; }
  .row-actions .btn{ flex:1 1 auto; min-height:40px; }

  /* ---- list cards: Edit/Hide drop to their own full-width line ---- */
  .person{ flex-wrap:wrap; }
  .person-actions{ width:100%; justify-content:flex-start; gap:8px; }
  .person-actions .btn{ flex:1 1 auto; min-height:40px; }

  .cal-meta{ max-width:none; text-align:left; }

  /* ---- tables scroll sideways inside their own card ---- */
  .card{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .table{ min-width:520px; }
}

@media (max-width:560px){
  /* readable copy (≥14px) and 16px fields so iOS does not zoom on focus */
  .muted,.hint,.person-bio,.setting-help,.cal-meta,.row-warn,
  .tl-item .muted,.status,.filters .check{ font-size:14px; }

  input[type=text], input[type=email], input[type=password],
  input[type=number], input[type=date], input[type=search], input[type=time],
  select, textarea,
  .filters input[type=date], .filters input[type=search], .filters select,
  .setting textarea, .reschedule-row input{ font-size:16px; }

  .wrap{ padding:20px 14px 56px; }
  .gate-card{ padding:28px 20px 22px; }
  .rem-stats{ gap:10px; }
  .facts{ gap:10px 14px; }
  .toast{ max-width:calc(100vw - 32px); text-align:center; }
}

/* --------------------------------------------------------------- new tabs
   Prescriptions, Users and Languages (roles/i18n batch). Appended after the
   responsive pass above; its own small query at the end. */

/* status pills — used by the bookings detail, prescription rows and users */
.badge{ display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:99px;
        font-size:11.5px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; flex:none; }
.rx-badge-draft{ background:#fff3d6; color:#8a5a00; }
.rx-badge-issued{ background:#e4f6ee; color:#0f7d5b; }
.rx-badge-void{ background:#ffe3e3; color:#a52626; }

/* languages */
.lang-chips{ display:flex; flex-wrap:wrap; gap:8px; }
.chip{ border:1px solid var(--line); background:var(--surface); border-radius:99px; padding:7px 14px;
       font:inherit; font-size:13.5px; font-weight:600; color:var(--muted); cursor:pointer; }
.chip:hover{ color:var(--ink); border-color:#cfdde6; }
.chip.is-active{ background:var(--brand); border-color:var(--brand); color:#fff; }
.str-row{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px;
          align-items:center; padding:9px 0; border-bottom:1px solid var(--line); }
.str-src{ min-width:0; }
.str-src code{ display:inline-block; font-size:11.5px; color:var(--muted); background:var(--brand-50);
               border-radius:6px; padding:1px 6px; margin-bottom:3px; }
.str-src span{ display:block; font-size:14.5px; color:var(--ink); }
.str-out input{ width:100%; padding:9px 12px; border:1px solid var(--line); border-radius:9px;
                font:inherit; font-size:14.5px; background:var(--bg); color:var(--ink); }
.str-out input:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.str-out input:not([value=""]){ background:var(--surface); }

/* prescriptions */
.rx-tools{ display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
.rx-meta-row{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.rx-meta-row strong{ font-size:16px; letter-spacing:.01em; }
.rx-meta-row .hint{ margin-top:0; margin-left:auto; }
.rx-sec{ padding:14px 16px; }
.rx-sec-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
.rx-sec-head strong{ font-size:12.5px; text-transform:uppercase; letter-spacing:.07em; color:var(--brand); }
.rx-sec .field{ margin-bottom:0; }
.rx-sec .grid-2{ margin-bottom:0; align-items:start; }
.rx-sec textarea{ resize:vertical; min-height:64px; }
.rx-sec + .rx-sec{ margin-top:12px; }
#rxList .person{ cursor:pointer; }

/* users */
.checks{ display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:8px 14px; margin-top:8px; }
.checks .check{ margin-top:0; }

@media (max-width:700px){
  .str-row{ grid-template-columns:1fr; gap:6px; padding:11px 0; }
  .rx-meta-row .hint{ margin-left:0; flex:1 1 100%; }
  .checks{ grid-template-columns:1fr; }
}

/* --------------------------------------------- prescription page view ----
   A full-page, read-only view of the finished document (the same sheet the
   patient sees). The document is written into a same-origin about:blank
   iframe — the same CSP-safe technique the print popup uses — and its
   Print/Download buttons are wired from the parent. */
.rx-view{
  position:fixed; inset:0; z-index:55;
  display:flex; flex-direction:column;
  background:var(--bg);
}
.rx-view-bar{
  display:flex; align-items:center; gap:12px;
  padding:11px 18px;
  background:var(--surface);
  border-bottom:1px solid var(--line);
}
.rx-view-bar strong{ font-size:15px; letter-spacing:.01em; }
.rx-view-tools{ display:flex; gap:8px; margin-left:auto; }
.rx-view-frame{ flex:1; width:100%; border:0; background:#fff; }
body.rx-view-open{ overflow:hidden; }
.rx-view-btn{ flex:none; }

/* --------------------------------------------- read-only prescription ----
   Issued and void prescriptions are final: the editor still shows every
   field (the doctor may need to read them) but nothing accepts input. */
#rxEdit.is-locked .field input,
#rxEdit.is-locked .field select,
#rxEdit.is-locked .field textarea{
  background:var(--bg);
  border-style:dashed;
  cursor:default;
}
#rxEdit.is-locked input:disabled,
#rxEdit.is-locked select:disabled,
#rxEdit.is-locked textarea:disabled{
  color:var(--ink-2);
  -webkit-text-fill-color:var(--ink-2);
  opacity:1;
}
.rx-lock{
  margin-top:0;
  padding:9px 12px;
  border-left:3px solid var(--accent);
  background:var(--peach-100);
  border-radius:0 8px 8px 0;
  color:var(--ink-2);
  font-weight:600;
}
