/* ============================================================
   Doctor / Admin Dashboard — Phase 0 UI shell
   Dominant language flips to FLAT + ACRYLIC (staff tool, not a
   first-impression brand moment) but keeps the same colour tokens
   as the patient site for brand continuity.
   ============================================================ */
*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0; background:#F1ECE1; color:var(--text); font-family:var(--font-body);
  font-size:15px; line-height:1.5; -webkit-font-smoothing:antialiased;
}
a{ text-decoration:none; color:inherit; }
button{ font-family:inherit; }
img{ max-width:100%; display:block; }

/* ---------- Login screen ---------- */
.login-screen{
  min-height:100vh; display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:24px; background:
    radial-gradient(60% 50% at 20% 10%, rgba(201,161,90,.16), transparent 70%),
    radial-gradient(55% 45% at 90% 90%, rgba(126,150,154,.18), transparent 70%),
    #F1ECE1;
}
.login-card{
  width:100%; max-width:380px; background:rgba(255,254,251,.88); backdrop-filter:blur(16px) saturate(160%);
  -webkit-backdrop-filter:blur(16px) saturate(160%);
  border:1px solid rgba(255,255,255,.6); border-radius:24px; padding:32px 26px; box-shadow:var(--shadow-lg);
}
.login-mark{ width:44px; height:44px; margin:0 auto 14px; display:block; }
.login-mark path{ fill:none; stroke:var(--walnut); stroke-width:5.5; stroke-linecap:round; stroke-linejoin:round; }
.login-card h1{ font-family:var(--font-display); font-size:21px; text-align:center; margin:0 0 4px; }
.login-card p.sub{ text-align:center; font-size:12.5px; color:var(--text-muted); margin:0 0 24px; }
.field{ margin-bottom:14px; }
.field label{ display:block; font-size:12px; font-weight:700; color:var(--ink-soft); margin-bottom:6px; }
.field input{
  width:100%; padding:12px 14px; border-radius:12px; border:1px solid var(--border); background:var(--white);
  font-size:14px; outline:none; transition:border-color 150ms, box-shadow 150ms;
}
.field input:focus{ border-color:var(--teal); box-shadow:0 0 0 3px var(--teal-light); }
.login-btn{
  width:100%; padding:13px; border:none; border-radius:12px; background:var(--ink); color:var(--cream);
  font-weight:700; font-size:14.5px; cursor:pointer; margin-top:6px; display:flex; align-items:center; justify-content:center; gap:8px;
}
.login-btn:active{ transform:scale(.98); }
.login-security{ display:flex; gap:8px; align-items:flex-start; margin-top:20px; padding:12px; background:var(--teal-light); border-radius:12px; font-size:11.5px; color:var(--teal-dk); }
.login-back{ display:block; text-align:center; margin-top:18px; font-size:12.5px; color:var(--text-muted); }

/* ---------- App shell ---------- */
.app{ display:flex; min-height:100vh; }
.sidebar{
  position:fixed; top:0; left:0; bottom:0; width:250px; z-index:80; padding:20px 14px;
  background:rgba(250,247,240,.78); backdrop-filter:blur(20px) saturate(170%); -webkit-backdrop-filter:blur(20px) saturate(170%);
  border-right:1px solid rgba(255,255,255,.5); box-shadow:6px 0 30px rgba(74,49,35,.06);
  transform:translateX(-100%); transition:transform 320ms var(--ease-out);
  display:flex; flex-direction:column;
}
.sidebar.is-open{ transform:translateX(0); }
.side-brand{ display:flex; align-items:center; gap:9px; padding:6px 8px 18px; }
.side-brand svg{ width:26px; height:26px; }
.side-brand svg path{ fill:none; stroke:var(--walnut); stroke-width:5.5; stroke-linecap:round; stroke-linejoin:round; }
.side-brand strong{ font-family:var(--font-display); font-size:14.5px; display:block; }
.side-brand span{ font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.06em; }
.side-nav{ display:flex; flex-direction:column; gap:2px; flex:1; overflow-y:auto; }
.side-link{
  display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:12px; font-size:13.5px; font-weight:600;
  color:var(--ink-soft); cursor:pointer; border:none; background:none; width:100%; text-align:left;
}
.side-link svg{ width:18px; height:18px; flex:0 0 auto; }
.side-link:hover{ background:rgba(126,150,154,.1); }
.side-link.active{ background:var(--ink); color:var(--cream); }
.side-group-label{ font-size:10.5px; text-transform:uppercase; letter-spacing:.07em; color:var(--text-muted); margin:16px 10px 6px; font-weight:700; }
.side-foot{ border-top:1px solid var(--border); padding-top:12px; margin-top:10px; display:flex; align-items:center; gap:10px; }
.side-foot .who{ width:34px; height:34px; border-radius:50%; background:var(--sage-light); color:var(--sage-dk); display:grid; place-items:center; font-weight:700; font-size:13px; }
.side-foot strong{ display:block; font-size:12.5px; }
.side-foot span{ font-size:11px; color:var(--text-muted); }

.sidebar-scrim{ position:fixed; inset:0; background:rgba(43,38,32,.35); z-index:75; opacity:0; pointer-events:none; transition:opacity 250ms; }
.sidebar-scrim.is-open{ opacity:1; pointer-events:auto; }

.main{ flex:1; min-width:0; padding-bottom:40px; }
.topbar{
  position:sticky; top:0; z-index:60; display:flex; align-items:center; gap:12px; padding:14px 16px;
  background:rgba(241,236,225,.85); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px);
  border-bottom:1px solid var(--border);
}
.icon-btn{ width:38px; height:38px; border-radius:12px; border:1px solid var(--border); background:var(--white); display:grid; place-items:center; cursor:pointer; }
.icon-btn svg{ width:19px; height:19px; }
.topbar h2{ font-family:var(--font-display); font-size:18px; margin:0; flex:1; min-width:0; }
.topbar-actions{ display:flex; gap:8px; }

.view{ display:none; padding:18px 16px 10px; animation:view-in 260ms var(--ease-out); }
.view.active{ display:block; }
@keyframes view-in{ from{ opacity:0; transform:translateY(6px);} to{ opacity:1; transform:translateY(0);} }

/* ---------- stat tiles ---------- */
.stat-row{ display:grid; grid-template-columns:repeat(2,1fr); gap:10px; margin-bottom:18px; }
.stat-tile{
  background:rgba(255,254,251,.75); backdrop-filter:blur(10px); border:1px solid rgba(255,255,255,.6);
  border-radius:16px; padding:14px; box-shadow:var(--shadow-sm);
}
.stat-tile .n{ font-family:var(--font-display); font-size:26px; color:var(--ink); }
.stat-tile .l{ font-size:11.5px; color:var(--text-muted); font-weight:600; }
.stat-tile.accent{ background:linear-gradient(155deg,#3a2c1c,#241a10); border:none; }
.stat-tile.accent .n{ color:var(--brass-light); }
.stat-tile.accent .l{ color:#C9B896; }

.quick-actions{ display:flex; gap:8px; overflow-x:auto; margin-bottom:20px; }
.qa-btn{
  flex:0 0 auto; display:flex; align-items:center; gap:7px; padding:10px 14px; border-radius:12px;
  border:1px solid var(--border); background:var(--white); font-size:12.5px; font-weight:700; cursor:pointer; color:var(--ink);
}
.qa-btn svg{ width:16px; height:16px; color:var(--teal-dk); }

.card-block{ background:var(--white); border:1px solid var(--border); border-radius:16px; padding:14px; margin-bottom:14px; }
.card-block h3{ font-size:13.5px; margin:0 0 10px; display:flex; justify-content:space-between; align-items:center; }
.card-block h3 a{ font-size:11.5px; font-weight:700; color:var(--teal-dk); }

.activity-row{ display:flex; gap:10px; padding:9px 0; border-bottom:1px solid var(--parchment-dk); font-size:12.5px; }
.activity-row:last-child{ border-bottom:none; }
.activity-dot{ width:7px; height:7px; border-radius:50%; margin-top:5px; flex:0 0 auto; }

/* ---------- pills ---------- */
.pill{ display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:999px; font-size:10.5px; font-weight:700; }
.pill.new{ background:var(--teal-light); color:var(--teal-dk); }
.pill.contacted{ background:#E9E2F5; color:#6B4FA0; }
.pill.followup{ background:var(--brass-light); color:var(--brass-dk); }
.pill.booked{ background:#DCEAF7; color:#2E6DA4; }
.pill.converted{ background:var(--sage-light); color:var(--sage-dk); }
.pill.closed{ background:#EDEAE3; color:#8A8071; }
.pill.confirmed{ background:var(--sage-light); color:var(--sage-dk); }
.pill.upcoming{ background:var(--teal-light); color:var(--teal-dk); }
.pill.completed{ background:#EDEAE3; color:#8A8071; }
.pill.cancelled{ background:var(--terracotta-light); color:var(--terracotta); }
.pill.paid{ background:var(--sage-light); color:var(--sage-dk); }
.pill.due{ background:var(--terracotta-light); color:var(--terracotta); }

/* ---------- toggle (kanban / table) ---------- */
.view-toggle{ display:flex; background:var(--parchment-dk); border-radius:10px; padding:3px; gap:3px; }
.view-toggle button{ border:none; background:none; padding:6px 12px; border-radius:8px; font-size:11.5px; font-weight:700; color:var(--text-muted); cursor:pointer; }
.view-toggle button.active{ background:var(--white); color:var(--ink); box-shadow:var(--shadow-sm); }

/* ---------- kanban ---------- */
.kanban{ display:flex; gap:12px; overflow-x:auto; padding-bottom:8px; margin-top:14px; }
.kanban-col{ flex:0 0 230px; background:rgba(255,254,251,.6); border:1px solid var(--border); border-radius:14px; padding:10px; }
.kanban-col h4{ font-size:11.5px; text-transform:uppercase; letter-spacing:.04em; margin:2px 4px 10px; display:flex; justify-content:space-between; color:var(--ink-soft); }
.kanban-col h4 span{ background:var(--white); border-radius:999px; padding:1px 7px; font-weight:700; }
.kcard{
  background:var(--white); border-radius:12px; padding:10px 11px; margin-bottom:8px; box-shadow:var(--shadow-sm);
  cursor:grab; border:1px solid transparent;
}
.kcard:active{ cursor:grabbing; }
.kcard.dragging{ opacity:.4; }
.kcard strong{ display:block; font-size:12.5px; }
.kcard .meta{ font-size:10.5px; color:var(--text-muted); margin-top:2px; }
.kcard .kfoot{ display:flex; justify-content:space-between; align-items:center; margin-top:8px; }
.kcard .wa-btn{ width:28px; height:28px; border-radius:50%; background:#E4F3E6; color:#2E9E4F; display:grid; place-items:center; cursor:pointer; }
.kcard .wa-btn svg{ width:14px; height:14px; }
.kanban-col.drop-target{ outline:2px dashed var(--teal); outline-offset:-2px; }

/* ---------- table ---------- */
.table-scroll{ position:relative; }
.table-wrap{ overflow-x:auto; margin-top:14px; border:1px solid var(--border); border-radius:14px; background:var(--white); -webkit-overflow-scrolling:touch; }
.table-scroll::after{
  content:""; position:absolute; top:15px; right:0; bottom:8px; width:36px; pointer-events:none;
  background:linear-gradient(90deg, transparent, rgba(241,236,225,.9));
  border-radius:0 14px 14px 0;
}
.table-hint{ display:flex; align-items:center; gap:5px; font-size:11px; color:var(--text-muted); margin:7px 2px 0; }
.table-hint svg{ width:12px; height:12px; }
@media (min-width:760px){ .table-scroll::after{ display:none; } .table-hint{ display:none; } }
table{ width:100%; border-collapse:collapse; font-size:12.5px; min-width:600px; }
th{ text-align:left; padding:10px 12px; background:var(--parchment); font-size:10.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted); position:sticky; top:0; }
td{ padding:10px 12px; border-top:1px solid var(--parchment-dk); vertical-align:middle; }
tr td:first-child, tr th:first-child{ font-weight:700; color:var(--ink); }
.row-actions{ display:flex; gap:6px; }
.row-actions button{ width:30px; height:30px; border-radius:8px; border:1px solid var(--border); background:var(--white); display:grid; place-items:center; cursor:pointer; }
.row-actions button svg{ width:13px; height:13px; }

/* ---------- day tabs (appointments) ---------- */
.day-tabs{ display:flex; gap:8px; overflow-x:auto; margin:14px 0; }
.day-tab{ flex:0 0 auto; padding:9px 15px; border-radius:12px; border:1px solid var(--border); background:var(--white); font-size:12px; font-weight:700; cursor:pointer; }
.day-tab.active{ background:var(--ink); color:var(--cream); border-color:var(--ink); }
.appt-card{ display:flex; gap:12px; background:var(--white); border:1px solid var(--border); border-radius:14px; padding:12px; margin-bottom:10px; align-items:center; }
.appt-time{ text-align:center; flex:0 0 56px; }
.appt-time strong{ display:block; font-size:14px; }
.appt-time span{ font-size:10px; color:var(--text-muted); }
.appt-body{ flex:1; min-width:0; }
.appt-body strong{ font-size:13px; display:block; }
.appt-body span{ font-size:11px; color:var(--text-muted); }
.appt-actions{ display:flex; gap:6px; }
.appt-actions button{ width:30px; height:30px; border-radius:9px; border:1px solid var(--border); background:var(--white); display:grid; place-items:center; }
.appt-actions button svg{ width:14px; height:14px; }

/* ---------- invoices ---------- */
.invoice-card{ display:flex; justify-content:space-between; align-items:center; background:var(--white); border:1px solid var(--border); border-radius:14px; padding:14px; margin-bottom:10px; }
.invoice-card strong{ font-size:13px; display:block; }
.invoice-card span{ font-size:11px; color:var(--text-muted); }
.invoice-amt{ text-align:right; }
.invoice-amt strong{ font-size:15px; }

/* ---------- Dashboard Assistant (distinct from patient chatbot: acrylic, teal accent) ---------- */
.assist-fab{
  position:fixed; right:16px; bottom:16px; z-index:90; width:56px; height:56px; border-radius:18px; border:none; cursor:pointer;
  background:linear-gradient(155deg, rgba(126,150,154,.9), rgba(93,115,119,.95));
  backdrop-filter:blur(6px); box-shadow:0 10px 26px rgba(93,115,119,.4); color:#fff; display:grid; place-items:center;
}
.assist-panel{
  position:fixed; right:0; top:0; bottom:0; width:min(360px,92vw); z-index:120;
  background:rgba(250,247,240,.9); backdrop-filter:blur(22px) saturate(170%); -webkit-backdrop-filter:blur(22px) saturate(170%);
  border-left:1px solid rgba(255,255,255,.5); box-shadow:-16px 0 50px rgba(0,0,0,.15);
  transform:translateX(100%); transition:transform 380ms var(--ease-spring);
  display:flex; flex-direction:column;
}
.assist-panel.is-open{ transform:translateX(0); }
.assist-head{ display:flex; align-items:center; gap:10px; padding:16px; border-bottom:1px solid var(--border); }
.assist-avatar{ width:36px; height:36px; border-radius:11px; background:linear-gradient(155deg,#8EA5A9,var(--teal-dk)); display:grid; place-items:center; color:#fff; }
.assist-head strong{ font-size:13.5px; display:block; }
.assist-head span{ font-size:11px; color:var(--teal-dk); font-weight:600; }
.assist-body{ flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:10px; }
.assist-body .msg{ max-width:88%; padding:10px 13px; border-radius:14px; font-size:13px; line-height:1.45; }
.assist-body .msg.bot{ align-self:flex-start; background:var(--white); box-shadow:var(--shadow-sm); border-bottom-left-radius:4px; }
.assist-body .msg.user{ align-self:flex-end; background:var(--teal-dk); color:#fff; border-bottom-right-radius:4px; }
.assist-chip-row{ display:flex; flex-wrap:wrap; gap:6px; padding:0 16px 10px; }
.assist-chip-row button{ border:1px solid var(--border); background:var(--white); padding:7px 11px; border-radius:999px; font-size:11.5px; font-weight:700; }
.assist-input{ display:flex; gap:8px; padding:12px 14px 16px; border-top:1px solid var(--border); }
.assist-input input{ flex:1; border:1px solid var(--border); border-radius:999px; padding:10px 14px; font-size:13px; }
.assist-input button{ width:38px; height:38px; border-radius:50%; border:none; background:var(--teal-dk); color:#fff; display:grid; place-items:center; }

/* ---------- patient detail drawer ---------- */
.pd-overlay{ position:fixed; inset:0; background:rgba(43,38,32,.35); z-index:110; opacity:0; pointer-events:none; transition:opacity 250ms; }
.pd-overlay.is-open{ opacity:1; pointer-events:auto; }
.pd-panel{
  position:fixed; right:0; top:0; bottom:0; width:min(380px,94vw); z-index:111; background:var(--cream);
  transform:translateX(100%); transition:transform 340ms var(--ease-spring); overflow-y:auto; box-shadow:-16px 0 50px rgba(0,0,0,.15);
}
.pd-panel.is-open{ transform:translateX(0); }
.pd-head{ padding:20px; background:linear-gradient(155deg,var(--sage-light),var(--parchment)); }
.pd-head .who{ width:56px; height:56px; border-radius:50%; background:var(--white); display:grid; place-items:center; font-weight:700; font-size:20px; color:var(--sage-dk); box-shadow:var(--shadow-sm); margin-bottom:10px; }
.pd-body{ padding:16px 20px; }
.pd-row{ display:flex; justify-content:space-between; padding:9px 0; border-bottom:1px solid var(--border); font-size:12.5px; }
.pd-actions{ display:flex; gap:8px; margin-top:16px; }
.pd-actions button{ flex:1; padding:11px; border-radius:12px; border:1px solid var(--border); background:var(--white); font-weight:700; font-size:12.5px; display:flex; align-items:center; justify-content:center; gap:6px; }
.pd-actions button.wa{ background:#E4F3E6; color:#2E9E4F; border-color:#c9e8cd; }
.pd-close{ position:absolute; top:14px; right:14px; width:36px; height:36px; border-radius:50%; background:rgba(255,255,255,.7); display:grid; place-items:center; border:none; }

/* ---------- toast (honest feedback for not-yet-wired actions) ---------- */
.toast{
  position:fixed; left:50%; bottom:24px; z-index:200; max-width:88vw;
  transform:translate(-50%, 12px); opacity:0; pointer-events:none;
  background:var(--ink); color:var(--cream); padding:11px 18px; border-radius:999px;
  font-size:12.5px; font-weight:600; box-shadow:var(--shadow-lg);
  display:flex; align-items:center; gap:8px; transition:opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
  text-align:center;
}
.toast.is-visible{ opacity:1; transform:translate(-50%, 0); pointer-events:auto; }
.toast svg{ flex:0 0 auto; color:var(--brass-light); }

/* ---------- notification dropdown ---------- */
.notif-badge{ position:absolute; top:7px; right:7px; width:8px; height:8px; border-radius:50%; background:var(--terracotta); border:2px solid var(--white); }
.notif-pop{
  position:absolute; top:56px; right:16px; z-index:65; width:280px;
  background:var(--white); border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow-lg);
  opacity:0; transform:translateY(-8px) scale(.97); pointer-events:none; transition:opacity 180ms, transform 180ms;
  overflow:hidden;
}
.notif-pop.is-open{ opacity:1; transform:translateY(0) scale(1); pointer-events:auto; }
.notif-pop h5{ margin:0; padding:12px 14px; font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); border-bottom:1px solid var(--parchment-dk); }
.notif-row{ padding:11px 14px; border-bottom:1px solid var(--parchment-dk); font-size:12.5px; }
.notif-row:last-child{ border-bottom:none; }
.notif-row strong{ display:block; font-size:12.5px; }
.notif-row span{ font-size:11px; color:var(--text-muted); }

@media (min-width:900px){
  .sidebar{ transform:translateX(0); position:sticky; height:100vh; }
  .sidebar-scrim{ display:none; }
  .app{ align-items:flex-start; }
  .main{ margin-left:0; width:calc(100% - 250px); }
  #hamburgerBtn{ display:none; }
  .stat-row{ grid-template-columns:repeat(4,1fr); }
}
