/* SmileDesign for Practices — same dark palette as the public /smiledesign/ page */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #141722;
  --border: #2e3149;
  --accent: #6c63ff;
  --accent2: #a78bfa;
  --text: #e2e8f0;
  --muted: #8b93a7;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --radius: 14px;
}
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.45;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent2); }
h1, h2, h3 { margin: 0; letter-spacing: -.3px; }
p { margin: 0; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: rgba(15,17,23,.92); position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--text); }
.brand b { font-size: 1.15rem; font-weight: 700; }
.brand b span { color: var(--accent2); }
.brand small { color: var(--muted); font-size: .8rem; }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topbar nav a, .linkbtn {
  color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 8px;
  font-size: .9rem; background: none; border: none; cursor: pointer; font-family: inherit;
}
.topbar nav a:hover, .linkbtn:hover, .topbar nav a.active { color: var(--text); background: var(--surface); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 99px; background: var(--surface);
  font-size: .88rem; color: var(--text); white-space: nowrap;
}
.pill b { color: var(--success); }
.pill.low b { color: var(--warning); }

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 20px 40px; }

/* ── Buttons / inputs ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; border: 1px solid transparent;
  font-size: .95rem; font-weight: 600; font-family: inherit; cursor: pointer;
  text-decoration: none; transition: opacity .15s, background .15s, transform .08s;
  color: #fff; background: var(--accent);
}
.btn:hover:not(:disabled) { opacity: .92; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: transparent; border-color: var(--border); color: var(--text); }
.btn.secondary:hover:not(:disabled) { background: var(--surface2); }
.btn.success { background: transparent; border-color: var(--success); color: var(--success); }
.btn.block { width: 100%; }
.btn.small { padding: 7px 12px; font-size: .85rem; }
.btn.big { padding: 16px 28px; font-size: 1.08rem; border-radius: 12px; }
.btn.google { background: #fff; color: #1f2937; border-color: #fff; }
.btn.google img { width: 18px; height: 18px; }

label { display: block; font-size: .85rem; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: .95rem; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(108,99,255,.5); border-color: var(--accent); }
textarea { resize: vertical; min-height: 64px; }
.check { display: flex; gap: 9px; align-items: flex-start; margin-top: 16px; font-size: .88rem; color: var(--muted); }
.check input { margin-top: 3px; accent-color: var(--accent); }
.hint { color: var(--muted); font-size: .8rem; margin-top: 5px; }

/* ── Cards / flashes ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; box-shadow: 0 18px 60px rgba(0,0,0,.35);
}
.auth-wrap { max-width: 440px; margin: 24px auto 0; }
.auth-wrap h1 { font-size: 1.45rem; margin-bottom: 4px; }
.auth-wrap .sub { color: var(--muted); font-size: .9rem; margin-bottom: 20px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 18px 0 4px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-foot { text-align: center; color: var(--muted); font-size: .88rem; margin-top: 18px; }
.recaptcha-note { color: var(--muted); font-size: .72rem; margin-top: 12px; text-align: center; }

.flashes { max-width: 1180px; margin: 16px auto 0; padding: 0 20px; width: 100%; }
.flash {
  padding: 11px 15px; border-radius: 9px; font-size: .9rem; margin-bottom: 8px;
  border: 1px solid var(--border); background: var(--surface);
}
.flash.success { color: var(--success); border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.08); }
.flash.danger  { color: var(--error);   border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.08); }
.flash.warning { color: var(--warning); border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.08); }
.flash.info    { color: var(--accent2); border-color: rgba(167,139,250,.35); background: rgba(167,139,250,.08); }

/* ── Dashboard hero (upload) ─────────────────────────────────────────────── */
.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center;
  background: linear-gradient(135deg, rgba(108,99,255,.16), rgba(167,139,250,.05) 60%), var(--surface);
}
.hero h1 { font-size: 1.6rem; margin-bottom: 8px; }
.hero h1 span { color: var(--accent2); }
.hero .lead { color: var(--muted); margin-bottom: 18px; max-width: 560px; }
.steps { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.steps li { display: flex; gap: 10px; align-items: center; font-size: .92rem; }
.steps li i {
  font-style: normal; width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(108,99,255,.25); color: var(--accent2); font-size: .8rem; font-weight: 700;
}
.hero-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.balance-box {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; text-align: center;
}
.balance-box .amt { font-size: 2.2rem; font-weight: 700; margin: 4px 0; }
.balance-box .muted { color: var(--muted); font-size: .88rem; }
.balance-box .btn { margin-top: 14px; }

/* ── History ─────────────────────────────────────────────────────────────── */
.section-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 34px 0 14px;
}
.section-head h2 { font-size: 1.2rem; }
.section-head .count { color: var(--muted); font-size: .9rem; }
.section-head .spacer { flex: 1; }
.section-head select { width: auto; padding: 7px 10px; font-size: .88rem; }
.section-head .perpage { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .88rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.pcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; display: flex; flex-direction: column;
}
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--border); cursor: zoom-in; position: relative; }
.pair figure { margin: 0; position: relative; aspect-ratio: 4 / 5; background: var(--surface2); overflow: hidden; }
.pair img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pair figcaption {
  position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 99px;
  background: rgba(0,0,0,.6); color: #fff; font-size: .72rem; letter-spacing: .3px;
}
.pair .open-hint {
  position: absolute; right: 8px; bottom: 8px; padding: 4px 9px; border-radius: 99px;
  background: rgba(0,0,0,.65); color: #fff; font-size: .75rem; opacity: 0; transition: opacity .15s;
}
.pair:hover .open-hint { opacity: 1; }
.placeholder {
  aspect-ratio: 8 / 5; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; text-align: center;
  background: var(--surface2); color: var(--muted); padding: 18px; font-size: .9rem;
}
.placeholder.failed { color: var(--error); }
.mini-bar { width: 70%; height: 6px; background: #1e2133; border-radius: 99px; overflow: hidden; }
.mini-bar div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .6s ease; }
.pmeta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.pmeta .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.pmeta time { color: var(--muted); font-size: .84rem; }
.fname { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.comment-view {
  font-size: .9rem; color: var(--text); white-space: pre-wrap; word-break: break-word;
  cursor: text; border-radius: 7px; padding: 6px 8px; margin: 0 -8px; min-height: 30px;
}
.comment-view:hover { background: var(--surface2); }
.comment-view.empty { color: var(--muted); font-style: italic; }
.comment-edit textarea { min-height: 70px; font-size: .9rem; }
.comment-edit .row { margin-top: 6px; justify-content: flex-end; }
.badge { font-size: .72rem; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); }
.badge.ok { color: var(--success); border-color: rgba(52,211,153,.35); }
.badge.bad { color: var(--error); border-color: rgba(248,113,113,.35); }
.badge.run { color: var(--accent2); border-color: rgba(167,139,250,.35); }

.empty-state {
  text-align: center; padding: 48px 20px; color: var(--muted);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.pager button {
  min-width: 38px; padding: 7px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit;
}
.pager button.cur { background: var(--accent); border-color: var(--accent); }
.pager button:disabled { opacity: .4; cursor: default; }
.pager span { color: var(--muted); padding: 7px 4px; }

/* ── Before / after slider ───────────────────────────────────────────────── */
.ba {
  position: relative; width: 100%; overflow: hidden; border-radius: 10px;
  background: #0a0c14; user-select: none; -webkit-user-select: none;
  cursor: ew-resize; touch-action: pan-y; --pos: 50%;
}
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.ba .ba-after { clip-path: inset(0 0 0 var(--pos)); }
.ba .ba-line {
  position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px;
  background: #fff; box-shadow: 0 0 8px rgba(0,0,0,.6); pointer-events: none;
}
.ba .ba-knob {
  position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border-radius: 50%; background: #fff; color: #333; box-shadow: 0 2px 10px rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
}
.ba .ba-tag {
  position: absolute; top: 12px; padding: 3px 10px; border-radius: 99px;
  background: rgba(0,0,0,.6); color: #fff; font-size: .78rem; pointer-events: none;
}
.ba .ba-tag.l { left: 12px; }
.ba .ba-tag.r { right: 12px; }
.ba:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(5,6,10,.78); z-index: 50;
  display: none; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow-y: auto;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 640px; padding: 26px; position: relative;
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
}
.modal.wide { max-width: 980px; }
.modal:focus { outline: none; }
.pair:focus-visible { outline: 2px solid var(--accent2); outline-offset: -2px; }
.modal h2 { font-size: 1.25rem; margin-bottom: 6px; }
.modal .sub { color: var(--muted); font-size: .9rem; margin-bottom: 16px; }
.modal .x {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--surface2); color: var(--text); font-size: 1.1rem; cursor: pointer;
}
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 38px 20px; text-align: center;
  cursor: pointer; transition: border-color .2s, background .2s; color: var(--muted);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: rgba(108,99,255,.07); }
.dropzone strong { color: var(--text); }
.dropzone .ico { font-size: 2.2rem; margin-bottom: 8px; }
.tips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 16px 0 4px; padding: 0; list-style: none; }
.tips li { font-size: .84rem; color: var(--muted); display: flex; gap: 7px; }
.tips li::before { content: '✓'; color: var(--success); }
.preview { margin-top: 16px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #0a0c14; }
.preview img { width: 100%; max-height: 340px; object-fit: contain; display: block; }
.preview .name { padding: 8px 12px; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--border); }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; }
.progress { margin: 18px 0 6px; }
.progress .lbl { display: flex; justify-content: space-between; font-size: .88rem; color: var(--muted); margin-bottom: 8px; }
.progress .lbl b { color: var(--text); font-weight: 500; }
.bar { height: 8px; background: #1e2133; border-radius: 99px; overflow: hidden; }
.bar div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .6s ease; }
.msg { margin-top: 14px; padding: 11px 14px; border-radius: 9px; font-size: .9rem; display: none; }
.msg.error { display: block; color: var(--error); background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.3); }
.msg.ok { display: block; color: var(--success); background: rgba(52,211,153,.08); border: 1px solid rgba(52,211,153,.3); }
.viewer-meta { display: flex; gap: 16px; align-items: flex-start; margin-top: 16px; flex-wrap: wrap; }
.viewer-meta .grow { flex: 1; min-width: 240px; }
.fund-amt { font-size: 2.6rem; font-weight: 700; text-align: center; margin: 10px 0 2px; }
.fund-sub { text-align: center; color: var(--muted); margin-bottom: 8px; }

.banner { margin-bottom: 18px; }

/* ── Account page ────────────────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
table.tx { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tx th, table.tx td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
table.tx th { color: var(--muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
table.tx td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tx th.num { text-align: right; }
.plus { color: var(--success); }
.minus { color: var(--text); }
.table-wrap { overflow-x: auto; }

footer.site {
  border-top: 1px solid var(--border); padding: 22px 16px 26px; text-align: center;
  color: var(--muted); font-size: .82rem;
}
footer.site img { height: 34px; display: block; margin: 0 auto 8px; }
footer.site a { color: var(--muted); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .brand { white-space: nowrap; }
  .brand small { display: none; }
  .topbar nav { margin-left: 0; width: 100%; gap: 2px; justify-content: flex-start; flex-wrap: wrap; }
  .pill .lbl { display: none; }
  .topbar nav a, .linkbtn { padding: 6px 8px; font-size: .85rem; white-space: nowrap; }
  .pill { padding: 5px 10px; font-size: .82rem; }
  main { padding: 18px 14px 30px; }
  .card { padding: 20px; }
  .grid { grid-template-columns: 1fr; }
  .tips { grid-template-columns: 1fr; }
  .modal { padding: 20px 16px; }
  .hero h1 { font-size: 1.35rem; }
}

/* practice name in the header ("SmileDesign ✦ for <practice>") */
.brand small.practice { display: inline-block; vertical-align: bottom; color: var(--text); opacity: .8; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  .brand small.practice { display: inline-block; max-width: 55vw; font-size: .75rem; }
}

/* patient name on cards + print links */
.pmeta .row-right { display: inline-flex; align-items: center; gap: 10px; }
.pmeta .plink { font-size: .8rem; color: var(--accent2); text-decoration: none; white-space: nowrap; }
.pmeta .plink:hover { text-decoration: underline; }
.pmeta .pname { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-actions { display: flex; flex-direction: column; gap: 10px; }
