/* Endura Sleep team platform — brand system per D4.1 Rev 2 */
:root{
  --night:#0C171C; --night2:#142530; --night3:#16242B; --dusk:#1E3A44;
  --snow:#F4FAFB; --soft:#E1F3F1;
  --ink:#17282C; --ink2:#3C5257; --mute:#566B70; --mute-d:#93AEB2;
  --line:#D5E4E5; --line-d:rgba(160,200,205,.16);
  --teal:#2CC0B3; --teal2:#12A79B; --teal-deep:#0C7E77; --cyan:#79D2DC;
  --teal-ink:#0A7069;   /* T-927: teal text on the --soft / linen tints (teal-deep is 4.3:1 there) */
  --amber:#C97A52; --red:#B4534B;
  --grad:linear-gradient(135deg,#0AB48C,#3EC2B7 55%,#79D2DC);
  --disp:'Jost',-apple-system,sans-serif; --body:'Manrope',-apple-system,Arial,sans-serif;
}
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{font-family:var(--body); background:#EAF2F3; color:var(--ink); font-size:15px; line-height:1.55;
  -webkit-font-smoothing:antialiased;}
button{font-family:inherit}
[hidden]{display:none!important}
::selection{background:rgba(44,192,179,.28); color:var(--night)}
/* Focus (T-927): a 2px teal ring on anything reached by keyboard (buttons, chips, cards, links); inputs show it on click too.
   Teal-deep is 4.2:1 or more on every light surface; dark areas (top bar, login) use cyan. */
:focus-visible{outline:2px solid var(--teal-deep); outline-offset:2px}
.login-stage :focus-visible{outline-color:var(--cyan)}

/* ---------- Wordmark ---------- */
.wm-endura{font-family:var(--disp); font-weight:300; letter-spacing:.26em; text-transform:uppercase}
/* Crescent stands in for the D: cap-height x1.06, centred on the caps, and spaced
   .22em ink-to-ink from N and U (same ratio as the brand logo PNG). The negative
   right margin drops the tracking after the last P so the lockup aligns and centres true. */
.endura-lockup{display:inline-flex; align-items:baseline; white-space:nowrap; line-height:1; margin-right:-.26em}
.endura-lockup .moon{width:.552em; height:.74em; margin:0 .141em 0 -.124em; flex:none; align-self:baseline; position:relative; top:.02em}

/* ---------- Buttons ---------- */
.btn{display:inline-flex; align-items:center; gap:8px; font-weight:700; font-size:13.5px;
  border-radius:999px; padding:10px 20px; white-space:nowrap; cursor:pointer; border:1px solid transparent;
  transition:filter .2s, transform .2s, box-shadow .2s}
.btn .arr{font-weight:400; transition:transform .25s ease}
.btn:hover .arr{transform:translateX(4px)}
.btn-teal{background:var(--grad); color:#07231F; box-shadow:0 10px 26px -12px rgba(44,192,179,.55)}
.btn-teal:hover{filter:brightness(1.06); transform:translateY(-1px)}
.btn-wide{width:100%; justify-content:center; padding:12px}
.btn-quiet{background:none; border:1px solid var(--line); color:var(--ink2); border-radius:999px;
  padding:8px 16px; font-size:13px; font-weight:600; cursor:pointer; transition:border-color .2s, color .2s}
.btn-quiet:hover{border-color:var(--teal2); color:var(--teal-deep)}
.btn-danger{background:none; border:1px solid rgba(180,83,75,.4); color:var(--red); border-radius:999px;
  padding:8px 16px; font-size:13px; font-weight:600; cursor:pointer}
.btn-danger:hover{background:rgba(180,83,75,.08)}
/* T08: where Delete would be on a remake case */
.no-delete{margin:0; font-size:13px; font-weight:600; color:var(--ink2)}

/* ============ LOGIN ============ */
.login-stage{position:fixed; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center;
  overflow:hidden; color:var(--snow);
  background:
    radial-gradient(ellipse 62% 52% at 80% 116%, rgba(201,122,82,.18), transparent 62%),
    radial-gradient(circle at 16% 20%, rgba(70,194,183,.15), transparent 46%),
    linear-gradient(168deg, #0A151A 0%, #122029 52%, #1C3742 100%);}
.stars{position:absolute; inset:0; pointer-events:none}
.stars i{position:absolute; border-radius:50%; background:#EAF7F8; animation:tw 6s ease-in-out infinite}
@keyframes tw{0%,100%{opacity:.25}50%{opacity:.9}}
.login-card{position:relative; z-index:2; width:400px; max-width:calc(100% - 40px); text-align:center;
  background:rgba(16,30,38,.72); backdrop-filter:blur(14px); border:1px solid var(--line-d); border-radius:18px;
  padding:44px 40px 36px; box-shadow:0 44px 90px -34px rgba(0,0,0,.7), 0 0 70px -20px rgba(44,192,179,.3);
  animation:rise .9s cubic-bezier(.2,.7,.2,1) both}
@keyframes rise{from{opacity:0; transform:translateY(18px)}to{opacity:1; transform:none}}
.login-moon{width:64px; height:64px; margin:0 auto 20px; filter:drop-shadow(0 0 22px rgba(70,194,183,.5))}
.login-card .endura-lockup{font-size:19px; color:var(--snow)}
.login-sub{font-size:12px; font-weight:700; letter-spacing:.2em; text-transform:uppercase; color:#7FC7C0; margin:14px 0 30px}
#login-form{text-align:left}
#login-form label{display:block; font-size:12px; font-weight:700; letter-spacing:.12em; text-transform:uppercase;
  color:var(--mute-d); margin:16px 0 6px}
#login-form input,#login-form select{width:100%; background:rgba(10,21,26,.6); border:1px solid var(--line-d);
  border-radius:10px; color:var(--snow); font-family:inherit; font-size:14.5px; padding:11px 14px; outline:none;
  transition:border-color .2s}
#login-form input:focus,#login-form select:focus{border-color:var(--teal)}
#login-form input:focus-visible,#login-form select:focus-visible{outline:2px solid var(--cyan); outline-offset:1px}
#login-form .btn-wide{margin-top:26px}
#login-form .btn-wide:disabled{opacity:.6; cursor:progress}
.login-error{margin:14px 0 0; padding:10px 12px; border-radius:10px; font-size:13px; line-height:1.45;
  color:#F6D7C8; background:rgba(201,122,82,.16); border:1px solid rgba(201,122,82,.4)}
/* Two-step sign-in (T-1504) */
#mfa-form label{display:block; font-size:12px; font-weight:700; letter-spacing:.12em; text-transform:uppercase;
  color:var(--mute-d); margin:16px 0 6px}
#mfa-form input{width:100%; background:rgba(10,21,26,.6); border:1px solid var(--line-d); border-radius:10px;
  color:var(--snow); font-family:inherit; font-size:18px; letter-spacing:.2em; padding:11px 14px; outline:none;
  transition:border-color .2s}
#mfa-form input:focus{border-color:var(--teal)}
#mfa-form input:focus-visible{outline:2px solid var(--cyan); outline-offset:1px}
#mfa-form .btn-wide{margin-top:26px}
#mfa-form .btn-wide:disabled{opacity:.6; cursor:progress}
.mfa-title{margin:0 0 8px; font-size:22px; color:var(--snow)}
.mfa-text{margin:0 0 12px; font-size:13.5px; line-height:1.5; color:var(--mute-d)}
.mfa-enrol{text-align:center; margin:12px 0}
.mfa-enrol img{background:#fff; padding:8px; border-radius:10px}
.mfa-enrol code{display:block; margin-top:6px; word-break:break-all; color:var(--snow); font-size:13px}
.mfa-alts{display:flex; gap:10px; justify-content:center; margin-top:16px}
.mfa-alts .btn-quiet{border-color:var(--line-d); color:var(--mute-d)}
.mfa-alts .btn-quiet:hover{border-color:var(--cyan); color:var(--cyan)}
.login-note{margin-top:18px; font-size:12px; color:var(--mute-d); text-align:center; line-height:1.5}
.login-foot{position:absolute; bottom:22px; left:0; right:0; text-align:center; font-size:12px; color:var(--mute-d); z-index:2}

/* ============ TOPBAR ============ */
.topbar{position:sticky; top:0; z-index:40; display:flex; align-items:center; gap:22px;
  background:rgba(12,23,28,.97); color:var(--snow); padding:0 26px; height:64px;
  border-bottom:1px solid var(--line-d); box-shadow:0 10px 40px -20px rgba(0,0,0,.5)}
.tb-mark{font-size:16px; color:var(--snow)}
.tb-app{font-family:var(--disp); font-weight:400; font-size:13px; letter-spacing:.18em; text-transform:uppercase;
  color:#7FC7C0; border-left:1px solid var(--line-d); padding-left:22px}
.tb-tools{display:flex; align-items:center; gap:12px; flex:1; justify-content:flex-end; min-width:0}
.tb-tools .chip-toggle, .tb-tools .btn{white-space:nowrap; flex:none}
#search{width:250px; flex:0 1 250px; min-width:150px; background:rgba(20,37,48,.7); border:1px solid var(--line-d); border-radius:999px;
  color:var(--snow); font-family:inherit; font-size:13.5px; padding:9px 16px; outline:none; transition:border-color .2s}
#search:focus{border-color:var(--teal)}
#search:focus-visible{outline:2px solid var(--cyan); outline-offset:2px}
#search::placeholder{color:var(--mute-d)}
.chip-toggle{background:rgba(20,37,48,.7); border:1px solid var(--line-d); color:var(--mute-d); border-radius:999px;
  padding:8px 14px; font-size:13px; font-weight:600; cursor:pointer; transition:all .2s}
.chip-toggle[aria-pressed="true"]{background:rgba(44,192,179,.18); border-color:var(--teal); color:var(--cyan)}
.chip-toggle:hover{border-color:var(--cyan); color:var(--cyan)}
/* T-1087: the dentist's "Not accepted" count, in lamplight amber so it reads as waiting on them */
.chip-alert{border-color:#E8B77A; color:#F5D9A8}
.badge.badge-alert{background:#E8B77A; color:var(--night)}
.topbar button:focus-visible{outline:2px solid var(--cyan); outline-offset:2px}
/* Approval queues (T-921): one group of chips for the admin team, set apart from search and filters */
.tb-queues{display:flex; align-items:center; gap:8px; padding-left:12px; border-left:1px solid var(--line-d)}
/* "+ New" menu (lab): New case / Remake claim */
.tb-new{position:relative; flex:none}
.tb-menu{position:absolute; right:0; top:calc(100% + 8px); z-index:50; min-width:190px; padding:6px;
  background:var(--night2); border:1px solid var(--line-d); border-radius:12px; box-shadow:0 18px 40px -18px rgba(0,0,0,.7)}
.tb-menu [role="menuitem"]{display:block; width:100%; text-align:left; background:none; border:0; border-radius:8px;
  color:var(--snow); font-size:13.5px; font-weight:600; padding:10px 12px; min-height:44px; cursor:pointer}
.tb-menu [role="menuitem"]:hover,.tb-menu [role="menuitem"]:focus{background:rgba(44,192,179,.18); color:var(--cyan); outline:none}
.tb-menu [role="menuitem"]:focus-visible{outline:2px solid var(--cyan); outline-offset:-2px}
.tb-user{display:flex; align-items:center; gap:12px; border-left:1px solid var(--line-d); padding-left:22px}
#user-name{font-size:13px; color:#C4DADD; font-weight:600}
.tb-user .btn-quiet{border-color:var(--line-d); color:var(--mute-d)}
.tb-user .btn-quiet:hover{border-color:var(--cyan); color:var(--cyan)}

/* ============ KPI STRIP ============ */
.kpis{display:grid; grid-template-columns:repeat(6,1fr); gap:12px; padding:18px 26px 6px}
/* Loading / save errors and the one-time import offer (T-820) */
.app-msg{margin:14px 26px 0; padding:10px 14px; border-radius:10px; font-size:13px; line-height:1.45;
  background:#EEF6F6; border:1px solid var(--line); color:var(--ink2)}
.app-msg.err{background:#FBEDEB; border-color:rgba(180,83,75,.35); color:var(--red); font-weight:600}
.import-offer{margin:14px 26px 0; padding:12px 14px; border-radius:10px; background:#FFF6EA;
  border:1px solid rgba(201,122,82,.35); display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px; font-size:13px}
.import-offer p{flex:1 1 280px; margin:0; line-height:1.45}
.io-acts{display:flex; flex-wrap:wrap; gap:8px}
.kpi{background:#fff; border:1px solid var(--line); border-radius:14px; padding:14px 18px 12px; position:relative; overflow:hidden}
.kpi::after{content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--grad)}
.kpi .kv{font-family:var(--disp); font-weight:400; font-size:30px; line-height:1; color:var(--ink)}
.kpi .kv small{font-size:15px; color:var(--mute)}
.kpi .kl{font-size:12px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--teal-deep); margin-top:6px}
.kpi .kt{font-size:12px; color:var(--mute); margin-top:2px}
.kpi.warn::after{background:var(--amber)}
.kpi.bad::after{background:var(--red)}
.kpi.bad .kv{color:var(--red)}
.kbar{height:5px; background:var(--soft); border-radius:99px; margin-top:9px; overflow:hidden}
.kbar b{display:block; height:100%; background:var(--grad); border-radius:99px; transition:width .5s ease}

/* ============ BOARD ============ */
/* Stage strip (T-922): every stage with its count, sticky under the top bar */
.stage-strip{position:sticky; top:var(--tb-h,64px); z-index:30; display:flex; align-items:flex-start; gap:10px 14px;
  padding:10px 26px; margin-top:12px; background:rgba(234,242,243,.96); backdrop-filter:blur(6px);
  border-bottom:1px solid var(--line)}
.ss-tools{display:flex; gap:6px; flex:none}
.ss-toggle,.ss-edit{background:#fff; border:1px solid var(--line); color:var(--ink2); border-radius:999px;
  padding:6px 13px; font-size:12.5px; font-weight:700; cursor:pointer; transition:border-color .2s, color .2s, background .2s}
.ss-toggle:hover,.ss-edit:hover{border-color:var(--teal2); color:var(--teal-deep)}
.ss-toggle[aria-pressed="true"]{background:var(--teal-deep); border-color:var(--teal-deep); color:#fff}
.ss-edit[aria-expanded="true"]{border-color:var(--teal2); color:var(--teal-deep)}
.ss-list{list-style:none; display:flex; flex-wrap:wrap; gap:6px; min-width:0}
.ss-btn{display:inline-flex; align-items:center; gap:7px; background:#fff; border:1px solid var(--line); border-radius:999px;
  padding:4px 5px 4px 11px; font-size:12px; font-weight:600; color:var(--ink2); cursor:pointer; white-space:nowrap;
  transition:border-color .2s, background .2s}
.ss-btn:hover{border-color:var(--teal2)}
.ss-btn .ss-n{min-width:22px; padding:1px 7px; border-radius:99px; background:var(--soft); color:var(--ink);
  font-size:12px; font-weight:800; text-align:center}
.ss-btn.none .ss-n{background:#EEF2F3; color:var(--ink2)}
.ss-btn.in-view{border-color:var(--teal2); background:#F4FBFA}
.ss-btn.mine{box-shadow:inset 0 -2px 0 var(--teal2)}
.ss-btn.folded{background:transparent}
.ss-picker{display:none}
.ss-toggle:focus-visible,.ss-edit:focus-visible,.ss-btn:focus-visible,.ss-step:focus-visible,#stage-pick:focus-visible,
.edge-btn:focus-visible,.col-peek:focus-visible,.ms-opt input:focus-visible{outline:2px solid var(--teal-deep); outline-offset:2px}
.col:focus-visible{outline:2px solid var(--teal-deep); outline-offset:2px}
.col:focus:not(:focus-visible){outline:none}
/* Choose my stages */
.mystages-panel{margin:10px 26px 0; padding:14px 16px; border:1px solid var(--line); border-radius:14px; background:#fff}
.mystages-panel legend{padding:0 6px; font-family:var(--disp); font-weight:500; font-size:14.5px}
.ms-help{font-size:12.5px; color:var(--ink2); margin-bottom:10px}
.ms-list{display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:4px 14px}
.ms-opt{display:flex; align-items:center; gap:8px; min-height:32px; font-size:13px}
.ms-opt input{width:17px; height:17px; accent-color:var(--teal-deep); flex:none}
.ms-acts{display:flex; justify-content:flex-end; gap:8px; margin-top:10px}
/* Edge cues: fade plus an arrow wherever more columns sit off-screen */
.board-shell{position:relative}
.edge-cue{position:absolute; top:0; bottom:0; width:64px; pointer-events:none; z-index:5}
.edge-cue.before{left:0; background:linear-gradient(90deg,#EAF2F3 18%,rgba(234,242,243,0))}
.edge-cue.after{right:0; background:linear-gradient(270deg,#EAF2F3 18%,rgba(234,242,243,0))}
.edge-btn{pointer-events:auto; position:absolute; top:22px; width:40px; height:40px; border-radius:50%;
  background:#fff; border:1px solid var(--line); color:var(--teal-deep); font-size:16px; cursor:pointer;
  box-shadow:0 8px 20px -10px rgba(23,40,44,.45); transition:border-color .2s}
.edge-cue.before .edge-btn{left:10px} .edge-cue.after .edge-btn{right:10px}
.edge-btn:hover{border-color:var(--teal2)}

.board-wrap{flex:1; overflow-x:auto; padding:14px 26px 10px; scroll-padding-inline:26px}
.board{display:flex; width:max-content; gap:14px; align-items:flex-start; min-height:calc(100vh - 360px)}
.col{flex:0 0 264px; background:#F0F6F7; border:1px solid var(--line); border-radius:14px; display:flex; flex-direction:column; max-height:calc(100vh - 300px)}
/* Not one of my stages: a narrow column with the count */
.col.collapsed{flex-basis:52px; background:#E4EEEF}
.col-peek{display:flex; flex-direction:column; align-items:center; gap:10px; width:100%; padding:12px 0 16px; border:0;
  background:none; border-radius:14px; cursor:pointer; color:var(--ink2)}
.col-peek:hover{color:var(--teal-deep)}
.col-peek .cn{writing-mode:vertical-rl; transform:rotate(180deg); font-family:var(--disp); font-weight:500; font-size:13.5px; white-space:nowrap}
.col-peek .cc{font-size:12px; font-weight:700; color:var(--ink); background:var(--soft); border-radius:99px; padding:2px 7px; min-width:24px; text-align:center}
.col.qc{background:#EDF4EE}
.col.outsource{background:#F2F1EC}
.col-head{display:flex; align-items:center; gap:8px; padding:13px 14px 10px; border-bottom:1px solid var(--line)}
.col-head .cn{font-family:var(--disp); font-weight:500; font-size:14.5px; letter-spacing:.02em}
.col-head .cc{margin-left:auto; font-size:12px; font-weight:700; color:var(--ink); background:var(--soft);
  border-radius:99px; padding:2px 9px; min-width:24px; text-align:center}
.col-head .qcflag{font-size:12px; font-weight:800; letter-spacing:.08em; color:#fff; background:var(--teal-deep);
  border-radius:5px; padding:2px 6px; text-transform:uppercase}
.col-hint{font-size:12px; color:var(--mute); padding:6px 14px 4px}
.col-cards{flex:1; overflow-y:auto; padding:8px 10px 12px; display:flex; flex-direction:column; gap:8px; min-height:60px}
.col.dragover{outline:2px dashed var(--teal); outline-offset:-4px}

/* Card */
.case{background:#fff; border:1px solid var(--line); border-radius:12px; padding:12px 13px 10px; cursor:grab;
  transition:transform .2s ease, box-shadow .2s ease; position:relative}
.case:hover{transform:translateY(-2px); box-shadow:0 16px 32px -20px rgba(23,40,44,.4)}
.case.dragging{opacity:.45; cursor:grabbing}
/* Card colours (W5, T-806): the first of CaseForm.CARD_TONES that applies. Change request waiting
   (T-804): lamplight yellow so the technician on it notices; serious remake red, remake light red (T-846's shades);
   technician check (T-842) purple until a technician confirms the instructions; Follow up blue. */
.case.tone-change,.lg-sw.tone-change{background:#FFF6DC; border-color:#E8B77A; box-shadow:0 0 0 1px #E8B77A}
.case.tone-serious,.lg-sw.tone-serious{background:#FAE3DE; border-color:var(--red); box-shadow:0 0 0 1px var(--red)}
.case.tone-remake,.lg-sw.tone-remake{background:#FDF1EE; border-color:#E7B2A8; box-shadow:0 0 0 1px #E7B2A8}
.case.tone-tech,.lg-sw.tone-tech{background:#F4F0FB; border-color:#A894D6; box-shadow:0 0 0 1px #A894D6}
.case.tone-followup,.lg-sw.tone-followup{background:#EAF2FC; border-color:#6F9BD8; box-shadow:0 0 0 1px #6F9BD8}
.case .cflag{display:inline-block; font-size:12px; font-weight:800; letter-spacing:.08em; text-transform:uppercase;
  color:#6B4A12; background:#F5D9A8; border-radius:5px; padding:2px 7px; margin:0 4px 7px 0}
.case .cflag.tc{color:#4A3577; background:#E3DAF5}
.case .cflag.rm{color:#7E2F27; background:#F6D3CC}   /* Remake (T-846) */
.case .cflag.rm.sr{color:#fff; background:#9A3F33}   /* Serious remake */
.case .cflag.fu{color:#1F4677; background:#D3E3F7}
.case.tone-serious .cid,.case.tone-remake .cid,.case.tone-followup .cid{color:var(--teal-ink)}   /* teal-deep is under 4.5:1 on these */
/* The one-line colour legend above the board (T-806) */
.board-legend{list-style:none; display:flex; flex-wrap:wrap; align-items:center; gap:6px 18px; margin:12px 26px 0;
  font-size:12px; font-weight:600; color:var(--ink2)}
.board-legend li{display:inline-flex; align-items:center; gap:6px; white-space:nowrap}
.lg-sw{display:inline-block; width:14px; height:14px; border:1px solid; border-radius:4px}
.lg-star{color:#8A5A1F; font-size:13px}
.no-follow{margin-top:18px}   /* New orders review (W2) */
.case .chead{display:flex; align-items:center; gap:7px; margin-bottom:6px}
.case .cid{font-size:12px; font-weight:800; letter-spacing:.06em; color:var(--teal-deep)}
.case .star{color:var(--amber); font-size:13px; margin-left:auto}
.case .cpat{font-weight:700; font-size:14px; line-height:1.3}
.case .cclin{font-size:12px; color:var(--mute); margin-top:1px}
.case .ctags{display:flex; flex-wrap:wrap; gap:5px; margin-top:8px}
.case .tag{font-size:12px; font-weight:700; letter-spacing:.04em; border-radius:6px; padding:2.5px 7px;
  background:var(--soft); color:var(--teal-ink)}
.case .tag.mat{background:#EDF1F7; color:#4A6285}
.case .tag.adl{background:#F0EBDD; color:#76602F}
.case .tag.remake{background:#F6EBDC; color:#8A5A1F}
.case .tag.price{background:#EDF4EE; color:#2F6B47}
.case .tag.need{background:#FBE9E4; color:#9A3F33}
.case .cfoot{display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:9px; padding-top:8px; border-top:1px solid var(--line)}
.case .due{font-size:12px; font-weight:600; color:var(--ink2)}
/* T-927: amber (3.3:1) and red (4.4:1 on the tech-check card) are too light for 12px text */
.case .due.today{color:#8A5A1F} .case .due.over{color:#9A3F33}
/* Move buttons (T-923): 44px tall for a bench tablet; the next stage is the main action, Back is quieter */
.case .movers{flex:1 1 100%; display:flex; gap:6px}
.case .mv{min-height:44px; border-radius:10px; font-family:inherit; font-size:12.5px; font-weight:700; line-height:1.25;
  cursor:pointer; transition:background .15s, border-color .15s, color .15s}
.case .mv-next{flex:1 1 auto; padding:6px 12px; border:1px solid var(--teal-deep); background:var(--teal-deep); color:#fff; text-align:center}
.case .mv-next:hover{background:#0A6A64; border-color:#0A6A64}
.case .mv-back{flex:none; padding:6px 10px; border:1px solid var(--line); background:#fff; color:var(--ink2); font-weight:600}
.case .mv-back:hover{border-color:var(--teal2); color:var(--teal-ink); background:var(--soft)}
.case .mv:focus-visible,.case:focus-visible{outline:2px solid var(--teal-deep); outline-offset:2px}
.case .mv-lock{flex:1 1 100%; margin:0; font-size:12px; line-height:1.4; font-weight:600; color:var(--ink2)}
.case .notes{font-size:12px; color:var(--ink2); background:#F6FAFA; border-left:2px solid var(--teal); border-radius:0 7px 7px 0;
  padding:5px 8px; margin-top:8px; line-height:1.45; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden}
/* Move toast (T-923) */
.toast{position:fixed; left:0; right:0; bottom:20px; z-index:50; display:flex; align-items:center; gap:14px;
  width:max-content; max-width:calc(100vw - 32px); margin:0 auto;
  padding:8px 8px 8px 18px; border-radius:14px; background:var(--night); color:var(--snow); font-size:13.5px; font-weight:600;
  box-shadow:0 18px 40px -18px rgba(14,26,32,.6); transform:translateY(12px); opacity:0; pointer-events:none;
  transition:opacity .2s ease, transform .2s ease}
.toast.show{opacity:1; transform:none; pointer-events:auto}
.toast p{margin:0; padding:8px 0}
.toast-undo{min-height:44px; padding:8px 16px; border-radius:10px; border:1px solid var(--line-d); background:transparent;
  color:var(--cyan); font-family:inherit; font-size:13.5px; font-weight:800; cursor:pointer}
.toast-undo:hover{background:rgba(121,210,220,.12)}
.toast-undo:focus-visible{outline:2px solid var(--cyan); outline-offset:2px}
.empty-col{font-size:12px; color:var(--ink2); text-align:center; padding:14px 6px; border:1px dashed var(--line); border-radius:10px}
.empty-col.err{color:var(--red); background:#fff; border-color:rgba(180,83,75,.35)}

/* ============ MY CASES (dentist / clinic) ============ */
.mycases-wrap{max-width:1040px; margin:0 auto; padding:26px 26px 40px}
.mc-head{margin-bottom:16px}
.mc-title{font-family:var(--disp); font-weight:400; font-size:26px; letter-spacing:.02em}
.mc-sub{font-size:13px; color:var(--mute); margin-top:2px}
.mc-list{background:#fff; border:1px solid var(--line); border-radius:14px; overflow:hidden}
.mc-row{display:grid; grid-template-columns:96px 150px 1.1fr 1fr 1fr 120px 150px; gap:12px; align-items:center;
  padding:12px 18px; border-top:1px solid var(--line); font-size:14px}
.mc-row:first-child{border-top:0}
.mc-headrow{background:#F0F6F7; font-size:12px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--teal-deep)}
.mc-cell{min-width:0; overflow-wrap:anywhere}
.mc-label{display:none}
.mc-id{font-size:12px; font-weight:800; letter-spacing:.06em; color:var(--teal-deep)}
.mc-pat{font-weight:700}
.mc-type,.mc-mat{color:var(--ink2)}
/* T-920: the return date; a late case gets a calm note in the lamplight tone, not a red label */
.mc-back{font-size:13px; font-weight:700; color:var(--ink)}
.mc-back-pending,.mc-back-none,.mc-back-delivered{font-weight:600; color:var(--ink2)}
.mc-back-late{font-weight:600; color:#6B4A12}
.status{display:inline-block; font-size:12px; font-weight:700; border-radius:99px; padding:3px 10px;
  background:var(--soft); color:var(--teal-ink)}
.status.s-received{background:#EDF1F7; color:#4A6285}
.status.s-quality-check{background:#EDF4EE; color:#2F6B47}
.status.s-dispatched{background:var(--grad); color:#07231F}
.status.s-follow-up{background:#F0EBDD; color:#76602F}
.status.s-awaiting-approval{background:#F6F1E6; color:#8A5A1C}
.status.s-change-requested{background:#F5D9A8; color:#6B4A12}
.status.s-not-accepted{background:#FBE9E4; color:#9A3F33}
.status.s-technician-check{background:#E3DAF5; color:#4A3577}
.mc-tech{grid-column:1 / -1; font-size:13px; color:var(--ink2); background:#F4F0FB; border-left:3px solid #7A62B8;
  border-radius:0 9px 9px 0; padding:7px 10px; line-height:1.45; overflow-wrap:anywhere}
.mc-tech-q{margin-top:4px; white-space:pre-line}
.mc-tech b{color:#4A3577}
.mc-reason{grid-column:1 / -1; font-size:13px; color:var(--ink2); background:#FBE9E4; border-left:3px solid #9A3F33;
  border-radius:0 9px 9px 0; padding:7px 10px; overflow-wrap:anywhere}
.mc-reason b{color:#9A3F33}
.mc-reason-title{font-size:12px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:#9A3F33}   /* T-1087 */
.mc-reason .na-reason{margin-top:3px}
.mc-reason-next{font-size:12.5px; color:var(--ink2); margin-top:4px}
.mc-approved{grid-column:1 / -1; font-size:13px; font-weight:600; color:#0A5F59; background:var(--soft);
  border-left:3px solid var(--teal-deep); border-radius:0 9px 9px 0; padding:7px 10px; overflow-wrap:anywhere}
.mc-act{text-align:right}
.mc-claim{font-size:12.5px; padding:6px 12px; white-space:nowrap; cursor:pointer}
.mc-claim:hover{border-color:var(--teal2); color:var(--teal-deep)}
.sr-only{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}
.mc-empty{padding:26px 18px; text-align:center; font-size:13.5px; color:var(--mute)}

/* ============ MODAL ============ */
dialog{border:0; border-radius:18px; padding:0; margin:auto; width:600px; max-width:calc(100% - 40px);
  max-height:calc(100dvh - 32px); overflow-y:auto; overscroll-behavior:contain;
  box-shadow:0 60px 120px -40px rgba(0,0,0,.5)}
dialog::backdrop{background:rgba(10,21,26,.55); backdrop-filter:blur(3px)}
#case-form,#remake-form,.claims-wrap{padding:30px 32px 26px}
#case-form h3,#remake-form h3,.claims-wrap h3{font-family:var(--disp); font-weight:400; font-size:24px; margin-bottom:20px}
.fgrid{display:grid; grid-template-columns:1fr 1fr; gap:14px 16px}
.f{display:flex; flex-direction:column}
.f-wide{grid-column:1/-1}
.f{min-width:0}
.f label,.f .flabel{font-size:12px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--ink2); margin-bottom:5px}
.f input,.f select,.f textarea{border:1px solid var(--line); border-radius:9px; font-family:inherit; font-size:14px;
  padding:9px 12px; outline:none; transition:border-color .2s; background:#FBFDFD; color:var(--ink)}
.f input:focus,.f select:focus,.f textarea:focus{border-color:var(--teal2)}
.f input:focus-visible,.f select:focus-visible,.f textarea:focus-visible{outline:2px solid var(--teal-deep); outline-offset:1px}
/* Fixed on a change request (T-840 E01-E03): readable, clearly not editable */
.f input[readonly],.f textarea[readonly],.f select:disabled{background:#F1EEE8; color:var(--ink2); border-style:dashed; cursor:not-allowed; opacity:1}
/* Case form rules: hints, More list, jaw toggles, legacy note */
.f select{width:100%}
.f .req{color:var(--red)}
.fsub{display:flex; flex-direction:column; margin-top:10px}
.fhint{font-size:12px; color:var(--ink2); margin-top:5px; line-height:1.4}
/* Dentist's case search on the remake claim (T-847) */
.cs-wrap{position:relative; display:flex; flex-direction:column}
.cs-list{list-style:none; position:absolute; top:calc(100% + 4px); left:0; right:0; z-index:5; background:#fff;
  border:1px solid var(--line); border-radius:9px; box-shadow:0 12px 30px -14px rgba(12,23,28,.35); overflow:hidden}
.cs-opt{display:grid; grid-template-columns:auto 1fr auto; gap:4px 12px; align-items:baseline; padding:9px 12px;
  font-size:13.5px; color:var(--ink2); cursor:pointer; border-top:1px solid var(--line)}
.cs-opt:first-child,.cs-none:first-child{border-top:0}
.cs-opt[aria-selected="true"],.cs-opt:hover{background:var(--soft)}
.cs-id{font-size:12px; font-weight:800; letter-spacing:.06em; color:var(--teal-deep)}
.cs-ty{font-size:12px; color:var(--ink2)}
.cs-opt mark{background:rgba(232,183,122,.45); color:inherit; border-radius:3px}
.cs-none{padding:10px 12px; font-size:13px; color:var(--ink2)}
/* T-1092: each remake reason's note, for touch screens (desktop keeps the option hover) */
.opt-help{display:none; margin-top:6px}
@media (hover:none){ .opt-help{display:block} }
.opt-help summary{display:inline-flex; align-items:center; gap:6px; min-height:44px; font-size:12.5px; font-weight:700;
  color:var(--teal-deep); cursor:pointer; border-radius:6px; list-style:none}
.opt-help summary::-webkit-details-marker{display:none}
.opt-help summary::before{content:''; width:7px; height:7px; border:solid currentColor; border-width:0 2px 2px 0;
  transform:rotate(-45deg); margin-right:2px; transition:transform .15s}
.opt-help[open] summary::before{transform:rotate(45deg)}
.opt-help summary:focus-visible{outline:2px solid var(--teal-deep); outline-offset:2px}
.opt-help dl{border:1px solid var(--line); border-radius:9px; background:#FBFDFD; padding:4px 12px; font-size:13px; line-height:1.45}
.opt-help dt{font-weight:700; color:var(--ink); padding-top:8px}
.opt-help dd{color:var(--ink2); padding-bottom:8px; border-bottom:1px solid var(--line); overflow-wrap:anywhere}
.opt-help dd:last-child{border-bottom:0}
.fwarn{font-size:12px; color:#8A5A1F; font-weight:600; margin-top:5px; line-height:1.4}
.freturn{font-size:12.5px; color:var(--teal-deep); font-weight:700; margin-top:6px}
.freturn:empty{display:none}
.jaw-pick{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.jaw-btn{display:flex; flex-direction:column; align-items:center; gap:6px; padding:12px 8px 10px; min-height:44px;
  border:1px solid var(--line); border-radius:12px; background:#FBFDFD; color:var(--ink2); font-size:13px; font-weight:600;
  cursor:pointer; transition:border-color .2s, background .2s, color .2s}
.jaw-btn:hover:not(:disabled){border-color:var(--teal2)}
.jaw-btn:focus-visible{outline:2px solid var(--teal-deep); outline-offset:2px}
.jaw-btn[aria-pressed="true"]{border-color:var(--teal2); background:var(--soft); color:var(--teal-ink)}
.jaw-btn:disabled{cursor:not-allowed}
.jaw-btn:disabled:not([aria-pressed="true"]){opacity:.45}
.jaw-pic{width:48px; height:32px; fill:none; stroke:currentColor; stroke-width:5; stroke-linecap:round; stroke-dasharray:5 2.5}
.legacy-note{font-size:12.5px; color:var(--ink2); background:#F6F1E6; border-left:3px solid var(--amber);
  border-radius:0 9px 9px 0; padding:9px 12px; line-height:1.45}
.checkline label{display:flex; align-items:center; gap:9px; font-size:13.5px; font-weight:600; text-transform:none;
  letter-spacing:0; color:var(--ink2); cursor:pointer}
.checkline input{accent-color:var(--teal2); width:16px; height:16px}
/* Field errors under each field (T-925), the "* Required" legend, and the links between an original and its remakes */
.ferr{font-size:12px; color:var(--red); font-weight:600; margin-top:5px; line-height:1.4}
.req-legend{font-size:12px; color:var(--ink2); margin:-12px 0 16px}
.req-legend .req{color:var(--red); font-weight:700}
.f [aria-invalid="true"]{border-color:var(--red)}
/* Saved case defaults under the dentist's new case form (T-848): actions left, the clinic's saved ones to the right */
.saved-defaults{border-top:1px solid var(--line); padding-top:14px}
.sd-row{display:flex; align-items:flex-start; gap:12px 16px; flex-wrap:wrap}
.sd-actions{display:flex; flex-direction:column; align-items:flex-start; gap:10px; flex:none}
.sd-actions .btn-quiet{white-space:nowrap}
.f .sd-check{display:flex; align-items:center; gap:7px; margin:0; font-size:12.5px; font-weight:600; text-transform:none;
  letter-spacing:0; color:var(--ink2); cursor:pointer}
.sd-check input{accent-color:var(--teal2); width:16px; height:16px}
.sd-list{list-style:none; display:flex; flex-wrap:wrap; align-content:flex-start; gap:8px; margin:0; padding:0; flex:1 1 240px; min-width:0}
.sd-list[hidden]{display:none}
.sd-item{display:inline-flex; align-items:center; max-width:100%; border:1px solid var(--line); border-radius:999px; background:#fff; overflow:hidden}
.sd-item.is-star{border-color:var(--teal2); background:var(--soft)}
.sd-item button{background:none; border:0; font-family:inherit; cursor:pointer; color:var(--ink2); min-height:34px}
.sd-fill{font-size:12.5px; font-weight:600; padding:6px 4px 6px 12px; text-align:left; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0}
.sd-star{font-size:15px; padding:6px 6px; color:var(--teal-deep)}
.sd-star:disabled{cursor:default; opacity:1}
.sd-remove{font-size:16px; padding:6px 11px 6px 4px; color:var(--mute)}
.sd-item button:hover:not(:disabled){color:var(--teal-deep)}
.sd-remove:hover{color:var(--red) !important}
.is-replacing .sd-fill{padding-right:12px}
.is-replacing .sd-item{border-style:dashed; border-color:var(--amber)}
.sd-msg:empty{display:none}
.remake-links{font-size:12.5px; color:var(--ink2); background:#F6F1E6; border-left:3px solid var(--amber);
  border-radius:0 9px 9px 0; padding:9px 12px; line-height:1.6}
.link-id{background:none; border:0; padding:0; font:inherit; font-weight:800; color:var(--teal-ink);   /* T-927: sits on linen boxes too */
  text-decoration:underline; text-underline-offset:2px; cursor:pointer}
.link-id:hover{color:var(--teal-deep)}
/* Remake claim: policy confirmation and the lab's claims list */
.policy-line label{align-items:flex-start; line-height:1.45}
.policy-line input{flex:none; margin-top:2px}
.policy-line a{color:var(--teal-deep); text-decoration:underline; text-underline-offset:2px}
#claims-modal{width:720px}
.cl-list{margin-top:14px; border:1px solid var(--line); border-radius:14px; overflow:hidden; background:#fff}
.cl-row{padding:14px 18px; border-top:1px solid var(--line); font-size:13.5px; color:var(--ink2); line-height:1.5}
.cl-row:first-child{border-top:0}
.cl-top{display:flex; justify-content:space-between; gap:12px; font-size:12px; color:var(--mute); font-weight:700}
.cl-stage{background:var(--soft); color:var(--teal-ink); border-radius:99px; padding:1px 9px}
.cl-ids{margin-top:4px; font-weight:600; color:var(--ink)}
.cl-notes{background:#F6FAFA; border-left:2px solid var(--teal); border-radius:0 7px 7px 0; padding:5px 8px; margin-top:4px}
.cl-by{font-size:12px; color:var(--mute)}
/* Remake claim photos (T-836): thumbnails that open full size; HEIC shown by name */
.cl-photos{font-size:12px; color:var(--ink2); margin-top:4px}
.ph-list{list-style:none; margin:6px 0 2px; padding:0; display:flex; flex-wrap:wrap; gap:8px}
.ph-item{display:flex; align-items:center; justify-content:center; width:72px; height:72px; border:1px solid var(--line);
  border-radius:9px; overflow:hidden; background:var(--snow); color:var(--teal-deep); text-decoration:none}
.ph-item img{width:100%; height:100%; object-fit:cover; display:block}
.ph-item:hover{border-color:var(--teal2)}
.ph-item:focus-visible{border-color:var(--teal2); outline:2px solid var(--teal-deep); outline-offset:1px}
.ph-item:not([href]){cursor:progress}
.ph-name{font-size:12px; font-weight:700; line-height:1.25; padding:4px; text-align:center; overflow-wrap:anywhere}
.ph-item.ph-off{border-style:dashed; color:var(--ink2); cursor:default}
/* Remake assessment (T-805): status chips, the assessment details. .badge is the one notification badge style (Remake claims, New orders, quotes to approve) */
.badge{display:inline-flex; align-items:center; justify-content:center; min-width:20px; height:20px; padding:0 6px;
  margin-left:4px; border-radius:99px; background:var(--amber); color:var(--night); font-size:12px; font-weight:800; line-height:1}
.badge[hidden]{display:none}
.badge-wide{height:22px; padding:0 10px; margin-left:10px; font-family:'Manrope',sans-serif; font-size:12px; vertical-align:middle}
.cl-chips{display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end}
.cl-status{border-radius:99px; padding:1px 9px; background:#EDF1F7; color:#4A6285}
.cl-status.k-assess{background:#F6EBDC; color:#8A5A1F}
.cl-status.k-quoted{background:#F0EBDD; color:#76602F}
.cl-status.k-approved{background:#EDF4EE; color:#2F6B47}
.cl-status.k-waiting_appliance{background:#EDF1F7; color:#4A6285}
.cl-status.k-declined{background:#F8ECEA; color:#9A3F37}
.cl-status.k-call_requested{background:#F6EBDC; color:#8A5A1F}
.cl-status.k-expired{background:#EFEBE6; color:#5E554B}
.cl-status.k-reminder{background:#fff; color:#8A5A1F; border:1px solid #E3C9A8}
/* T-845: the dentist's answer to a quote (free remake started, call asked for, decline box) */
.cl-started{background:#EDF4EE; border-left:2px solid #2F6B47; border-radius:0 7px 7px 0; padding:5px 8px; margin-top:4px; font-weight:600; color:#2F6B47}
.cl-call{background:#F6EBDC; border-left:2px solid var(--amber); border-radius:0 7px 7px 0; padding:5px 8px; margin-top:4px}
.qd-box{margin-top:10px; padding:12px; border:1px solid var(--line); border-radius:9px; background:#fff}
.qd-opts{border:0; margin:0 0 12px; padding:0; display:flex; flex-direction:column; gap:8px}
.qd-opts legend{padding:0; margin-bottom:6px}
.f .qd-opt input{padding:0; border:0; border-radius:50%}
/* T-844: the triage line and a declined claim's message */
.cl-triage{font-size:12.5px; color:var(--ink2)}
.cl-decline{background:#F8ECEA; border-left:2px solid var(--red); border-radius:0 7px 7px 0; padding:5px 8px; margin-top:4px}
.af-decline{margin-top:18px}
.cl-row.cl-new{box-shadow:inset 3px 0 0 var(--amber)}
.cl-acts{display:flex; flex-wrap:wrap; gap:10px; margin-top:10px}
.cl-acts button{min-height:40px; cursor:pointer}
.assess-list{display:grid; grid-template-columns:max-content 1fr; gap:3px 14px; margin-top:8px; padding:8px 10px;
  background:#F6FAFA; border-radius:9px; font-size:12.5px}
.assess-list dt{color:var(--mute); font-weight:700}
.assess-list dd{margin:0; color:var(--ink); overflow-wrap:anywhere}
.remake-links .assess-list{background:rgba(255,255,255,.6)}
.af-claim{font-size:13px; color:var(--ink2); line-height:1.5; background:#F6F1E6; border-left:3px solid var(--amber);
  border-radius:0 9px 9px 0; padding:9px 12px; margin-bottom:16px}
/* The warranty line on the assessment form (T-843): read only, from the original case */
.af-warranty{font-size:12.5px; color:var(--ink2); background:#F6FAFA; border-left:3px solid var(--teal);
  border-radius:0 9px 9px 0; padding:9px 12px; line-height:1.45}
.af-warranty.w-remake_price,.af-warranty.w-unknown{background:#F6F1E6; border-left-color:var(--amber)}
.af-warranty.w-outside{background:#F8ECEA; border-left-color:var(--red)}
.f input:disabled{background:#F2F6F6; color:var(--ink2)}
#assess-form{padding:30px 32px 26px}
#assess-form h3{font-family:var(--disp); font-weight:400; font-size:24px; margin-bottom:16px}
.mc-claims{margin-bottom:22px}
.mc-claims .cl-list{margin-top:8px}
.mc-h2{font-family:var(--disp); font-weight:400; font-size:20px}
/* New orders: the admin team's approval of dentists' cases (T-803) */
#orders-modal{width:720px}
.no-status{font-size:13px; color:#2F6B47; font-weight:700; margin-top:6px}
.no-status:empty{display:none}
#no-body{outline:none}
.no-row{display:block; width:100%; text-align:left; background:#fff; border-left:0; border-right:0; border-bottom:0;
  font:inherit; cursor:pointer; min-height:44px}
.no-row:first-child{border-top:0}
.no-row:hover,.no-row:focus-visible{background:#F6FAFA}
.no-row > span{display:block}
.no-back{font-size:12.5px; padding:6px 12px; margin-top:14px; cursor:pointer}
.no-title{font-family:var(--disp); font-weight:400; font-size:21px; margin-top:16px}
.no-details{display:grid; grid-template-columns:minmax(150px, max-content) 1fr; gap:8px 18px; margin-top:16px;
  background:#fff; border:1px solid var(--line); border-radius:14px; padding:14px 18px; font-size:13.5px}
.no-details dt{font-size:12px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--mute); padding-top:2px}
.no-details dd{color:var(--ink); font-weight:600; min-width:0; overflow-wrap:anywhere}
.no-sec{font-size:12px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--mute); margin-top:18px}
.no-files{list-style:none; margin-top:6px; font-size:13.5px}
.no-files a{color:var(--teal-deep); font-weight:700; text-decoration:underline; text-underline-offset:2px; overflow-wrap:anywhere}
/* Not accepted (T-841): flags on new orders, the disapproval reason, the reason the dentist sees */
.no-flags{display:flex; flex-wrap:wrap; gap:6px; margin-top:6px}
.no-row > .no-flags{display:flex}
.no-flag{font-size:12px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; border-radius:99px;
  padding:2px 9px; background:#F6F1E6; color:#8A5A1C}
.no-flag.q{background:#F5D9A8; color:#6B4A12}
.no-flag.ns{background:#F6DCD8; color:#8A2F28}   /* T-924: no scans or impression yet */
.no-flag.rs{background:#DDF0EE; color:#0A5E58}   /* T-1087: sent again after Not accepted */
.no-disapprove{margin-top:18px}
.no-wait{margin-top:16px}
.change-box.na-box{background:#FBE9E4; border-color:#D9A79E; border-left-color:#9A3F33; margin-top:12px}
.change-box.na-box .cb-title{color:#9A3F33}
/* T-1087: a resent order in New orders: the reason, the dentist's note and what changed */
.change-box.rs-box{background:#EEF7F6; border-color:#B9DCD8; border-left-color:var(--teal-deep); margin-top:12px}
.change-box.rs-box .cb-title{color:var(--teal-deep)}
.rs-was,.rs-note{font-size:13px; color:var(--ink); margin-top:6px; white-space:pre-line; overflow-wrap:anywhere}
.rs-was b{color:#9A3F33}
.rs-note b{color:var(--teal-deep)}
.rs-h{font-size:12px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--ink2); margin-top:10px}
.rs-note-field{margin-top:12px}
.change-box.tc-box{background:#F4F0FB; border-color:#C9BBE8; border-left-color:#7A62B8}
.change-box.tc-box .cb-title{color:#4A3577}
.tc-notes{font-size:14px; color:var(--ink); background:#fff; border-radius:8px; padding:8px 10px; margin-top:8px;
  white-space:pre-line; overflow-wrap:anywhere}
.tc-asked{font-size:13px; color:var(--ink); margin-top:8px; white-space:pre-line; overflow-wrap:anywhere}
.tc-asked b{color:#4A3577}
.na-reason{font-size:14px; color:var(--ink); margin-top:6px; white-space:pre-line; overflow-wrap:anywhere}
/* Follow-ups (T-807): two weeks after delivery, drafted, approved, copied and marked sent */
#followups-modal{width:760px}
#fu-list{outline:none}
.fu-meta{font-size:12.5px; color:var(--mute); margin-top:2px}
.cl-stage.fu-approved{background:#E4F2EA; color:#2F6B47}
.cl-stage.fu-sent{background:#EEF2F2; color:var(--ink2)}
.cl-stage.fu-skipped{background:#F1EEE8; color:var(--mute)}
.cl-stage.fu-closed{background:#E4F2EA; color:#2F6B47}
.fu-edit{margin-top:10px; display:grid; gap:10px}
.fu-edit input,.fu-edit textarea{background:#fff}
.fu-edit textarea{min-height:220px; line-height:1.5}
.fu-msg{margin-top:10px; border:1px solid var(--line); border-radius:10px; background:#fff; padding:10px 12px;
  font-size:13.5px; color:var(--ink); white-space:pre-wrap; overflow-wrap:anywhere}
.fu-msg b{display:block; margin-bottom:6px}
.fu-note{font-size:12.5px; font-weight:700; color:#8A4B00; margin-top:8px}
.fu-skip{margin-top:12px}
.fu-skip input[type="text"],.fu-skip select{background:#fff}
.fu-edit textarea[data-fu-note]{min-height:88px}
.fu-check{display:flex; align-items:center; gap:8px; font-size:13px; color:var(--ink2); margin-top:8px}
.fu-done{margin-top:16px}
.fu-done summary,.fu-optouts h4,.fu-quiet h4{font-size:12px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; color:var(--mute); cursor:pointer}
.fu-optouts{margin-top:16px}
/* Quiet clinics (T-808, Rule 3) */
.fu-quiet{margin-top:18px}
.fu-quiet > .fu-meta{margin:4px 0 10px}
.fu-optouts ul{list-style:none; margin-top:8px; border:1px solid var(--line); border-radius:14px; background:#fff}
.fu-optouts li{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 18px; border-top:1px solid var(--line);
  font-size:13.5px; color:var(--ink2)}
.fu-optouts li:first-child{border-top:0}
/* Key clients (T-2083) */
#keyclients-modal{width:760px}
#kc-list{outline:none}
#kc-list section + section,#kc-list details{margin-top:18px}
#kc-list h4{font-size:12px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; color:var(--mute)}
.kc-head{display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:4px 12px}
.kc-tier{font-size:12.5px; font-weight:700; color:var(--mute)}
.kc-tier.kc-key{color:var(--teal-deep)}
.kc-tier.kc-general{color:var(--ink2)}
.kc-filter{display:flex; align-items:center; gap:8px; margin:10px 0; font-size:13px; font-weight:700; color:var(--ink2)}
.kc-filter select{min-height:44px; max-width:100%; font:inherit}
@media(max-width:480px){#keyclients-modal{width:calc(100vw - 24px)}}
.kc-alert{font-size:13px; font-weight:700; color:#8A4B00; margin-top:6px; overflow-wrap:anywhere}
.kc-flag{display:flex; align-items:flex-start; gap:8px; font-size:13px; color:var(--ink2); margin-top:8px}
.kc-flag input{margin-top:3px; flex:none}
.kc-error{background:#FBEDEB; border:1px solid rgba(180,83,75,.35); border-radius:12px; padding:12px 14px; color:var(--red); font-weight:600}
.kc-error .btn{margin-top:10px; min-height:44px}
/* Change requests (T-804): old → new values on the case, in New orders and in the admin list */
#changes-modal{width:720px}
#cr-list{outline:none}
.change-box{background:#FFF6DC; border:1px solid #E8B77A; border-left:3px solid #E8B77A; border-radius:0 12px 12px 0;
  padding:11px 14px; font-size:13px; color:var(--ink2); line-height:1.45; margin-top:6px}
.cb-title{font-size:12px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; color:#6B4A12}
.cb-who{font-size:12px; color:var(--mute); margin-top:1px}
.cb-files{margin-top:10px; padding-top:8px; border-top:1px solid #E8B77A}
.cb-list{display:grid; grid-template-columns:minmax(120px, max-content) 1fr; gap:4px 14px; margin-top:8px}
.cb-list dt{font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--mute); padding-top:1px}
.cb-list dd{min-width:0; overflow-wrap:anywhere}
.cb-list s{color:var(--mute)}
.cb-list b{color:var(--ink)}
.cb-actions{display:flex; justify-content:flex-end; flex-wrap:wrap; gap:10px; margin-top:10px}
/* T-840: the return date the lab sets (V01) and the disapproval reply (V02) */
.cb-return,.cb-disapprove{margin-top:12px}
.cb-return input{max-width:220px; background:#fff}
.cb-disapprove textarea{background:#fff}
.mc-reply{grid-column:1 / -1; background:#FFF6DC; border-left:3px solid #E8B77A; border-radius:0 9px 9px 0;
  padding:8px 12px; font-size:13px; color:var(--ink2); line-height:1.45; white-space:pre-line}
.mc-reply-title{font-size:12px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:#6B4A12; white-space:normal}
.cb-flag{display:block; font-size:12px; font-weight:700; color:#8A4B00; margin-top:1px}
.cb-date{font-size:13px; color:var(--ink); margin-top:8px}
.cb-blocked{font-size:13px; font-weight:700; color:#8A2A12; margin-top:10px}
#cf-msg:empty{display:none}
/* Case files (T-738, B13): drop zone, files grouped by type, upload progress */
.drop-zone{border:1.5px dashed var(--line); border-radius:12px; background:var(--snow); padding:16px 14px; text-align:center;
  transition:background .15s, border-color .15s}
.drop-zone.drag-over{background:var(--soft); border:1.5px solid var(--teal-deep); box-shadow:inset 0 0 0 1px var(--teal-deep)}   /* T-1086: 4.4:1 against the zone */
.drop-zone.is-off{opacity:.6}
.drop-title{font-size:13.5px; font-weight:600; color:var(--ink2)}
.f .drop-pick{display:inline; font-size:inherit; font-weight:700; letter-spacing:0; text-transform:none; color:var(--teal-deep);
  text-decoration:underline; text-underline-offset:2px; cursor:pointer; margin:0}
.f .drop-input{position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); border:0}
.drop-zone:focus-within{border-color:var(--teal2)}
.file-errs:empty{display:none}
.file-errs p{font-size:12px; color:var(--red); font-weight:600; margin-top:6px; line-height:1.4}
.file-group{margin-top:12px}
.file-group h5{font-size:12px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--ink2)}
.file-list{list-style:none; margin:6px 0 0; padding:0; display:flex; flex-direction:column; gap:6px}
.file-list li{display:flex; align-items:center; gap:4px 10px; flex-wrap:wrap; font-size:13px; padding:7px 10px;
  border:1px solid var(--line); border-radius:9px; background:#FBFDFD}
.file-list li.pending{border-style:dashed}
.file-list li.failed{border-color:var(--red)}
.file-name{font-weight:600; color:var(--ink); overflow-wrap:anywhere; min-width:0; flex:1 1 160px}
.file-meta{font-size:12px; color:var(--ink2)}
.file-list progress{flex:1 1 100%; height:6px; accent-color:var(--teal2)}
.file-err{flex:1 1 100%; font-size:12px; color:var(--red); font-weight:600}
.file-btn{background:none; border:0; color:var(--teal-deep); font:inherit; font-size:12.5px; font-weight:700; cursor:pointer;
  padding:0 8px; min-height:44px; text-decoration:underline; text-underline-offset:2px}
.file-btn.remove{color:var(--red)}
.file-btn:disabled{opacity:.4; cursor:default}
.files-empty{font-size:12.5px; color:var(--ink2); margin-top:8px}
.file-btn:focus-visible{outline:2px solid var(--teal-deep); outline-offset:2px}
.file-err[hidden]{display:none}
/* T-1086: the dentist's files on a case in My cases, shut until opened */
.mc-files{grid-column:1 / -1}
.mc-files summary{display:inline-flex; align-items:center; gap:6px; min-height:32px; font-size:12.5px; font-weight:700;
  color:var(--teal-deep); cursor:pointer; border-radius:6px; list-style:none}
.mc-files summary::-webkit-details-marker{display:none}
.mc-files summary::before{content:''; width:7px; height:7px; border:solid currentColor; border-width:0 2px 2px 0;
  transform:rotate(-45deg); margin-right:2px; transition:transform .15s}
.mc-files details[open] summary::before{transform:rotate(45deg)}
.mc-files .files-empty{margin-top:0}
.mc-files summary:focus-visible{outline:2px solid var(--teal-deep); outline-offset:2px}
.mc-files details[open] summary{margin-bottom:2px}
.mc-files .file-groups{max-width:760px}
.mc-files .file-group:first-child{margin-top:4px}
.impression-line{margin-top:12px}
.impression-line label{min-height:44px}
.impression-line input:focus-visible{outline:2px solid var(--teal-deep); outline-offset:2px}   /* 3:1+ on white, as the other platform inputs (T-925) */
.impression-line .fhint{margin-top:0; color:var(--ink2)}   /* AA on white */
/* "Your appliance" preview (T-849, B14): product photo + live summary, not saved with the case */
.pv{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.1fr); border:1px solid var(--line); border-radius:12px;
  overflow:hidden; background:#FBFDFD}
.pv-img{position:relative; background:var(--snow); aspect-ratio:4/5; max-height:300px; width:100%; overflow:hidden}
.pv-photo{position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block}
.pv-none{position:absolute; inset:0; display:flex; align-items:center; justify-content:center; padding:12px; text-align:center;
  font-size:13px; font-weight:600; color:var(--ink2); background:radial-gradient(circle at 50% 40%,#fff 0,var(--soft) 80%)}
.pv-cap{position:absolute; left:8px; right:8px; bottom:8px; font-size:12px; line-height:1.35; color:#fff;
  background:rgba(12,23,28,.72); border-radius:8px; padding:5px 9px}
.pv-txt{padding:14px 16px; min-width:0}
.pv-title{font-size:16px; font-weight:700; color:var(--ink); line-height:1.3}
.pv-rows{display:grid; grid-template-columns:auto minmax(0,1fr); gap:5px 14px; font-size:13px; margin:10px 0 0;
  padding-top:10px; border-top:1px solid var(--line)}
.pv-rows dt{color:var(--ink2)}
.pv-rows dd{margin:0; color:var(--ink); font-weight:600; overflow-wrap:anywhere}
@media(max-width:560px){ .pv{grid-template-columns:1fr} .pv-img{aspect-ratio:4/3; max-height:none} }
.modal-actions{display:flex; align-items:center; gap:12px; margin-top:24px}
.modal-actions .spacer{flex:1}

/* Discard this case? (T-926): asked when a changed form is closed. Keep editing is the default. */
.discard-modal{width:420px}
.discard-wrap{padding:26px 28px 22px}
.discard-wrap h3{font-family:var(--disp); font-weight:400; font-size:22px; margin-bottom:10px}
.discard-wrap p{font-size:14px; color:var(--ink2)}
.discard-wrap .modal-actions{margin-top:20px}
.discard-wrap button:focus-visible{outline:2px solid var(--teal-deep); outline-offset:2px}

/* ============ FOOTER ============ */
.app-foot{padding:12px 26px 20px; font-size:12px; color:var(--mute); text-align:center}

/* ============ RESPONSIVE ============ */
@media(max-width:1100px){ .kpis{grid-template-columns:repeat(3,1fr)} }
/* Top bar needs about 1860px on one row (admin view, with New orders, Change requests, Claims to assess and Follow-ups all showing a badge); below that the tools move to a second row */
@media(max-width:1860px){
  .topbar{flex-wrap:wrap; height:auto; padding-top:12px; padding-bottom:12px; row-gap:12px}
  .tb-tools{order:3; flex:1 1 100%; min-width:0}
  .tb-user{margin-left:auto}
  .tb-tools .chip-toggle, .tb-tools .btn, #user-name, #btn-logout{white-space:nowrap}
}
@media(max-width:720px){
  .sd-item button{min-height:44px}
  .sd-actions{flex-direction:row; flex-wrap:wrap; align-items:center; width:100%}
  .topbar{flex-wrap:wrap; height:auto; padding:12px 16px; gap:12px}
  .tb-app{display:none}
  .tb-tools{order:3; width:100%; justify-content:flex-start; flex-wrap:wrap; gap:10px}
  #search{flex:1 1 100%; width:auto; min-width:0; min-height:44px}
  .tb-tools .chip-toggle, .tb-tools .btn{min-height:44px; white-space:nowrap}
  .tb-tools .btn, .tb-new{margin-left:auto}
  .tb-new .btn{margin-left:0}
  .tb-queues{order:1; flex:1 1 100%; flex-wrap:wrap; padding-left:0; border-left:0}
  .tb-user{margin-left:auto; border-left:0; padding-left:0}
  .kpis{grid-template-columns:repeat(2,1fr); padding:14px 16px 4px}
  .app-msg,.import-offer{margin:12px 16px 0}
  /* One column at a time with a stage picker (and swipe) */
  .board-legend{margin:12px 16px 0; gap:6px 14px}
  .stage-strip{position:static; padding:10px 16px; flex-wrap:wrap}   /* the top bar already takes a third of a phone screen */
  .ss-tools{width:100%}
  .ss-toggle,.ss-edit{min-height:44px; padding:8px 16px}
  .ss-list{display:none}
  .ss-picker{display:flex; gap:8px; width:100%; align-items:center}
  #stage-pick{flex:1; min-width:0; min-height:44px; border:1px solid var(--line); border-radius:12px; background:#fff;
    color:var(--ink); font-family:inherit; font-size:15px; font-weight:600; padding:8px 12px}
  .ss-step{flex:none; width:44px; height:44px; border-radius:12px; border:1px solid var(--line); background:#fff;
    color:var(--teal-deep); font-size:16px; cursor:pointer}
  .ss-step:disabled{opacity:.4; cursor:default}
  .mystages-panel{margin:10px 16px 0}
  .ms-list{grid-template-columns:1fr}
  .ms-opt{min-height:44px}
  .ms-acts button{min-height:44px}
  .board-wrap{padding:12px 16px; overflow-x:hidden}
  .board.single{width:100%; min-height:0}
  .board.single .col{flex:1 1 100%; min-width:0; max-height:none}
  .edge-cue{display:none}
  .mycases-wrap{padding:18px 16px 32px}
  .mc-headrow{display:none}
  .mc-row{grid-template-columns:1fr auto; gap:4px 12px; padding:14px 16px}
  .mc-id{grid-column:1} .mc-status{grid-column:2; grid-row:1 / span 2; align-self:start}
  .mc-back{grid-column:1; margin-bottom:4px}
  .mc-pat,.mc-type,.mc-mat{grid-column:1}
  .mc-act{grid-column:1 / -1; text-align:left} .mc-act:empty{display:none}
  .mc-claim{min-height:44px; margin-top:6px}
  .mc-reason,.mc-tech,.mc-approved{margin-top:6px; order:1}
  .mc-act{order:2}
  .mc-files{order:3}
  .mc-files summary{min-height:44px}
  .no-disapprove .modal-actions button{min-height:44px}
  .mc-type .mc-label,.mc-mat .mc-label{display:inline; font-size:12px; font-weight:700; letter-spacing:.08em;
    text-transform:uppercase; color:var(--mute); margin-right:6px}
  .fgrid{grid-template-columns:1fr}
  #case-form,#remake-form,#assess-form,.claims-wrap{padding:24px 20px 20px}
  /* T-1090: 44px tap targets on the assessment form (the shared .f style stays as it is elsewhere) */
  #assess-form .f input,#assess-form .f select{min-height:44px}
  #assess-form .f textarea{min-height:66px}
  #assess-form .modal-actions button{min-height:44px}
  .cl-acts button{min-height:44px}
  .qd-opt{min-height:44px}
  .cl-row{padding:12px 14px}
  .cs-opt{grid-template-columns:auto 1fr}
  .cs-ty{grid-column:1/-1}
  .no-details{grid-template-columns:1fr; gap:2px; padding:12px 14px}
  .no-details dd{margin-bottom:8px}
  .cb-list{grid-template-columns:1fr; gap:0}
  .cb-list dd{margin-bottom:6px}
  .cb-actions .btn,.cb-actions .btn-quiet{min-height:44px; flex:1 1 100%; justify-content:center}
  .fu-edit input,.fu-skip input[type="text"],.fu-skip select{min-height:44px}
  .fu-done summary,.fu-optouts button,.fu-check{min-height:44px}
  .fu-optouts li{flex-wrap:wrap; padding:10px 14px}
  .cb-return input{max-width:none; min-height:44px}
  .no-back,.modal-actions .btn{min-height:44px}
  .modal-actions{flex-wrap:wrap}
  .discard-wrap{padding:22px 20px 18px}
  .discard-wrap .modal-actions button{min-height:44px; flex:1 1 100%; justify-content:center}
  .discard-wrap .modal-actions .spacer{display:none}
  .discard-wrap #dc-keep{order:-1}
}
@media(prefers-reduced-motion:reduce){
  *{animation:none!important; transition:none!important}
}
