:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1b2430; --muted: #66758a; --line: #e2e7ee;
  --brand: #1f6feb; --brand-dark: #1857bd; --brand-soft: #e8f0fe;
  --good: #1a8f4c; --good-soft: #e3f6ea; --warn: #b7791f; --warn-soft: #fdf3dc; --bad: #c62f3b; --bad-soft: #fde8ea;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
h1 { font-size: 24px; margin: 0 0 4px; } h2 { font-size: 18px; margin: 0 0 12px; } h3 { font-size: 15px; margin: 0 0 8px; }
a { color: var(--brand); text-decoration: none; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; }
.hidden { display: none !important; }

/* left sidebar */
.side { position: fixed; left: 0; top: 0; bottom: 0; width: 230px; background: #fff; border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 14px; z-index: 10; }
.brand { font-weight: 800; font-size: 26px; letter-spacing: 1px; color: var(--brand); padding: 0 8px; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; letter-spacing: 0; }
.newcase { width: 100%; padding: 12px; font-size: 16px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a { padding: 10px 14px; border-radius: 8px; color: var(--ink); font-weight: 500; }
.nav a.on, .nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.who { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.who .muted { word-break: break-all; }
.chip { background: var(--brand-soft); color: var(--brand-dark); padding: 4px 10px; border-radius: 99px; font-weight: 600; font-size: 13px; }
main { max-width: 1180px; margin: 0 0 0 230px; padding: 24px 28px 60px; }
@media (max-width: 800px) {
  .side { position: static; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex: 1; } .newcase { width: auto; } .who { flex-direction: row; border: 0; padding: 0; }
  main { margin-left: 0; padding: 16px; }
}

/* pop-up window */
.modal { position: fixed; inset: 0; background: rgba(20,30,45,.55); z-index: 40; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 30px 16px; }
.modal-box { background: var(--bg); border-radius: 16px; width: 100%; max-width: 760px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { margin-bottom: 14px; }
.modal-box .viewer { height: 260px; }

/* tooth chart: two arches */
.chart { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0; }
.chart { flex-direction: column !important; align-items: center; gap: 0 !important; }
.archbox { position: relative; flex: none; }
.archbox .lab { position: absolute; bottom: 0; font-size: 12px; color: var(--muted); } .archbox .lab.l { left: 4px; } .archbox .lab.r { right: 4px; }
.archbox .lab.c { left: 50%; top: 50%; transform: translate(-50%, -50%); bottom: auto; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; opacity: .6; }

/* New case window: everything on one screen, no scrolling */
.modal { align-items: center; padding: 12px; overflow: hidden; }
.modal-box { max-width: 1180px; max-height: calc(100vh - 24px); overflow: auto; padding: 14px 16px; }
.modal-head { margin-bottom: 10px; }
.form2 { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 0 14px; align-items: start; }
.form2 .card { margin-bottom: 8px; padding: 10px 14px; }
.form2 .card h2 { font-size: 15px; margin-bottom: 8px; }
.form2 > :nth-child(1) { grid-column: 2; grid-row: 1; }
.form2 > :nth-child(2) { grid-column: 2; grid-row: 2; }
.form2 > :nth-child(3) { grid-column: 1; grid-row: 1 / span 3; }
.form2 > :nth-child(4) { grid-column: 2; grid-row: 3; }
.form2 > :nth-child(5) { grid-column: 1 / -1; grid-row: 4; display: flex; align-items: center; gap: 18px; margin-bottom: 0; }
.form2 > :nth-child(5) > .between { flex: 1; flex-wrap: nowrap; }
.form2 > :nth-child(5) > .notice { flex: 1; margin: 0 !important; }
.form2 > :nth-child(5) > #send { width: 220px !important; margin: 0 !important; flex: none; }
.chart .tooth { font-size: 12px; }
.form2 textarea { min-height: 64px; }
.form2 .drop { padding: 10px; }
.modal-box .viewer { height: 76px; margin-top: 8px; }
.modal-box { padding: 10px 14px !important; } .modal-head { margin-bottom: 6px !important; }
.form2 textarea { min-height: 56px; }
.flist { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 132px; overflow-y: auto; }
.frow { display: flex; align-items: center; gap: 8px; padding: 3px 8px; background: var(--bg); border-radius: 8px; }
.frow .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.frow button.small, .frow .btn.small { padding: 3px 10px; font-size: 12.5px; }
.form2 .drop { padding: 8px; }
.form2 .notice { margin-bottom: 8px; padding: 8px 12px; }
@media (max-width: 900px) { .form2 { grid-template-columns: 1fr; } .form2 > * { grid-column: 1 !important; grid-row: auto !important; } .modal { overflow: auto; align-items: flex-start; } }
.chart .tooth { position: absolute; transform: translate(-50%, -50%); padding: 0; font-size: 15px; font-weight: 500; color: #333; background: #d6d6d6; border: 2px solid transparent; border-radius: 46% 54% 50% 50% / 52% 48% 52% 48%; transition: transform .08s; }
.chart .tooth:hover { background: #c4cddb; transform: translate(-50%, -50%) scale(1.07); }
.chart .tooth.on { color: #fff; }
.chart .tooth.on:hover { filter: brightness(1.08); }
.chart .tooth.sel { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
@media (max-width: 520px) { .archbox { zoom: .75; } }
.pick { position: absolute; z-index: 5; width: 164px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.pick button { background: #fff; color: var(--ink); text-align: left; padding: 8px 10px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.pick button:hover { background: var(--brand-soft); }
.pick .clear { color: var(--bad); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chipline { display: flex; align-items: center; gap: 6px; font-weight: 500; }

/* basics */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.flat { padding: 0; overflow: hidden; }
.row { display: flex; gap: 16px; flex-wrap: wrap; } .row > * { flex: 1; min-width: 240px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.page-head { margin-bottom: 20px; }
button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 9px; padding: 10px 18px; cursor: pointer; background: var(--brand); color: #fff; display: inline-block; text-align: center; }
button:hover, .btn:hover { background: var(--brand-dark); }
button.ghost, .btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.ghost:hover { background: var(--bg); }
button.good { background: var(--good); } button.bad { background: var(--bad); } button.warn { background: var(--warn); }
button.small { padding: 6px 12px; font-size: 13px; }
button:disabled { background: #b9c4d3; cursor: not-allowed; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input, select, textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid #cdd6e2; border-radius: 9px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { min-height: 80px; resize: vertical; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; background: var(--bg); color: var(--muted); }
.badge.blue { background: var(--brand-soft); color: var(--brand-dark); } .badge.green { background: var(--good-soft); color: var(--good); }
.badge.amber { background: var(--warn-soft); color: var(--warn); } .badge.red { background: var(--bad-soft); color: var(--bad); }
.notice { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; background: var(--brand-soft); color: var(--brand-dark); }
.notice.warn { background: var(--warn-soft); color: #7a5413; } .notice.bad { background: var(--bad-soft); color: #8d1d27; } .notice.good { background: var(--good-soft); color: #11663a; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: #fafbfd; }
tr.click { cursor: pointer; } tr.click:hover td { background: #f7faff; }
tr:last-child td { border-bottom: 0; }
.big { font-size: 28px; font-weight: 800; } .stat { text-align: left; }
.stat .big { margin-top: 2px; }

/* sign in / register */
.auth { max-width: 400px; margin: 0 auto; padding: 70px 20px 40px; }
.auth .logo { text-align: center; font-size: 56px; font-weight: 800; letter-spacing: 3px; color: var(--brand); margin-bottom: 24px; }
.auth .card { padding: 26px; }
.seg { display: flex; gap: 6px; margin: 4px 0 6px; }
.seg button { flex: 1; background: #fff; color: var(--ink); border: 1.5px solid #c5cfdd; padding: 9px 6px; }
.seg button.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }

/* steps */
.steps { display: flex; gap: 0; margin-bottom: 20px; }
.step { flex: 1; text-align: center; font-size: 13px; color: var(--muted); position: relative; padding-top: 28px; }
.step::before { content: ""; position: absolute; top: 8px; left: 0; right: 0; height: 3px; background: var(--line); }
.step::after { content: ""; position: absolute; top: 1px; left: 50%; margin-left: -8px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--line); }
.step.done::before, .step.now::before { background: var(--brand); } .step.done::after { background: var(--brand); border-color: var(--brand); }
.step.now::after { border-color: var(--brand); } .step.now { color: var(--ink); font-weight: 700; }
.step:first-child::before { left: 50%; } .step:last-child::before { right: 50%; }

/* new case */
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 84px; }
.num { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; align-items: center; justify-content: center; font-size: 14px; margin-right: 8px; }
.drop { border: 2px dashed #b9c6d9; border-radius: 12px; padding: 22px; text-align: center; background: #fafcff; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.viewer { width: 100%; height: 340px; background: radial-gradient(circle at 50% 35%, #fafcff, #dfe6ef); border: 1px solid var(--line); border-radius: 12px; position: relative; overflow: hidden; margin-top: 12px; }
.viewer.tall { height: 440px; }
.viewer-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); padding: 20px; text-align: center; }
.viewer-hint { position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: var(--muted); background: rgba(255,255,255,.8); padding: 2px 8px; border-radius: 6px; pointer-events: none; }
.teeth { display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 10px 0; }
.arch { display: flex; gap: 4px; align-items: center; }
.arch .gap { width: 14px; }
.tooth { width: 38px; height: 44px; padding: 0; font-size: 13px; background: #fff; color: var(--ink); border: 1.5px solid #c5cfdd; border-radius: 10px 10px 14px 14px; }
.tooth:hover { background: var(--brand-soft); border-color: var(--brand); }
.tooth.on { background: var(--brand); color: #fff; border-color: var(--brand-dark); }
.arch-label { font-size: 12px; color: var(--muted); }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.type { background: #fff; color: var(--ink); border: 1.5px solid #c5cfdd; padding: 12px; text-align: left; font-weight: 600; }
.type:hover { background: var(--brand-soft); border-color: var(--brand); }
.type.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.sum-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sum-row:last-of-type { border-bottom: 0; }
.checks label { font-weight: 500; margin: 6px 0; display: flex; gap: 8px; align-items: center; }
.checks input { width: auto; }
.stars button { background: #fff; color: #d3dae5; font-size: 28px; padding: 0 4px; border: 0; line-height: 1; }
.stars button.on { color: #f2b01e; }
.timer { font-size: 38px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--bad); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.demo { border: 1px dashed #c9a85c; background: #fffaf0; border-radius: 10px; padding: 10px 14px; margin-top: 14px; font-size: 13px; }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.how div { background: var(--brand-soft); border-radius: 12px; padding: 16px; } .how b { display: block; margin-bottom: 4px; font-size: 16px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; }
#toast div { background: #1b2430; color: #fff; padding: 12px 20px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
#toast div.bad { background: var(--bad); }

/* ===== Look & feel v2: deep navy + teal ===== */
:root {
  --bg: #f2f5f8; --ink: #14233a; --muted: #62738a; --line: #e1e8ef;
  --brand: #0f766e; --brand-dark: #0b5f58; --brand-soft: #dff4f1;
  --navy: #0f2742; --navy-2: #173556;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,39,66,.05), 0 6px 18px rgba(15,39,66,.06);
}
body { background: radial-gradient(1200px 500px at 80% -10%, #e3f1f0 0, transparent 60%), var(--bg); }
h1 { font-size: 26px; letter-spacing: -.3px; } h2 { letter-spacing: -.2px; }
.side { background: linear-gradient(180deg, var(--navy) 0, var(--navy-2) 100%); border-right: 0; color: #dbe6f3; }
.brandrow { display: flex; align-items: center; gap: 11px; padding: 2px 6px 6px; }
.brandrow img { width: 42px; height: 42px; flex: none; }
.brandrow .brand { padding: 0; color: #fff; font-size: 24px; line-height: 1; }
.brandrow .brand small { color: #9db3cc; font-size: 11px; margin-top: 4px; line-height: 1.2; }
.side .nav a { color: #c5d4e6; }
.side .nav a.on, .side .nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.side .newcase { background: #14b8a6; color: #06302c; box-shadow: 0 4px 14px rgba(20,184,166,.35); }
.side .newcase:hover { background: #2dd4bf; }
.side .who { border-top-color: rgba(255,255,255,.14); color: #c5d4e6; }
.side .who .muted { color: #9db3cc; }
.side .chip { background: rgba(255,255,255,.12); color: #fff; }
.side button.ghost { background: transparent; color: #dbe6f3; border-color: rgba(255,255,255,.25); }
.side button.ghost:hover { background: rgba(255,255,255,.1); }
.card { box-shadow: var(--shadow); border-color: #e6ecf2; }
.card.flat { box-shadow: var(--shadow); }
button, .btn { transition: background .15s, transform .05s, box-shadow .15s; }
button:active, .btn:active { transform: translateY(1px); }
button:not(.ghost):not(.small):hover, .btn:not(.ghost):hover { box-shadow: 0 4px 12px rgba(15,118,110,.25); }
tr.click:hover { background: #f4faf9; }
th { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; }
.modal { backdrop-filter: blur(3px); background: rgba(15,39,66,.55); }
.modal-box { box-shadow: 0 24px 70px rgba(0,0,0,.35); }
/* sign-in / register pages */
body:has(.auth) { background: linear-gradient(135deg, var(--navy) 0, #0e5e63 100%); min-height: 100vh; }
.auth { padding-top: 60px; }
.auth .logo { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #fff; font-size: 34px; letter-spacing: 3px; margin-bottom: 22px; }
.auth .logo img { width: 84px; height: 84px; filter: drop-shadow(0 8px 20px rgba(0,0,0,.35)); }
.auth .logo small { font-size: 13px; font-weight: 500; letter-spacing: .5px; color: #b6d0e6; }
.auth .card { box-shadow: 0 20px 60px rgba(0,0,0,.35); border: 0; }
.layout.even { grid-template-columns: 1fr 1fr; align-items: stretch; }
.layout.even > div:first-child > .card:last-child { margin-bottom: 0; }
.layout.even > .card:last-child { margin-bottom: 0; }
.caserow { cursor: pointer; margin-bottom: 16px; }
.caserow > .card { margin-bottom: 0; }
@media (max-width: 900px) { .layout.even { grid-template-columns: 1fr; } }
.caserow { margin-bottom: 34px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.caserow:last-child { border-bottom: 0; }
.casehead { font-size: 24px; margin: 0 0 8px; }
.caserow .layout.even > .card { margin-bottom: 0; }
/* compact case rows so more cases fit on one screen */
.caserow { margin-bottom: 14px; padding-bottom: 12px; }
.casehead { font-size: 17px; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.caserow .steps { margin-bottom: 8px; max-width: 560px; }
.caserow .step { padding-top: 20px; font-size: 11.5px; }
.caserow .step::before { top: 5px; height: 2px; }
.caserow .step::after { top: 0; margin-left: -6px; width: 12px; height: 12px; border-width: 2px; }
.caserow .layout.even { gap: 12px; }
.caserow .layout.even > .card { padding: 10px 14px; border-radius: 11px; }
.caserow .card h2 { font-size: 14.5px; margin-bottom: 6px; }
.caserow .card p { font-size: 13.5px; }
.caserow .kv { gap: 2px 12px; font-size: 13px; }
.caserow .kv dt, .caserow .kv dd { margin: 0; }
.caserow .card .btn.small { padding: 4px 12px; }
/* lab comments: big enough to read the hint and a few lines, grows with the text, scrolls only when very long */
textarea.grow, .form2 textarea.grow { min-height: 110px; max-height: 260px; resize: none; overflow-y: hidden; line-height: 1.45; }
/* My cases: one white box per case, status on the left and the request on the right */
.caserow .card.joined { padding: 12px 16px; margin-bottom: 0; }
.caserow .card.joined .layout.even { gap: 0; }
.caserow .jleft { padding-right: 18px; }
.caserow .jright { padding-left: 18px; border-left: 1px solid var(--line); }
.caserow .jright h2, .caserow .jleft h2 { font-size: 14.5px; margin-bottom: 6px; }
@media (max-width: 900px) { .caserow .jright { padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--line); margin-top: 12px; } .caserow .jleft { padding: 0; } }
/* My cases v3: everything for a case in one box, tinted softly by its status */
.caserow.card.joined { padding: 12px 18px 14px; margin-bottom: 12px; border-bottom: 1px solid #e6ecf2; transition: box-shadow .15s; }
.caserow.card.joined:hover { box-shadow: 0 6px 20px rgba(15,39,66,.1); }
.caserow .cardtop { display: flex; align-items: center; gap: 24px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid rgba(20,35,58,.08); }
.caserow .cardtop .casehead { margin: 0; flex: none; }
.caserow .cardtop .steps { flex: 1; margin: 0; max-width: 520px; }
.caserow .jright { border-left-color: rgba(20,35,58,.1); }
.caserow.st-queued    { background: rgba(37, 99, 235, .06);  border-color: rgba(37, 99, 235, .18); }
.caserow.st-taken, .caserow.st-revision, .caserow.st-disputed { background: rgba(217, 119, 6, .07); border-color: rgba(217, 119, 6, .2); }
.caserow.st-uploaded  { background: rgba(22, 163, 74, .08);  border-color: rgba(22, 163, 74, .22); }
.caserow.st-completed { background: rgba(22, 163, 74, .05);  border-color: rgba(22, 163, 74, .16); }
.caserow.st-returned  { background: rgba(220, 38, 38, .06);  border-color: rgba(220, 38, 38, .18); }
.caserow.st-cancelled { background: rgba(100, 116, 139, .08); border-color: rgba(100, 116, 139, .2); }
@media (max-width: 900px) { .caserow .cardtop { flex-direction: column; align-items: flex-start; gap: 6px; } .caserow .cardtop .steps { width: 100%; } }
.caserow .btn.small { padding: 5px 14px; font-size: 13px; }
.caserow p { font-size: 13.5px; }
.caserow.st-completed { background: rgba(22, 163, 74, .11); border-color: rgba(22, 163, 74, .26); }

/* My cases: search + status filter */
.casebar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 20px; }
.searchbox { position: relative; flex: 1 1 320px; max-width: 460px; }
.searchbox input { padding-right: 38px; background: #fff; }
.searchbox input::-webkit-search-cancel-button { display: none; }
.clearx { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px 8px; cursor: pointer; visibility: hidden; }
.clearx:hover { color: var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.fchip:hover { border-color: var(--brand); }
.fchip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.fchip .n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 600; text-align: center; }
.fchip.on .n { background: rgba(255,255,255,.22); color: #fff; }

/* Credits page */
.statgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.statgrid .card { margin-bottom: 0; }
@media (max-width: 1100px) { .statgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .statgrid { grid-template-columns: 1fr; } }
.credits2 { margin-bottom: 0; }
.topups { display: flex; flex-wrap: wrap; gap: 8px; }
.heldlist { display: flex; flex-direction: column; }
.heldrow { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.heldrow:last-child { border-bottom: 0; }
.heldrow:hover { background: var(--bg); }
.heldrow .right { margin-left: auto; }
.histhead { padding: 16px; flex-wrap: wrap; gap: 10px; border-bottom: 1px solid var(--line); }
.tablewrap { overflow-x: auto; }
table.hist td { white-space: nowrap; } table.hist td:nth-child(3) { white-space: normal; min-width: 220px; }
table.hist .amt { font-weight: 700; }

/* Ratings: gold stars when rated, gray when not */
.starrow { display: inline-flex; gap: 1px; font-size: 20px; line-height: 1; white-space: nowrap; }
.starrow span { color: #cfd6e0; }
.starrow span.on { color: #f2b01e; }
.ratebox { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 8px 12px; border-radius: 10px; background: rgba(255,255,255,.6); }
.ratebox.need { background: var(--warn-soft); border: 1px solid #f0d9a6; }
.stars button:disabled { cursor: default; background: #fff; }

/* Notifications bell (sidebar) + panel */
.navbell { display: flex; align-items: center; gap: 10px; width: 100%; background: transparent; color: #c5d4e6; border: 0; border-radius: 8px; padding: 10px 14px; font-weight: 500; text-align: left; }
.navbell:hover, .navbell.has { background: rgba(255,255,255,.1); color: #fff; }
.navbell .bcount { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: #ef4444; color: #fff; font-size: 12px; font-weight: 800; text-align: center; }
.npanel { position: fixed; left: 240px; top: 16px; width: 380px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(15,30,50,.22); z-index: 60; overflow: hidden; }
.nhead { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.nhead b { font-size: 16px; margin-right: auto; }
.linkbtn { background: none; border: 0; padding: 2px 4px; color: var(--brand); font-weight: 600; font-size: 13px; }
.linkbtn:hover { background: none; text-decoration: underline; }
.nclose { color: var(--muted); font-size: 20px; line-height: 1; }
.nlist { overflow-y: auto; }
.nitem { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.nitem:hover { background: var(--bg); }
.nitem > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.nitem .ntext { font-size: 14px; line-height: 1.4; }
.nitem.unread { background: #f3f8ff; } .nitem.unread .ntext { font-weight: 600; }
.ndot { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: var(--brand); }
.k-good .ndot { background: var(--good); } .k-bad .ndot { background: var(--bad); } .k-warn .ndot { background: #e0a21b; } .k-info .ndot { background: var(--brand); }
.nitem:not(.unread) .ndot { opacity: .35; }
.nempty { padding: 28px 16px; text-align: center; }
@media (max-width: 800px) { .navbell { width: auto; } .navbell > span:not(.bcount) { display: none; } .npanel { left: 8px; right: 8px; top: 64px; width: auto; } }

/* Wrong-file report + paused timer */
.paused { color: var(--warn); }
.timer.paused { color: var(--warn); }
.small-drop { padding: 14px; }
.fixcard .notice { margin-bottom: 0; }

/* Design on the scan */
.viewmode { display: inline-flex; margin-top: 12px; }
.viewmode button { flex: none; padding: 7px 14px; font-size: 13px; }
.viewer-bar { position: absolute; right: 10px; top: 10px; left: 10px; z-index: 2; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; pointer-events: none; }
.viewer-bar > * { pointer-events: auto; }
.viewer-btn { background: rgba(255,255,255,.92); color: var(--ink); border: 1px solid var(--line); padding: 6px 12px; font-size: 13px; }
.viewer-btn:hover { background: #fff; }
.stars.inline { display: inline-flex; }
.stars.inline button { font-size: 24px; padding: 0 2px; background: none; }
.stars.inline:hover button { color: #f2b01e; }
.stars.inline button:hover ~ button { color: #d3dae5; }

.viewer-btn:not(.on) { color: var(--muted); }
.viewer-bar .viewer-btn.on:not(:first-child) { border-color: #9aa6b5; }
.viewer-warn { position: absolute; left: 10px; right: 10px; bottom: 36px; z-index: 2; background: var(--warn-soft); color: #7a5410; border: 1px solid #f0d9a6; border-radius: 8px; padding: 8px 12px; font-size: 13px; line-height: 1.4; }

/* Brand: logo + "Clinical Dental Design" only */
.brandrow .brandtext { font-size: 17px; font-weight: 700; letter-spacing: .2px; line-height: 1.2; color: #fff; }
.auth .logo { font-size: 22px; letter-spacing: .5px; font-weight: 700; }

/* Profile button (top right) + menu */
.topbar { display: flex; justify-content: flex-end; margin: -8px 0 10px; }
.profwrap { position: relative; }
.profbtn { display: flex; align-items: center; gap: 10px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 4px 14px 4px 4px; font-weight: 600; box-shadow: 0 1px 3px rgba(15,30,50,.06); }
.profbtn:hover { background: #fff; border-color: #c3ccd8; }
.pname { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchev { color: var(--muted); font-size: 12px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; object-fit: cover; color: #fff; font-weight: 700; letter-spacing: .5px; background: #e2e7ee; }
.pmenu { position: absolute; right: 0; top: calc(100% + 8px); width: 280px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(15,30,50,.2); z-index: 70; overflow: hidden; }
.phead { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.phead .muted { word-break: break-all; }
.pitem { display: block; width: 100%; text-align: left; padding: 11px 16px; background: #fff; color: var(--ink); font-weight: 500; border: 0; border-radius: 0; }
.pitem:hover { background: var(--bg); }
#switch.pitem { color: var(--bad); border-top: 1px solid var(--line); }
.side .who .chip { color: #fff; }

/* My profile page */
.profhead { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.pinfo { display: flex; flex-direction: column; gap: 4px; }
.pbtns { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.ratehead { display: flex; align-items: center; gap: 16px; }
.bigrate { font-size: 44px; font-weight: 800; line-height: 1; }
.ratehead .starrow { font-size: 24px; }
.ratebars { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.rbar { display: grid; grid-template-columns: 40px 1fr 30px; align-items: center; gap: 10px; font-size: 13px; }
.rtrack { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.rtrack div { height: 100%; background: #f2b01e; border-radius: 99px; }
.rlist { display: flex; flex-direction: column; }
.rrow { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.rrow:hover { background: var(--bg); }
.rrow .starrow { font-size: 16px; }
.mini { background: var(--bg); border-radius: 10px; padding: 10px 14px; min-width: 120px !important; }
.mini b { font-size: 20px; }
.whocell { display: flex; align-items: center; gap: 12px; }
@media (max-width: 800px) { .topbar { margin: 0 0 10px; } .pname { display: none; } .profbtn { padding: 3px 8px 3px 3px; } }
.pbtns .btn.small, .pbtns button.small { padding: 6px 14px; font-size: 13px; line-height: 1.5; }

/* Brand: logo on top, name underneath on one line */
.brandrow { flex-direction: column; align-items: flex-start; gap: 8px; }
.brandrow .brandtext { font-size: 15px; white-space: nowrap; }
/* "Change password": a plain link that opens a small window */
.pwlink { align-self: flex-start; padding: 2px 0; margin-top: 6px; font-size: 14px; }
.modal-box.narrow { max-width: 440px; height: auto; }
/* Logo centred and a bit bigger, name centred under it */
.brandrow { align-items: center; text-align: center; gap: 10px; padding: 4px 0 8px; }
.brandrow img { width: 58px; height: 58px; }
.brandrow img { width: 50px; height: 59px; }
.auth .logo img { height: 70px; width: auto; }
/* Click the round picture to add or change it */
.avpick { position: relative; display: inline-flex; cursor: pointer; border-radius: 50%; margin: 0; }
.avpick:hover .avatar { filter: brightness(.88); }
.avcam { position: absolute; right: 0; bottom: 2px; width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--ink); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(15,30,50,.18); }
.avpick:hover .avcam { color: var(--brand); }
.plinks { display: flex; gap: 18px; flex-wrap: wrap; }
.pwlink.plain { color: var(--muted); font-weight: 500; }

/* Crown on preparation / on implant (in the tooth menu) */
.pickgroup { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 4px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.pickgroup > .muted { padding: 2px 10px 0; }
.pickrow { display: flex; flex-direction: column; }
/* Connectors between neighbouring teeth */
.chart .link { position: absolute; z-index: 2; width: 14px; height: 14px; padding: 0; border-radius: 50%; background: #fff; border: 2px dashed #9aa6b5; opacity: .85; }
.chart .link:hover { border-color: var(--brand); opacity: 1; background: var(--brand-soft); }
.chart .link.on { width: 18px; height: 7px; border-radius: 4px; border: 0; background: #1f2937; opacity: 1; }
.linkicon { display: inline-block; width: 14px; text-align: center; font-weight: 900; color: #1f2937; }
/* Bite splint: the arch gets a light grey shape behind the teeth */
.splintrow { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.splintrow .fchip { padding: 4px 12px; font-size: 13px; }
.splintrow .fchip.on { background: #9aa3ad; border-color: #9aa3ad; color: #fff; }
.archbox.splint::before { content: ''; position: absolute; inset: 6% 8%; border-radius: 48% 48% 40% 40%; background: #c9cfd8; opacity: .55; }
.chart .archbox:nth-child(2).splint::before { border-radius: 40% 40% 48% 48%; }
/* Implant details */
.imbox { margin-top: 10px; padding: 10px 12px; border: 1px solid #d8c5f2; background: #faf5ff; border-radius: 10px; }
.imbox h3 { margin: 0 0 4px; font-size: 14px; }
.imgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.imgrid label { margin-top: 6px; font-size: 12.5px; }
.imgrid input, .imgrid select { padding: 6px 8px; font-size: 13.5px; }
.kv.implant { grid-template-columns: auto 1fr; font-size: 13px; margin: 0; }
/* Version, bottom right */
#appver { position: fixed; right: 10px; bottom: 6px; z-index: 30; font-size: 11.5px; color: var(--muted); background: rgba(255,255,255,.75); padding: 1px 8px; border-radius: 6px; pointer-events: none; }
.form2 { grid-template-rows: auto auto 1fr auto; }
/* implant details card: right column, under the comments */
.form2 { grid-template-rows: auto auto auto 1fr auto; }
.form2 > :nth-child(3) { grid-row: 1 / span 4; }
.form2 > :nth-child(5) { grid-row: 5; }
.form2 > :nth-child(6) { grid-column: 2; grid-row: 4; }
.form2 > .imbox.hidden { display: none !important; }
.form2 .imgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } @media (max-width: 900px) { .form2 .imgrid { grid-template-columns: 1fr 1fr; } }

/* Crown + "on implant" in the tooth menu */
.pickcrown { display: flex; align-items: stretch; gap: 4px; }
.pickcrown > button:first-child { flex: 1; }
.pick .implbtn { flex: none; font-size: 12.5px; padding: 6px 8px; border: 1px solid #e2d4f5; color: #6b21a8; }
.pick .implbtn.on { background: #9333ea; color: #fff; border-color: #9333ea; }
.pick .implbtn.on .dot { background: #fff !important; }
.pick { width: 210px; }
/* Missing tooth and splint teeth */
.chart .tooth.miss { background: transparent !important; border: 2px dashed #9aa6b5 !important; color: #9aa6b5; }
.chart .tooth.spl { color: #374151; }
.dot.dmiss { background: transparent !important; border: 1.5px dashed #9aa6b5; box-sizing: border-box; }
/* Connector: a dot just outside the gap between two teeth. Grey = not connected, green = connected */
.chart .link { width: 11px; height: 11px; border: 0; border-radius: 50%; background: #c3cad4; opacity: 1; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px #fff; }
.chart .link:hover { background: #86efac; }
.chart .link.on { width: 12px; height: 12px; border-radius: 50%; background: #22c55e; }
/* Scan file type */
.kindsel { width: auto; min-width: 128px; padding: 3px 6px; font-size: 12.5px; }
.kindsel.need { border-color: var(--warn); background: var(--warn-soft); }
.kindtag { display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--brand-dark); background: var(--brand-soft); border-radius: 99px; padding: 0 7px; margin-left: 2px; }
/* "A scan seems to be missing" */
.askover { position: fixed; inset: 0; z-index: 90; background: rgba(15,30,50,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.askcard { max-width: 460px; width: 100%; margin: 0; }
.askcard ul { margin: 6px 0 10px; padding-left: 20px; } .askcard li { margin: 3px 0; font-weight: 600; }
.chart .tooth.spl { background: #dfe3e8 !important; border: 2.5px solid #7b8594 !important; color: #374151; font-weight: 600; } .legend .dot[style*="c9cfd8"], .pick .dot[style*="c9cfd8"] { border: 2px solid #7b8594; box-sizing: border-box; }

/* "Crown on implant? Tap the tooth" line under the chart */
.implrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; padding: 6px 10px; background: #faf5ff; border: 1px solid #ead9fb; border-radius: 10px; }
.implchips { display: flex; gap: 6px; flex-wrap: wrap; }
.ichip { min-width: 34px; padding: 3px 8px; border-radius: 99px; background: #fff; color: #be185d; border: 1.5px solid #ec4899; font-weight: 700; font-size: 13px; }
.ichip:hover { background: #fdf2f8; }
.ichip.on { background: #9333ea; border-color: #9333ea; color: #fff; }
.ichip.on:hover { background: #7e22ce; }
.pick { width: 180px; }

/* Redo cards and notes */
.redocard { border: 1.5px solid #f0d9a6; }
.redonote { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: var(--warn-soft); color: #7a5410; }
.faultrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.kbdtip { display: inline-block; }
kbd { font: 600 11px var(--mono, ui-monospace, Consolas, monospace); padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: #fff; color: var(--ink); }
.chart { user-select: none; }

/* Crown on implant: same purple as every crown, plus a small screw badge */
.chart .tooth.impl { overflow: visible; }
.chart .tooth.impl::after { content: ''; position: absolute; right: -6px; bottom: -6px; width: 15px; height: 15px; background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2016%2016%22%3E%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%227.5%22%20fill%3D%22%23fff%22%20stroke%3D%22%236b21a8%22%2F%3E%3Cpath%20d%3D%22M5%204.2h6M5.6%206.2h4.8M5.9%208.2h4.2M6.3%2010.2h3.4M7.1%2012.2h1.8%22%20stroke%3D%22%236b21a8%22%20stroke-width%3D%221.3%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat; pointer-events: none; }
.dot.dimpl { position: relative; overflow: visible; }
.dot.dimpl::after { content: ''; position: absolute; right: -5px; bottom: -5px; width: 10px; height: 10px; background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2016%2016%22%3E%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%227.5%22%20fill%3D%22%23fff%22%20stroke%3D%22%236b21a8%22%2F%3E%3Cpath%20d%3D%22M5%204.2h6M5.6%206.2h4.8M5.9%208.2h4.2M6.3%2010.2h3.4M7.1%2012.2h1.8%22%20stroke%3D%22%236b21a8%22%20stroke-width%3D%221.3%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat; }
.ichip { color: #6b21a8; border-color: #9333ea; }
.ichip:hover { background: #faf5ff; }
.ichip.on { position: relative; padding-right: 22px; }
.ichip.on::after { content: ''; position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2016%2016%22%3E%3Ccircle%20cx%3D%228%22%20cy%3D%228%22%20r%3D%227.5%22%20fill%3D%22%23fff%22%20stroke%3D%22%236b21a8%22%2F%3E%3Cpath%20d%3D%22M5%204.2h6M5.6%206.2h4.8M5.9%208.2h4.2M6.3%2010.2h3.4M7.1%2012.2h1.8%22%20stroke%3D%22%236b21a8%22%20stroke-width%3D%221.3%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat; }
.legend .dot.dimpl, .chipline .dot.dimpl { margin-right: 5px; }

/* Crown on implant: the screw sits in the middle of the tooth, in place of the number */
.chart .tooth.impl { color: transparent !important; }
.chart .tooth.impl::after { right: auto; bottom: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 62%; height: 62%; background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M4.2%203.6h7.6M4.9%206h6.2M5.5%208.4h5M6.1%2010.8h3.8M7%2013.2h2%22%20stroke%3D%22%23ffffff%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat; }
/* Crowns box (right column): one row per crown */
.crownlist { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.crownrow { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
.crownrow.on { border-color: #d8c5f2; background: #fdfbff; }
.crownhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.crownhead .tick { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.crownhead .tick input { width: 16px; height: 16px; margin: 0; accent-color: #9333ea; }
.copyfrom { width: auto; margin-left: auto; padding: 3px 6px; font-size: 12.5px; }
.crownrow .imgrid { margin-top: 4px; }

/* Levels */
.lvhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.lvbig { font: 800 28px var(--display, inherit); }
.lvlist { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.lvtick { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; align-items: center; justify-content: center; margin-right: 8px; font-size: 12px; font-weight: 800; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.lvtick.ok { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.setlv { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.tick { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; cursor: pointer; }
.tick input { width: 16px; height: 16px; margin: 0; }
/* Cases a designer cannot take yet */
.lockedcard { opacity: .72; }
.lockline { font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--bg); border-radius: 8px; padding: 4px 8px; margin-bottom: 8px; }

.acceptrate { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; font-weight: 600; font-size: 14px; }
.acceptrate .stars.inline button { font-size: 26px; }
#acceptStars button.on { color: #f2b01e; }

/* People: designers and dentists */
.peoplehead { margin: 18px 0 10px; display: flex; align-items: center; gap: 8px; }
.flaglist { display: flex; flex-direction: column; gap: 4px; }
.flagrow { display: flex; align-items: flex-start; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); margin: 0; cursor: pointer; font-weight: 400; }
.flagrow:last-child { border-bottom: 0; }
.flagrow input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
