
:root{
  --bg:#0a0908;--panel:#151310;--panel-2:#1c1915;--text:#f3eadb;--muted:#ad9f8a;--border:#3a332b;
  --brand:#c8a468;--brand-light:#e2c99d;--brand-deep:#9b7643;--silver:#c5c3bf;--brand-soft:#2b241c;
  --danger:#d17b73;--success:#8eb49a;--shadow:0 16px 38px rgba(0,0,0,.34)
}
*{box-sizing:border-box}body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--text);background:var(--bg)}
button,input,select,textarea{font:inherit}button{cursor:pointer}.hidden{display:none!important}
.login-screen{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#173d35,#0f7258);padding:24px}
.login-card{width:min(390px,94vw);background:#fff;border-radius:20px;padding:30px;box-shadow:0 30px 90px rgba(0,0,0,.24)}
.login-card h1{margin:14px 0 4px;text-align:center}.login-card>p{margin:0 0 24px;text-align:center;color:var(--muted)}
.login-card form{display:grid;gap:14px}.login-card label{font-size:12px;color:var(--muted);display:grid;gap:6px}
.login-card input{border:1px solid var(--border);border-radius:9px;padding:11px 12px}.login-logo{margin:0 auto;width:50px!important;height:50px!important}
.login-error{min-height:20px;margin-top:12px;color:var(--danger);font-size:12px;text-align:center}.poc-note{margin-top:16px;color:var(--muted);font-size:10px;text-align:center}

.app-shell{min-height:100vh;display:grid;grid-template-columns:220px minmax(0,1fr) 370px}
.sidebar{background:#173d35;color:#fff;padding:18px 14px;display:flex;flex-direction:column;min-height:100vh}.brand{display:flex;gap:10px;align-items:center;padding:8px;margin-bottom:12px}
.brand-mark{width:38px;height:38px;border-radius:11px;display:grid;place-items:center;background:#fff;color:#173d35;font-weight:800}.brand-title{font-weight:800}.brand-subtitle{font-size:12px;opacity:.72;margin-top:2px}
.user-card{display:flex;align-items:center;gap:10px;margin:0 7px 16px;padding:10px;border:1px solid rgba(255,255,255,.13);border-radius:11px}.user-avatar{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:rgba(255,255,255,.16);font-weight:800}.user-name{font-size:13px;font-weight:800}.user-role{font-size:11px;opacity:.7;margin-top:2px}
.nav{display:grid;gap:5px}.nav-item{border:0;background:transparent;color:rgba(255,255,255,.82);text-align:left;padding:11px 12px;border-radius:9px}.nav-item:hover,.nav-item.active{background:rgba(255,255,255,.12);color:#fff}
.sidebar-footer{margin-top:auto;display:grid;gap:8px}.main{min-width:0}.topbar{min-height:86px;background:#fff;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 24px}
.topbar h1{margin:0;font-size:24px}.topbar p{margin:5px 0 0;color:var(--muted);font-size:13px}.top-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.refresh-meta{display:flex;justify-content:flex-end;gap:16px;padding:7px 24px 0;color:var(--muted);font-size:11px}
.content{padding:16px 24px 40px}.connection-badge{padding:7px 10px;border-radius:999px;background:#eef2f2;color:#5b6666;font-size:12px;font-weight:700}.connection-badge.ok{background:#e6f5ee;color:#17664e}.connection-badge.error{background:#fde7e7;color:#963939}
.primary-btn,.secondary-btn,.send-btn,.tool-btn,.chip,.icon-btn,.mini-btn,.logout-btn{border-radius:9px;border:1px solid transparent}.primary-btn,.send-btn{background:var(--brand);color:#fff;border-color:var(--brand);padding:10px 14px;font-weight:700}.secondary-btn{background:#fff;border-color:var(--border);padding:10px 14px;color:var(--text)}.logout-btn{background:transparent;border-color:rgba(255,255,255,.18);color:#fff;padding:10px 14px}.mini-btn{background:#fff;border-color:var(--border);padding:6px 8px;font-size:11px;color:var(--muted)}.full{width:100%}
.card{background:#fff;border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow)}.panel{padding:18px}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;font-size:13px}
th{color:var(--muted);font-weight:700;text-align:left;border-bottom:1px solid var(--border);padding:10px 8px;white-space:nowrap;background:#fff;position:sticky;top:0;z-index:1}td{border-bottom:1px solid #eef2f2;padding:10px 8px;vertical-align:middle;white-space:nowrap}tr:hover td{background:#fbfdfd}
.filter-row th{padding:7px 6px;background:#fafcfc;top:37px}.filter-input{width:100%;min-width:90px;border:1px solid var(--border);border-radius:7px;padding:6px 7px;background:#fff}.table-tools{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:12px;flex-wrap:wrap}.table-count{color:var(--muted);font-size:12px}
.status-select,.paid-select{border:1px solid var(--border);border-radius:20px;padding:6px 28px 6px 10px;background:#fff}.edit-btn{border:1px solid var(--border);background:#fff;border-radius:8px;padding:6px 9px}
.kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:16px}.kpi{padding:17px}.kpi-label{font-size:12px;color:var(--muted)}.kpi-value{font-size:27px;font-weight:800;margin-top:8px}.kpi-foot{font-size:12px;color:var(--muted);margin-top:6px}
.kanban-wrap{overflow:auto}.kanban{display:grid;grid-template-columns:repeat(6,minmax(220px,1fr));gap:14px;min-width:1380px}.kanban-col{background:#edf3f2;border-radius:12px;padding:12px;min-height:420px}.kanban-title{font-weight:800;display:flex;justify-content:space-between;margin-bottom:10px}.kanban-card{background:#fff;border:1px solid var(--border);border-radius:10px;padding:11px;margin-bottom:9px;box-shadow:0 5px 12px rgba(0,0,0,.04)}.kanban-card strong{display:block}.kanban-meta{color:var(--muted);font-size:12px;margin-top:5px}
.stage-stack{display:grid;gap:6px}.stage-pill{display:grid;grid-template-columns:auto 1fr auto;gap:8px;align-items:center;border:1px solid var(--border);border-radius:10px;padding:7px 9px;background:#fff}.stage-name{font-weight:700}.stage-cost{font-weight:800;color:var(--brand)}
.ai-panel{background:#fff;border-left:1px solid var(--border);display:flex;flex-direction:column;min-height:100vh;position:sticky;top:0;height:100vh}.ai-header{display:flex;justify-content:space-between;gap:10px;align-items:flex-start;padding:17px 16px;border-bottom:1px solid var(--border)}.ai-title{font-weight:800}.ai-subtitle{font-size:12px;color:var(--muted);margin-top:3px}
.quick-actions{padding:10px 12px;display:flex;gap:7px;border-bottom:1px solid var(--border);flex-wrap:wrap}.chip{background:var(--brand-soft);color:var(--brand);border-color:#d5ebe4;padding:6px 9px;font-size:12px}.chat-messages{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:10px}.msg{max-width:88%;padding:10px 11px;border-radius:12px;font-size:13px;line-height:1.4;white-space:pre-wrap}.msg.ai{background:#f0f4f4;align-self:flex-start}.msg.user{background:var(--brand);color:#fff;align-self:flex-end}
.input-tools{display:flex;gap:8px;align-items:center;padding:0 12px 8px}.tool-btn{width:38px;height:36px;display:grid;place-items:center;background:#fff;border-color:var(--border)}.tool-btn.recording{background:#fde7e7;border-color:#e5aaaa}.voice-state{font-size:11px;color:var(--muted)}.chat-form{padding:0 12px 6px;display:grid;grid-template-columns:1fr auto;gap:8px}.chat-form textarea{resize:none;border:1px solid var(--border);border-radius:10px;padding:10px}.chat-hint{padding:0 14px 12px;color:var(--muted);font-size:10px}
.modal-backdrop{position:fixed;inset:0;background:rgba(14,35,31,.45);display:grid;place-items:center;z-index:20;padding:20px}.modal{width:min(950px,96vw);max-height:92vh;overflow:auto;background:#fff;border-radius:16px;box-shadow:0 30px 80px rgba(0,0,0,.2)}.modal-header{padding:16px 20px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center}.modal-header h2{margin:0}.modal-subtitle{font-size:11px;color:var(--muted);margin-top:4px}.icon-btn{border:0;background:#eef2f2;width:34px;height:34px;font-size:23px}
.form-grid{padding:18px 20px 20px;display:grid;grid-template-columns:1fr 1fr;gap:14px}.form-grid label{font-size:12px;color:var(--muted);display:grid;gap:6px}.form-grid input,.form-grid select{border:1px solid var(--border);border-radius:8px;padding:9px 10px;color:var(--text);background:#fff}.wide{grid-column:1/-1}.modal-actions{display:flex;justify-content:flex-end;gap:8px}.price-hint{font-size:12px;color:var(--muted);min-height:18px}
.flow-loading{position:fixed;top:18px;left:50%;transform:translateX(-50%);z-index:50;pointer-events:none}.flow-loading-card{min-width:250px;display:flex;align-items:center;gap:12px;padding:12px 16px;border:1px solid var(--border);border-radius:12px;background:#fff;box-shadow:0 14px 40px rgba(20,45,40,.18)}.flow-loading-card strong{font-size:13px}.flow-loading-card div:last-child div{font-size:11px;color:var(--muted);margin-top:2px}.spinner{width:20px;height:20px;border:3px solid #dbe8e4;border-top-color:var(--brand);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}
.empty-state{padding:50px;text-align:center;color:var(--muted)}.error-text{color:var(--danger)}
@media(max-width:1180px){.app-shell{grid-template-columns:190px minmax(0,1fr)}.ai-panel{position:fixed;right:0;width:350px;z-index:10;box-shadow:-10px 0 25px rgba(0,0,0,.08)}.main{margin-right:350px}.kpi-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:860px){.app-shell{grid-template-columns:1fr}.sidebar{min-height:auto}.nav{grid-template-columns:repeat(2,1fr)}.main{margin-right:0}.ai-panel{position:static;width:auto;height:540px;min-height:540px}.kpi-grid{grid-template-columns:1fr}.form-grid{grid-template-columns:1fr}.wide{grid-column:auto}}
@media print{.sidebar,.ai-panel,.top-actions,.filter-row,.table-tools,.refresh-meta{display:none!important}.app-shell{display:block}.content{padding:0}.card{box-shadow:none}.topbar{border:0;padding-left:0}body{background:#fff}}


/* ===== FLOWRISE DENTAL STUDIO — BRAND THEME ===== */
html{background:var(--bg)}
body{
  color:var(--text);
  background:
    radial-gradient(circle at 42% -10%,rgba(200,164,104,.10),transparent 28%),
    linear-gradient(180deg,#0b0a09 0%,#090807 100%);
}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* Login */
.login-screen{
  background:
    radial-gradient(circle at 50% 12%,rgba(200,164,104,.16),transparent 27%),
    radial-gradient(circle at 50% 45%,rgba(94,82,64,.13),transparent 38%),
    #050505;
}
.login-card{
  width:min(430px,94vw);
  background:linear-gradient(180deg,#151310,#0f0e0c);
  border:1px solid #41372c;
  box-shadow:0 36px 100px rgba(0,0,0,.58);
  padding:25px 30px 30px;
}
.login-brand-image{
  display:block;width:100%;max-height:215px;object-fit:cover;object-position:center;border-radius:14px;
  margin:0 auto 12px;box-shadow:0 14px 35px rgba(0,0,0,.35);
}
.login-card>p{color:var(--brand-light);letter-spacing:.08em;text-transform:uppercase;font-size:11px}
.login-card label{color:var(--muted)}
.login-card input{background:#0d0c0b;color:var(--text);border-color:var(--border)}
.login-card input:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(200,164,104,.10)}
.login-error{color:var(--danger)}.poc-note{color:#776c5d}

/* Sidebar */
.app-shell{background:var(--bg)}
.sidebar{
  background:
    radial-gradient(circle at 50% 2%,rgba(200,164,104,.10),transparent 18%),
    linear-gradient(180deg,#090909,#050505);
  border-right:1px solid #2f2922;
}
.brand{display:block;padding:2px 2px 14px;margin-bottom:6px}
.sidebar-brand-image{
  width:100%;height:128px;object-fit:cover;object-position:center;border-radius:12px;display:block;border:1px solid #2d271f;
}
.user-card{background:rgba(200,164,104,.055);border-color:rgba(200,164,104,.19)}
.user-avatar{color:#0d0b08;background:linear-gradient(135deg,var(--brand-light),var(--brand-deep))}
.user-name{color:#f7eddb}.user-role{color:var(--brand-light);opacity:.82}
.nav-item{color:#bdb2a2}
.nav-item:hover,.nav-item.active{
  background:linear-gradient(90deg,rgba(200,164,104,.20),rgba(200,164,104,.07));
  color:#f5e9d3;box-shadow:inset 2px 0 0 var(--brand);
}
.sidebar-footer .secondary-btn{background:#15120f;border-color:#4a3d30;color:var(--brand-light)}
.logout-btn{border-color:#4a3d30;color:#d7c8b0}

/* Main */
.main{background:transparent}
.topbar{
  background:rgba(18,16,13,.96);border-bottom-color:#302a23;box-shadow:0 8px 24px rgba(0,0,0,.14);
}
.topbar h1{color:#f2e7d5;font-weight:650;letter-spacing:.01em}
.topbar p,.refresh-meta{color:var(--muted)}
.connection-badge{background:#24201b;color:var(--muted);border:1px solid var(--border)}
.connection-badge.ok{background:#17231c;color:#9dc1a7;border-color:#2f4838}
.connection-badge.error{background:#2d1817;color:#df8c83;border-color:#5d2d29}

/* Buttons */
.primary-btn,.send-btn{
  background:linear-gradient(135deg,#dfc18c,#a67d45);color:#100d09;border-color:#d0a96d;
  box-shadow:0 8px 20px rgba(157,117,64,.18)
}
.primary-btn:hover,.send-btn:hover{filter:brightness(1.06)}
.secondary-btn{background:#171511;border-color:#453b30;color:#d9c9b1}
.secondary-btn:hover{border-color:var(--brand);color:var(--brand-light)}
.mini-btn,.tool-btn{background:#171511;border-color:#40372e;color:#d8c8ae}
.chip{background:#282118;color:var(--brand-light);border-color:#51412e}.chip:hover{background:#34291d}
.icon-btn{background:#27221c;color:#e5d4b8}.logout-btn:hover{border-color:var(--brand);color:var(--brand-light)}

/* Cards + tables */
.card{background:linear-gradient(180deg,#171511,#13110f);border-color:#332d26;box-shadow:var(--shadow)}
.panel{background:linear-gradient(180deg,#171511,#12110f)}
.kpi-label,.kpi-foot,.table-count{color:var(--muted)}.kpi-value{color:var(--brand-light)}
table{color:var(--text)}
th{color:#d1b788;border-bottom-color:#3d352c;background:#171511}
td{border-bottom-color:#29251f}tr:hover td{background:#1d1915}
.filter-row th{background:#11100e}
.filter-input{background:#0c0b0a;color:var(--text);border-color:#39322a}
.filter-input:focus{outline:none;border-color:var(--brand)}
.edit-btn{background:#211c16;border-color:#4e4031;color:var(--brand-light)}
.status-select,.paid-select{background:#11100e;color:#e8dbc5;border-color:#43392e}
.status-select:focus,.paid-select:focus{outline:none;border-color:var(--brand)}

/* Production */
.kanban-col{background:linear-gradient(180deg,#1d1a16,#151310);border:1px solid #342e27}
.kanban-title{color:var(--brand-light)}
.kanban-card{background:#100f0d;border-color:#383128;box-shadow:0 7px 18px rgba(0,0,0,.25)}
.kanban-meta{color:var(--muted)}
.stage-pill{background:#100f0d;border-color:#3b332a}.stage-name{color:var(--brand-light)}.stage-cost{color:#d8bc86}

/* AI panel */
.ai-panel{background:linear-gradient(180deg,#13110f,#0b0a09);border-left-color:#332c24}
.ai-header,.quick-actions{border-bottom-color:#302a23}
.ai-title{color:var(--brand-light);letter-spacing:.02em}.ai-subtitle{color:var(--silver)}
.chat-messages{background:rgba(0,0,0,.08)}
.msg.ai{background:#211d18;color:#efe4d3;border:1px solid #342d25}
.msg.user{background:linear-gradient(135deg,#caa66c,#9d7542);color:#0f0c08}
.chat-form textarea{background:#0b0a09;color:var(--text);border-color:#3d352c}
.chat-form textarea:focus{outline:none;border-color:var(--brand)}
.chat-hint,.voice-state{color:#776d60}
.tool-btn.recording{background:#341a18;border-color:#75413b;color:#efb0a9}

/* Modal */
.modal-backdrop{background:rgba(0,0,0,.72);backdrop-filter:blur(4px)}
.modal{background:linear-gradient(180deg,#181511,#0f0e0c);border:1px solid #43382c}
.modal-header{border-bottom-color:#342d25}.modal-header h2{color:var(--brand-light)}
.modal-subtitle{color:var(--muted)}
.form-grid label{color:#b9ab96}
.form-grid input,.form-grid select{background:#0c0b0a;color:var(--text);border-color:#3d352c}
.form-grid input:focus,.form-grid select:focus{outline:none;border-color:var(--brand)}
.form-grid input[readonly]{background:#16130f;color:#c6b9a6}
.price-hint{color:var(--muted)}
.flow-loading-card{background:#171410;border-color:#44392d;color:var(--text)}
.flow-loading-card div:last-child div{color:var(--muted)}
.spinner{border-color:#3d3429;border-top-color:var(--brand)}
.empty-state{color:var(--muted)}.error-text{color:var(--danger)}

::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:#0a0908}
::-webkit-scrollbar-thumb{background:#3b3228;border-radius:8px}
::-webkit-scrollbar-thumb:hover{background:#5a4937}

@media print{
  body{background:#fff;color:#111}.main,.content{background:#fff}
  .card,.panel{background:#fff;color:#111;border-color:#ccc}
  table,th,td{color:#111}th{background:#f5f0e7;color:#6d5432}td{border-bottom-color:#ddd}
}


/* ===== V7 CRUD + OLD-ORDER VISIBILITY ===== */
.row-actions{display:flex;gap:6px;align-items:center}
.danger-btn{
  border:1px solid #6b3732;
  background:#2b1816;
  color:#e4a39c;
  border-radius:8px;
  padding:6px 9px;
}
.danger-btn:hover{background:#3a1d1a;border-color:#a7584f;color:#ffd0ca}
.secondary-btn.active-toggle{
  border-color:var(--brand);
  color:var(--brand-light);
  background:#2a2219;
}
.secondary-btn:disabled{opacity:.45;cursor:not-allowed}


/* V8 agent-mode polish */
.ai-subtitle{
  display:inline-block;
  margin-top:5px;
  padding:3px 7px;
  border:1px solid #4a3c2c;
  border-radius:999px;
  background:rgba(200,164,104,.07);
  color:#c9b38f;
  font-size:10px;
  letter-spacing:.02em;
}


/* ===== V8.5 — IN-CHAT AI THINKING / LOADING ===== */
.thinking-msg{
  min-width:190px;
  max-width:88%;
  padding:11px 13px;
  background:linear-gradient(145deg,#211d18,#181511)!important;
  border:1px solid #473b2e!important;
  box-shadow:0 8px 22px rgba(0,0,0,.16);
}

.thinking-head{
  display:flex;
  align-items:center;
  gap:9px;
  margin-bottom:6px;
}

.thinking-label{
  font-size:11px;
  font-weight:700;
  color:var(--brand-light);
  letter-spacing:.02em;
}

.thinking-status{
  color:#b9ad9d;
  font-size:12px;
  line-height:1.35;
  transition:opacity .2s ease;
}

.thinking-dots{
  display:inline-flex;
  align-items:center;
  gap:4px;
  height:10px;
}

.thinking-dots span{
  width:5px;
  height:5px;
  border-radius:50%;
  background:var(--brand);
  opacity:.35;
  animation:flowriseThinking 1.15s infinite ease-in-out;
}

.thinking-dots span:nth-child(2){animation-delay:.16s}
.thinking-dots span:nth-child(3){animation-delay:.32s}

@keyframes flowriseThinking{
  0%,60%,100%{transform:translateY(0);opacity:.3}
  30%{transform:translateY(-4px);opacity:1}
}


/* ===== V8.6 — MOBILE-FIRST APP UX ===== */
.mobile-menu-btn,
.mobile-drawer-close,
.mobile-ai-close,
.mobile-bottom-nav,
.mobile-backdrop{display:none}

.topbar-title-row{display:flex;align-items:center;gap:10px;min-width:0}
.ai-header-actions{display:flex;gap:7px;align-items:center}

.mobile-card-list,
.mobile-list-toolbar,
.mobile-production-stack{display:none}

@media(max-width:860px){
  html,body{width:100%;max-width:100%;overflow-x:hidden}
  body.mobile-drawer-active{overflow:hidden}
  .app-shell{display:block;min-height:100dvh;padding-bottom:calc(72px + env(safe-area-inset-bottom));overflow-x:hidden}

  /* Off-canvas account/menu drawer */
  .sidebar{
    display:flex;
    position:fixed;
    inset:0 auto 0 0;
    width:min(84vw,320px);
    min-height:100dvh;
    height:100dvh;
    padding:14px;
    z-index:110;
    transform:translateX(-105%);
    transition:transform .22s ease;
    box-shadow:18px 0 45px rgba(0,0,0,.42);
    overflow-y:auto;
  }
  .sidebar.mobile-open{transform:translateX(0)}
  .sidebar .nav{grid-template-columns:1fr}
  .sidebar-brand-image{height:112px}
  .brand{position:relative}
  .mobile-drawer-close{
    display:grid;
    place-items:center;
    position:absolute;
    top:8px;
    right:8px;
    z-index:2;
    width:44px;
    height:44px;
    border-radius:50%;
    border:1px solid rgba(255,255,255,.22);
    background:rgba(0,0,0,.62);
    color:#fff;
    font-size:26px;
  }

  /* Mobile top bar */
  .main{margin-right:0;width:100%;min-width:0}
  .topbar{
    position:sticky;
    top:0;
    z-index:35;
    min-height:auto;
    padding:10px 12px 11px;
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
    backdrop-filter:blur(14px);
  }
  .topbar-title-row{width:100%}
  .mobile-menu-btn{
    display:grid;
    place-items:center;
    flex:0 0 44px;
    width:44px;
    height:44px;
    border-radius:11px;
    border:1px solid #4a3d30;
    background:#17130f;
    color:var(--brand-light);
    font-size:22px;
  }
  .topbar h1{font-size:20px;line-height:1.1}
  .topbar p{font-size:11px;margin-top:3px}
  .top-actions{
    width:100%;
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
  }
  .top-actions .connection-badge{
    grid-column:1/-1;
    justify-self:start;
    padding:5px 8px;
    font-size:10px;
  }
  .top-actions #toggleOldBtn,
  .top-actions #refreshBtn{
    width:100%;
    min-height:44px;
  }
  .top-actions #newOrderBtn{
    grid-column:1/-1;
    width:100%;
    min-height:46px;
  }

  .refresh-meta{
    padding:7px 12px 0;
    justify-content:space-between;
    gap:10px;
    font-size:10px;
  }
  .content{padding:12px 12px 24px}

  /* Bottom navigation */
  .mobile-bottom-nav{
    display:grid;
    grid-template-columns:repeat(5,1fr);
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    min-height:68px;
    padding:5px 5px calc(5px + env(safe-area-inset-bottom));
    background:rgba(12,10,8,.96);
    border-top:1px solid #3b3126;
    backdrop-filter:blur(18px);
    z-index:100;
    box-shadow:0 -10px 35px rgba(0,0,0,.28);
  }
  .mobile-nav-item{
    min-width:0;
    min-height:54px;
    border:0;
    border-radius:11px;
    background:transparent;
    color:#948878;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    font-size:9px;
    font-weight:700;
    padding:4px 2px;
  }
  .mobile-nav-item.active{color:var(--brand-light);background:rgba(200,164,104,.10)}
  .mobile-nav-icon{font-size:19px;line-height:1}
  .mobile-ai-nav{color:#c7ab79}
  .mobile-ai-nav.active{background:linear-gradient(180deg,rgba(200,164,104,.22),rgba(200,164,104,.08))}

  .mobile-backdrop{
    position:fixed;
    inset:0;
    display:block;
    z-index:85;
    background:rgba(0,0,0,.56);
    backdrop-filter:blur(2px);
  }

  /* AI becomes a mobile chat drawer instead of occupying the page */
  .ai-panel{
    position:fixed;
    inset:0 0 calc(68px + env(safe-area-inset-bottom)) 0;
    width:100%;
    height:auto;
    min-height:0;
    z-index:95;
    transform:translateY(105%);
    transition:transform .24s ease;
    box-shadow:0 -18px 50px rgba(0,0,0,.42);
    padding-top:env(safe-area-inset-top);
  }
  .ai-panel.mobile-open{transform:translateY(0)}
  .ai-header{padding:12px 12px 10px}
  .mobile-ai-close{
    display:grid;
    place-items:center;
    width:44px;
    height:44px;
    border-radius:11px;
    border:1px solid #493d31;
    background:#17130f;
    color:var(--brand-light);
    font-size:25px;
  }
  .newChatBtn,.mini-btn{min-height:38px}
  .quick-actions{
    flex-wrap:nowrap;
    overflow-x:auto;
    padding:8px 10px;
    scrollbar-width:none;
  }
  .quick-actions::-webkit-scrollbar{display:none}
  .chip{flex:0 0 auto;min-height:38px}
  .chat-messages{padding:12px;gap:9px}
  .msg{max-width:91%;font-size:14px;padding:11px 12px}
  .input-tools{padding:7px 10px}
  .tool-btn{width:46px;height:44px}
  .chat-form{
    padding:0 10px 7px;
    grid-template-columns:minmax(0,1fr) auto;
  }
  .chat-form textarea{min-height:48px;font-size:16px;padding:12px}
  .send-btn{min-width:66px;min-height:48px}
  .chat-hint{display:none}

  /* Mobile Work Orders / general cards */
  .mobile-list-toolbar,
  .mobile-card-list,
  .mobile-production-stack{display:block}
  .mobile-list-toolbar{
    margin-bottom:10px;
    padding:12px;
    border:1px solid #332d26;
    border-radius:14px;
    background:linear-gradient(180deg,#171511,#12110f);
  }
  .mobile-list-toolbar>div:first-child{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:8px;
    margin-bottom:9px;
  }
  .mobile-search-wrap{position:relative}
  .mobile-search-input{
    width:100%;
    min-width:0;
    height:46px;
    padding:10px 42px 10px 12px;
    font-size:16px;
  }
  .mobile-clear-search{
    position:absolute;
    right:4px;
    top:4px;
    width:38px;
    height:38px;
    border:0;
    border-radius:9px;
    background:#28221b;
    color:var(--brand-light);
    font-size:22px;
  }
  .mobile-card-list{display:grid;gap:10px}
  .mobile-order-card,
  .mobile-summary-card,
  .mobile-kanban-card{
    background:linear-gradient(180deg,#181511,#11100e);
    border:1px solid #382f27;
    border-radius:15px;
    padding:13px;
    box-shadow:0 10px 24px rgba(0,0,0,.22);
  }
  .mobile-card-head{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:10px;
  }
  .mobile-card-head strong{font-size:15px;color:#f2e5d1}
  .mobile-id{
    display:inline-block;
    margin-bottom:4px;
    color:var(--brand-light);
    font-size:11px;
    font-weight:800;
    letter-spacing:.05em;
  }
  .mobile-muted{font-size:11px;color:var(--muted);margin-top:3px;line-height:1.35}
  .mobile-card-badges{
    display:grid;
    justify-items:end;
    gap:5px;
  }
  .mobile-status-badge,
  .mobile-deadline{
    display:inline-flex;
    align-items:center;
    min-height:28px;
    padding:5px 8px;
    border-radius:999px;
    border:1px solid #45392d;
    background:#211c16;
    color:#d7c5a9;
    font-size:10px;
    white-space:nowrap;
  }
  .mobile-card-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-top:11px;
  }
  .mobile-card-grid>div{
    min-width:0;
    padding:9px;
    border-radius:10px;
    background:#0d0c0a;
    border:1px solid #2f2922;
  }
  .mobile-card-grid span,
  .mobile-detail-list span,
  .mobile-tech-line>span{
    display:block;
    color:#8e8375;
    font-size:9px;
    text-transform:uppercase;
    letter-spacing:.04em;
    margin-bottom:4px;
  }
  .mobile-card-grid strong,
  .mobile-detail-list strong{
    display:block;
    color:#eadbc4;
    font-size:12px;
    line-height:1.3;
    overflow-wrap:anywhere;
  }
  .mobile-primary-status{margin-top:11px}
  .mobile-primary-status label{
    display:grid;
    grid-template-columns:auto 1fr;
    align-items:center;
    gap:9px;
    color:var(--muted);
    font-size:11px;
  }
  .mobile-primary-status .status-select,
  .mobile-full-select{
    width:100%;
    min-height:44px;
  }
  .mobile-details{
    margin-top:10px;
    border-top:1px solid #2d2721;
    padding-top:9px;
  }
  .mobile-details summary{
    min-height:40px;
    display:flex;
    align-items:center;
    color:var(--brand-light);
    font-size:11px;
    font-weight:700;
    cursor:pointer;
  }
  .mobile-detail-list{
    display:grid;
    gap:7px;
    padding:2px 0 7px;
  }
  .mobile-detail-list>div{
    display:flex;
    justify-content:space-between;
    gap:10px;
    padding:8px 0;
    border-bottom:1px solid #28221c;
  }
  .mobile-detail-list strong{text-align:right}
  .mobile-card-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-top:11px;
  }
  .mobile-touch-btn{min-height:46px;font-weight:700}
  .mobile-stage-block{margin-top:11px}
  .mobile-section-label{font-size:10px;color:var(--muted);margin-bottom:7px}
  .stage-pill{
    grid-template-columns:1fr;
    gap:7px;
    padding:10px;
  }
  .stage-pill .status-select{width:100%;min-height:44px}
  .mobile-empty{padding:30px 12px}

  /* Mobile production */
  .mobile-production-stack{display:grid;gap:12px}
  .mobile-production-section{
    border:1px solid #342d25;
    border-radius:15px;
    padding:10px;
    background:#12100e;
  }
  .mobile-production-title{
    display:flex;
    justify-content:space-between;
    align-items:center;
    color:var(--brand-light);
    font-size:13px;
    font-weight:800;
    padding:2px 2px 9px;
  }
  .mobile-kanban-card{margin-bottom:8px}
  .mobile-kanban-card:last-child{margin-bottom:0}
  .mobile-stage-empty{padding:15px 8px;color:#756b5e;font-size:11px;text-align:center}

  /* Mobile technician cards */
  .mobile-tech-line{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:5px 8px;
    align-items:center;
    padding:10px 0;
    border-bottom:1px solid #2b251f;
  }
  .mobile-tech-line>span{grid-column:1/-1;margin:0}
  .mobile-tech-line strong{font-size:12px;color:#e7d7bf}
  .mobile-tech-line .paid-select{min-height:42px}

  /* KPIs fit better in a phone grid */
  .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .kpi{padding:12px}
  .kpi-value{font-size:20px;overflow-wrap:anywhere}

  /* Modal becomes a touch-friendly full-screen form */
  .modal-backdrop{padding:0;z-index:130}
  .modal{
    width:100vw;
    height:100dvh;
    max-height:100dvh;
    border-radius:0;
    overflow:auto;
    padding-bottom:env(safe-area-inset-bottom);
  }
  .modal-header{
    position:sticky;
    top:0;
    z-index:3;
    background:#15120f;
    padding:12px;
  }
  .icon-btn{width:46px;height:46px}
  .form-grid{
    grid-template-columns:1fr;
    gap:12px;
    padding:14px 12px 18px;
  }
  .wide{grid-column:auto}
  .form-grid input,.form-grid select{
    min-height:46px;
    font-size:16px;
  }
  .modal-actions{
    position:sticky;
    bottom:0;
    z-index:2;
    display:grid;
    grid-template-columns:1fr 1fr;
    padding:10px 0 calc(4px + env(safe-area-inset-bottom));
    background:linear-gradient(180deg,rgba(15,14,12,.65),#0f0e0c 24%);
  }
  .modal-actions button{min-height:48px}

  /* Touch target baseline */
  .primary-btn,.secondary-btn,.logout-btn,.edit-btn,.danger-btn{min-height:44px}
}

/* ==========================================================================
   V18.8 — Production guardrails, presentation mode and modal clearance
   ========================================================================== */
@media(min-width:861px){
  #orderForm .job-modal-actions{
    padding-right:210px!important;
  }
}

.production-today-alert,
.production-tomorrow-alert{
  color:#c91f1a!important;
  background:#fff!important;
  border-color:#df4a44!important;
  font-size:12px!important;
  font-weight:1000!important;
  text-transform:lowercase;
}

.stage-na-toggle{
  display:flex!important;
  grid-template-columns:auto 1fr!important;
  align-items:center;
  gap:7px!important;
  padding:7px 8px;
  border:1px solid #e2ddd3;
  border-radius:8px;
  background:#fbfaf7;
  color:#5f5850!important;
  font-weight:800;
}
.stage-na-toggle input{width:17px;height:17px;margin:0;accent-color:#b57908}
.production-stage-card.stage-not-applicable{opacity:.72;background:#f2f0eb!important}
.production-stage-card.stage-not-applicable>label:not(.stage-na-toggle){display:none!important}
.stage-pill-na,.stage-mini-na{background:#f1efe9!important;color:#706a62!important;font-style:italic}
.stage-technician{font-weight:800;color:#5b544b}
.stage-pill-mine{border-color:#c89b3d!important;background:#fff8e8!important}

.dashboard-production-toolbar{
  display:flex;
  justify-content:flex-end;
  margin-bottom:9px;
}
.dashboard-maximize-btn{font-weight:900!important}
body.dashboard-production-maximized #appShell{
  display:block!important;
  min-height:100dvh;
}
body.dashboard-production-maximized #appShell>.sidebar,
body.dashboard-production-maximized #appShell>.topbar,
body.dashboard-production-maximized #appShell>.ai-panel,
body.dashboard-production-maximized #appShell>.sidebar-expand-btn,
body.dashboard-production-maximized #appShell>.ai-expand-btn,
body.dashboard-production-maximized .main>.topbar,
body.dashboard-production-maximized .main>.refresh-meta,
body.dashboard-production-maximized #humanChatRoot,
body.dashboard-production-maximized #content>.date-range-filter-card,
body.dashboard-production-maximized #content>.production-drag-hint{
  display:none!important;
}
body.dashboard-production-maximized .main{width:100vw!important;min-height:100dvh!important;margin:0!important}
body.dashboard-production-maximized #content{padding:10px!important}
body.dashboard-production-maximized .kanban-wrap{height:calc(100dvh - 58px);overflow:auto}
body.dashboard-production-maximized .kanban{min-height:100%;grid-template-columns:repeat(6,minmax(300px,1fr))!important}
body.dashboard-production-maximized .kanban-col{min-height:calc(100dvh - 78px)}
body.dashboard-production-maximized .dashboard-production-toolbar{position:sticky;top:0;z-index:40;margin:0 0 8px}

@media(max-width:390px){
  .topbar h1{font-size:18px}
  .mobile-bottom-nav{padding-left:2px;padding-right:2px}
  .mobile-nav-item{font-size:8px}
  .mobile-nav-icon{font-size:17px}
  .kpi-grid{grid-template-columns:1fr 1fr}
  .kpi-value{font-size:18px}
  .mobile-card-grid{gap:6px}
}


/* ===== V8.7 — PARTNER / TECHNICIAN PDF REPORT FILTERS ===== */
.report-filter-panel{
  margin-bottom:12px;
  padding:13px;
  border:1px solid #3b3229;
  border-radius:14px;
  background:linear-gradient(180deg,#191612,#12100e);
  box-shadow:0 10px 26px rgba(0,0,0,.16);
}
.report-filter-head,
.report-filter-foot{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}
.report-filter-head>div{
  display:grid;
  gap:3px;
}
.report-filter-head strong{
  color:#ead9bf;
  font-size:13px;
}
.report-filter-head span,
.report-filter-foot span{
  color:#897d6e;
  font-size:10px;
}
.report-filter-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:9px;
  margin:12px 0;
}
.technician-report-grid{
  grid-template-columns:repeat(5,minmax(0,1fr));
}
.report-filter-grid label{
  display:grid;
  gap:5px;
  min-width:0;
  color:#9e9180;
  font-size:10px;
  font-weight:700;
}
.report-filter-grid select,
.report-filter-grid input{
  width:100%;
  min-width:0;
  height:40px;
  padding:8px 9px;
  border:1px solid #41372d;
  border-radius:9px;
  background:#0e0d0b;
  color:#e8dac5;
}
.report-pdf-btn{
  min-width:110px;
}
.report-pdf-btn:disabled{
  opacity:.45;
  cursor:not-allowed;
}

@media(max-width:1100px) and (min-width:861px){
  .report-filter-grid,
  .technician-report-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media(max-width:860px){
  .report-filter-panel{
    margin-bottom:10px;
    padding:11px;
  }
  .report-filter-head{
    align-items:flex-start;
  }
  .report-filter-head>div{
    min-width:0;
  }
  .report-filter-head span{
    line-height:1.35;
  }
  .report-filter-grid,
  .technician-report-grid{
    grid-template-columns:1fr 1fr;
    gap:8px;
  }
  .report-filter-grid label:last-child:nth-child(odd){
    grid-column:1/-1;
  }
  .report-filter-grid select,
  .report-filter-grid input{
    height:46px;
    font-size:16px;
  }
  .report-filter-foot{
    align-items:flex-start;
    flex-direction:column;
  }
  .report-filter-foot .secondary-btn{
    width:100%;
  }
  .report-pdf-btn{
    min-width:104px;
    min-height:44px;
  }
}

@media(max-width:420px){
  .report-filter-grid,
  .technician-report-grid{
    grid-template-columns:1fr;
  }
  .report-filter-grid label:last-child:nth-child(odd){
    grid-column:auto;
  }
}


/* ===== V9 — SECURE LOGIN + PATIENTS + ADMIN CONFIG ===== */
.admin-config-stack{display:grid;gap:14px}
.admin-config-section{padding:14px}
.admin-section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.admin-section-head h3{margin:0 0 4px;color:#ead9bf;font-size:15px}
.admin-section-head p{margin:0;color:#8d8275;font-size:10px;line-height:1.4}
.admin-add-grid{
  display:grid;
  grid-template-columns:1.2fr 1.2fr .8fr auto;
  gap:8px;
  align-items:end;
  margin-bottom:10px;
  padding:10px;
  border:1px solid #342c24;
  border-radius:11px;
  background:#100f0d;
}
.admin-cost-add{grid-template-columns:1fr 1.2fr 1fr .8fr auto}
.admin-worktype-add{grid-template-columns:1.5fr auto auto}
.admin-add-grid label{
  display:grid;
  gap:5px;
  color:#9c907f;
  font-size:10px;
  font-weight:700;
}
.admin-add-grid input,.admin-add-grid select,
.admin-config-table input,.admin-config-table select,
.admin-contract-delete select{
  width:100%;
  min-width:110px;
  height:38px;
  padding:7px 8px;
  border:1px solid #41372d;
  border-radius:8px;
  background:#0d0c0a;
  color:#e8dac5;
}
.admin-checkbox-label{
  display:flex!important;
  align-items:center;
  gap:8px!important;
  min-height:38px;
}
.admin-checkbox-label input{width:18px!important;min-width:18px;height:18px!important}
.admin-contract-delete{
  display:grid;
  grid-template-columns:minmax(220px,380px) auto;
  gap:8px;
  justify-content:start;
  margin-bottom:12px;
}
.admin-row-actions{white-space:nowrap}
.admin-row-actions button{margin-right:5px}
.admin-config-table table{min-width:760px}

@media(max-width:860px){
  .mobile-bottom-nav{grid-template-columns:repeat(6,1fr)}
  .mobile-nav-item{font-size:8px}
  .admin-config-section{padding:10px}
  .admin-section-head{flex-direction:column}
  .admin-add-grid,
  .admin-cost-add,
  .admin-worktype-add{
    grid-template-columns:1fr;
  }
  .admin-add-grid input,.admin-add-grid select{min-height:46px;font-size:16px}
  .admin-contract-delete{grid-template-columns:1fr}
  .admin-contract-delete select{min-height:46px;font-size:16px}
}


/* ===== V9.1 — DASHBOARD SPACE + ADMIN SCROLL ===== */
.main,.content,.card,.panel,.admin-config-section{min-width:0}

/* Admin tables always get their own horizontal scroll area */
.admin-config-table{
  display:block;
  width:100%;
  max-width:100%;
  overflow-x:auto!important;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
  scrollbar-gutter:stable both-edges;
  padding-bottom:4px;
}
.admin-config-table table{
  width:100%;
  min-width:980px;
}
.admin-config-table::-webkit-scrollbar{height:12px}
.admin-config-table::-webkit-scrollbar-track{background:#0b0a09;border-radius:8px}
.admin-config-table::-webkit-scrollbar-thumb{background:#594936;border-radius:8px;border:2px solid #0b0a09}
.admin-config-table::-webkit-scrollbar-thumb:hover{background:#7a6247}

.admin-create-card{
  border:1px solid #342c24;
  border-radius:12px;
  padding:10px;
  margin-bottom:10px;
  background:linear-gradient(180deg,#13110f,#0e0d0b);
}
.admin-create-title{
  color:var(--brand-light);
  font-size:11px;
  font-weight:800;
  margin-bottom:8px;
  letter-spacing:.02em;
}
.admin-create-note{
  color:#817568;
  font-size:9px;
  margin-top:-2px;
}
.admin-contract-add{margin-bottom:4px}
.patient-detail-table table{min-width:900px}

/* Desktop panel minimize / restore controls */
.desktop-panel-collapse,
.desktop-panel-expand{
  display:none;
}

@media(min-width:861px){
  .desktop-panel-collapse{
    display:grid;
    place-items:center;
    width:30px;
    height:30px;
    border-radius:8px;
    border:1px solid #493d31;
    background:#15120f;
    color:var(--brand-light);
    cursor:pointer;
    font-size:20px;
    line-height:1;
  }

  .sidebar-collapse-btn{
    position:absolute;
    right:7px;
    top:7px;
    z-index:4;
  }

  .brand{position:relative}

  .desktop-panel-expand{
    position:fixed;
    top:50%;
    transform:translateY(-50%);
    z-index:70;
    width:30px;
    height:72px;
    border:1px solid #4c4033;
    background:#15120f;
    color:var(--brand-light);
    cursor:pointer;
    font-size:22px;
    box-shadow:0 10px 28px rgba(0,0,0,.3);
  }
  .sidebar-expand-btn{
    display:none;
    left:0;
    border-radius:0 10px 10px 0;
    border-left:0;
  }
  .ai-expand-btn{
    display:none;
    right:0;
    border-radius:10px 0 0 10px;
    border-right:0;
  }

  .app-shell .sidebar,
  .app-shell .ai-panel,
  .app-shell .main{
    transition:width .2s ease,opacity .18s ease,transform .2s ease,margin .2s ease;
  }

  .app-shell.sidebar-collapsed .sidebar{
    width:0!important;
    min-width:0!important;
    padding-left:0!important;
    padding-right:0!important;
    border-right:0!important;
    overflow:hidden!important;
    opacity:0;
    pointer-events:none;
  }
  .app-shell.sidebar-collapsed .sidebar-expand-btn{
    display:grid;
    place-items:center;
  }

  .app-shell.ai-collapsed .ai-panel{
    width:0!important;
    min-width:0!important;
    overflow:hidden!important;
    opacity:0;
    pointer-events:none;
    border-left:0!important;
  }
  .app-shell.ai-collapsed .ai-expand-btn{
    display:grid;
    place-items:center;
  }
}

@media(min-width:1181px){
  .app-shell.sidebar-collapsed{
    grid-template-columns:0 minmax(0,1fr) 370px;
  }
  .app-shell.ai-collapsed{
    grid-template-columns:220px minmax(0,1fr) 0;
  }
  .app-shell.sidebar-collapsed.ai-collapsed{
    grid-template-columns:0 minmax(0,1fr) 0;
  }
}

@media(min-width:861px) and (max-width:1180px){
  .app-shell.sidebar-collapsed{
    grid-template-columns:0 minmax(0,1fr);
  }
  .app-shell.ai-collapsed .main{
    margin-right:0!important;
  }
  .app-shell.ai-collapsed .ai-panel{
    transform:translateX(105%);
  }
}

@media(max-width:860px){
  .desktop-panel-collapse,
  .desktop-panel-expand{display:none!important}
  .admin-config-table table{min-width:880px}
  .patient-detail-table table{min-width:820px}
}


/* ===== V9.3 — TOOTH CASE SHEET ===== */
body.case-sheet-open{overflow:hidden}

.case-sheet-backdrop{
  position:fixed;
  inset:0;
  z-index:160;
  display:grid;
  place-items:center;
  padding:18px;
  background:rgba(0,0,0,.76);
  backdrop-filter:blur(5px);
}

.case-sheet-modal{
  width:min(1180px,97vw);
  max-height:95vh;
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  overflow:hidden;
  border:1px solid #4a3e31;
  border-radius:18px;
  background:linear-gradient(180deg,#171410,#0d0c0a);
  box-shadow:0 34px 100px rgba(0,0,0,.55);
}

.case-sheet-header,
.case-sheet-footer{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  padding:13px 16px;
  background:#15120f;
}

.case-sheet-header{border-bottom:1px solid #3a3128}
.case-sheet-footer{border-top:1px solid #3a3128}

.case-sheet-header h2{
  margin:0;
  color:#f0dfc5;
  font-size:18px;
}

.case-sheet-subtitle{
  margin-top:3px;
  color:#958877;
  font-size:11px;
}

.case-sheet-content{
  min-height:0;
  overflow:auto;
  padding:14px;
}

.case-sheet-footer-hint{
  color:#8f8375;
  font-size:10px;
  line-height:1.35;
}

.case-sheet-footer-actions{
  display:flex;
  gap:8px;
  flex:0 0 auto;
}

.case-summary-grid{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:8px;
  margin-bottom:12px;
}

.case-summary-grid>div{
  min-width:0;
  padding:10px;
  border:1px solid #332c25;
  border-radius:10px;
  background:#100f0d;
}

.case-summary-grid span{
  display:block;
  margin-bottom:4px;
  color:#83786a;
  font-size:9px;
  text-transform:uppercase;
  letter-spacing:.05em;
}

.case-summary-grid strong{
  display:block;
  color:#eadbc5;
  font-size:11px;
  overflow-wrap:anywhere;
}

.case-editor-layout{
  display:grid;
  grid-template-columns:minmax(0,1.05fr) minmax(340px,.95fr);
  gap:12px;
  align-items:start;
}

.case-card{
  min-width:0;
  padding:12px;
  border:1px solid #382f27;
  border-radius:14px;
  background:linear-gradient(180deg,#171511,#100f0d);
}

.case-card-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  margin-bottom:10px;
}

.case-card h3{
  margin:0 0 3px;
  color:#ead9bf;
  font-size:13px;
}

.case-card p{
  margin:0;
  color:#817669;
  font-size:10px;
  line-height:1.35;
}

.case-tooth-tools{
  display:flex;
  gap:6px;
}

.compact-btn{
  min-height:34px!important;
  padding:6px 9px!important;
  font-size:10px;
}

.case-tooth-chart{
  display:grid;
  place-items:center;
  min-height:330px;
  padding:4px;
  border:1px solid #2f2922;
  border-radius:12px;
  background:
    radial-gradient(circle at 50% 48%,rgba(200,164,104,.06),transparent 42%),
    #0b0a09;
}

.dental-chart-svg{
  width:min(100%,520px);
  height:auto;
  display:block;
  overflow:visible;
}

.tooth-svg-group.interactive{cursor:pointer}
.tooth-svg-shape{
  fill:#f5efe6;
  stroke:#817563;
  stroke-width:1.2;
  transition:fill .14s ease,stroke .14s ease,transform .14s ease;
  transform-box:fill-box;
  transform-origin:center;
}

.tooth-svg-group.interactive:hover .tooth-svg-shape,
.tooth-svg-group.interactive:focus .tooth-svg-shape{
  stroke:#e0bd7d;
  stroke-width:2;
  transform:scale(1.08);
}

.tooth-svg-group.selected .tooth-svg-shape{
  fill:#c8a468;
  stroke:#f1d39b;
  stroke-width:2;
}

.tooth-svg-label{
  pointer-events:none;
  fill:#26221d;
  font-size:8.5px;
  font-weight:800;
}

.tooth-svg-group.selected .tooth-svg-label{
  fill:#0b0907;
}

.arch-caption{
  fill:#766b5e;
  font-size:9px;
  font-weight:800;
  letter-spacing:.12em;
}

.midline{
  stroke:#3b332a;
  stroke-width:1;
  stroke-dasharray:4 5;
}

.case-selected-line{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:7px;
  margin-top:8px;
  padding:8px 10px;
  border:1px solid #332c25;
  border-radius:9px;
  color:#9f9282;
  font-size:10px;
  background:#0f0d0b;
}

.case-selected-line strong{
  color:#ead9bf;
  font-size:15px;
}

.case-selected-line.warning{
  border-color:#7f5c23;
  background:#1a140b;
}

.case-warning-text{
  margin-left:auto;
  color:#e2b96c;
  font-weight:700;
}

.case-prescription-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}

.case-prescription-grid label{
  display:grid;
  gap:5px;
  color:#968979;
  font-size:10px;
  font-weight:700;
}

.case-prescription-grid input,
.case-prescription-grid select,
.case-prescription-grid textarea,
.case-selected-table input{
  width:100%;
  min-width:0;
  border:1px solid #41372d;
  border-radius:9px;
  background:#0c0b09;
  color:#eadbc5;
  padding:9px;
}

.case-prescription-grid input,
.case-prescription-grid select{
  height:42px;
}

.case-prescription-grid textarea{
  min-height:94px;
  resize:vertical;
}

.case-wide{grid-column:1/-1}

.selected-teeth-card{
  margin-top:12px;
}

.case-selected-table{
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

.case-selected-table table{
  min-width:760px;
}

.case-selected-table th{
  color:#b9aa96;
  font-size:9px;
  text-transform:uppercase;
}

.case-selected-table td{
  vertical-align:middle;
}

.case-tooth-input{
  height:38px!important;
}

.empty-case-row{
  padding:26px!important;
  text-align:center;
  color:#7c7165;
}

.case-sheet-row-btn{
  min-height:34px!important;
  padding:6px 9px!important;
  white-space:nowrap;
  font-size:10px;
}

.patient-case-actions{
  grid-template-columns:1fr!important;
}

@media(max-width:1000px){
  .case-summary-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .case-editor-layout{grid-template-columns:1fr}
  .case-tooth-chart{min-height:300px}
}

@media(max-width:860px){
  .case-sheet-backdrop{
    padding:0;
    align-items:stretch;
  }

  .case-sheet-modal{
    width:100vw;
    height:100dvh;
    max-height:100dvh;
    border-radius:0;
    border:0;
  }

  .case-sheet-header{
    padding:calc(10px + env(safe-area-inset-top)) 12px 10px;
  }

  .case-sheet-content{
    padding:10px;
  }

  .case-sheet-footer{
    padding:9px 10px calc(9px + env(safe-area-inset-bottom));
    align-items:stretch;
    flex-direction:column;
  }

  .case-sheet-footer-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
  }

  .case-sheet-footer-actions button{
    min-height:48px;
  }

  .case-summary-grid{
    grid-template-columns:1fr 1fr;
  }

  .case-tooth-chart{
    min-height:270px;
  }

  .case-prescription-grid{
    grid-template-columns:1fr;
  }

  .case-wide{grid-column:auto}

  .case-prescription-grid input,
  .case-prescription-grid select,
  .case-prescription-grid textarea{
    font-size:16px;
  }

  .case-tooth-tools{
    flex-direction:column;
  }
}

@media(max-width:420px){
  .case-summary-grid{grid-template-columns:1fr 1fr}
  .case-card{padding:10px}
  .case-tooth-chart{min-height:240px}
}


/* ===== V10 — FLOWRISE JOB DEFINITION / EXOCAD-INSPIRED UX ===== */
:root{
  --job-purple:#65569a;
  --job-purple-light:#8c7dc2;
  --job-orange:#d88921;
  --job-orange-light:#f1af4a;
}

.modal{
  width:min(1540px,97vw);
  max-height:96vh;
}

.job-definition-form{
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  min-height:0;
  overflow:hidden;
}

.job-definition-strip{
  display:grid;
  grid-template-columns:1fr 1.2fr 1fr;
  gap:7px;
  padding:9px 12px;
  border-bottom:1px solid #332d28;
  background:#0e0d0b;
}

.job-strip-item{
  display:flex;
  align-items:center;
  gap:8px;
  min-height:39px;
  padding:7px 10px;
  border:1px solid #352f2a;
  border-radius:9px;
  color:#756d64;
  background:#13110f;
}

.job-strip-item span{
  display:grid;
  place-items:center;
  width:24px;
  height:24px;
  border:1px solid #4b425f;
  color:#9a8cc5;
  font-weight:900;
  border-radius:5px;
}

.job-strip-item.active{
  border-color:#51456f;
  color:#e9dfd1;
  background:linear-gradient(180deg,#1d1827,#15121c);
}

.job-strip-item.active span{
  background:var(--job-purple);
  color:#fff;
  border-color:var(--job-purple-light);
}

.job-definition-layout{
  display:grid;
  grid-template-columns:minmax(300px,.86fr) minmax(520px,1.45fr) minmax(300px,.82fr);
  gap:10px;
  min-height:0;
  overflow:auto;
  padding:10px 12px;
}

.job-panel{
  min-width:0;
  border:1px solid #382f29;
  border-radius:13px;
  padding:11px;
  background:linear-gradient(180deg,#171511,#100f0d);
  align-self:start;
}

.job-tooth-panel{
  border-color:#4a405f;
  box-shadow:inset 0 1px 0 rgba(140,125,194,.08);
}

.job-panel-head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
  margin-bottom:10px;
}

.job-eyebrow{
  color:var(--job-purple-light);
  font-size:9px;
  letter-spacing:.13em;
  font-weight:900;
  margin-bottom:3px;
}

.job-panel h3{
  color:#eadfce;
  margin:0;
  font-size:14px;
}

.job-panel-head p{
  margin:3px 0 0;
  color:#84796d;
  font-size:9px;
}

.job-count-badge{
  min-width:66px;
  display:grid;
  justify-items:center;
  padding:7px 9px;
  border:1px solid #55496f;
  border-radius:9px;
  background:#171321;
}

.job-count-badge strong{
  color:#f3b35c;
  font-size:19px;
  line-height:1;
}

.job-count-badge span{
  color:#9186aa;
  font-size:8px;
  margin-top:3px;
  text-transform:uppercase;
}

.job-field-grid,
.job-prescription-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.job-field-grid label,
.job-prescription-grid label,
.job-notes-block label,
.production-stage-card label{
  display:grid;
  gap:4px;
  min-width:0;
  color:#968a7a;
  font-size:9px;
  font-weight:700;
}

.job-field-grid input,
.job-field-grid select,
.job-prescription-grid input,
.job-prescription-grid select,
.job-notes-block textarea,
.production-stage-card select{
  width:100%;
  min-width:0;
  border:1px solid #40372f;
  border-radius:8px;
  background:#0b0a09;
  color:#eadcca;
  padding:8px;
}

.job-field-grid input,
.job-field-grid select,
.job-prescription-grid input,
.job-prescription-grid select,
.production-stage-card select{
  height:38px;
}

.job-wide{grid-column:1/-1}

.job-notes-block{
  display:grid;
  gap:8px;
  margin-top:9px;
  padding-top:9px;
  border-top:1px solid #302923;
}

.job-notes-block textarea{
  min-height:72px;
  resize:vertical;
}

.order-tooth-chart{
  display:grid;
  place-items:center;
  min-height:385px;
  border:1px solid #382f45;
  border-radius:12px;
  background:
    radial-gradient(ellipse at center,rgba(101,86,154,.13),transparent 52%),
    #090809;
  overflow:hidden;
}

.order-tooth-chart .dental-chart-svg{
  width:min(100%,590px);
}

.order-tooth-chart .tooth-svg-shape{
  fill:#d97918;
  stroke:#f0aa47;
  stroke-width:1.25;
  filter:drop-shadow(0 3px 3px rgba(0,0,0,.32));
}

.order-tooth-chart .tooth-svg-label{
  fill:#fff6e8;
  font-size:8.5px;
  text-shadow:0 1px 2px #000;
}

.order-tooth-chart .tooth-svg-group:not(.selected) .tooth-svg-shape{
  fill:#3d3835;
  stroke:#77706b;
}

.order-tooth-chart .tooth-svg-group:not(.selected) .tooth-svg-label{
  fill:#d8d2cb;
}

.order-tooth-chart .tooth-svg-group.selected .tooth-svg-shape{
  fill:#e28b17;
  stroke:#ffd085;
  stroke-width:2.3;
  filter:drop-shadow(0 0 8px rgba(226,139,23,.34));
}

.order-tooth-chart .arch-caption{
  fill:#8c7dc2;
}

.order-tooth-chart .midline{
  stroke:#51465f;
}

.order-tooth-toolbar{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
  margin-top:8px;
}

.sync-elements-toggle{
  margin-left:auto;
  display:flex!important;
  align-items:center;
  gap:6px!important;
  color:#a49a8e!important;
  font-size:9px!important;
  cursor:pointer;
}

.sync-elements-toggle input{
  width:16px!important;
  height:16px!important;
}

.order-tooth-mismatch{
  margin-top:7px;
  padding:7px 9px;
  border:1px solid #805726;
  border-radius:8px;
  color:#e4aa5a;
  background:#1c1309;
  font-size:9px;
}

.job-prescription-grid{
  margin-top:8px;
}

.order-selected-teeth-details{
  margin-top:9px;
  padding-top:8px;
  border-top:1px solid #30283a;
}

.order-selected-head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-bottom:6px;
}

.order-selected-head strong{
  color:#d9ccba;
  font-size:10px;
}

.order-selected-head span{
  color:#776f66;
  font-size:8px;
}

.order-selected-table{
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

.order-selected-table table{
  min-width:630px;
}

.order-selected-table input{
  width:100%;
  min-width:95px;
  height:33px;
  padding:6px 7px;
  border:1px solid #3b332c;
  border-radius:6px;
  background:#0b0a09;
  color:#e8dbc8;
}

.production-stage-card{
  display:grid;
  gap:7px;
  margin-bottom:9px;
  padding:9px;
  border:1px solid #342d27;
  border-left:3px solid var(--job-purple);
  border-radius:9px;
  background:#0f0e0c;
}

.production-stage-title{
  color:#a497cc;
  font-size:9px;
  font-weight:900;
  letter-spacing:.08em;
}

.job-price-summary{
  display:grid;
  gap:7px;
  padding:9px;
  border:1px solid #4e3f2c;
  border-radius:9px;
  background:linear-gradient(180deg,#18130d,#100e0b);
}

.job-price-summary>div:not(.price-hint){
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
}

.job-price-summary span{
  color:#8f8374;
  font-size:8px;
  text-transform:uppercase;
}

.job-price-summary input{
  width:120px;
  text-align:right;
  border:0;
  background:transparent;
  color:#e5be7d;
  font-weight:800;
}

.job-price-summary .price-breakdown{
  display:grid;
  gap:0;
  margin-bottom:4px;
  border:1px solid #e3dfd7;
  border-radius:10px;
  overflow:hidden;
  background:#fff;
}

.price-breakdown-head,
.price-breakdown-line{
  display:grid;
  grid-template-columns:minmax(150px,1fr) 86px 108px 96px;
  gap:8px;
  align-items:center;
  padding:9px 10px;
}

.price-breakdown-head{
  background:#f7f4ee;
  border-bottom:1px solid #e3dfd7;
  font-weight:800;
}

.price-breakdown-line+.price-breakdown-line{border-top:1px solid #ece8e0;}
.price-breakdown-line>span:not(:first-child),.price-breakdown-head>span:not(:first-child){text-align:right;}
.price-breakdown-line strong{display:block;color:#2b2925;font-size:12px;line-height:1.3;}
.price-breakdown-line small{display:block;margin-top:2px;color:#8f8374;font-size:10px;}
.price-breakdown-unmatched{background:#fff5f3;}

.price-breakdown-totals{
  display:grid;
  border-top:2px solid #c58a1a;
  background:#fbf6e9;
}

.price-breakdown-totals>div{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:8px 10px;
}

.price-breakdown-totals>div+div{
  border-top:1px solid #eadfc8;
}

.price-breakdown-total span,
.price-breakdown-total strong{
  color:#6c4b0b;
  font-size:14px;
  font-weight:900;
}

@media (max-width:700px){
  .price-breakdown-head,.price-breakdown-line{grid-template-columns:minmax(105px,1fr) 64px 82px 78px;font-size:10px;}
}

.job-modal-actions{
  position:sticky;
  bottom:0;
  z-index:3;
  display:flex;
  justify-content:flex-end;
  gap:8px;
  padding:9px 12px calc(9px + env(safe-area-inset-bottom));
  border-top:1px solid #342d27;
  background:rgba(13,12,10,.96);
  backdrop-filter:blur(12px);
}

#loadOlderBtn.active-toggle{
  border-color:#66568f;
  color:#b4a4df;
}

#datasetScope{
  color:#867c70;
}

.case-sheet-footer-actions{
  flex-wrap:wrap;
}

@media(max-width:1280px) and (min-width:861px){
  .job-definition-layout{
    grid-template-columns:minmax(285px,.8fr) minmax(470px,1.3fr);
  }
  .job-production-panel{
    grid-column:1/-1;
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:8px;
  }
  .job-production-panel .job-panel-head,
  .job-production-panel .job-price-summary{
    grid-column:1/-1;
  }
}

@media(max-width:860px){
  .job-definition-strip{
    grid-template-columns:repeat(3,1fr);
    padding:7px 9px;
  }

  .job-strip-item{
    padding:5px 6px;
    gap:5px;
    min-height:35px;
  }

  .job-strip-item strong{font-size:9px}
  .job-strip-item span{width:21px;height:21px;font-size:10px}

  .job-definition-layout{
    display:grid;
    grid-template-columns:1fr;
    padding:8px;
    overflow:auto;
  }

  .job-field-grid,
  .job-prescription-grid{
    grid-template-columns:1fr;
  }

  .job-wide{grid-column:auto}

  .job-field-grid input,
  .job-field-grid select,
  .job-prescription-grid input,
  .job-prescription-grid select,
  .job-notes-block textarea,
  .production-stage-card select{
    min-height:46px;
    font-size:16px;
  }

  .order-tooth-chart{
    min-height:300px;
  }

  .sync-elements-toggle{
    width:100%;
    margin-left:0;
    padding-top:4px;
  }

  .job-production-panel{
    display:block;
  }

  .job-modal-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
  }

  .top-actions{
    grid-template-columns:1fr 1fr;
  }
  .top-actions #loadOlderBtn,
  .top-actions #toggleOldBtn,
  .top-actions #refreshBtn{
    width:100%;
  }
  .top-actions #newOrderBtn{
    grid-column:1/-1;
  }
}


/* ===== V10.1 — SIMPLIFIED JOB HEADER + CASE EXPORT ===== */
.job-definition-form{
  grid-template-rows:minmax(0,1fr) auto;
}

/* V10.1 removes the decorative A/B/C strip. */
.job-definition-strip{display:none!important}

.case-export-btn{
  border-color:#6a593f!important;
  color:#e5c48e!important;
  font-weight:800;
}

@media(max-width:860px){
  .job-modal-actions{
    grid-template-columns:1fr 1fr;
  }
  .job-modal-actions #saveOrderBtn{
    grid-column:1/-1;
  }
}


/* ===== V10.3 — SORTABLE TABLES ===== */
.sort-header{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:7px;
  padding:0;
  border:0;
  background:transparent;
  color:inherit;
  font:inherit;
  font-weight:inherit;
  text-align:left;
  cursor:pointer;
  white-space:nowrap;
}

.sort-header:hover{
  color:var(--brand-light);
}

.sort-header.active{
  color:var(--brand-light);
}

.sort-arrow{
  flex:0 0 auto;
  color:#776b5e;
  font-size:9px;
  line-height:1;
}

.sort-header.active .sort-arrow{
  color:var(--brand);
}

/* Patients now opens the exact same Work Order case-definition editor. */
.patient-case-actions .primary-btn,
.case-sheet-row-btn{
  white-space:nowrap;
}


/* ===== V10.9 — ANATOMICAL TOOTH EDITOR ===== */
.order-tooth-stage{
  position:relative;
  min-width:0;
}

.order-tooth-chart{
  min-height:510px;
  position:relative;
  overflow:hidden;
  background:
    radial-gradient(ellipse at 50% 50%,rgba(200,164,104,.045),transparent 47%),
    radial-gradient(ellipse at 50% 50%,rgba(111,98,154,.08),transparent 68%),
    #090809;
}

.order-tooth-chart .dental-chart-svg{
  width:min(100%,680px);
  max-height:540px;
  margin:auto;
}

.anatomical-chart .tooth-svg-group{
  transform-box:fill-box;
  transform-origin:center;
}

.anatomical-chart .tooth-svg-shape{
  fill:var(--tooth-color,#66635f);
  stroke:var(--tooth-stroke,#918e88);
  stroke-width:1.35;
  vector-effect:non-scaling-stroke;
  filter:drop-shadow(0 3px 4px rgba(0,0,0,.34));
  transition:filter .16s ease,stroke .16s ease,opacity .16s ease;
}

.anatomical-chart .tooth-anatomy{
  fill:none;
  stroke:var(--tooth-line,#aaa69f);
  stroke-width:1.15;
  stroke-linecap:round;
  stroke-linejoin:round;
  opacity:.72;
  pointer-events:none;
  vector-effect:non-scaling-stroke;
}

.anatomical-chart .tooth-cusp{
  fill:none;
  stroke:var(--tooth-line,#aaa69f);
  stroke-width:.8;
  opacity:.43;
  pointer-events:none;
  vector-effect:non-scaling-stroke;
}

.anatomical-chart .tooth-highlight{
  fill:none;
  stroke:rgba(255,255,255,.4);
  stroke-width:1.4;
  stroke-linecap:round;
  opacity:.58;
  pointer-events:none;
  vector-effect:non-scaling-stroke;
}

.order-tooth-chart .tooth-svg-group:not(.selected){
  opacity:.86;
}

.order-tooth-chart .tooth-svg-group.selected{
  opacity:1;
}

.order-tooth-chart .tooth-svg-group.interactive:hover .tooth-svg-shape,
.order-tooth-chart .tooth-svg-group.interactive:focus .tooth-svg-shape{
  stroke:#f0c77f;
  stroke-width:2.4;
  filter:drop-shadow(0 0 9px rgba(224,181,103,.38)) drop-shadow(0 3px 4px rgba(0,0,0,.36));
}

.order-tooth-chart .tooth-svg-group.selected .tooth-svg-shape{
  filter:drop-shadow(0 0 7px color-mix(in srgb,var(--tooth-color) 58%,transparent)) drop-shadow(0 3px 4px rgba(0,0,0,.36));
}

.anatomical-chart .tooth-svg-label{
  fill:#f4eee6!important;
  paint-order:stroke;
  stroke:rgba(0,0,0,.72);
  stroke-width:2px;
  stroke-linejoin:round;
  font-size:10px!important;
  font-weight:900;
  pointer-events:none;
}

.order-work-type-legend{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:start;
  gap:10px;
  margin-top:8px;
  padding:8px 10px;
  border:1px solid #312a25;
  border-radius:10px;
  background:#0d0c0a;
}

.legend-title{
  color:#8f8374;
  font-size:8px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.08em;
  padding-top:3px;
  white-space:nowrap;
}

.legend-items{
  display:flex;
  flex-wrap:wrap;
  gap:6px 12px;
}

.legend-item{
  display:inline-flex;
  align-items:center;
  gap:5px;
  color:#b9ad9e;
  font-size:9px;
}

.work-type-swatch{
  --swatch:#66635f;
  width:10px;
  height:10px;
  flex:0 0 10px;
  display:inline-block;
  border-radius:3px;
  background:var(--swatch);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.2),0 0 6px color-mix(in srgb,var(--swatch) 40%,transparent);
  vertical-align:-1px;
  margin-right:4px;
}

.work-type-swatch.neutral{
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.2);
}

.order-tooth-popover{
  position:absolute;
  z-index:18;
  width:min(330px,calc(100% - 20px));
  padding:12px;
  border:1px solid #54483b;
  border-radius:14px;
  background:
    linear-gradient(180deg,rgba(30,27,23,.985),rgba(15,14,12,.99));
  box-shadow:0 22px 60px rgba(0,0,0,.56),0 0 0 1px rgba(200,164,104,.05);
  backdrop-filter:blur(14px);
}

.order-tooth-popover::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  border-radius:inherit;
  background:linear-gradient(125deg,rgba(255,255,255,.035),transparent 34%);
}

.tooth-popover-head{
  position:relative;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:11px;
}

.tooth-popover-identity{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.tooth-popover-preview{
  width:58px;
  height:58px;
  flex:0 0 58px;
  display:grid;
  place-items:center;
  border:1px solid #4b4033;
  border-radius:12px;
  background:#0d0b09;
}

.tooth-popover-preview svg{
  width:50px;
  height:50px;
}

.tooth-popover-preview .tooth-svg-shape{
  fill:var(--tooth-color,#c8a468);
  stroke:var(--tooth-stroke,#ecd19f);
  stroke-width:1.2;
}

.tooth-popover-preview .tooth-anatomy,
.tooth-popover-preview .tooth-cusp{
  fill:none;
  stroke:var(--tooth-line,#f0dcb9);
  stroke-width:1;
  opacity:.7;
}

.tooth-popover-preview .tooth-highlight{
  fill:none;
  stroke:rgba(255,255,255,.42);
  stroke-width:1.3;
}

.tooth-popover-kicker{
  color:#8e7cad;
  font-size:7px;
  font-weight:900;
  letter-spacing:.12em;
  margin-bottom:2px;
}

.tooth-popover-head h4{
  margin:0;
  color:#f0e2cd;
  font-size:14px;
}

.tooth-popover-meta{
  margin-top:3px;
  color:#877b6d;
  font-size:8.5px;
  text-transform:capitalize;
}

.tooth-popover-close{
  position:relative;
  width:28px!important;
  height:28px!important;
  min-height:28px!important;
}

.tooth-popover-fields{
  position:relative;
  display:grid;
  gap:8px;
}

.tooth-popover-fields label{
  display:grid;
  gap:4px;
  color:#958878;
  font-size:9px;
  font-weight:800;
}

.tooth-popover-fields input{
  width:100%;
  height:39px;
  padding:8px 9px;
  border:1px solid #41372d;
  border-radius:8px;
  background:#0b0a08;
  color:#eadcca;
}

.tooth-popover-fields input:focus{
  border-color:#876a3f;
  outline:none;
  box-shadow:0 0 0 2px rgba(200,164,104,.08);
}

.tooth-popover-actions{
  position:relative;
  display:flex;
  align-items:center;
  gap:6px;
  margin-top:11px;
  padding-top:10px;
  border-top:1px solid #332c25;
}

.tooth-popover-spacer{flex:1}

.tooth-remove-btn{
  min-height:34px!important;
  padding:6px 8px!important;
  font-size:9px!important;
}

.configured-tooth-row{
  cursor:pointer;
  transition:background .12s ease;
}

.configured-tooth-row:hover,
.configured-tooth-row:focus{
  background:rgba(200,164,104,.05);
  outline:none;
}

.tooth-row-edit-btn{
  min-width:48px;
}

.order-selected-table table{
  min-width:700px;
}

@media(max-width:1100px) and (min-width:861px){
  .order-tooth-chart{
    min-height:460px;
  }
}

@media(max-width:860px){
  .order-tooth-chart{
    min-height:430px;
  }

  .order-work-type-legend{
    grid-template-columns:1fr;
    gap:5px;
  }

  .order-tooth-popover{
    position:absolute;
    left:8px!important;
    right:8px!important;
    bottom:8px!important;
    top:auto!important;
    width:auto;
    max-height:72%;
    overflow:auto;
  }

  .tooth-popover-fields input{
    min-height:46px;
    font-size:16px;
  }

  .tooth-popover-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
  }

  .tooth-popover-spacer{
    display:none;
  }

  .tooth-remove-btn{
    grid-column:1/-1;
  }
}

@media(max-width:520px){
  .order-tooth-chart{
    min-height:370px;
  }

  .anatomical-chart .tooth-svg-label{
    font-size:9px!important;
  }
}


/* ===== V10.10 — DENTAL ARCH STUDIO / REFERENCE-MATCHED LAYOUT ===== */

/* Give the dental editor the width it needs. */
@media(min-width:1181px){
  .job-definition-layout{
    grid-template-columns:minmax(340px,1fr) minmax(340px,1fr)!important;
  }

  .job-project-panel{grid-column:1}
  .job-production-panel{grid-column:2}
  .job-tooth-panel{
    grid-column:1/-1;
    grid-row:2;
  }
}

.job-tooth-panel{
  padding:0!important;
  overflow:hidden;
  border-color:#302d2a!important;
  background:#0b0c0d!important;
}

.tooth-studio-titlebar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:12px 16px;
  border-bottom:1px solid #292a2b;
  background:linear-gradient(180deg,#141516,#101112);
}

.tooth-studio-titlebar h3{
  margin:1px 0 2px;
  color:#e8e7e4;
  font-size:15px;
}

.tooth-studio-titlebar p{
  margin:0;
  color:#777a7c;
  font-size:9px;
}

.tooth-studio-shell{
  display:grid;
  grid-template-columns:220px minmax(560px,1fr) 330px;
  min-height:700px;
  background:
    radial-gradient(circle at 50% 46%,rgba(255,255,255,.018),transparent 42%),
    linear-gradient(180deg,#111314,#0b0c0d);
}

.tooth-studio-left{
  display:flex;
  flex-direction:column;
  gap:24px;
  padding:22px 16px 18px;
  border-right:1px solid #242627;
  background:rgba(15,17,18,.76);
}

.tooth-studio-card{
  border:1px solid #2c2f31;
  border-radius:9px;
  background:linear-gradient(180deg,#161819,#121415);
  overflow:hidden;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.02);
}

.tooth-studio-card h4{
  margin:0;
  padding:16px 16px 9px;
  color:#e5e4e0;
  font-size:11px;
  font-weight:800;
}

.order-work-type-legend{
  display:block!important;
  margin:0!important;
  padding:0 16px 16px!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
}

.legend-vertical-list{
  display:grid;
  gap:13px;
}

.legend-vertical-item{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  color:#c6c6c3;
  font-size:10px;
}

.legend-vertical-item span:last-child{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.work-type-swatch{
  width:14px!important;
  height:14px!important;
  flex:0 0 14px!important;
  border-radius:0!important;
  border:1px solid rgba(255,255,255,.08);
  box-shadow:none!important;
}

.tooth-view-card{
  padding-bottom:13px;
}

.tooth-view-buttons{
  display:grid;
  gap:8px;
  padding:0 14px;
}

.tooth-view-btn{
  height:39px;
  border:1px solid #373a3c;
  border-radius:4px;
  background:#151718;
  color:#aaa9a5;
  font-size:10px;
  font-weight:700;
  cursor:pointer;
  transition:border-color .14s ease,color .14s ease,background .14s ease;
}

.tooth-view-btn:hover{
  border-color:#7d6538;
  color:#dbc18f;
}

.tooth-view-btn.active{
  border-color:#c28e31;
  color:#e9b85a;
  background:#181715;
  box-shadow:inset 0 0 0 1px rgba(218,166,73,.08);
}

.tooth-clear-card{
  margin-top:auto;
}

.tooth-clear-all{
  width:100%;
  height:50px;
  border:0;
  border-top:1px solid #292c2e;
  background:#121415;
  color:#aaa9a5;
  font-size:10px;
  cursor:pointer;
}

.tooth-clear-all:hover{
  color:#e4c078;
  background:#171717;
}

.tooth-hidden-controls{
  display:none!important;
}

/* CENTER ARCH */
.tooth-studio-center{
  position:relative;
  min-width:0;
  min-height:700px;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  padding:8px 0 12px;
  overflow:hidden;
}

.order-tooth-chart{
  flex:1;
  min-height:630px!important;
  width:100%;
  display:grid!important;
  place-items:center!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  overflow:visible!important;
}

.order-tooth-chart .dental-chart-svg{
  width:min(100%,760px)!important;
  height:auto!important;
  max-height:650px!important;
  overflow:visible;
}

.anatomical-chart .tooth-render{
  filter:url(#toothBevel) drop-shadow(0 4px 4px rgba(0,0,0,.42));
}

.anatomical-chart .tooth-svg-shape{
  fill:var(--tooth-color,#777774)!important;
  stroke:var(--tooth-stroke,#989895)!important;
  stroke-width:1.15!important;
  filter:none!important;
}

.anatomical-chart .tooth-anatomy{
  stroke:var(--tooth-line,#c1bfba)!important;
  stroke-width:1.05!important;
  opacity:.52!important;
}

.anatomical-chart .tooth-cusp{
  stroke:var(--tooth-line,#c1bfba)!important;
  stroke-width:.85!important;
  opacity:.48!important;
}

.anatomical-chart .tooth-highlight{
  stroke:rgba(255,255,255,.56)!important;
  stroke-width:1.5!important;
  opacity:.66!important;
}

.anatomical-chart .tooth-shadow-line{
  fill:none;
  stroke:rgba(0,0,0,.28);
  stroke-width:1.1;
  stroke-linecap:round;
  pointer-events:none;
}

.anatomical-chart .tooth-svg-group:not(.selected){
  opacity:.96!important;
}

.anatomical-chart .tooth-svg-group.interactive:hover .tooth-svg-shape,
.anatomical-chart .tooth-svg-group.interactive:focus .tooth-svg-shape{
  stroke:#f0c15c!important;
  stroke-width:2!important;
}

.active-tooth-halo{
  fill:none;
  stroke:rgba(255,217,139,.32);
  stroke-width:4;
  filter:drop-shadow(0 0 8px rgba(237,180,68,.48));
  pointer-events:none;
}

.tooth-number-label{
  fill:#d1d1ce;
  font-size:10px;
  font-weight:700;
  paint-order:stroke;
  stroke:#0c0d0e;
  stroke-width:3px;
  stroke-linejoin:round;
}

.chart-divider{
  stroke:#5c4523;
  stroke-width:1;
  stroke-dasharray:4 4;
  opacity:.65;
}

.arch-center-letter{
  fill:#b98432;
  font-size:21px;
  font-weight:400;
}

.quadrant-label,
.both-arches-label{
  fill:#765d39;
  font-size:12px;
  font-weight:800;
  letter-spacing:.08em;
  opacity:.75;
}

.tooth-editor-hint{
  position:absolute;
  left:18px;
  bottom:13px;
  color:#777a7b;
  font-size:9px;
}

.order-tooth-mismatch{
  position:absolute;
  left:50%;
  bottom:8px;
  transform:translateX(-50%);
  max-width:70%;
  z-index:4;
}

/* RIGHT DETAIL PANEL */
.tooth-detail-panel{
  min-width:0;
  border-left:1px solid #292b2d;
  background:linear-gradient(180deg,#181a1b,#131516);
  padding:0;
  position:relative!important;
  left:auto!important;
  right:auto!important;
  top:auto!important;
  bottom:auto!important;
  width:auto!important;
  max-height:none!important;
  overflow:auto;
}

.tooth-detail-empty{
  height:100%;
  min-height:700px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:28px;
  color:#777a7b;
  text-align:center;
}

.tooth-detail-empty strong{
  color:#d7d6d2;
  font-size:13px;
}

.tooth-detail-empty span{
  max-width:210px;
  font-size:9px;
  line-height:1.5;
}

.tooth-empty-icon{
  font-size:38px;
  filter:grayscale(1);
  opacity:.5;
}

.tooth-detail-panel.is-empty .tooth-detail-form{
  display:none;
}

.tooth-detail-panel:not(.is-empty) .tooth-detail-empty{
  display:none;
}

.tooth-detail-form{
  padding:20px 18px 18px;
}

.tooth-detail-head{
  display:grid;
  grid-template-columns:78px minmax(0,1fr) 28px;
  gap:12px;
  align-items:start;
  margin-bottom:24px;
}

.tooth-detail-preview{
  width:78px;
  height:100px;
  display:grid;
  place-items:center;
  background:transparent;
  border:0;
}

.tooth-detail-preview svg{
  width:72px;
  height:88px;
  filter:drop-shadow(0 0 12px rgba(211,162,67,.2));
}

.tooth-detail-heading{
  padding-top:6px;
  min-width:0;
}

.tooth-detail-heading h4{
  margin:0 0 5px;
  color:#efeeeb;
  font-size:15px;
}

.tooth-detail-meta{
  color:#8d8e8e;
  font-size:9px;
  margin-bottom:8px;
}

.tooth-detail-type-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:#aaa9a6;
  font-size:9px;
}

.tooth-badge-dot{
  --badge:#777774;
  width:7px;
  height:7px;
  border-radius:50%;
  background:var(--badge);
  box-shadow:0 0 5px color-mix(in srgb,var(--badge) 55%,transparent);
}

.tooth-detail-close{
  width:28px;
  height:28px;
  border:0;
  background:transparent;
  color:#a7a8a7;
  font-size:24px;
  line-height:1;
  cursor:pointer;
}

.tooth-detail-fields{
  display:grid;
  gap:18px;
}

.tooth-detail-fields label{
  display:grid;
  gap:7px;
  color:#d0cfcc;
  font-size:10px;
  font-weight:600;
}

.tooth-detail-fields select,
.tooth-detail-fields input,
.tooth-detail-fields textarea{
  width:100%;
  border:1px solid #3a3d3f;
  border-radius:4px;
  background:#17191a;
  color:#e5e4e1;
  padding:10px 11px;
  font-size:10px;
  outline:none;
}

.tooth-detail-fields select,
.tooth-detail-fields input{
  height:42px;
}

.tooth-detail-fields textarea{
  min-height:72px;
  resize:vertical;
}

.tooth-detail-fields select:focus,
.tooth-detail-fields input:focus,
.tooth-detail-fields textarea:focus{
  border-color:#806331;
  box-shadow:0 0 0 1px rgba(202,153,60,.08);
}

.tooth-detail-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:20px;
}

.tooth-detail-save{
  height:42px!important;
  background:linear-gradient(180deg,#e0b158,#c99639)!important;
  color:#16130e!important;
  border:0!important;
  border-radius:4px!important;
  font-weight:800!important;
}

.tooth-detail-cancel{
  height:42px!important;
  border-radius:4px!important;
}

.tooth-detail-remove{
  grid-column:1/-1;
  border:0;
  background:transparent;
  color:#a85c5c;
  font-size:9px;
  cursor:pointer;
  padding:5px;
}

/* Case-level fields remain accessible but out of the way. */
.case-defaults-details{
  border-top:1px solid #292b2d;
  background:#0e1011;
}

.case-defaults-details summary{
  cursor:pointer;
  padding:10px 14px;
  color:#817d76;
  font-size:9px;
  user-select:none;
}

.case-defaults-grid{
  max-width:700px;
  padding:0 14px 14px;
}

.tooth-configured-data-hidden{
  display:none!important;
}

/* Tablet */
@media(max-width:1280px) and (min-width:861px){
  .tooth-studio-shell{
    grid-template-columns:190px minmax(460px,1fr) 300px;
  }

  .tooth-studio-left{
    padding-left:12px;
    padding-right:12px;
  }

  .order-tooth-chart .dental-chart-svg{
    width:min(100%,650px)!important;
  }
}

/* Mobile: stack into chart + bottom editor while preserving interaction. */
@media(max-width:860px){
  .tooth-studio-shell{
    grid-template-columns:1fr;
    min-height:0;
  }

  .tooth-studio-left{
    order:2;
    display:grid;
    grid-template-columns:1fr;
    gap:8px;
    padding:10px;
    border-right:0;
    border-top:1px solid #292b2d;
  }

  .tooth-view-card{
    display:none;
  }

  .tooth-clear-card{
    margin-top:0;
  }

  .tooth-studio-center{
    order:1;
    min-height:470px;
  }

  .order-tooth-chart{
    min-height:460px!important;
  }

  .order-tooth-chart .dental-chart-svg{
    width:min(100%,570px)!important;
    max-height:470px!important;
  }

  .tooth-detail-panel{
    order:3;
    border-left:0;
    border-top:1px solid #292b2d;
  }

  .tooth-detail-empty{
    min-height:150px;
  }

  .tooth-detail-form{
    padding:14px;
  }

  .tooth-detail-fields select,
  .tooth-detail-fields input,
  .tooth-detail-fields textarea{
    font-size:16px;
  }

  .tooth-detail-head{
    grid-template-columns:70px minmax(0,1fr) 28px;
  }
}


/* ===== V10.11 — VERTICAL OVAL DENTAL ARCH ===== */
.tooth-studio-center{
  min-height:780px!important;
}

.order-tooth-chart{
  min-height:735px!important;
}

.order-tooth-chart .dental-chart-svg{
  width:min(100%,610px)!important;
  max-height:735px!important;
  aspect-ratio:500 / 660;
}

/* More breathing room around the vertically elongated arch. */
.tooth-studio-shell{
  min-height:780px;
}

.tooth-detail-empty{
  min-height:780px;
}

@media(max-width:1280px) and (min-width:861px){
  .tooth-studio-center{
    min-height:700px!important;
  }

  .order-tooth-chart{
    min-height:660px!important;
  }

  .order-tooth-chart .dental-chart-svg{
    width:min(100%,555px)!important;
    max-height:660px!important;
  }

  .tooth-studio-shell{
    min-height:700px;
  }

  .tooth-detail-empty{
    min-height:700px;
  }
}

@media(max-width:860px){
  .tooth-studio-center{
    min-height:590px!important;
  }

  .order-tooth-chart{
    min-height:565px!important;
  }

  .order-tooth-chart .dental-chart-svg{
    width:min(100%,470px)!important;
    max-height:565px!important;
  }
}


/* ===== V10.12 — INDIVIDUAL TOOTH GEOMETRY + V10.9 FLOATING POPUP ===== */

/* The arch is intentionally hand-positioned tooth-by-tooth in JS.
   These visual tweaks reinforce the different natural sizes. */
.anatomical-chart .central-incisor .tooth-svg-shape{
  stroke-width:1.25!important;
}
.anatomical-chart .lateral-incisor,
.anatomical-chart .lower-lateral-incisor{
  opacity:.98;
}
.anatomical-chart .upper-canine .tooth-highlight,
.anatomical-chart .lower-canine .tooth-highlight{
  stroke-width:1.7!important;
}
.anatomical-chart .upper-first-molar .tooth-cusp,
.anatomical-chart .lower-first-molar .tooth-cusp{
  stroke-width:1!important;
}
.anatomical-chart .upper-third-molar,
.anatomical-chart .lower-third-molar{
  opacity:.93;
}

/* Back to the V10.9 idea: left legend + central arch + contextual popup.
   No permanent right-side editor. */
.tooth-studio-popup-mode{
  grid-template-columns:220px minmax(620px,1fr)!important;
  min-height:780px!important;
  position:relative;
}

.tooth-studio-popup-mode .tooth-studio-center{
  min-height:780px!important;
  position:relative;
  overflow:visible!important;
}

.tooth-studio-popup-mode .order-tooth-chart{
  min-height:735px!important;
}

.tooth-studio-popup-mode .order-tooth-chart .dental-chart-svg{
  width:min(100%,610px)!important;
  max-height:735px!important;
}

/* Floating tooth editor */
.order-tooth-popover{
  position:absolute!important;
  z-index:35!important;
  width:min(350px,calc(100% - 24px))!important;
  padding:14px!important;
  border:1px solid #51473b!important;
  border-radius:14px!important;
  background:linear-gradient(180deg,rgba(29,27,24,.99),rgba(14,13,12,.995))!important;
  box-shadow:0 24px 70px rgba(0,0,0,.62),0 0 0 1px rgba(200,164,104,.05)!important;
  backdrop-filter:blur(16px);
  max-height:calc(100% - 20px);
  overflow:auto;
}

.order-tooth-popover.hidden{
  display:none!important;
}

.tooth-popover-head{
  display:flex!important;
  justify-content:space-between!important;
  align-items:flex-start!important;
  gap:12px!important;
  margin-bottom:13px!important;
}

.tooth-popover-identity{
  display:flex!important;
  gap:11px!important;
  align-items:center!important;
  min-width:0;
}

.tooth-popover-preview{
  width:64px!important;
  height:64px!important;
  flex:0 0 64px!important;
  display:grid!important;
  place-items:center!important;
  border:1px solid #44392e!important;
  border-radius:12px!important;
  background:#0d0b09!important;
}

.tooth-popover-preview svg{
  width:56px!important;
  height:56px!important;
}

.tooth-popover-kicker{
  color:#9b89be!important;
  font-size:7px!important;
  font-weight:900!important;
  letter-spacing:.12em!important;
  margin-bottom:3px!important;
}

.tooth-popover-head h4{
  margin:0!important;
  color:#f0e4d2!important;
  font-size:15px!important;
}

.tooth-popover-meta{
  color:#877d70!important;
  font-size:8.5px!important;
  margin-top:3px!important;
}

.tooth-popover-close{
  width:28px!important;
  height:28px!important;
  min-height:28px!important;
}

.tooth-popover-fields{
  display:grid!important;
  gap:10px!important;
}

.tooth-popover-fields label{
  display:grid!important;
  gap:5px!important;
  color:#a09382!important;
  font-size:9px!important;
  font-weight:800!important;
}

.tooth-popover-fields select,
.tooth-popover-fields input,
.tooth-popover-fields textarea{
  width:100%!important;
  border:1px solid #41372d!important;
  border-radius:8px!important;
  background:#0c0b09!important;
  color:#eadcca!important;
  padding:9px!important;
  outline:none!important;
}

.tooth-popover-fields select,
.tooth-popover-fields input{
  height:40px!important;
}

.tooth-popover-fields textarea{
  min-height:70px!important;
  resize:vertical;
}

.tooth-popover-fields select:focus,
.tooth-popover-fields input:focus,
.tooth-popover-fields textarea:focus{
  border-color:#86683c!important;
  box-shadow:0 0 0 2px rgba(200,164,104,.08)!important;
}

.tooth-popover-actions{
  display:flex!important;
  align-items:center!important;
  gap:7px!important;
  margin-top:13px!important;
  padding-top:11px!important;
  border-top:1px solid #332c25!important;
}

.tooth-popover-spacer{flex:1!important}

.tooth-remove-btn{
  min-height:34px!important;
  padding:6px 9px!important;
  font-size:9px!important;
}

/* Remove/neutralize the V10.10 fixed-right-card visual model. */
.tooth-detail-panel,
.tooth-detail-empty,
.tooth-detail-form{
  all:unset;
}

/* Slightly more spacing for hand-positioned labels. */
.tooth-number-label{
  font-size:10.5px!important;
}

/* Mobile -> floating popup becomes bottom sheet, as in V10.9. */
@media(max-width:860px){
  .tooth-studio-popup-mode{
    grid-template-columns:1fr!important;
    min-height:0!important;
  }

  .tooth-studio-popup-mode .tooth-studio-center{
    min-height:590px!important;
  }

  .tooth-studio-popup-mode .order-tooth-chart{
    min-height:565px!important;
  }

  .order-tooth-popover{
    left:8px!important;
    right:8px!important;
    bottom:8px!important;
    top:auto!important;
    width:auto!important;
    max-height:72%!important;
  }

  .tooth-popover-fields select,
  .tooth-popover-fields input,
  .tooth-popover-fields textarea{
    font-size:16px!important;
  }

  .tooth-popover-actions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
  }

  .tooth-popover-spacer{display:none!important}

  .tooth-remove-btn{
    grid-column:1/-1;
  }
}


/* ===== V10.13 — REFERENCE-MATCHED TOOTH GEOMETRY ===== */
.reference-odontogram{
  aspect-ratio:474 / 776!important;
}

.tooth-studio-popup-mode .tooth-studio-center{
  min-height:830px!important;
}

.tooth-studio-popup-mode .order-tooth-chart{
  min-height:790px!important;
}

.tooth-studio-popup-mode .order-tooth-chart .dental-chart-svg{
  width:min(100%,540px)!important;
  max-height:790px!important;
}

.reference-odontogram .tooth-render{
  filter:url(#toothBevel) drop-shadow(0 3px 3px rgba(0,0,0,.34));
}

.reference-odontogram .tooth-svg-shape{
  stroke-width:1.15!important;
}

.reference-odontogram .tooth-anatomy{
  stroke-width:1.05!important;
  opacity:.62!important;
}

.reference-odontogram .tooth-cusp{
  stroke-width:.8!important;
  opacity:.56!important;
}

.reference-inside-label{
  fill:#f2f0e9!important;
  font-size:17px!important;
  font-weight:900!important;
  paint-order:stroke!important;
  stroke:#34312d!important;
  stroke-width:3px!important;
  stroke-linejoin:round!important;
  pointer-events:none!important;
}

.reference-odontogram .active-tooth-halo{
  r:26;
  stroke-width:3.2!important;
}

/* Make posterior teeth feel stacked vertically like the reference rather than circular. */
.reference-odontogram .tooth-svg-group[data-tooth="16"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="17"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="18"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="26"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="27"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="28"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="46"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="47"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="48"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="36"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="37"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="38"] .tooth-svg-shape{
  stroke-linejoin:round;
}

@media(max-width:1280px) and (min-width:861px){
  .tooth-studio-popup-mode .tooth-studio-center{
    min-height:750px!important;
  }
  .tooth-studio-popup-mode .order-tooth-chart{
    min-height:710px!important;
  }
  .tooth-studio-popup-mode .order-tooth-chart .dental-chart-svg{
    width:min(100%,490px)!important;
    max-height:710px!important;
  }
}

@media(max-width:860px){
  .tooth-studio-popup-mode .tooth-studio-center{
    min-height:650px!important;
  }
  .tooth-studio-popup-mode .order-tooth-chart{
    min-height:620px!important;
  }
  .tooth-studio-popup-mode .order-tooth-chart .dental-chart-svg{
    width:min(100%,410px)!important;
    max-height:620px!important;
  }
  .reference-inside-label{
    font-size:15px!important;
  }
}


/* ===== V10.14 — CENTERED TEETH + PDF UX ===== */

/* Desktop returns to the original 3-panel composition:
   Case Info | Teeth | Production */
@media(min-width:1181px){
  .job-definition-layout{
    display:grid!important;
    grid-template-columns:minmax(285px,.78fr) minmax(540px,1.52fr) minmax(300px,.82fr)!important;
    gap:10px!important;
    align-items:start!important;
  }

  .job-project-panel{
    grid-column:1!important;
    grid-row:1!important;
  }

  .job-tooth-panel{
    grid-column:2!important;
    grid-row:1!important;
    align-self:start!important;
  }

  .job-production-panel{
    grid-column:3!important;
    grid-row:1!important;
    display:block!important;
  }

  .job-production-panel .job-panel-head,
  .job-production-panel .job-price-summary{
    grid-column:auto!important;
  }
}

/* The tooth panel now uses the full center column instead of its own side bar. */
.tooth-studio-popup-mode{
  display:grid!important;
  grid-template-columns:1fr!important;
  min-height:760px!important;
}

.tooth-center-tools{
  display:grid;
  gap:9px;
  padding:10px 12px;
  border-bottom:1px solid #292b2d;
  background:#0f1112;
}

.tooth-center-tool-title{
  color:#87827a;
  font-size:8px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.08em;
  margin-bottom:6px;
}

.tooth-center-legend .order-work-type-legend{
  padding:0!important;
}

.tooth-center-legend .legend-vertical-list{
  display:flex!important;
  flex-wrap:wrap!important;
  gap:6px 12px!important;
}

.tooth-center-legend .legend-vertical-item{
  font-size:8.5px!important;
}

.tooth-center-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.tooth-view-inline{
  display:flex;
  gap:5px;
  flex-wrap:wrap;
}

.tooth-view-inline .tooth-view-btn{
  height:31px;
  padding:0 9px;
  font-size:8px;
}

.tooth-clear-compact{
  height:31px;
  padding:0 10px;
  border:1px solid #3a3530;
  border-radius:5px;
  background:#151515;
  color:#a49c92;
  font-size:8px;
  cursor:pointer;
}

.tooth-clear-compact:hover{
  border-color:#7f623a;
  color:#dfb66f;
}

.tooth-studio-popup-mode .tooth-studio-center{
  min-height:700px!important;
}

.tooth-studio-popup-mode .order-tooth-chart{
  min-height:665px!important;
}

.tooth-studio-popup-mode .order-tooth-chart .dental-chart-svg{
  width:min(100%,475px)!important;
  max-height:665px!important;
}

/* Autocomplete with real partial matching. */
.partial-autocomplete{
  position:relative;
}

.partial-suggestions{
  position:absolute;
  left:0;
  right:0;
  top:calc(100% + 4px);
  z-index:60;
  max-height:210px;
  overflow:auto;
  border:1px solid #514439;
  border-radius:8px;
  background:#11100e;
  box-shadow:0 12px 30px rgba(0,0,0,.48);
  padding:4px;
}

.partial-suggestion-item{
  width:100%;
  display:block;
  border:0;
  border-radius:5px;
  background:transparent;
  color:#d8cdbd;
  padding:8px 9px;
  text-align:left;
  font-size:9px;
  cursor:pointer;
}

.partial-suggestion-item:hover{
  background:rgba(200,164,104,.1);
  color:#f0d9b4;
}

.partial-suggestion-empty{
  padding:8px 9px;
  color:#766f66;
  font-size:8.5px;
}

/* PDF loading indicator */
.pdf-loading{
  cursor:wait!important;
  opacity:.86;
}

.button-spinner{
  width:13px;
  height:13px;
  display:inline-block;
  vertical-align:-2px;
  margin-right:6px;
  border:2px solid currentColor;
  border-right-color:transparent;
  border-radius:50%;
  animation:flowrise-spin .7s linear infinite;
}

@keyframes flowrise-spin{
  to{transform:rotate(360deg)}
}

@media(max-width:1180px) and (min-width:861px){
  .job-definition-layout{
    grid-template-columns:minmax(300px,.85fr) minmax(520px,1.35fr)!important;
  }

  .job-project-panel{grid-column:1!important}
  .job-tooth-panel{grid-column:2!important}
  .job-production-panel{
    grid-column:1/-1!important;
    display:grid!important;
    grid-template-columns:repeat(3,1fr)!important;
    gap:8px!important;
  }

  .job-production-panel .job-panel-head,
  .job-production-panel .job-price-summary{
    grid-column:1/-1!important;
  }
}

@media(max-width:860px){
  .tooth-center-actions{
    align-items:stretch;
    flex-direction:column;
  }

  .tooth-view-inline{
    display:grid;
    grid-template-columns:repeat(3,1fr);
  }

  .tooth-clear-compact{
    width:100%;
  }

  .partial-suggestions{
    max-height:180px;
  }
}


/* ===== V10.15 — ROMANIAN CASE SHEET DETAILS ===== */

/* Global Material now lives visibly in Case Information. */
.job-project-panel #orderMaterial{
  width:100%;
}

/* Keep the compact defaults section balanced after moving Material out. */
.case-defaults-grid{
  grid-template-columns:1fr 1fr!important;
}

/* Better visible loading state on Case Sheet buttons. */
.case-export-btn.pdf-loading,
#printCaseSheetBtn.pdf-loading{
  min-width:145px;
}


/* ===== V10.17 — MULTI-TOOTH EDIT + RECEPTION DATE ===== */

.batch-selected .tooth-svg-shape{
  stroke:#f0c569!important;
  stroke-width:2.7!important;
}

.batch-selected{
  filter:drop-shadow(0 0 7px rgba(240,197,105,.5));
}

.multi-tooth-preview{
  width:100%;
  height:100%;
  min-height:58px;
  display:grid;
  place-items:center;
  align-content:center;
  gap:1px;
  color:#ddc69c;
  text-align:center;
}

.multi-tooth-preview strong{
  font-size:22px;
  line-height:1;
}

.multi-tooth-preview span{
  font-size:8px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:#8f8270;
}

.multi-tooth-preview small{
  max-width:60px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:#b6a58c;
  font-size:7px;
}

.mobile-card-actions-left,
.patient-case-actions-left{
  justify-content:flex-start!important;
  margin-bottom:8px;
}

/* Ensure partner autocomplete stays above nearby modal fields. */
.job-project-panel .partial-autocomplete{
  position:relative;
  z-index:4;
}

.job-project-panel .partial-suggestions{
  z-index:80;
}


/* ===== V10.18 — POPUP BESIDE ODONTOGRAM ===== */

/*
  On desktop the tooth editor is deliberately outside the odontogram.
  This leaves all 32 teeth clickable while Ctrl/Cmd multi-selection is active.
*/
@media(min-width:861px){
  .order-tooth-popover{
    position:fixed!important;
    width:320px!important;
    max-width:calc(100vw - 24px)!important;
    max-height:calc(100vh - 24px)!important;
    overflow:auto!important;
    z-index:120!important;
  }

  /* The popup may sit over Case Info / Production, but never over the teeth. */
  .order-tooth-popover::after{
    content:"";
    position:absolute;
    inset:auto auto -1px 12px;
    width:calc(100% - 24px);
    height:1px;
    background:linear-gradient(90deg,transparent,rgba(200,164,104,.2),transparent);
    pointer-events:none;
  }

  .tooth-popover-meta{
    line-height:1.35!important;
  }
}

/* Mobile stays as the existing bottom-sheet popup. */
@media(max-width:860px){
  .order-tooth-popover{
    position:absolute!important;
    width:auto!important;
    max-width:none!important;
  }
}


/* ===== V10.20 — GOLD / SILVER / TEAL EDIT MODE ===== */

:root{
  /* Replaces the older purple with a muted dental-teal accent. */
  --job-purple:#557f78;
  --job-purple-light:#87aaa3;

  --edit-gold:#c8a468;
  --edit-gold-light:#e2c99d;
  --edit-gold-dark:#806238;

  --edit-silver:#aeb4b8;
  --edit-silver-light:#d7dadd;
  --edit-silver-dark:#686e73;

  --edit-teal:#557f78;
  --edit-teal-light:#87aaa3;
}

/* ----------------------------------------------------------
   TOOTH POPUP — intentionally high contrast from the dark UI
   ---------------------------------------------------------- */

.order-tooth-popover{
  border:1px solid #f0d39b!important;
  background:
    radial-gradient(circle at 14% 4%,rgba(255,248,220,.28),transparent 26%),
    linear-gradient(155deg,#d6b36f 0%,#c59a50 46%,#a97937 100%)!important;
  box-shadow:
    0 28px 80px rgba(0,0,0,.68),
    0 0 0 1px rgba(255,228,171,.34),
    0 0 34px rgba(200,164,104,.24)!important;
  color:#1b160f!important;
}

.order-tooth-popover::before{
  background:
    linear-gradient(125deg,rgba(255,255,255,.19),transparent 32%)!important;
}

.order-tooth-popover::after{
  background:linear-gradient(
    90deg,
    transparent,
    rgba(255,245,213,.68),
    transparent
  )!important;
}

.order-tooth-popover .tooth-popover-kicker{
  color:#4b3820!important;
}

.order-tooth-popover .tooth-popover-head h4{
  color:#18130d!important;
}

.order-tooth-popover .tooth-popover-meta{
  color:#5a4529!important;
}

.order-tooth-popover .tooth-detail-type-badge{
  color:#49361f!important;
}

.order-tooth-popover .tooth-popover-preview{
  border-color:#7b5b2e!important;
  background:rgba(30,22,13,.88)!important;
  box-shadow:inset 0 0 0 1px rgba(255,229,172,.08);
}

.order-tooth-popover .tooth-popover-fields label{
  color:#2e2417!important;
}

.order-tooth-popover .tooth-popover-fields input,
.order-tooth-popover .tooth-popover-fields textarea,
.order-tooth-popover .tooth-popover-fields select{
  border-color:#73542d!important;
  background:#20180f!important;
  color:#f7ead1!important;
}

.order-tooth-popover .tooth-popover-fields input::placeholder,
.order-tooth-popover .tooth-popover-fields textarea::placeholder{
  color:#a99779!important;
}

.order-tooth-popover .tooth-popover-fields input:focus,
.order-tooth-popover .tooth-popover-fields textarea:focus,
.order-tooth-popover .tooth-popover-fields select:focus{
  border-color:#f3d79f!important;
  box-shadow:0 0 0 2px rgba(255,238,201,.22)!important;
}

.order-tooth-popover .partial-suggestions{
  border-color:#7b5b2e!important;
  background:#20180f!important;
  box-shadow:0 15px 36px rgba(0,0,0,.45)!important;
}

.order-tooth-popover .partial-suggestion-item{
  color:#f0dfbf!important;
}

.order-tooth-popover .partial-suggestion-item:hover{
  background:rgba(226,201,157,.13)!important;
  color:#fff3d7!important;
}

.order-tooth-popover .partial-suggestion-empty{
  color:#b5a180!important;
}

.order-tooth-popover .tooth-popover-actions{
  border-top-color:rgba(62,43,21,.34)!important;
}

.order-tooth-popover .primary-btn{
  border-color:#17120c!important;
  background:#17120c!important;
  color:#f3d69e!important;
}

.order-tooth-popover .secondary-btn{
  border-color:#6f522d!important;
  background:rgba(255,244,216,.16)!important;
  color:#251c11!important;
}

.order-tooth-popover .danger-btn{
  border-color:#743a2e!important;
  background:#4c241d!important;
  color:#ffd2c5!important;
}

.order-tooth-popover .tooth-popover-close{
  background:rgba(31,22,12,.12)!important;
  color:#241a0f!important;
}

/* ----------------------------------------------------------
   EDIT MODE — CASE INFO = GOLD
   ---------------------------------------------------------- */

.job-definition-form.edit-mode .job-project-panel{
  border-color:var(--edit-gold)!important;
  box-shadow:
    inset 0 1px 0 rgba(226,201,157,.14),
    0 0 0 1px rgba(200,164,104,.04)!important;
}

.job-definition-form.edit-mode .job-project-panel .job-eyebrow,
.job-definition-form.edit-mode .job-project-panel .job-panel-head h3{
  color:var(--edit-gold-light)!important;
}

.job-definition-form.edit-mode .job-project-panel .job-field-grid label,
.job-definition-form.edit-mode .job-project-panel .job-notes-block label{
  color:#c9b18a!important;
}

.job-definition-form.edit-mode .job-project-panel .job-field-grid input,
.job-definition-form.edit-mode .job-project-panel .job-field-grid select,
.job-definition-form.edit-mode .job-project-panel .job-notes-block textarea{
  border-color:var(--edit-gold-dark)!important;
}

.job-definition-form.edit-mode .job-project-panel .job-field-grid input:focus,
.job-definition-form.edit-mode .job-project-panel .job-field-grid select:focus,
.job-definition-form.edit-mode .job-project-panel .job-notes-block textarea:focus{
  border-color:var(--edit-gold-light)!important;
  box-shadow:0 0 0 2px rgba(200,164,104,.11)!important;
}

.job-definition-form.edit-mode .job-project-panel .job-notes-block{
  border-top-color:#604a2d!important;
}

/* ----------------------------------------------------------
   EDIT MODE — PRODUCTION = SILVER
   ---------------------------------------------------------- */

.job-definition-form.edit-mode .job-production-panel{
  border-color:var(--edit-silver)!important;
  box-shadow:
    inset 0 1px 0 rgba(215,218,221,.12),
    0 0 0 1px rgba(174,180,184,.03)!important;
}

.job-definition-form.edit-mode .job-production-panel .job-eyebrow,
.job-definition-form.edit-mode .job-production-panel .job-panel-head h3{
  color:var(--edit-silver-light)!important;
}

.job-definition-form.edit-mode .job-production-panel .production-stage-card{
  border-color:var(--edit-silver-dark)!important;
  background:linear-gradient(180deg,#171819,#101112)!important;
}

.job-definition-form.edit-mode .job-production-panel .production-stage-title{
  color:var(--edit-silver-light)!important;
}

.job-definition-form.edit-mode .job-production-panel .production-stage-card label{
  color:#b2b6b9!important;
}

.job-definition-form.edit-mode .job-production-panel .production-stage-card select{
  border-color:var(--edit-silver-dark)!important;
}

.job-definition-form.edit-mode .job-production-panel .production-stage-card select:focus{
  border-color:var(--edit-silver-light)!important;
  box-shadow:0 0 0 2px rgba(174,180,184,.10)!important;
}

.job-definition-form.edit-mode .job-production-panel .job-price-summary{
  border-color:#777d81!important;
  background:linear-gradient(180deg,#171819,#111213)!important;
}

.job-definition-form.edit-mode .job-production-panel .job-price-summary span{
  color:#aeb4b8!important;
}

.job-definition-form.edit-mode .job-production-panel .job-price-summary input{
  color:#e0e2e4!important;
}

/* ----------------------------------------------------------
   DENTAL / FORMER PURPLE ACCENTS = MUTED TEAL
   ---------------------------------------------------------- */

.job-tooth-panel{
  border-color:#456d67!important;
  box-shadow:inset 0 1px 0 rgba(135,170,163,.10)!important;
}

.job-tooth-panel .job-eyebrow,
.tooth-popover-kicker{
  color:var(--edit-teal-light)!important;
}

.job-count-badge{
  border-color:#496f69!important;
  background:#111c1a!important;
}

.job-count-badge span{
  color:#84a49e!important;
}

.tooth-center-tool-title,
.production-stage-title{
  color:#91aaa5;
}

.tooth-view-btn.active{
  border-color:#5f8c84!important;
  color:#a8c8c1!important;
  background:#111917!important;
}

.tooth-view-btn:hover{
  border-color:#4d7972!important;
  color:#a2c1bb!important;
}

.order-tooth-chart{
  border-color:#345b55!important;
  background:
    radial-gradient(ellipse at 50% 50%,rgba(85,127,120,.12),transparent 48%),
    radial-gradient(ellipse at 50% 50%,rgba(200,164,104,.025),transparent 68%),
    #090a09!important;
}

.chart-divider{
  stroke:#4d7770!important;
}

.arch-center-letter,
.quadrant-label,
.both-arches-label{
  fill:#719c94!important;
}

#loadOlderBtn.active-toggle{
  border-color:#527d75!important;
  color:#a1c1ba!important;
}

.batch-selected .tooth-svg-shape{
  stroke:#9bbdb5!important;
}

.batch-selected{
  filter:drop-shadow(0 0 7px rgba(115,157,149,.52))!important;
}

/* On small screens the popup remains golden even as a bottom sheet. */
@media(max-width:860px){
  .order-tooth-popover{
    border-color:#efd198!important;
  }
}


/* ===== V10.21 — MOUSE-FRIENDLY DATE PICKER ===== */

.date-input-with-picker{
  position:relative;
  display:grid;
  grid-template-columns:minmax(0,1fr) 34px;
  gap:5px;
  align-items:center;
}

.date-input-with-picker input[type="date"]{
  width:100%;
  min-width:0;
}

.date-input-with-picker input[type="date"]::-webkit-calendar-picker-indicator{
  opacity:.45;
  cursor:pointer;
}

.date-picker-btn{
  height:38px;
  min-width:34px;
  display:grid;
  place-items:center;
  padding:0;
  border:1px solid #6d5735;
  border-radius:8px;
  background:linear-gradient(180deg,#241d14,#16120d);
  color:#e3c58f;
  font-size:15px;
  cursor:pointer;
  transition:border-color .12s ease,background .12s ease,transform .08s ease;
}

.date-picker-btn:hover{
  border-color:#c8a468;
  background:linear-gradient(180deg,#322719,#1d1710);
}

.date-picker-btn:active{
  transform:translateY(1px);
}

.job-definition-form.edit-mode .job-project-panel .date-picker-btn{
  border-color:#a9844c;
  color:#f0d39c;
}

@media(max-width:860px){
  .date-input-with-picker{
    grid-template-columns:minmax(0,1fr) 46px;
  }

  .date-picker-btn{
    min-width:46px;
    height:46px;
    font-size:18px;
  }
}


/* ===== V10.22 — PRODUCTION KANBAN DRAG & DROP ===== */

.production-drag-hint{
  display:flex;
  align-items:center;
  gap:8px;
  margin:0 0 10px;
  padding:9px 11px;
  border:1px solid #3d574f;
  border-radius:10px;
  background:linear-gradient(180deg,#121b18,#0f1513);
  color:#9fb7b1;
  font-size:10px;
}

.production-drag-icon{
  display:grid;
  place-items:center;
  width:23px;
  height:23px;
  flex:0 0 23px;
  border:1px solid #557f78;
  border-radius:6px;
  color:#b5d0c9;
  font-size:14px;
}

.kanban-col{
  transition:border-color .14s ease,background .14s ease,box-shadow .14s ease;
}

.kanban-card-list{
  min-height:80px;
}

.kanban-draggable-card{
  cursor:grab;
  user-select:none;
  transition:
    opacity .12s ease,
    transform .12s ease,
    border-color .12s ease,
    box-shadow .12s ease;
}

.kanban-draggable-card:active{
  cursor:grabbing;
}

.kanban-card-drag-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:8px;
}

.kanban-grip{
  color:#766b5f;
  font-size:17px;
  letter-spacing:-3px;
  line-height:1;
  cursor:grab;
}

.kanban-draggable-card:hover{
  border-color:#705d43;
  box-shadow:0 9px 24px rgba(0,0,0,.32);
}

.kanban-draggable-card.dragging{
  opacity:.38;
  transform:scale(.975);
  border-style:dashed;
}

.kanban-draggable-card.drag-saving{
  position:relative;
  pointer-events:none;
  border-color:#c8a468!important;
  box-shadow:0 0 0 1px rgba(200,164,104,.18),0 10px 26px rgba(0,0,0,.32)!important;
}

.kanban-draggable-card.drag-saving::after{
  content:"Se actualizează...";
  position:absolute;
  right:8px;
  top:8px;
  padding:3px 6px;
  border:1px solid #9b7643;
  border-radius:999px;
  background:#21180e;
  color:#e2c99d;
  font-size:8px;
  font-weight:800;
}

.kanban-drop-zone{
  display:grid;
  place-items:center;
  height:0;
  overflow:hidden;
  opacity:0;
  margin-top:0;
  border:1px dashed transparent;
  border-radius:9px;
  color:#91aaa5;
  font-size:9px;
  font-weight:800;
  transition:height .14s ease,opacity .14s ease,margin .14s ease,border-color .14s ease;
}

body.kanban-drag-active .kanban-drop-zone{
  height:38px;
  opacity:.65;
  margin-top:8px;
  border-color:#476a64;
}

body.kanban-drag-active .kanban-col{
  border-color:#46514b;
}

body.kanban-drag-active .kanban-col.drag-over{
  border-color:#c8a468!important;
  background:
    linear-gradient(180deg,rgba(200,164,104,.10),rgba(200,164,104,.025)),
    linear-gradient(180deg,#1d1a16,#151310)!important;
  box-shadow:
    inset 0 0 0 1px rgba(200,164,104,.16),
    0 0 22px rgba(200,164,104,.08);
}

body.kanban-drag-active .kanban-col.drag-over .kanban-drop-zone{
  opacity:1;
  border-color:#c8a468;
  color:#e2c99d;
  background:rgba(200,164,104,.06);
}

.kanban-status-select{
  cursor:pointer;
}

@media(max-width:860px){
  .production-drag-hint{
    display:none;
  }
}


/* ===== V10.23 — PRODUCTION STAGE STATUSES ===== */

.production-mini-stages{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:5px;
  margin-top:8px;
  padding-top:8px;
  border-top:1px solid #2d2924;
}

.production-mini-stage{
  display:grid;
  gap:3px;
  min-width:0;
}

.production-mini-stage>span{
  color:#827a70;
  font-size:7.5px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.035em;
}

.production-mini-status{
  width:100%;
  min-width:0;
  height:29px;
  padding:4px 5px;
  border-radius:6px;
  font-size:8px;
  font-weight:800;
  cursor:pointer;
  outline:none;
  transition:border-color .12s ease,background .12s ease,color .12s ease;
}

/* Neînceput = grey */
.production-mini-status.stage-status-not-started{
  border:1px solid #5d6063;
  background:#202224;
  color:#b6b8ba;
}

/* În lucru = blue */
.production-mini-status.stage-status-started{
  border:1px solid #4f7fae;
  background:#152436;
  color:#8fc2f0;
}

/* Finalizat = green */
.production-mini-status.stage-status-finished{
  border:1px solid #4f8b67;
  background:#15271d;
  color:#91d2a8;
}

.production-mini-status.stage-status-not-started:focus{
  border-color:#8b8e91;
}

.production-mini-status.stage-status-started:focus{
  border-color:#76aee0;
}

.production-mini-status.stage-status-finished:focus{
  border-color:#78b990;
}

.kanban-draggable-card .production-mini-stages{
  cursor:default;
}

.kanban-draggable-card .production-mini-status{
  cursor:pointer;
}

/* Management mobile cards also show the same stage controls,
   only while the global work-order status is "În lucru". */
.mobile-kanban-card .production-mini-stages{
  margin-top:10px;
  grid-template-columns:repeat(3,1fr);
}

@media(max-width:1100px) and (min-width:861px){
  .production-mini-stages{
    grid-template-columns:1fr;
  }

  .production-mini-stage{
    grid-template-columns:62px minmax(0,1fr);
    align-items:center;
  }
}

@media(max-width:520px){
  .mobile-kanban-card .production-mini-stages{
    grid-template-columns:1fr;
  }

  .mobile-kanban-card .production-mini-stage{
    grid-template-columns:70px minmax(0,1fr);
    align-items:center;
  }

  .production-mini-status{
    height:36px;
    font-size:10px;
  }
}


/* ===== V10.24 — PRODUCTION ACTION MENU + DEADLINE PRIORITY ===== */

.kanban-draggable-card{
  position:relative;
}

.kanban-card-menu-wrap{
  position:relative;
  display:flex;
  align-items:center;
  gap:5px;
  flex:0 0 auto;
}

.kanban-menu-btn{
  width:29px;
  height:27px;
  min-height:27px;
  display:grid;
  place-items:center;
  padding:0 4px;
  border:1px solid transparent;
  border-radius:7px;
  background:transparent;
  cursor:pointer!important;
  letter-spacing:-3px;
}

.kanban-menu-btn:hover{
  border-color:rgba(95,83,67,.55);
  background:rgba(0,0,0,.08);
}

.kanban-card-menu{
  position:absolute;
  z-index:80;
  top:calc(100% + 5px);
  right:0;
  width:168px;
  padding:5px;
  border:1px solid #5c5043;
  border-radius:9px;
  background:#171410;
  box-shadow:0 18px 45px rgba(0,0,0,.52);
}

.kanban-card-menu button{
  width:100%;
  min-height:34px;
  display:grid;
  grid-template-columns:20px minmax(0,1fr);
  align-items:center;
  gap:7px;
  padding:7px 8px;
  border:0;
  border-radius:6px;
  background:transparent;
  color:#e8dbc8;
  text-align:left;
  font-size:9px;
  cursor:pointer;
}

.kanban-card-menu button:hover{
  background:rgba(200,164,104,.10);
  color:#f1d8ae;
}

.kanban-card-menu button>span:first-child{
  color:#c8a468;
  text-align:center;
  font-size:12px;
}

/* Deadline colouring is intentionally limited by JS to:
   Neînceput / În lucru / Finalizat. */

.kanban-card.deadline-priority-grey,
.mobile-kanban-card.deadline-priority-grey{
  background:#d7d8d7!important;
  border-color:#b9bbb9!important;
  color:#242625!important;
}

.kanban-card.deadline-priority-gold,
.mobile-kanban-card.deadline-priority-gold{
  background:#d8bd82!important;
  border-color:#b58b45!important;
  color:#241b10!important;
}

.kanban-card.deadline-priority-red,
.mobile-kanban-card.deadline-priority-red{
  background:#efb4b0!important;
  border-color:#d77d76!important;
  color:#2d1715!important;
}

.kanban-card.deadline-priority-grey .kanban-meta,
.kanban-card.deadline-priority-gold .kanban-meta,
.kanban-card.deadline-priority-red .kanban-meta,
.mobile-kanban-card.deadline-priority-grey .mobile-muted,
.mobile-kanban-card.deadline-priority-gold .mobile-muted,
.mobile-kanban-card.deadline-priority-red .mobile-muted{
  color:#554f47!important;
}

.kanban-card.deadline-priority-grey .kanban-grip,
.kanban-card.deadline-priority-gold .kanban-grip,
.kanban-card.deadline-priority-red .kanban-grip{
  color:#4b443c!important;
}

.kanban-card.deadline-priority-grey .kanban-menu-btn:hover,
.kanban-card.deadline-priority-gold .kanban-menu-btn:hover,
.kanban-card.deadline-priority-red .kanban-menu-btn:hover{
  border-color:rgba(45,39,31,.32);
  background:rgba(255,255,255,.20);
}

/* Keep controls readable on the light priority cards. */
.kanban-card.deadline-priority-grey .status-select,
.kanban-card.deadline-priority-gold .status-select,
.kanban-card.deadline-priority-red .status-select{
  border-color:#4c4439!important;
  background:#171511!important;
  color:#f0e1cc!important;
}

.kanban-card.deadline-priority-grey .production-mini-stages,
.kanban-card.deadline-priority-gold .production-mini-stages,
.kanban-card.deadline-priority-red .production-mini-stages{
  border-top-color:rgba(42,35,27,.24)!important;
}

.kanban-card.deadline-priority-grey .production-mini-stage>span,
.kanban-card.deadline-priority-gold .production-mini-stage>span,
.kanban-card.deadline-priority-red .production-mini-stage>span{
  color:#514b43!important;
}

.production-tomorrow-alert{
  display:inline-flex;
  align-items:center;
  gap:3px;
  min-height:22px;
  padding:2px 5px;
  border:1px solid #b3211d;
  border-radius:7px;
  background:#e12620;
  color:#fff;
  box-shadow:0 0 0 2px rgba(225,38,32,.12);
  font-size:14px;
  font-weight:1000;
  line-height:1;
}

.production-tomorrow-alert small{
  font-size:6.5px;
  font-weight:900;
  letter-spacing:.04em;
}

.production-deadline-stack{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:6px;
  flex-wrap:wrap;
}

.mobile-kanban-card.deadline-priority-grey .mobile-deadline,
.mobile-kanban-card.deadline-priority-gold .mobile-deadline,
.mobile-kanban-card.deadline-priority-red .mobile-deadline{
  color:#4c443b!important;
}

/* The action menu itself stays dark even when the card is light. */
.deadline-priority-grey .kanban-card-menu,
.deadline-priority-gold .kanban-card-menu,
.deadline-priority-red .kanban-card-menu{
  color:#e8dbc8!important;
}

@media(max-width:860px){
  .production-tomorrow-alert{
    min-height:24px;
    font-size:15px;
  }
}


/* ===== V10.25 — DEADLINE GLOW, DARK CARD SURFACE ===== */

/*
  Urgency no longer fills the whole work-order card.
  It is communicated through:
  - luminous border
  - subtle outer/inset glow
  - title color
  Existing deadline logic is unchanged.
*/

/* Reset all urgency cards to the normal dark Flowrise surface. */
.kanban-card.deadline-priority-grey,
.kanban-card.deadline-priority-gold,
.kanban-card.deadline-priority-red{
  background:#100f0d!important;
  color:var(--text)!important;
}

.mobile-kanban-card.deadline-priority-grey,
.mobile-kanban-card.deadline-priority-gold,
.mobile-kanban-card.deadline-priority-red{
  background:linear-gradient(180deg,#181511,#11100e)!important;
  color:var(--text)!important;
}

/* Restore normal secondary text now that the card is dark again. */
.kanban-card.deadline-priority-grey .kanban-meta,
.kanban-card.deadline-priority-gold .kanban-meta,
.kanban-card.deadline-priority-red .kanban-meta{
  color:var(--muted)!important;
}

.mobile-kanban-card.deadline-priority-grey .mobile-muted,
.mobile-kanban-card.deadline-priority-gold .mobile-muted,
.mobile-kanban-card.deadline-priority-red .mobile-muted{
  color:var(--muted)!important;
}

.kanban-card.deadline-priority-grey .kanban-grip,
.kanban-card.deadline-priority-gold .kanban-grip,
.kanban-card.deadline-priority-red .kanban-grip{
  color:#766b5f!important;
}

/* Keep normal dark controls inside the card. */
.kanban-card.deadline-priority-grey .status-select,
.kanban-card.deadline-priority-gold .status-select,
.kanban-card.deadline-priority-red .status-select{
  border-color:#4c4439!important;
  background:#171511!important;
  color:#f0e1cc!important;
}

.kanban-card.deadline-priority-grey .production-mini-stages,
.kanban-card.deadline-priority-gold .production-mini-stages,
.kanban-card.deadline-priority-red .production-mini-stages{
  border-top-color:#2d2924!important;
}

.kanban-card.deadline-priority-grey .production-mini-stage>span,
.kanban-card.deadline-priority-gold .production-mini-stage>span,
.kanban-card.deadline-priority-red .production-mini-stage>span{
  color:#827a70!important;
}

/* > 14 days — silver / light grey glow */
.kanban-card.deadline-priority-grey,
.mobile-kanban-card.deadline-priority-grey{
  border-color:#7f878b!important;
  box-shadow:
    0 0 0 1px rgba(174,180,184,.10),
    0 0 14px rgba(174,180,184,.15),
    inset 0 0 12px rgba(174,180,184,.035),
    0 7px 18px rgba(0,0,0,.25)!important;
}

.kanban-card.deadline-priority-grey .kanban-card-drag-head>strong,
.mobile-kanban-card.deadline-priority-grey .mobile-card-head strong{
  color:#c5c9cb!important;
  text-shadow:0 0 9px rgba(197,201,203,.18);
}

/* 7–14 days — Flowrise gold glow */
.kanban-card.deadline-priority-gold,
.mobile-kanban-card.deadline-priority-gold{
  border-color:#c8a468!important;
  box-shadow:
    0 0 0 1px rgba(200,164,104,.12),
    0 0 16px rgba(200,164,104,.20),
    inset 0 0 13px rgba(200,164,104,.045),
    0 7px 18px rgba(0,0,0,.25)!important;
}

.kanban-card.deadline-priority-gold .kanban-card-drag-head>strong,
.mobile-kanban-card.deadline-priority-gold .mobile-card-head strong{
  color:#e2c99d!important;
  text-shadow:0 0 10px rgba(226,201,157,.22);
}

/* < 7 days — soft red glow */
.kanban-card.deadline-priority-red,
.mobile-kanban-card.deadline-priority-red{
  border-color:#cf625a!important;
  box-shadow:
    0 0 0 1px rgba(207,98,90,.12),
    0 0 17px rgba(207,98,90,.21),
    inset 0 0 13px rgba(207,98,90,.045),
    0 7px 18px rgba(0,0,0,.25)!important;
}

.kanban-card.deadline-priority-red .kanban-card-drag-head>strong,
.mobile-kanban-card.deadline-priority-red .mobile-card-head strong{
  color:#ef9c95!important;
  text-shadow:0 0 10px rgba(239,156,149,.23);
}

/* Keep deadline text readable on the dark card. */
.mobile-kanban-card.deadline-priority-grey .mobile-deadline,
.mobile-kanban-card.deadline-priority-gold .mobile-deadline,
.mobile-kanban-card.deadline-priority-red .mobile-deadline{
  color:#b9ad9d!important;
}

/* Hover intensifies the urgency glow slightly without changing card fill. */
.kanban-card.deadline-priority-grey:hover{
  border-color:#aeb4b8!important;
  box-shadow:
    0 0 0 1px rgba(174,180,184,.15),
    0 0 20px rgba(174,180,184,.20),
    0 9px 24px rgba(0,0,0,.32)!important;
}

.kanban-card.deadline-priority-gold:hover{
  border-color:#e2c99d!important;
  box-shadow:
    0 0 0 1px rgba(226,201,157,.15),
    0 0 21px rgba(200,164,104,.26),
    0 9px 24px rgba(0,0,0,.32)!important;
}

.kanban-card.deadline-priority-red:hover{
  border-color:#ee8a82!important;
  box-shadow:
    0 0 0 1px rgba(238,138,130,.15),
    0 0 22px rgba(207,98,90,.28),
    0 9px 24px rgba(0,0,0,.32)!important;
}


/* ===== V11 — OPERATIONS POC: DATE RANGES / CALENDAR / MATERIALS / ADMIN UX ===== */

/* Today deadline badge */
.production-today-alert{
  display:inline-flex;align-items:center;gap:3px;min-height:22px;padding:2px 6px;border:1px solid #c8201b;border-radius:7px;
  background:#ed2922;color:#fff;box-shadow:0 0 0 2px rgba(237,41,34,.13),0 0 12px rgba(237,41,34,.25);font-weight:1000;line-height:1;
}
.production-today-alert strong{font-size:12px;letter-spacing:-1px}.production-today-alert small{font-size:7px;font-weight:1000;letter-spacing:.04em}

/* Date-range controls */
.date-range-filter-card{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;margin-bottom:11px;padding:11px 12px;border:1px solid #3a332b;border-radius:13px;background:linear-gradient(180deg,#171511,#11100e)}
.date-range-filter-head{display:grid;gap:2px;margin-right:4px;min-width:130px}.date-range-filter-head strong{color:#e5d6bf;font-size:11px}.date-range-filter-head span{color:#796f62;font-size:8px}
.date-range-filter-body{display:flex;gap:12px;flex-wrap:wrap;align-items:flex-end}.date-range-group{display:flex;gap:7px;align-items:flex-end;padding-left:11px;border-left:2px solid #5c4930}.date-range-label{align-self:center;color:#d2b47d;font-size:9px;font-weight:900;text-transform:uppercase;letter-spacing:.06em;margin-right:2px}.date-range-group label{display:grid;gap:3px;color:#8f8577;font-size:8px;font-weight:700}.range-date-input{display:grid;grid-template-columns:minmax(112px,1fr) 30px;gap:4px}.range-date-input input{height:34px;min-width:0;padding:5px 7px;border:1px solid #44382d;border-radius:7px;background:#0d0c0a;color:#e8dac6}.range-date-input button{height:34px;width:30px;padding:0;border:1px solid #6a5333;border-radius:7px;background:#211a12;color:#e0c18d;cursor:pointer}.date-range-clear{margin-left:auto;min-height:34px!important}.range-filter-note{display:inline-block;padding:5px 6px;color:#7b7164;font-size:8px;font-style:italic;white-space:nowrap}.table-tool-actions{display:flex;gap:7px;align-items:center}

/* Admin Config: one task at a time */
.admin-config-shell{display:grid;gap:10px}.admin-config-tabs{display:flex;gap:6px;padding:5px;border:1px solid #393027;border-radius:12px;background:#100e0c;overflow-x:auto}.admin-config-tabs button{min-height:38px;padding:7px 12px;border:1px solid transparent;border-radius:8px;background:transparent;color:#8d8172;font-weight:800;cursor:pointer;white-space:nowrap}.admin-config-tabs button.active{border-color:#80663d;background:rgba(200,164,104,.11);color:#e3c996}.admin-config-toolbar{display:flex;justify-content:flex-end}.admin-config-search{display:grid;grid-template-columns:minmax(220px,420px) 38px;gap:5px}.admin-contract-workspace{display:grid;grid-template-columns:240px minmax(0,1fr);gap:10px}.admin-contract-list,.admin-contract-detail{border:1px solid #39312a;border-radius:13px;background:linear-gradient(180deg,#171511,#100f0d);min-width:0}.admin-contract-list{padding:10px}.admin-contract-detail{padding:12px}.admin-pane-title{display:flex;justify-content:space-between;align-items:center;padding:3px 3px 9px;color:#dfc28e}.admin-pane-title span{color:#776c5f;font-size:9px}.admin-contract-items{display:grid;gap:5px;max-height:650px;overflow:auto}.admin-contract-items button{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;width:100%;padding:9px;border:1px solid #332d27;border-radius:8px;background:#11100e;color:#c9bdac;text-align:left;cursor:pointer}.admin-contract-items button small{color:#746b60;font-size:7.5px}.admin-contract-items button.active{border-color:#a9854d;background:#20190f;color:#efd5a7;box-shadow:0 0 12px rgba(200,164,104,.08)}.admin-empty-small{padding:18px 6px;text-align:center;color:#71685d;font-size:9px}.admin-create-card.compact{margin:8px 0 10px}.admin-row-actions{white-space:nowrap}

/* Calendar */
.calendar-loading-state{padding:30px;color:#9a8d7c}.calendar-toolbar{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:10px;padding:10px 12px;margin-bottom:10px}.calendar-toolbar>div{display:flex;gap:6px}.calendar-toolbar h2{margin:0;color:#e5d4ba;font-size:17px;text-transform:capitalize}.calendar-toolbar>button{justify-self:end}.calendar-board{padding:8px;overflow:hidden}.calendar-weekdays,.calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}.calendar-weekdays div{padding:7px;text-align:center;color:#8b8174;font-size:8px;font-weight:900;text-transform:uppercase;letter-spacing:.05em}.calendar-day{min-height:126px;padding:6px;border-top:1px solid #2c2823;border-left:1px solid #2c2823;background:#100f0d}.calendar-day:nth-child(7n){border-right:1px solid #2c2823}.calendar-day:nth-last-child(-n+7){border-bottom:1px solid #2c2823}.calendar-day-outside{opacity:.45;background:#0c0b0a}.calendar-day-today{box-shadow:inset 0 0 0 1px #c8a468;background:linear-gradient(180deg,rgba(200,164,104,.055),#100f0d)}.calendar-day-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:5px}.calendar-day-head button{width:25px;height:25px;padding:0;border:0;border-radius:7px;background:transparent;color:#c9bdad;font-weight:900;cursor:pointer}.calendar-day-today .calendar-day-head button{background:#c8a468;color:#17120b}.calendar-day-head span{font-size:7px;color:#6e665d}.calendar-events{display:grid;gap:3px}.calendar-event{width:100%;padding:4px 5px;border:1px solid;border-radius:5px;text-align:left;font-size:7.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.calendar-event span{opacity:.72}.calendar-type-meeting{background:#132522;border-color:#527f76;color:#9dd0c7}.calendar-type-payment{background:#261b0e;border-color:#b58b45;color:#e5c37f}.calendar-type-order{background:#1c1a2a;border-color:#6f6a96;color:#bbb3e1}.calendar-type-delivery{background:#152032;border-color:#4776a6;color:#91bfea}.calendar-type-reminder{background:#2b1715;border-color:#a9524d;color:#e99a94}.calendar-type-other{background:#202224;border-color:#65696c;color:#c2c5c7}.calendar-event-done{opacity:.48;text-decoration:line-through}.calendar-more{padding:2px 4px;color:#7a7064;font-size:7px}.calendar-editor-backdrop{position:fixed;inset:0;z-index:150;display:grid;place-items:center;padding:20px;background:rgba(0,0,0,.68);backdrop-filter:blur(4px)}.calendar-editor-card{width:min(640px,95vw);max-height:92vh;overflow:auto;padding:14px;border:1px solid #5a4935;border-radius:15px;background:linear-gradient(180deg,#1b1814,#100f0d);box-shadow:0 30px 90px rgba(0,0,0,.62)}.calendar-editor-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:12px}.calendar-editor-head span{color:#8d806e;font-size:8px;text-transform:uppercase;letter-spacing:.08em}.calendar-editor-head h3{margin:2px 0 0;color:#e8d8c0}.calendar-editor-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px}.calendar-editor-grid label{display:grid;gap:4px;color:#a19482;font-size:9px;font-weight:800}.calendar-editor-grid input,.calendar-editor-grid select,.calendar-editor-grid textarea{width:100%;min-width:0;border:1px solid #44392e;border-radius:8px;background:#0c0b09;color:#e8dbc8;padding:8px}.calendar-editor-grid .wide{grid-column:1/-1}.calendar-editor-grid textarea{resize:vertical}.calendar-editor-actions{display:grid;grid-template-columns:auto 1fr auto auto;gap:7px;margin-top:12px;padding-top:10px;border-top:1px solid #332c25}

/* Materials */
.materials-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:11px 12px;margin-bottom:10px}.materials-toolbar>div:first-child{display:grid;gap:2px}.materials-toolbar>div:first-child strong{color:#e4d4bd}.materials-toolbar>div:first-child span{font-size:8px;color:#786f64}.materials-toolbar-actions{display:flex;gap:6px;align-items:center}.materials-toolbar-actions input{min-width:280px}.materials-table{min-width:980px}.material-qty-control{display:flex;align-items:center;gap:5px}.material-qty-control button{width:28px;height:28px;padding:0;border:1px solid #4b4136;border-radius:7px;background:#17140f;color:#dfc28d;font-size:16px;cursor:pointer}.material-qty-control strong{min-width:42px;text-align:center}.low-stock-badge{display:inline-flex;margin-left:6px;padding:2px 5px;border:1px solid #aa514b;border-radius:999px;background:#2a1715;color:#e98e87;font-size:6.5px;font-weight:900;vertical-align:2px}.material-low-stock td{background:rgba(169,76,70,.025)}.material-notes{max-width:280px;white-space:normal}.material-editor-card{width:min(720px,95vw)}

@media(max-width:1100px){.admin-contract-workspace{grid-template-columns:200px minmax(0,1fr)}.calendar-day{min-height:108px}}
@media(max-width:860px){
  .date-range-filter-card{display:grid}.date-range-filter-body{display:grid}.date-range-group{display:grid;grid-template-columns:1fr 1fr;padding:9px;border-left:0;border-top:2px solid #5c4930}.date-range-label{grid-column:1/-1}.range-date-input{grid-template-columns:minmax(0,1fr) 42px}.range-date-input input,.range-date-input button{height:44px}.date-range-clear{margin-left:0;width:100%}
  .admin-contract-workspace{grid-template-columns:1fr}.admin-contract-items{display:flex;overflow-x:auto;max-height:none}.admin-contract-items button{min-width:180px}.admin-config-search{grid-template-columns:minmax(0,1fr) 44px;width:100%}
  .calendar-toolbar{grid-template-columns:1fr auto}.calendar-toolbar h2{grid-column:1/-1;grid-row:1;text-align:center}.calendar-toolbar>div{grid-row:2}.calendar-toolbar>button{grid-row:2}.calendar-board{overflow-x:auto}.calendar-weekdays,.calendar-grid{min-width:760px}.calendar-editor-grid{grid-template-columns:1fr}.calendar-editor-grid .wide{grid-column:auto}.calendar-editor-actions{grid-template-columns:1fr 1fr}.calendar-editor-actions>span{display:none}.materials-toolbar{display:grid}.materials-toolbar-actions{display:grid;grid-template-columns:1fr auto auto}.materials-toolbar-actions input{min-width:0}.production-today-alert{min-height:24px}
}

/* V11 final touch: mobile work-order report action */
.mobile-list-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.mobile-list-actions .mobile-search-wrap{min-width:min(340px,100%);flex:1}
@media(max-width:520px){.mobile-list-actions{display:grid;grid-template-columns:1fr}.mobile-list-actions .primary-btn{width:100%}}


/* ===== V11.1 — MATERIAL SAVE FEEDBACK ===== */

.material-editor-card{
  position:relative;
}

.material-save-overlay{
  position:absolute;
  inset:0;
  z-index:8;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:22px;
  border-radius:15px;
  background:rgba(10,9,8,.84);
  backdrop-filter:blur(3px);
  text-align:center;
}

.material-save-overlay .spinner{
  width:28px;
  height:28px;
  border-width:3px;
  border-color:#4a4033;
  border-top-color:#c8a468;
}

.material-save-overlay strong{
  color:#e2c99d;
  font-size:13px;
}

.material-save-overlay small{
  color:#9d9180;
  font-size:9px;
}

.material-save-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
}

.inline-spinner{
  width:13px;
  height:13px;
  border:2px solid rgba(10,9,8,.28);
  border-top-color:#0a0908;
  border-radius:50%;
  animation:spin .75s linear infinite;
}

.material-editor-is-saving input,
.material-editor-is-saving select,
.material-editor-is-saving textarea,
.material-editor-is-saving button:disabled{
  cursor:wait;
}

/* Keep the generic loading toast visible even above calendar/material dialogs. */
.flow-loading{
  z-index:260;
}

/* ===== V11.1 — TECHNICIAN BREAKDOWN IN ADMIN CONFIG ===== */

.admin-technician-workspace .admin-technician-list{
  min-width:190px;
}

.admin-technician-list .admin-contract-items button span{
  font-weight:800;
}

.admin-technician-list .admin-contract-items button.active{
  border-color:#c8a468;
  box-shadow:inset 3px 0 0 #c8a468,0 0 14px rgba(200,164,104,.08);
}

@media(max-width:860px){
  .admin-technician-workspace{
    grid-template-columns:1fr;
  }

  .admin-technician-workspace .admin-technician-list{
    min-width:0;
  }

  .admin-technician-list .admin-contract-items{
    display:flex;
    gap:6px;
    overflow-x:auto;
    padding-bottom:4px;
  }

  .admin-technician-list .admin-contract-items button{
    min-width:140px;
    flex:0 0 auto;
  }
}


/* ===== V11.2 — WORK ORDER QUICK FILTERS ===== */

.work-quick-filter-card{
  margin:-2px 0 11px;
  padding:10px 12px;
  border:1px solid #3a332b;
  border-radius:13px;
  background:linear-gradient(180deg,#15130f,#100f0d);
}

.work-quick-filter-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}

.work-quick-filter-head>div{
  display:grid;
  gap:2px;
}

.work-quick-filter-head strong{
  color:#e5d6bf;
  font-size:11px;
}

.work-quick-filter-head span{
  color:#796f62;
  font-size:8px;
}

.work-quick-filter-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
}

.work-quick-filter-grid label{
  display:grid;
  gap:4px;
  min-width:0;
  color:#9a8d7d;
  font-size:8px;
  font-weight:800;
}

.work-quick-filter-grid select{
  width:100%;
  min-width:0;
  height:36px;
  padding:6px 30px 6px 8px;
  border:1px solid #44382d;
  border-radius:8px;
  background:#0d0c0a;
  color:#e8dac6;
  cursor:pointer;
}

.work-quick-filter-grid select:focus{
  outline:none;
  border-color:#c8a468;
  box-shadow:0 0 0 2px rgba(200,164,104,.08);
}

/* Existing Model / Modelare / Cer-Fin table filters are now dropdowns. */
.filter-row .work-stage-filter-select{
  min-width:112px;
  height:32px;
  padding:5px 26px 5px 7px;
  cursor:pointer;
}

@media(max-width:860px){
  .work-quick-filter-card{
    margin-bottom:10px;
  }

  .work-quick-filter-grid{
    grid-template-columns:1fr;
  }

  .work-quick-filter-grid select{
    height:46px;
    font-size:16px;
  }

  .work-quick-filter-head{
    align-items:flex-start;
  }
}


/* ===== V11.3 — ADMIN GROUP DUPLICATION ===== */

.admin-group-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  flex-wrap:wrap;
}

.admin-duplicate-group-btn{
  border-color:#80663d!important;
  background:rgba(200,164,104,.08)!important;
  color:#e3c996!important;
}

.admin-duplicate-group-btn:hover{
  border-color:#c8a468!important;
  background:rgba(200,164,104,.14)!important;
  box-shadow:0 0 13px rgba(200,164,104,.08);
}

@media(max-width:860px){
  .admin-section-head{
    align-items:flex-start;
  }

  .admin-group-actions{
    width:100%;
    justify-content:flex-start;
  }

  .admin-group-actions .secondary-btn,
  .admin-group-actions .danger-btn{
    min-height:40px;
  }
}


/* ===== V11.4 — DOCTOR / PARTNER ROLE ===== */

.app-shell.doctor-role-mode .ai-panel,
.app-shell.doctor-role-mode .ai-expand-btn{
  display:none!important;
}

@media(min-width:1181px){
  .app-shell.doctor-role-mode{
    grid-template-columns:220px minmax(0,1fr) 0!important;
  }
  .app-shell.doctor-role-mode.sidebar-collapsed{
    grid-template-columns:0 minmax(0,1fr) 0!important;
  }
}

@media(min-width:861px) and (max-width:1180px){
  .app-shell.doctor-role-mode{
    grid-template-columns:220px minmax(0,1fr)!important;
  }
}

.job-definition-form.doctor-mode .doctor-hidden-field{
  display:none!important;
}

.job-definition-form.doctor-mode .doctor-visible-field,
.job-definition-form.doctor-mode .doctor-visible-price{
  display:grid!important;
}

.job-definition-form.doctor-mode .job-definition-layout{
  grid-template-columns:minmax(260px,.9fr) minmax(430px,1.45fr) minmax(220px,.62fr);
}

.job-definition-form.doctor-mode .job-production-panel{
  align-self:start;
}

.job-definition-form.doctor-mode .job-price-summary{
  margin-top:0;
}

.job-definition-form.doctor-mode #status:disabled{
  opacity:1;
  cursor:not-allowed;
  border-color:#4b4034;
  color:#d8cab6;
  background:#171410;
}

.doctor-partner-context{
  margin:0 0 10px;
  padding:8px 10px;
  border:1px solid #3d342b;
  border-radius:9px;
  background:#11100e;
  color:#887d70;
  font-size:9px;
}

.doctor-partner-context strong{
  color:#e0c38e;
}

.doctor-status-readonly{
  display:inline-flex;
  align-items:center;
  min-height:29px;
  padding:5px 9px;
  border:1px solid #4a4035;
  border-radius:999px;
  background:#171410;
  color:#d7c9b5;
  font-size:9px;
  font-weight:800;
  white-space:nowrap;
}

.doctor-clinic-note{
  display:block;
  max-width:280px;
  white-space:normal;
  line-height:1.35;
  color:#c5b8a6;
}

.doctor-mobile-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:7px;
  margin-top:10px;
}

.doctor-mobile-grid>div{
  display:grid;
  gap:3px;
  padding:8px;
  border:1px solid #342e27;
  border-radius:8px;
  background:#100f0d;
}

.doctor-mobile-grid span,
.doctor-mobile-note span{
  color:#83786b;
  font-size:8px;
  text-transform:uppercase;
  letter-spacing:.035em;
}

.doctor-mobile-grid strong{
  color:#e4d4bc;
  font-size:11px;
}

.doctor-mobile-note{
  display:grid;
  gap:4px;
  margin-top:8px;
  padding:8px 9px;
  border-left:2px solid #9b7643;
  background:rgba(200,164,104,.05);
  color:#cdbda7;
  font-size:10px;
  line-height:1.4;
}

.doctor-mobile-edit{
  width:100%;
  margin-top:10px;
}

@media(max-width:860px){
  .app-shell.doctor-role-mode .mobile-bottom-nav{
    grid-template-columns:1fr!important;
  }

  .app-shell.doctor-role-mode #mobileAiBtn{
    display:none!important;
  }

  .job-definition-form.doctor-mode .job-definition-layout{
    grid-template-columns:1fr;
  }

  .doctor-mobile-grid{
    grid-template-columns:1fr 1fr;
  }

  .doctor-mobile-grid>div:last-child{
    grid-column:1/-1;
  }
}


/* ===== V11.5 — DOCTOR OWN/CLINIC SCOPE + DELETE + CASE EXPORT ===== */

.doctor-row-actions{
  display:flex;
  gap:5px;
  flex-wrap:wrap;
}

.doctor-row-actions button{
  white-space:nowrap;
}

.doctor-mobile-actions{
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:6px;
  margin-top:10px;
}

.doctor-mobile-actions button{
  width:100%;
  min-width:0;
}

.doctor-quick-filter-grid{
  grid-template-columns:repeat(2,minmax(0,1fr));
}

@media(max-width:860px){
  .doctor-mobile-actions{
    grid-template-columns:1fr;
  }

  .doctor-quick-filter-grid{
    grid-template-columns:1fr;
  }
}


/* ===== V11.6 — DOCTOR PER-TOOTH MATERIAL + NOTES ===== */

.job-definition-form.doctor-mode #orderToothForm label{
  color:#a99b88;
}

.job-definition-form.doctor-mode #orderToothForm label:has(#orderToothMaterial),
.job-definition-form.doctor-mode #orderToothForm label:has(#orderToothNote){
  color:#e0c28c;
}

.job-definition-form.doctor-mode #orderToothMaterial,
.job-definition-form.doctor-mode #orderToothNote{
  border-color:#6b5433;
  background:#12100d;
}

.job-definition-form.doctor-mode #orderToothMaterial:focus,
.job-definition-form.doctor-mode #orderToothNote:focus{
  border-color:#c8a468;
  box-shadow:0 0 0 2px rgba(200,164,104,.08);
}


/* ===== V11.8 — DOCTOR ACTION BUTTONS ===== */

.doctor-workorders-panel th:first-child,
.doctor-workorders-panel td:first-child{
  min-width:198px;
}

.doctor-action-stack{
  display:grid;
  gap:7px;
  width:182px;
  max-width:100%;
}

.doctor-action-btn{
  --action-border:#443c32;
  --action-fg:#e8ddcc;
  --action-icon:#e8ddcc;
  --action-bg:linear-gradient(180deg,#181512,#12110f);

  appearance:none;
  width:100%;
  min-height:44px;
  display:grid;
  grid-template-columns:30px minmax(0,1fr) 18px;
  align-items:center;
  gap:9px;
  padding:7px 9px 7px 8px;
  border:1px solid var(--action-border);
  border-radius:13px;
  background:var(--action-bg);
  color:var(--action-fg);
  text-align:left;
  cursor:pointer;
  box-shadow:0 5px 13px rgba(0,0,0,.14);
  transition:
    transform .16s ease,
    border-color .16s ease,
    box-shadow .16s ease,
    background .16s ease;
}

.doctor-action-btn:hover{
  transform:translateY(-1px);
}

.doctor-action-btn:active{
  transform:translateY(0);
}

.doctor-action-btn:focus-visible{
  outline:none;
  box-shadow:0 0 0 2px rgba(200,164,104,.18),0 5px 14px rgba(0,0,0,.18);
}

.doctor-action-icon{
  width:30px;
  height:30px;
  display:grid;
  place-items:center;
  border-right:1px solid rgba(255,255,255,.07);
  padding-right:8px;
  color:var(--action-icon);
}

.doctor-action-icon svg{
  width:22px;
  height:22px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.doctor-action-label{
  min-width:0;
  font-size:11px;
  line-height:1.1;
  font-weight:850;
  letter-spacing:.005em;
  white-space:nowrap;
}

.doctor-action-chevron{
  justify-self:end;
  font-size:24px;
  line-height:1;
  font-weight:300;
  opacity:.86;
  transform:translateY(-1px);
}

/* Primary — premium Flowrise gold */
.doctor-action-edit{
  --action-border:#876837;
  --action-fg:#edcf95;
  --action-icon:#e6bd70;
  --action-bg:linear-gradient(135deg,rgba(105,76,35,.31),#18140f 58%,#13110e);
  box-shadow:
    0 6px 16px rgba(0,0,0,.17),
    inset 0 0 0 1px rgba(226,201,157,.035),
    0 0 13px rgba(200,164,104,.055);
}

.doctor-action-edit:hover{
  border-color:#b58a4a;
  box-shadow:
    0 7px 18px rgba(0,0,0,.2),
    inset 0 0 0 1px rgba(226,201,157,.06),
    0 0 17px rgba(200,164,104,.10);
}

/* Secondary — refined neutral */
.doctor-action-export{
  --action-border:#443e35;
  --action-fg:#e7ddcf;
  --action-icon:#d9d0c3;
  --action-bg:linear-gradient(180deg,#181613,#12110f);
}

.doctor-action-export:hover{
  border-color:#6c6254;
  background:linear-gradient(180deg,#1d1a16,#151310);
  box-shadow:0 7px 18px rgba(0,0,0,.2);
}

/* Danger — restrained red, not full alarm-red */
.doctor-action-delete{
  --action-border:#743632;
  --action-fg:#ef938b;
  --action-icon:#eb8179;
  --action-bg:linear-gradient(135deg,rgba(95,34,31,.33),#1a1211 58%,#15100f);
  box-shadow:
    0 6px 15px rgba(0,0,0,.16),
    0 0 10px rgba(155,54,48,.045);
}

.doctor-action-delete:hover{
  border-color:#9d4943;
  background:linear-gradient(135deg,rgba(118,42,37,.39),#201312 58%,#17100f);
  box-shadow:
    0 7px 18px rgba(0,0,0,.2),
    0 0 14px rgba(155,54,48,.09);
}

/* Old action wrappers are no longer used for Doctor, but neutralize
   inherited row-action sizing if the component is nested elsewhere. */
.doctor-row-actions{
  display:block;
}

/* Mobile: same design language, larger touch targets. */
.doctor-action-stack-mobile{
  width:100%;
  gap:8px;
  margin-top:10px;
}

.doctor-action-stack-mobile .doctor-action-btn{
  min-height:54px;
  grid-template-columns:38px minmax(0,1fr) 22px;
  padding:9px 12px 9px 10px;
  border-radius:14px;
}

.doctor-action-stack-mobile .doctor-action-icon{
  width:38px;
  height:34px;
  padding-right:10px;
}

.doctor-action-stack-mobile .doctor-action-icon svg{
  width:24px;
  height:24px;
}

.doctor-action-stack-mobile .doctor-action-label{
  font-size:15px;
}

.doctor-action-stack-mobile .doctor-action-chevron{
  font-size:28px;
}

@media(max-width:860px){
  .doctor-mobile-actions{
    display:none!important;
  }
}



/* ===== V11.9 — ADMIN CONFIG / USERS ===== */

.admin-users-workspace{
  grid-template-columns:240px minmax(0,1fr);
}

.admin-users-list .admin-contract-items button{
  grid-template-columns:minmax(0,1fr) auto;
}

.admin-users-list .admin-contract-items button span{
  font-weight:850;
}

.admin-users-list .admin-contract-items button small{
  text-align:right;
}

.admin-user-create-card{
  margin-top:0!important;
}

.admin-user-create-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:8px;
  align-items:end;
}

.admin-user-create-grid label,
.admin-user-editor-grid label{
  display:grid;
  gap:5px;
  min-width:0;
  color:#9e9180;
  font-size:9px;
  font-weight:750;
}

.admin-user-create-grid input,
.admin-user-create-grid select,
.admin-user-editor-grid input,
.admin-user-editor-grid select{
  width:100%;
  min-width:0;
  height:38px;
  padding:7px 8px;
  border:1px solid #41372d;
  border-radius:8px;
  background:#0e0d0b;
  color:#e8dac5;
}

.admin-user-create-grid .admin-checkbox-label,
.admin-user-editor-grid .admin-checkbox-label{
  display:flex;
  align-items:center;
  gap:8px;
  height:38px;
  padding:0 9px;
  border:1px solid #41372d;
  border-radius:8px;
  background:#0e0d0b;
}

.admin-user-create-grid .admin-checkbox-label input,
.admin-user-editor-grid .admin-checkbox-label input{
  width:auto;
  height:auto;
}

.admin-user-editor-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:9px;
  padding:12px;
  border:1px solid #342e27;
  border-radius:11px;
  background:#100f0d;
}

.admin-user-password-field small{
  color:#746b60;
  font-size:7.5px;
  line-height:1.25;
}

.admin-user-editor-actions{
  display:flex;
  justify-content:flex-end;
  margin-top:10px;
}

.admin-user-role-badge{
  display:inline-flex;
  align-items:center;
  min-height:30px;
  padding:5px 9px;
  border:1px solid #6d5838;
  border-radius:999px;
  background:rgba(200,164,104,.08);
  color:#e2c99d;
  font-size:9px;
  font-weight:850;
}

.admin-user-empty-detail{
  min-height:170px;
  display:grid;
  place-items:center;
}

@media(max-width:1100px) and (min-width:861px){
  .admin-user-create-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .admin-user-editor-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media(max-width:860px){
  .admin-users-workspace{
    grid-template-columns:1fr;
  }

  .admin-user-create-grid,
  .admin-user-editor-grid{
    grid-template-columns:1fr;
  }

  .admin-users-list .admin-contract-items{
    display:flex;
    gap:6px;
    overflow-x:auto;
  }

  .admin-users-list .admin-contract-items button{
    min-width:150px;
    flex:0 0 auto;
  }

  .admin-user-editor-actions .primary-btn{
    width:100%;
  }
}


/* ===== V12 — NAV ICONS ===== */
.nav-item{
  display:flex;
  align-items:center;
  gap:9px;
}
.nav-icon{
  width:20px;
  min-width:20px;
  display:inline-grid;
  place-items:center;
  color:#c8a468;
  font-size:15px;
  line-height:1;
  opacity:.88;
}
.nav-item.active .nav-icon{
  color:#e2c99d;
  text-shadow:0 0 10px rgba(200,164,104,.18);
}

/* ===== V12 — WORK ORDER LOCK ===== */
.lock-btn{
  border:1px solid #625039;
  background:rgba(200,164,104,.06);
  color:#d8c19a;
  border-radius:8px;
  padding:6px 9px;
  cursor:pointer;
  white-space:nowrap;
}
.lock-btn:hover{
  border-color:#9b7643;
  background:rgba(200,164,104,.10);
}
.lock-btn.is-locked{
  border-color:#c8a468;
  background:rgba(200,164,104,.13);
  color:#f0d39d;
  box-shadow:0 0 12px rgba(200,164,104,.08);
}
.management-order-actions{
  flex-wrap:wrap;
}
.order-lock-badge{
  display:inline-flex;
  align-items:center;
  gap:3px;
  margin-left:5px;
  padding:2px 6px;
  border:1px solid #80663d;
  border-radius:999px;
  background:rgba(200,164,104,.08);
  color:#e2c99d;
  font-size:8px;
  font-weight:800;
  white-space:nowrap;
}

/* ===== V12 — DOCTOR READ ONLY ===== */
.doctor-readonly-reason{
  padding:7px 9px;
  border:1px solid #4b4034;
  border-radius:9px;
  background:#12100e;
  color:#9d9180;
  font-size:8.5px;
  line-height:1.35;
}
.job-definition-form.doctor-readonly{
  position:relative;
}
.job-definition-form.doctor-readonly .job-panel{
  opacity:.94;
}
.job-definition-form.doctor-readonly input:disabled,
.job-definition-form.doctor-readonly select:disabled,
.job-definition-form.doctor-readonly textarea:disabled{
  opacity:.78;
  cursor:not-allowed;
  color:#c3b6a4;
  background:#100f0d;
}
.job-definition-form.doctor-readonly .tooth-svg-group.interactive{
  cursor:default!important;
}
.job-definition-form.doctor-readonly .tooth-row-edit-btn{
  display:none!important;
}

/* ===== V12 — DOCTOR PRODUCTION ===== */
.doctor-production-note{
  margin-bottom:10px;
  padding:9px 11px;
  border:1px solid #4a4034;
  border-radius:10px;
  background:#12100e;
  color:#9e9180;
  font-size:9px;
}
.doctor-production-kanban{
  grid-template-columns:repeat(4,minmax(210px,1fr));
}
.doctor-production-card{
  cursor:default;
}
.doctor-production-status{
  margin-top:9px;
  display:inline-flex;
  width:max-content;
  max-width:100%;
  padding:5px 8px;
  border:1px solid #51463a;
  border-radius:999px;
  background:#171410;
  color:#e3d3bc;
  font-size:9px;
  font-weight:800;
}

@media(max-width:1100px) and (min-width:861px){
  .doctor-production-kanban{
    grid-template-columns:repeat(2,minmax(240px,1fr));
  }
}
@media(max-width:860px){
  .nav-item{
    gap:10px;
  }
  .doctor-production-status{
    margin-top:7px;
  }
}


/* ===== V12.1 — COMPACT, UNIFORM ACTION BUTTONS =====
   Applies to operational CRUD/action areas only.
   Main CTA buttons such as "Lucrare nouă", Save, Export PDF etc. are unchanged.
*/

:root{
  --compact-action-width:112px;
  --compact-action-height:34px;
}

/* Desktop table/card actions — same rectangle for Edit / View / Lock / Delete etc. */
.row-actions,
.admin-row-actions,
.management-order-actions{
  gap:5px!important;
  align-items:center!important;
}

.row-actions > button,
.admin-row-actions > button,
.management-order-actions > button{
  width:var(--compact-action-width)!important;
  min-width:var(--compact-action-width)!important;
  max-width:var(--compact-action-width)!important;
  height:var(--compact-action-height)!important;
  min-height:var(--compact-action-height)!important;
  padding:4px 8px!important;
  border-radius:8px!important;
  font-size:10px!important;
  line-height:1!important;
  font-weight:750!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:5px!important;
  white-space:nowrap!important;
}

/* Admin Config: Save / Delete and group-level actions stay visually consistent. */
.admin-row-actions{
  display:flex!important;
  flex-wrap:wrap!important;
}

.admin-group-actions .admin-duplicate-group-btn,
.admin-group-actions .danger-btn,
.admin-user-editor-actions .primary-btn{
  min-height:34px!important;
  height:34px!important;
  padding:4px 10px!important;
  border-radius:8px!important;
  font-size:10px!important;
}

/* Work Orders lock button follows the exact same footprint. */
.lock-btn{
  width:var(--compact-action-width)!important;
  min-width:var(--compact-action-width)!important;
  max-width:var(--compact-action-width)!important;
  height:var(--compact-action-height)!important;
  min-height:var(--compact-action-height)!important;
  padding:4px 7px!important;
  border-radius:8px!important;
  font-size:10px!important;
  line-height:1!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:4px!important;
}

/* Doctor actions — keep the premium hierarchy but in the same compact footprint. */
.doctor-action-stack{
  width:var(--compact-action-width)!important;
  gap:5px!important;
}

.doctor-action-btn{
  width:var(--compact-action-width)!important;
  min-width:var(--compact-action-width)!important;
  max-width:var(--compact-action-width)!important;
  min-height:var(--compact-action-height)!important;
  height:var(--compact-action-height)!important;
  grid-template-columns:18px minmax(0,1fr) 11px!important;
  gap:5px!important;
  padding:3px 6px!important;
  border-radius:8px!important;
  box-shadow:0 3px 8px rgba(0,0,0,.12)!important;
}

.doctor-action-icon{
  width:18px!important;
  height:22px!important;
  padding-right:4px!important;
  font-size:13px!important;
}

.doctor-action-icon svg{
  width:15px!important;
  height:15px!important;
}

.doctor-action-label{
  font-size:10px!important;
  font-weight:800!important;
}

.doctor-action-chevron{
  font-size:17px!important;
}

.doctor-readonly-reason{
  width:var(--compact-action-width)!important;
  padding:5px 6px!important;
  border-radius:8px!important;
  font-size:7.5px!important;
}

/* Buttons inside production-card overflow menus should also be compact/equal. */
.production-card-menu button{
  min-height:32px!important;
  height:32px!important;
  padding:4px 8px!important;
  font-size:10px!important;
}

/* Mobile: still compact, but preserve a safe touch target and equal sizes. */
@media(max-width:860px){
  :root{
    --compact-action-width:100%;
    --compact-action-height:40px;
  }

  .mobile-card-actions{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:6px!important;
  }

  .mobile-card-actions > button,
  .mobile-touch-btn,
  .doctor-action-stack-mobile .doctor-action-btn{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    height:40px!important;
    min-height:40px!important;
    padding:5px 8px!important;
    border-radius:8px!important;
    font-size:11px!important;
  }

  .doctor-action-stack-mobile{
    width:100%!important;
    gap:6px!important;
    margin-top:8px!important;
  }

  .doctor-action-stack-mobile .doctor-action-btn{
    grid-template-columns:22px minmax(0,1fr) 13px!important;
  }

  .doctor-action-stack-mobile .doctor-action-icon{
    width:22px!important;
    height:24px!important;
    padding-right:5px!important;
  }

  .doctor-action-stack-mobile .doctor-action-label{
    font-size:11px!important;
  }

  .doctor-action-stack-mobile .doctor-action-chevron{
    font-size:18px!important;
  }

  .doctor-readonly-reason{
    width:100%!important;
  }
}


/* ===== V12.2 — USER-CARD LOGOUT + DOCTOR EXPORT ===== */

.user-card{
  align-items:flex-start;
}

.user-card-main{
  min-width:0;
  flex:1;
}

.user-logout-btn{
  width:auto!important;
  min-width:0!important;
  margin-top:7px;
  padding:3px 0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  color:rgba(255,255,255,.62)!important;
  font-size:9px!important;
  font-weight:700!important;
  line-height:1.2!important;
  text-align:left;
  cursor:pointer;
}

.user-logout-btn:hover{
  color:#e2c99d!important;
  text-decoration:underline;
  text-underline-offset:3px;
}

.user-logout-btn:focus-visible{
  outline:1px solid rgba(226,201,157,.55);
  outline-offset:3px;
}

/* No longer reserve a footer area just for logout. */
.sidebar-footer{
  display:none!important;
}

/* Locked/read-only Doctor keeps export visible and usable. */
.job-definition-form.doctor-readonly #orderCasePdfBtn,
.job-definition-form.doctor-mode #orderCasePdfBtn{
  display:inline-flex!important;
  opacity:1!important;
  pointer-events:auto!important;
  cursor:pointer!important;
}

@media(max-width:860px){
  .user-logout-btn{
    min-height:24px!important;
    padding:4px 0!important;
    font-size:10px!important;
  }
}


/* ===== V13 — CLINIC ↔ LAB NETWORK ===== */
.network-setup-card{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:center;
  margin-bottom:12px;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
}
.network-setup-card > div{display:grid;gap:4px}
.network-setup-card strong{font-size:12px}
.network-setup-card span{font-size:10px;color:var(--muted)}
.network-setup-card.pending{border-color:#d9c7aa;background:#fffaf2}
.network-setup-card.ready{border-color:#b7d7ca;background:#f4fbf8}
.network-setup-status{
  flex:0 0 auto;
  padding:5px 8px;
  border-radius:999px;
  border:1px solid currentColor;
  font-size:8px!important;
  font-weight:900;
  letter-spacing:.08em;
}

.network-tabs{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.network-tab{
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  border-radius:9px;
  padding:8px 11px;
  font-size:10px;
  font-weight:800;
  cursor:pointer;
}
.network-tab.active{
  border-color:#9b7643;
  background:#18140f;
  color:#f0d9b0;
}

.network-card{
  padding:16px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow);
}
.network-grid{
  display:grid;
  grid-template-columns:minmax(260px,.8fr) minmax(360px,1.2fr);
  gap:12px;
}
.network-card-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  margin-bottom:14px;
}
.network-card-head > div{display:grid;gap:4px}
.network-card-head strong{font-size:13px}
.network-card-head span{font-size:10px;color:var(--muted)}
.network-search-row{
  display:grid;
  grid-template-columns:1fr auto;
  gap:8px;
}
.network-empty{
  min-height:210px;
  display:grid;
  place-items:center;
  align-content:center;
  text-align:center;
  gap:8px;
  color:var(--muted);
  padding:30px 16px;
}
.network-empty strong{color:var(--text);font-size:12px}
.network-empty p{margin:0;max-width:580px;font-size:10px;line-height:1.5}
.network-empty-icon{
  display:grid;
  place-items:center;
  width:44px;
  height:44px;
  border-radius:50%;
  background:#f4eee5;
  color:#9b7643;
  font-size:21px;
}
.network-form-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-bottom:12px;
}
.network-field{
  display:grid;
  gap:5px;
  font-size:9px;
  color:var(--muted);
  font-weight:700;
}
.network-field input,
.network-field select,
.network-field textarea{
  width:100%;
  border:1px solid var(--border);
  border-radius:8px;
  padding:8px 9px;
  background:#fff;
  color:var(--text);
  font:inherit;
}
.network-wide{grid-column:1/-1}
.network-visibility-help{
  display:grid;
  gap:8px;
  margin-top:12px;
}
.network-visibility-help > div{
  display:grid;
  gap:2px;
  padding:8px 9px;
  border:1px solid #eee6dc;
  border-radius:9px;
  background:#fbfaf8;
}
.network-visibility-help strong{font-size:10px}
.network-visibility-help span{font-size:9px;color:var(--muted)}

/* ===== V13 — CASE FILES / SUPABASE STORAGE READY ===== */
.case-files-block{
  margin-top:14px;
  padding-top:13px;
  border-top:1px solid #3a332b;
}
.case-files-head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
}
.case-files-head h4{
  margin:2px 0 3px;
  font-size:12px;
}
.case-files-head p{
  margin:0;
  color:#968b7d;
  font-size:8.5px;
  line-height:1.35;
}
.case-files-plan-badge{
  flex:0 0 auto;
  border:1px solid #62513c;
  border-radius:999px;
  padding:4px 7px;
  color:#d9bd8d;
  background:#18140f;
  font-size:7.5px;
  font-weight:800;
}
.case-files-setup-notice{
  display:grid;
  gap:3px;
  margin-top:10px;
  padding:8px 9px;
  border:1px solid #4d4338;
  border-radius:9px;
  background:#12100e;
}
.case-files-setup-notice strong{font-size:8.5px;color:#e2cfb1}
.case-files-setup-notice span{font-size:7.8px;color:#958a7a;line-height:1.4}
.case-files-upload-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:7px;
  margin-top:9px;
  align-items:center;
}
.case-files-upload-row input[type="file"]{
  width:100%;
  min-width:0;
  font-size:8px;
  color:#b9ad9d;
}
.case-file-queue,
.case-file-list{
  display:grid;
  gap:6px;
  margin-top:8px;
}
.case-file-row{
  display:grid;
  grid-template-columns:32px minmax(0,1fr) auto;
  gap:8px;
  align-items:center;
  padding:7px 8px;
  border:1px solid #403831;
  border-radius:9px;
  background:#15120f;
}
.case-file-icon{
  width:32px;
  height:28px;
  display:grid;
  place-items:center;
  border-radius:7px;
  background:#2c241b;
  color:#dfbd82;
  font-size:7px;
  font-weight:900;
}
.case-file-main{
  min-width:0;
  display:grid;
  gap:2px;
}
.case-file-main strong{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:8.5px;
  color:#e9dfd1;
}
.case-file-main span{
  font-size:7.5px;
  color:#8e8375;
}
.case-file-empty{
  padding:8px;
  border:1px dashed #403831;
  border-radius:8px;
  color:#7f766b;
  font-size:7.8px;
}
.case-files-foot{
  display:flex;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap;
  margin-top:8px;
  color:#766d63;
  font-size:7px;
}

@media(max-width:860px){
  .network-grid{grid-template-columns:1fr}
  .network-form-grid{grid-template-columns:1fr}
  .network-wide{grid-column:auto}
  .case-files-head{display:grid}
  .case-files-plan-badge{width:max-content}
  .case-files-upload-row{grid-template-columns:1fr}
}


/* ===== V14 — SUPABASE AUTH / NICKNAME LOGIN ===== */
.login-card label{
  text-align:left;
}
.login-card input#loginUser{
  text-transform:none;
}
.user-role{
  line-height:1.35;
}


/* ===== V15 — LIVE SUPABASE FILE UPLOAD ===== */
.case-file-row.authorizing,
.case-file-row.uploading{
  border-color:#6b583e;
  background:#18140f;
}
.case-file-row.done{border-color:#40644f}
.case-file-row.error{border-color:#7c3d3d}

.case-file-state-dot{
  width:9px;height:9px;border-radius:50%;display:block;background:#8b8175;
}
.case-file-state-dot.authorizing,
.case-file-state-dot.uploading{
  border:2px solid #d5b57f;
  border-right-color:transparent;
  background:transparent;
  animation:caseFileSpin .8s linear infinite;
}
.case-file-state-dot.done{background:#5b9a73}
.case-file-actions{
  display:flex;gap:5px;flex-wrap:wrap;justify-content:flex-end;
}
.danger-mini{
  border-color:#6d3939!important;
  color:#d89a9a!important;
}
.case-file-empty.error{
  border-color:#6d3939;
  color:#d89a9a;
}
@keyframes caseFileSpin{to{transform:rotate(360deg)}}


/* ========================================================================== 
   V16 — FLOWRISE WHITE / GOLD / SILVER THEME
   Inspired by the supplied Flowrise Dental Studio identity.
   ========================================================================== */
:root{
  color-scheme:light;
  --bg:#f7f7f5;
  --panel:#ffffff;
  --panel-2:#faf9f6;
  --text:#262626;
  --muted:#77736c;
  --border:#e4e1da;
  --brand:#c79a39;
  --brand-light:#e6c56f;
  --brand-deep:#9e7422;
  --silver:#9da0a3;
  --brand-soft:#fff8e9;
  --danger:#b74a48;
  --success:#34795b;
  --shadow:0 10px 28px rgba(34,31,25,.065);
}
html,body{background:#f7f7f5!important;color:var(--text)!important}
body{background:linear-gradient(180deg,#ffffff 0,#f8f7f4 42%,#f5f4f1 100%)!important}

.login-screen{background:radial-gradient(circle at 50% 18%,#fffaf0 0,#fff 38%,#f3f2ef 100%)!important}
.login-card{background:#fff!important;border:1px solid #e8e3d9!important;box-shadow:0 26px 80px rgba(45,39,29,.12)!important}
.login-brand-image{max-height:230px!important;height:auto!important;object-fit:contain!important;background:#fff!important;box-shadow:none!important;border:0!important}
.login-card>p{color:var(--brand-deep)!important}.login-card label,.poc-note{color:var(--muted)!important}
.login-card input{background:#fff!important;color:var(--text)!important;border-color:var(--border)!important}
.login-card input:focus{border-color:var(--brand)!important;box-shadow:0 0 0 3px rgba(199,154,57,.12)!important}

.app-shell,.main{background:transparent!important}
.sidebar{background:#fff!important;color:var(--text)!important;border-right:1px solid var(--border)!important;box-shadow:8px 0 28px rgba(45,39,29,.035)!important}
.brand{padding-top:4px!important}.sidebar-brand-image{width:100%!important;height:auto!important;max-height:132px!important;object-fit:contain!important;background:#fff!important;border:0!important;border-radius:8px!important}
.user-card{background:#faf8f3!important;border-color:#ece6da!important}
.user-avatar{background:linear-gradient(145deg,#edcf81,#b8872e)!important;color:#fff!important;box-shadow:0 4px 12px rgba(177,128,37,.18)!important}
.user-name{color:#2c2b29!important}.user-role{color:#8a6a2d!important;opacity:1!important}
.logout-btn{background:#fff!important;color:#706c65!important;border-color:#ddd8cf!important}.logout-btn:hover{color:#9d7423!important;border-color:#c9a24d!important}
.nav-item{color:#625f59!important}.nav-item:hover{background:#faf7ef!important;color:#6f541e!important}
.nav-item.active{background:linear-gradient(90deg,#fff7e4,#fffdf8)!important;color:#815f1d!important;box-shadow:inset 3px 0 0 var(--brand)!important}

.topbar{background:rgba(255,255,255,.96)!important;border-bottom-color:var(--border)!important;box-shadow:0 8px 24px rgba(34,31,25,.035)!important}
.topbar h1{color:#262626!important}.topbar p,.refresh-meta{color:var(--muted)!important}
.connection-badge{background:#f3f2ef!important;color:#6f6b64!important;border:1px solid #e2dfd8!important}
.connection-badge.ok{background:#edf7f1!important;color:#2d7254!important;border-color:#d3eadc!important}
.connection-badge.error{background:#fff0ef!important;color:#a14340!important;border-color:#f0d2d0!important}

.primary-btn,.send-btn{background:linear-gradient(135deg,#dfbd64,#b8882d)!important;color:#fff!important;border-color:#b88931!important;box-shadow:0 7px 16px rgba(169,123,38,.14)!important}
.primary-btn:hover,.send-btn:hover{filter:brightness(1.035)!important}
.secondary-btn,.mini-btn,.tool-btn,.edit-btn{background:#fff!important;color:#5d5a54!important;border-color:#ddd9d1!important;box-shadow:none!important}
.secondary-btn:hover,.mini-btn:hover,.tool-btn:hover,.edit-btn:hover{border-color:#cba44d!important;color:#80601f!important;background:#fffaf0!important}
.secondary-btn.active-toggle{border-color:var(--brand)!important;color:#805f1e!important;background:#fff7e3!important}
.chip{background:#fff7e7!important;color:#86631f!important;border-color:#ead6a5!important}.chip:hover{background:#fff1cf!important}
.icon-btn{background:#f3f1ed!important;color:#55514b!important}.danger-btn{background:#fff!important;color:#a64543!important;border-color:#e5c6c4!important}.danger-btn:hover{background:#fff2f1!important;border-color:#d99d99!important;color:#923936!important}
.danger-mini{background:#fff!important;border-color:#e3bdbb!important;color:#a64b48!important}

.card,.panel{background:#fff!important;border-color:var(--border)!important;box-shadow:var(--shadow)!important;color:var(--text)!important}
.kpi-value{color:#6f541f!important}.kpi-label,.kpi-foot,.table-count{color:var(--muted)!important}
table{color:var(--text)!important;background:#fff!important}th{color:#80652f!important;background:#fbfaf7!important;border-bottom-color:#e2ded6!important}td{border-bottom-color:#ece9e2!important;background:#fff!important}tr:hover td{background:#fffaf1!important}.filter-row th{background:#f8f7f4!important}
.filter-input,.status-select,.paid-select,input,select,textarea{background:#fff;color:var(--text);border-color:#ddd9d1}
.filter-input:focus,.status-select:focus,.paid-select:focus,input:focus,select:focus,textarea:focus{outline:none;border-color:#c89b3c!important;box-shadow:0 0 0 3px rgba(199,154,57,.09)}

.kanban-col{background:#f4f2ed!important;border:1px solid #e6e2da!important}.kanban-title{color:#6c5525!important}.kanban-card,.stage-pill{background:#fff!important;border-color:#e1ddd5!important;box-shadow:0 6px 16px rgba(34,31,25,.05)!important}.kanban-meta{color:var(--muted)!important}.stage-name{color:#4f4b45!important}.stage-cost{color:#8b6722!important}

.ai-panel{background:#fff!important;border-left-color:var(--border)!important;box-shadow:-8px 0 28px rgba(45,39,29,.035)!important}.ai-header,.quick-actions{border-bottom-color:var(--border)!important}.ai-title{color:#6e5522!important}.ai-subtitle{background:#fff8e9!important;color:#81652c!important;border-color:#e8d5aa!important}.chat-messages{background:#fbfaf8!important}.msg.ai{background:#f2f1ee!important;color:#353330!important;border:1px solid #e4e0d8!important}.msg.user{background:linear-gradient(135deg,#dbb85d,#b7842b)!important;color:#fff!important}.chat-form textarea{background:#fff!important;color:var(--text)!important;border-color:#ddd9d1!important}.chat-hint,.voice-state{color:var(--muted)!important}

.modal-backdrop,.case-sheet-backdrop,.calendar-editor-backdrop{background:rgba(48,45,40,.30)!important;backdrop-filter:blur(4px)}
.modal,.case-sheet-modal,.calendar-editor-card{background:#fff!important;color:var(--text)!important;border:1px solid #e3dfd7!important;box-shadow:0 28px 80px rgba(38,34,28,.18)!important}.modal-header,.case-sheet-header{border-bottom-color:var(--border)!important}.modal-header h2,.case-sheet-header h2{color:#5f4a20!important}.modal-subtitle,.case-sheet-subtitle{color:var(--muted)!important}
.form-grid label,.job-definition-form label{color:#6f6a62!important}.form-grid input,.form-grid select,.job-definition-form input,.job-definition-form select,.job-definition-form textarea{background:#fff!important;color:var(--text)!important;border-color:#ddd9d1!important}.form-grid input[readonly],.job-definition-form input[readonly]{background:#f5f3ef!important;color:#6c6760!important}

.job-panel,.job-card,.job-price-summary,.case-card,.case-sheet-section,.tooth-editor-card,.order-tooth-popover,.case-file-dropzone,.case-file-row,.case-file-empty{background:#fff!important;color:var(--text)!important;border-color:#e3dfd7!important;box-shadow:none!important}.job-panel-head,.case-sheet-section-head{border-color:#ece8e0!important}.job-eyebrow{color:#9a762c!important}

.admin-config-shell,.admin-contract-detail,.admin-contract-list,.admin-create-card,.admin-user-editor-grid,.admin-config-section{background:#fff!important;color:var(--text)!important;border-color:#e3dfd7!important}.admin-config-tabs{background:#f5f3ef!important;border-color:#e3dfd7!important}.admin-config-tabs button{color:#69645d!important}.admin-config-tabs button.active{background:#fff!important;color:#7f5f1e!important;border-color:#d9bd7d!important;box-shadow:0 5px 12px rgba(50,43,31,.05)!important}.admin-contract-items button{background:#fff!important;color:#5f5b55!important;border-color:#e4e0d8!important}.admin-contract-items button.active{background:#fff7e5!important;color:#7b5d20!important;border-color:#dbbf7d!important}.admin-pane-title,.admin-section-head{color:#4c4944!important}.admin-empty-small{color:var(--muted)!important}
.admin-config-toolbar{gap:10px!important;align-items:center!important;flex-wrap:wrap!important}.admin-bulk-tools{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:wrap}.admin-csv-upload-label{display:inline-flex!important;align-items:center;cursor:pointer}.admin-bulk-hint,.legacy-admin-note{font-size:11px;color:#8b867e}.legacy-admin-note{margin-left:auto}

.calendar-shell,.calendar-grid,.calendar-day,.materials-toolbar,.network-card,.network-tab-panel,.partnership-card,.mobile-order-card,.mobile-kanban-card{background:#fff!important;color:var(--text)!important;border-color:#e4e0d8!important}.calendar-day.is-outside{background:#f7f6f3!important}.material-low-stock td{background:#fff9e8!important}

.flow-loading-card{background:#fff!important;color:var(--text)!important;border-color:#dedad2!important;box-shadow:0 14px 40px rgba(34,31,25,.12)!important}.flow-loading-card div:last-child div{color:var(--muted)!important}.spinner{border-color:#ece7dc!important;border-top-color:var(--brand)!important}.empty-state{color:var(--muted)!important}.error-text{color:var(--danger)!important}

::-webkit-scrollbar-track{background:#f4f3f0!important}::-webkit-scrollbar-thumb{background:#d3cec4!important}::-webkit-scrollbar-thumb:hover{background:#bcb5aa!important}

@media(max-width:860px){.sidebar{box-shadow:10px 0 35px rgba(40,35,28,.10)!important}.mobile-bottom-nav{background:#fff!important;border-top-color:#e1ddd5!important}.mobile-nav-item{color:#6a665f!important}.mobile-nav-item.active{color:#8a6824!important;background:#fff8e9!important}}


/* ==========================================================================
   V16.1 — COMPLETE LIGHT POLISH
   Removes remaining dark legacy surfaces and aligns contrast with the
   white / gold / silver Flowrise identity.
   ========================================================================== */

:root{
  --surface:#ffffff;
  --surface-soft:#faf9f6;
  --surface-muted:#f3f1ed;
  --surface-gold:#fff8e9;
  --ink:#292824;
  --ink-soft:#625f59;
  --line:#e2ded6;
}

/* Legacy dark components → light surfaces */
.sidebar-footer .secondary-btn,
.mobile-menu-btn,
.mobile-ai-close,
.mobile-clear-search,
.mobile-status-badge,
.mobile-deadline,
.mobile-card-grid>div,
.mobile-production-section,
.modal-header,
.report-filter-grid select,
.report-filter-grid input,
.admin-add-grid,
.admin-add-grid input,
.admin-add-grid select,
.admin-config-table input,
.admin-config-table select,
.admin-contract-delete select,
.desktop-panel-collapse,
.desktop-panel-expand,
.case-sheet-header,
.case-sheet-footer,
.case-summary-grid>div,
.case-selected-line,
.case-prescription-grid input,
.case-prescription-grid select,
.case-prescription-grid textarea,
.case-selected-table input,
.job-definition-strip,
.job-strip-item,
.job-field-grid input,
.job-field-grid select,
.job-prescription-grid input,
.job-prescription-grid select,
.job-notes-block textarea,
.production-stage-card select,
.order-selected-table input,
.production-stage-card,
.order-work-type-legend,
.tooth-popover-preview,
.tooth-popover-fields input,
.tooth-popover-fields select,
.tooth-popover-fields textarea,
.job-tooth-panel,
.tooth-view-btn,
.tooth-clear-all,
.tooth-detail-fields select,
.tooth-detail-fields input,
.tooth-detail-fields textarea,
.case-defaults-details,
.tooth-center-tools,
.tooth-clear-compact,
.partial-suggestions,
.order-tooth-popover .tooth-popover-fields input,
.order-tooth-popover .tooth-popover-fields textarea,
.order-tooth-popover .tooth-popover-fields select,
.order-tooth-popover .partial-suggestions,
.kanban-card-menu,
.range-date-input input,
.range-date-input button,
.calendar-day,
.calendar-day-outside,
.calendar-editor-grid input,
.calendar-editor-grid select,
.calendar-editor-grid textarea,
.material-qty-control button,
.work-quick-filter-grid select,
.doctor-partner-context,
.doctor-status-readonly,
.doctor-mobile-grid>div,
.job-definition-form.doctor-mode #orderToothMaterial,
.job-definition-form.doctor-mode #orderToothNote,
.admin-user-create-grid input,
.admin-user-create-grid select,
.admin-user-editor-grid input,
.admin-user-editor-grid select,
.admin-user-create-grid .admin-checkbox-label,
.admin-user-editor-grid .admin-checkbox-label,
.admin-user-editor-grid,
.doctor-readonly-reason,
.job-definition-form.doctor-readonly input:disabled,
.job-definition-form.doctor-readonly select:disabled,
.job-definition-form.doctor-readonly textarea:disabled,
.doctor-production-note,
.doctor-production-status,
.network-tab.active,
.case-files-plan-badge,
.case-files-setup-notice,
.case-file-row,
.case-file-row.authorizing,
.case-file-row.uploading{
  background:var(--surface)!important;
  color:var(--ink)!important;
  border-color:var(--line)!important;
  box-shadow:none!important;
}

/* Soft cards / read-only fields */
.mobile-card-grid>div,
.case-summary-grid>div,
.job-definition-strip,
.job-strip-item,
.case-defaults-details,
.doctor-readonly-reason,
.doctor-production-note,
.case-files-setup-notice,
.job-definition-form.doctor-readonly input:disabled,
.job-definition-form.doctor-readonly select:disabled,
.job-definition-form.doctor-readonly textarea:disabled{
  background:var(--surface-soft)!important;
  color:var(--ink-soft)!important;
}

.modal-header,
.case-sheet-header,
.case-sheet-footer{
  background:#fff!important;
}

.case-selected-line.warning,
.order-tooth-mismatch{
  background:#fff8e8!important;
  color:#87641f!important;
  border-color:#ead39d!important;
}

.tooth-view-btn.active,
.network-tab.active{
  background:#fff6df!important;
  color:#7a5b1c!important;
  border-color:#d9ba73!important;
}

.tooth-clear-all:hover,
.tooth-clear-compact:hover{
  background:#fff4f2!important;
  color:#98423f!important;
  border-color:#e6bbb8!important;
}

.case-file-icon{
  background:#f1eee7!important;
  color:#6c6253!important;
  border-color:#ded8ce!important;
}

.case-files-plan-badge{
  background:#fff6df!important;
  color:#7d5d1c!important;
  border-color:#e2c47c!important;
}

/* Light semantic status pills */
.production-mini-status.stage-status-not-started{
  background:#f1f1f0!important;
  color:#62615e!important;
  border-color:#d9d8d5!important;
}
.production-mini-status.stage-status-started{
  background:#eef5ff!important;
  color:#315f92!important;
  border-color:#cbdcf0!important;
}
.production-mini-status.stage-status-finished{
  background:#eef8f1!important;
  color:#347052!important;
  border-color:#cfe5d6!important;
}
.calendar-type-meeting{background:#edf8f5!important;color:#367668!important}
.calendar-type-payment{background:#fff6e7!important;color:#8a6422!important}
.calendar-type-order{background:#f3f0fb!important;color:#69558d!important}
.calendar-type-delivery{background:#eef4fb!important;color:#466c99!important}
.calendar-type-reminder{background:#fff0ef!important;color:#9a4b46!important}
.calendar-type-other{background:#f2f2f1!important;color:#62615e!important}
.low-stock-badge{background:#fff0ee!important;color:#a24742!important;border-color:#ebc4c0!important}

/* Inputs / menus / popovers */
.order-tooth-popover{
  background:#fff!important;
  color:var(--ink)!important;
  border-color:#ddd7cc!important;
  box-shadow:0 18px 50px rgba(45,39,29,.16)!important;
}
.tooth-popover-kicker{color:#9a7426!important}
.tooth-popover-head h4{color:#403a31!important}
.tooth-popover-meta,
.tooth-popover-fields label{color:#777168!important}
.tooth-popover-actions{border-top-color:#e6e1d8!important}
.partial-suggestions{
  box-shadow:0 12px 30px rgba(45,39,29,.12)!important;
}
.partial-suggestions button{
  background:#fff!important;
  color:#4f4c47!important;
  border-color:#ece8e0!important;
}
.partial-suggestions button:hover{
  background:#fff8e9!important;
  color:#7a5b1d!important;
}

/* File upload states */
.case-file-row.done{
  background:#f2faf5!important;
  border-color:#cfe4d6!important;
}
.case-file-row.error{
  background:#fff3f2!important;
  border-color:#e7c0bd!important;
}
.case-file-state-dot{background:#b1ada5!important}
.case-file-state-dot.done{background:#4f916c!important}

/* Keep overlays translucent, but neutral rather than black-heavy */
.modal-backdrop,
.case-sheet-backdrop,
.calendar-editor-backdrop,
.mobile-backdrop,
.material-save-overlay{
  background:rgba(54,50,43,.28)!important;
}

/* Calendar / admin / tables */
.admin-config-table::-webkit-scrollbar-track,
::-webkit-scrollbar-track{background:#f5f3ef!important}
::-webkit-scrollbar-thumb,
.admin-config-table::-webkit-scrollbar-thumb{background:#cbc5bb!important}
.calendar-day:hover{background:#fffaf0!important}
.calendar-day-outside{background:#faf9f6!important;color:#9b978f!important}

/* Remove the remaining dark priority-card/control surfaces */
.kanban-card.deadline-priority-grey,
.kanban-card.deadline-priority-gold,
.kanban-card.deadline-priority-red{
  background:#fff!important;
}
.kanban-card.deadline-priority-grey .status-select,
.kanban-card.deadline-priority-gold .status-select,
.kanban-card.deadline-priority-red .status-select{
  background:#fff!important;
  color:#4f4c47!important;
  border-color:#ddd8cf!important;
}
.kanban-menu-btn:hover{background:#f5f2ec!important}

/* Tooth chart — reference-like neutral enamel */
.reference-odontogram .tooth-render{
  filter:drop-shadow(0 2px 2px rgba(35,35,35,.14))!important;
}
.reference-odontogram .tooth-svg-group:not(.selected) .tooth-svg-shape{
  fill:#d2d2d0!important;
  stroke:#565654!important;
}
.reference-odontogram .tooth-svg-group:not(.selected) .tooth-anatomy,
.reference-odontogram .tooth-svg-group:not(.selected) .tooth-cusp{
  stroke:#747472!important;
  opacity:.82!important;
}
.reference-odontogram .tooth-svg-group:not(.selected) .tooth-highlight{
  stroke:rgba(255,255,255,.78)!important;
}
.reference-inside-label{
  fill:#222221!important;
  stroke:#f5f5f3!important;
  stroke-width:2.6px!important;
  font-size:16px!important;
}
.reference-odontogram .active-tooth-halo{
  stroke:rgba(199,154,57,.34)!important;
  filter:drop-shadow(0 0 6px rgba(199,154,57,.22))!important;
}
.chart-divider{stroke:#e6e1d8!important}
.arch-center-letter{fill:#b4afa6!important}

/* Work Orders — significantly smaller desktop action buttons only */
.management-order-actions{
  gap:4px!important;
  flex-wrap:nowrap!important;
}
.management-order-actions > button{
  width:auto!important;
  min-width:0!important;
  max-width:none!important;
  height:26px!important;
  min-height:26px!important;
  padding:2px 6px!important;
  border-radius:6px!important;
  font-size:8.5px!important;
  line-height:1!important;
  font-weight:750!important;
  gap:2px!important;
}
.management-order-actions .lock-btn{
  width:auto!important;
  min-width:0!important;
  max-width:none!important;
  height:26px!important;
  min-height:26px!important;
  padding:2px 6px!important;
  font-size:8.5px!important;
  background:#fffaf0!important;
  color:#80601f!important;
  border-color:#dec688!important;
}
.management-order-actions .lock-btn.is-locked{
  background:#fff2d9!important;
  color:#765313!important;
  border-color:#cba44d!important;
  box-shadow:none!important;
}

/* Mobile stays touchable, but visually lighter/less bulky */
.mobile-card-actions .mobile-touch-btn{
  min-height:36px!important;
  height:36px!important;
  padding:5px 8px!important;
  font-size:10px!important;
  border-radius:7px!important;
}

/* Dashboard layout: AI panel disappears completely. */
.app-shell.dashboard-role-mode{
  grid-template-columns:220px minmax(0,1fr)!important;
}
.app-shell.dashboard-role-mode .ai-panel,
.app-shell.dashboard-role-mode .ai-expand-btn{
  display:none!important;
}
.app-shell.dashboard-role-mode .main{
  margin-right:0!important;
}

@media(max-width:1180px){
  .app-shell.dashboard-role-mode{
    grid-template-columns:190px minmax(0,1fr)!important;
  }
}
@media(max-width:860px){
  .app-shell.dashboard-role-mode{
    grid-template-columns:1fr!important;
  }
}

/* Dark-text cleanup on white surfaces */
.job-count-badge,
.order-lock-badge{
  background:#fff5de!important;
  color:#7b5d20!important;
  border-color:#dfc37e!important;
}


/* ==========================================================================
   V16.2 — FINAL PALETTE ENFORCEMENT
   White / warm-white surfaces, graphite text, gold accents, silver borders.
   This section intentionally comes LAST so legacy dark-theme rules cannot win.
   ========================================================================== */
:root{
  --bg:#f7f6f3!important;
  --panel:#ffffff!important;
  --panel-2:#fbfaf7!important;
  --text:#292824!important;
  --muted:#746f67!important;
  --border:#e2ddd3!important;
  --brand:#c99a36!important;
  --brand-light:#d7b15b!important;
  --brand-deep:#9a6f1f!important;
  --silver:#a7a39c!important;
  --brand-soft:#fff7e5!important;
  --danger:#a84b47!important;
  --success:#3e815e!important;
  --shadow:0 10px 28px rgba(52,46,37,.08)!important;
  --surface:#ffffff!important;
  --surface-soft:#faf9f6!important;
  --surface-muted:#f3f1ed!important;
  --ink:#292824!important;
  --ink-soft:#68635c!important;
  --line:#e3ded5!important;
}

html,body,.app-shell,.main,.view,.login-screen{
  background:#f7f6f3!important;
  color:#292824!important;
}

/* Work Orders filter area specifically visible in the supplied screenshot */
.date-range-filter-card,
.work-quick-filter-card{
  background:#ffffff!important;
  color:#292824!important;
  border-color:#e2ddd3!important;
  box-shadow:0 6px 20px rgba(52,46,37,.045)!important;
}
.date-range-filter-head strong,
.work-quick-filter-head strong{
  color:#39352f!important;
}
.date-range-filter-head span,
.work-quick-filter-head span,
.date-range-group label,
.work-quick-filter-grid label,
.range-filter-note{
  color:#777168!important;
}
.date-range-label{
  color:#9a7022!important;
}
.date-range-group{
  border-left-color:#d8bc7c!important;
}
.range-date-input input,
.work-quick-filter-grid select{
  background:#fff!important;
  color:#35322d!important;
  border-color:#dcd6cc!important;
}
.range-date-input button{
  background:#fff8e8!important;
  color:#8a6420!important;
  border-color:#dec47f!important;
}

/* General cards / tables / side panels */
.card,.panel,.kanban-col,.kanban-card,.stage-pill,.ai-panel,.msg.ai,
.admin-contract-list,.admin-contract-detail,.admin-contract-items button,
.admin-config-tabs,.admin-create-card,.mobile-summary-card,.mobile-kanban-card,
.mobile-production-section,.case-sheet,.case-sheet-body,.job-tooth-panel,
.tooth-popover-preview,.calendar-day,.calendar-editor,.materials-card,
.login-card,.flow-loading-card{
  background:#fff!important;
  color:#292824!important;
  border-color:#e2ddd3!important;
  box-shadow:0 6px 22px rgba(52,46,37,.055)!important;
}

th,.filter-row th{
  background:#f5f1e9!important;
  color:#4c443a!important;
  border-color:#ddd7cc!important;
}
td{border-color:#ece8e1!important}
tr:hover td{background:#fffaf0!important}

.filter-input,.status-select,.paid-select,.chat-form textarea,
.form-grid input,.form-grid select,.form-grid textarea,
.admin-config-table input,.admin-config-table select,
.calendar-editor-grid input,.calendar-editor-grid select,.calendar-editor-grid textarea{
  background:#fff!important;
  color:#35322d!important;
  border-color:#dcd6cc!important;
}

.secondary-btn,.mini-btn,.tool-btn,.icon-btn,.edit-btn,.mobile-menu-btn,
.desktop-panel-collapse,.desktop-panel-expand{
  background:#fff!important;
  color:#58534c!important;
  border-color:#ddd7cd!important;
  box-shadow:none!important;
}
.secondary-btn:hover,.mini-btn:hover,.tool-btn:hover,.icon-btn:hover,.edit-btn:hover{
  background:#fff8e9!important;
  color:#7d5b1d!important;
  border-color:#d8bb78!important;
}

/* Keep primary CTAs gold, not black */
.primary-btn,.send-btn,.header-new-order-btn{
  background:linear-gradient(180deg,#d9af55,#c79229)!important;
  color:#fff!important;
  border-color:#b88321!important;
}

/* AI surface follows the same light product palette */
.ai-header,.quick-actions{
  border-color:#e4dfd7!important;
}
.ai-title{color:#7d5d1f!important}
.ai-subtitle,.chat-hint,.voice-state,.kanban-meta{color:#777168!important}
.chat-form textarea:focus,.filter-input:focus,.status-select:focus,.paid-select:focus{
  border-color:#c99a36!important;
  box-shadow:0 0 0 2px rgba(201,154,54,.10)!important;
}

/* Admin workspace */
.admin-config-tabs button{
  color:#69645d!important;
}
.admin-config-tabs button.active,
.admin-contract-items button.active{
  background:#fff7e5!important;
  color:#7b5a1c!important;
  border-color:#d9bd7b!important;
  box-shadow:none!important;
}
.admin-pane-title{color:#5c5143!important}
.admin-pane-title span,.admin-empty-small{color:#817a71!important}

/* Production */
.kanban-title,.stage-name{color:#6c5428!important}
.stage-cost{color:#8a681f!important}

/* Login */
.login-card{
  background:#fff!important;
  border-color:#e0dbd1!important;
  box-shadow:0 24px 65px rgba(56,48,37,.10)!important;
}

/* Neutral scrollbars */
::-webkit-scrollbar-track{background:#f3f1ed!important}
::-webkit-scrollbar-thumb{background:#c9c4ba!important;border-color:#f3f1ed!important}

/* Neutral overlays — not visually black */
.modal-backdrop,.case-sheet-backdrop,.calendar-editor-backdrop,.mobile-backdrop,.material-save-overlay{
  background:rgba(80,74,65,.20)!important;
}


/* Auto-neutralized legacy dark-surface selectors: 132 */
.login-screen,
.sidebar,
body,
/* Login */ .login-screen,
.login-card,
.login-card input,
.sidebar-footer .secondary-btn,
.connection-badge,
.connection-badge.ok,
.connection-badge.error,
.secondary-btn,
.mini-btn,.tool-btn,
.chip,
.chip:hover,
.icon-btn,
/* Cards + tables */ .card,
.panel,
th,
tr:hover td,
.filter-row th,
.filter-input,
.edit-btn,
.status-select,.paid-select,
/* Production */ .kanban-col,
.kanban-card,
.stage-pill,
/* AI panel */ .ai-panel,
.msg.ai,
.chat-form textarea,
.tool-btn.recording,
.modal,
.form-grid input,.form-grid select,
.form-grid input[readonly],
.flow-loading-card,
.danger-btn{
  background:#fff!important;
  color:#292824!important;
  border-color:#e2ddd3!important;
  box-shadow:none!important;
}
.danger-btn:hover,
.secondary-btn.active-toggle,
/* ===== V8.5 — IN-CHAT AI THINKING / LOADING ===== */ .thinking-msg,
.mobile-menu-btn,
.mobile-ai-close,
.mobile-list-toolbar,
.mobile-clear-search,
.mobile-order-card, .mobile-summary-card, .mobile-kanban-card,
.mobile-status-badge, .mobile-deadline,
.mobile-card-grid>div,
.mobile-production-section,
.modal-header,
.modal-actions,
/* ===== V8.7 — PARTNER / TECHNICIAN PDF REPORT FILTERS ===== */ .report-filter-panel,
.report-filter-grid select, .report-filter-grid input,
.admin-add-grid,
.admin-add-grid input,.admin-add-grid select, .admin-config-table input,.admin-config-table select, .admin-contract-delete select,
.admin-create-card,
.desktop-panel-collapse,
.desktop-panel-expand,
.case-sheet-modal,
.case-sheet-header, .case-sheet-footer,
.case-summary-grid>div,
.case-card,
.case-selected-line,
.case-selected-line.warning,
.case-prescription-grid input, .case-prescription-grid select, .case-prescription-grid textarea, .case-selected-table input,
.job-definition-strip,
.job-strip-item,
.job-strip-item.active,
.job-panel,
.job-count-badge,
.job-field-grid input, .job-field-grid select, .job-prescription-grid input, .job-prescription-grid select, .job-notes-block textarea, .production-stage-card select,
.order-selected-table input,
.production-stage-card{
  background:#fff!important;
  color:#292824!important;
  border-color:#e2ddd3!important;
  box-shadow:none!important;
}
.job-price-summary,
.order-work-type-legend,
/* Case-level fields remain accessible but out of the way. */ .case-defaults-details,
.partial-suggestions,
.job-definition-form.edit-mode .job-production-panel .production-stage-card,
.job-definition-form.edit-mode .job-production-panel .job-price-summary,
.date-picker-btn,
.date-picker-btn:hover,
/* ===== V10.22 — PRODUCTION KANBAN DRAG & DROP ===== */ .production-drag-hint,
body.kanban-drag-active .kanban-col.drag-over,
/* Neînceput = grey */ .production-mini-status.stage-status-not-started,
/* În lucru = blue */ .production-mini-status.stage-status-started,
/* Finalizat = green */ .production-mini-status.stage-status-finished,
.kanban-card-menu,
/* Keep controls readable on the light priority cards. */ .kanban-card.deadline-priority-grey .status-select, .kanban-card.deadline-priority-gold .status-select, .kanban-card.deadline-priority-red .status-select,
.production-tomorrow-alert,
/* ===== V10.25 — DEADLINE GLOW, DARK CARD SURFACE ===== */ /* Urgency no longer fills the whole work-order card. It is communicated through: - luminous border - subtle outer/inset glow - title color Existing deadline logic is unchanged. */ /* Reset all urgency cards to the normal dark Flowrise surface. */ .kanban-card.deadline-priority-grey, .kanban-card.deadline-priority-gold, .kanban-card.deadline-priority-red,
.mobile-kanban-card.deadline-priority-grey, .mobile-kanban-card.deadline-priority-gold, .mobile-kanban-card.deadline-priority-red,
/* Keep normal dark controls inside the card. */ .kanban-card.deadline-priority-grey .status-select, .kanban-card.deadline-priority-gold .status-select, .kanban-card.deadline-priority-red .status-select,
/* ===== V11 — OPERATIONS POC: DATE RANGES / CALENDAR / MATERIALS / ADMIN UX ===== */ /* Today deadline badge */ .production-today-alert,
/* Date-range controls */ .date-range-filter-card,
.range-date-input input,
.range-date-input button,
.admin-config-tabs,
.admin-contract-list,.admin-contract-detail,
.admin-contract-items button,
.admin-contract-items button.active,
.calendar-day,
.calendar-day-outside,
.calendar-day-today,
.calendar-type-meeting,
.calendar-type-payment,
.calendar-type-order,
.calendar-type-delivery,
.calendar-type-reminder{
  background:#fff!important;
  color:#292824!important;
  border-color:#e2ddd3!important;
  box-shadow:none!important;
}
.calendar-type-other,
.calendar-editor-card,
.calendar-editor-grid input,.calendar-editor-grid select,.calendar-editor-grid textarea,
.material-qty-control button,
.low-stock-badge,
/* ===== V11.2 — WORK ORDER QUICK FILTERS ===== */ .work-quick-filter-card,
.work-quick-filter-grid select,
.job-definition-form.doctor-mode #status:disabled,
.doctor-partner-context,
.doctor-status-readonly,
.doctor-mobile-grid>div,
.job-definition-form.doctor-mode #orderToothMaterial, .job-definition-form.doctor-mode #orderToothNote,
.doctor-action-export:hover,
.doctor-action-delete:hover,
.admin-user-create-grid input, .admin-user-create-grid select, .admin-user-editor-grid input, .admin-user-editor-grid select,
.admin-user-create-grid .admin-checkbox-label, .admin-user-editor-grid .admin-checkbox-label,
.admin-user-editor-grid,
/* ===== V12 — DOCTOR READ ONLY ===== */ .doctor-readonly-reason,
.job-definition-form.doctor-readonly input:disabled, .job-definition-form.doctor-readonly select:disabled, .job-definition-form.doctor-readonly textarea:disabled,
/* ===== V12 — DOCTOR PRODUCTION ===== */ .doctor-production-note,
.doctor-production-status,
.network-tab.active,
.case-files-plan-badge,
.case-files-setup-notice,
.case-file-row,
.case-file-icon,
/* ===== V15 — LIVE SUPABASE FILE UPLOAD ===== */ .case-file-row.authorizing, .case-file-row.uploading{
  background:#fff!important;
  color:#292824!important;
  border-color:#e2ddd3!important;
  box-shadow:none!important;
}

/* Screenshot-specific final priority */
.date-range-filter-card,.work-quick-filter-card{
  background:#fff!important;
  color:#292824!important;
}
.date-range-filter-card *,
.work-quick-filter-card *{
  text-shadow:none!important;
}


/* ==========================================================================
   V17.5 — FINAL UI POLISH
   Light dental editor, stronger gold contrast, mobile Work Order editor.
   ========================================================================== */

:root{
  --brand:#b57908!important;
  --brand-light:#d19a2d!important;
  --brand-deep:#744900!important;
  --brand-soft:#fff3d5!important;
  --text:#25231f!important;
  --muted:#6d675e!important;
  --border:#ded7ca!important;
}

/* Stronger readable gold on white */
.nav-item.active,
.mobile-nav-item.active,
.job-eyebrow,
.tooth-center-tool-title,
.tooth-popover-kicker,
.admin-pane-title,
.ai-title,
.mobile-id,
.kanban-title,
.stage-name{
  color:#7b5005!important;
}

.nav-icon,
.nav-item.active .nav-icon{
  color:#a96f06!important;
  opacity:1!important;
  text-shadow:none!important;
}

.primary-btn,
.send-btn,
.header-new-order-btn{
  background:linear-gradient(180deg,#c58a18,#aa6e05)!important;
  color:#fff!important;
  border-color:#8f5900!important;
  box-shadow:0 4px 10px rgba(143,89,0,.16)!important;
}

.primary-btn:hover,
.send-btn:hover,
.header-new-order-btn:hover{
  background:linear-gradient(180deg,#b97c0d,#965f00)!important;
  color:#fff!important;
}

.secondary-btn.active-toggle,
.tooth-view-btn.active,
.admin-config-tabs button.active,
.admin-contract-items button.active,
.network-tab.active{
  background:#fff0c7!important;
  color:#704600!important;
  border-color:#bf8412!important;
}

a,
.link-btn{
  color:#815400!important;
}

/* --------------------------------------------------------------------------
   DENTAL EDITOR: no dark surfaces anywhere
   -------------------------------------------------------------------------- */
.job-tooth-panel,
.tooth-studio-titlebar,
.tooth-studio-shell,
.tooth-studio-center,
.order-tooth-chart,
.tooth-center-tools,
.case-defaults-details,
.tooth-editor-hint{
  background:#fff!important;
  color:#292824!important;
  border-color:#ded7ca!important;
  box-shadow:none!important;
}

.job-tooth-panel{
  border:1px solid #d8c9aa!important;
}

.tooth-studio-titlebar{
  border-bottom:1px solid #e3ddd2!important;
}

.tooth-studio-titlebar h3{
  color:#292824!important;
}

.tooth-studio-titlebar p,
.tooth-editor-hint{
  color:#706a61!important;
}

.tooth-center-tools{
  border-bottom:1px solid #e6dfd4!important;
}

.tooth-center-tool-title{
  color:#79500a!important;
}

.order-work-type-legend,
.legend-vertical-list,
.legend-item{
  background:#fff!important;
  color:#4e4942!important;
  border-color:#e4ddd2!important;
}

.legend-item span,
.legend-vertical-list span,
.order-work-type-legend span{
  color:#514d46!important;
  opacity:1!important;
}

.tooth-view-btn,
.tooth-clear-compact{
  background:#fff!important;
  color:#36322d!important;
  border-color:#d8d0c4!important;
}

.tooth-view-btn:hover,
.tooth-clear-compact:hover{
  background:#fff7e5!important;
  color:#714800!important;
  border-color:#c89228!important;
}

.tooth-view-btn.active{
  background:#fff1cb!important;
  color:#6f4700!important;
  border-color:#b97b0b!important;
  box-shadow:0 0 0 1px rgba(185,123,11,.08)!important;
}

.order-tooth-chart{
  background:
    radial-gradient(circle at 50% 46%,#fff 0,#fff 42%,#fbfaf7 100%)!important;
}

.tooth-editor-hint{
  border-top:1px solid #e8e2d8!important;
}

.case-defaults-details{
  border-top:1px solid #e5ded2!important;
}

.case-defaults-details summary{
  color:#625d55!important;
}

/* Edit mode panels were still carrying legacy dark gradients. */
.job-definition-form.edit-mode .job-project-panel,
.job-definition-form.edit-mode .job-production-panel,
.job-definition-form.edit-mode .job-production-panel .production-stage-card,
.job-definition-form.edit-mode .job-production-panel .job-price-summary{
  background:#fff!important;
  color:#292824!important;
  border-color:#d9d1c5!important;
  box-shadow:none!important;
}

.job-definition-form.edit-mode .job-project-panel{
  border-top:3px solid #b87b0b!important;
}

.job-definition-form.edit-mode .job-production-panel{
  border-top:3px solid #8e9499!important;
}

.job-definition-form.edit-mode .job-project-panel .job-eyebrow,
.job-definition-form.edit-mode .job-project-panel .job-panel-head h3{
  color:#724900!important;
}

.job-definition-form.edit-mode .job-production-panel .job-eyebrow,
.job-definition-form.edit-mode .job-production-panel .job-panel-head h3,
.job-definition-form.edit-mode .job-production-panel .production-stage-title{
  color:#555d63!important;
}

.job-definition-form.edit-mode .job-project-panel label,
.job-definition-form.edit-mode .job-production-panel label,
.job-definition-form.edit-mode .job-production-panel .job-price-summary span{
  color:#68625a!important;
}

.job-definition-form.edit-mode .job-project-panel input,
.job-definition-form.edit-mode .job-project-panel select,
.job-definition-form.edit-mode .job-project-panel textarea,
.job-definition-form.edit-mode .job-production-panel select,
.job-definition-form.edit-mode .job-production-panel input{
  background:#fff!important;
  color:#292824!important;
  border-color:#d8d1c6!important;
}

.job-definition-form.edit-mode .job-project-panel input:focus,
.job-definition-form.edit-mode .job-project-panel select:focus,
.job-definition-form.edit-mode .job-project-panel textarea:focus{
  border-color:#b57908!important;
  box-shadow:0 0 0 2px rgba(181,121,8,.12)!important;
}

.job-definition-form.edit-mode .job-production-panel select:focus{
  border-color:#818990!important;
  box-shadow:0 0 0 2px rgba(129,137,144,.11)!important;
}

/* Tooth popup also follows the light palette. */
.order-tooth-popover,
.order-tooth-popover .partial-suggestions{
  background:#fff!important;
  color:#292824!important;
  border-color:#d9d1c5!important;
}

.order-tooth-popover .primary-btn{
  background:linear-gradient(180deg,#c58a18,#aa6e05)!important;
  color:#fff!important;
  border-color:#8f5900!important;
}

.order-tooth-popover .secondary-btn{
  background:#fff!important;
  color:#4c4740!important;
  border-color:#d5cec2!important;
}

.order-tooth-popover .danger-btn{
  background:#fff5f3!important;
  color:#9a403b!important;
  border-color:#dfb5b1!important;
}

.order-tooth-popover .partial-suggestion-item{
  color:#403c36!important;
}

.order-tooth-popover .partial-suggestion-item:hover{
  background:#fff5dc!important;
  color:#704700!important;
}

.order-tooth-popover .partial-suggestion-empty{
  color:#777168!important;
}

.order-tooth-popover .tooth-popover-actions{
  border-top-color:#e4ddd3!important;
}

/* --------------------------------------------------------------------------
   LOCK BUTTON — identical footprint for locked and unlocked labels
   -------------------------------------------------------------------------- */
.management-order-actions .lock-btn{
  width:94px!important;
  min-width:94px!important;
  max-width:94px!important;
  height:28px!important;
  min-height:28px!important;
  padding:2px 4px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  font-size:8.5px!important;
}

.management-order-actions .lock-btn.is-locked{
  width:94px!important;
  min-width:94px!important;
  max-width:94px!important;
}

/* --------------------------------------------------------------------------
   MOBILE WORK ORDER EDITING — full-screen, scrollable, touch friendly
   -------------------------------------------------------------------------- */
@media(max-width:860px){
  .modal-backdrop{
    padding:0!important;
    background:rgba(66,60,51,.20)!important;
    align-items:stretch!important;
  }

  .modal{
    width:100vw!important;
    height:100dvh!important;
    max-width:none!important;
    max-height:100dvh!important;
    border:0!important;
    border-radius:0!important;
    background:#fff!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
  }

  .modal-header{
    position:sticky!important;
    top:0!important;
    z-index:20!important;
    flex:0 0 auto!important;
    padding:calc(10px + env(safe-area-inset-top)) 12px 10px!important;
    background:#fff!important;
    border-bottom:1px solid #e2dbcf!important;
    box-shadow:0 4px 14px rgba(55,48,38,.06)!important;
  }

  .modal-header h2{
    color:#292824!important;
    font-size:19px!important;
  }

  .modal-subtitle{
    color:#706a61!important;
    font-size:11px!important;
    line-height:1.35!important;
  }

  #orderForm.job-definition-form{
    flex:1 1 auto!important;
    min-height:0!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
    background:#fff!important;
  }

  #orderForm .job-definition-layout{
    flex:1 1 auto!important;
    min-height:0!important;
    display:block!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    padding:10px 10px 26px!important;
    background:#f8f6f2!important;
  }

  #orderForm .job-panel{
    width:100%!important;
    max-width:none!important;
    margin:0 0 10px!important;
    border-radius:12px!important;
    background:#fff!important;
  }

  #orderForm .job-field-grid,
  #orderForm .job-prescription-grid{
    grid-template-columns:1fr!important;
  }

  #orderForm input,
  #orderForm select,
  #orderForm textarea{
    width:100%!important;
    max-width:100%!important;
    min-height:46px!important;
    font-size:16px!important;
  }

  #orderForm textarea{
    min-height:92px!important;
  }

  #orderForm .job-tooth-panel{
    overflow:visible!important;
  }

  #orderForm .tooth-studio-popup-mode,
  #orderForm .tooth-studio-center,
  #orderForm .order-tooth-chart{
    min-height:0!important;
    height:auto!important;
  }

  #orderForm .order-tooth-chart{
    padding:8px 0!important;
  }

  #orderForm .order-tooth-chart .dental-chart-svg{
    width:min(100%,410px)!important;
    height:auto!important;
    max-height:none!important;
    display:block!important;
    margin:0 auto!important;
  }

  #orderForm .tooth-view-inline{
    grid-template-columns:1fr!important;
  }

  #orderForm .tooth-center-actions{
    gap:7px!important;
  }

  #orderForm .order-tooth-popover{
    position:fixed!important;
    left:8px!important;
    right:8px!important;
    bottom:calc(8px + env(safe-area-inset-bottom))!important;
    top:auto!important;
    width:auto!important;
    max-height:74dvh!important;
    overflow:auto!important;
    z-index:180!important;
    border-radius:14px!important;
    box-shadow:0 18px 45px rgba(44,38,30,.20)!important;
  }

  #orderForm .modal-actions,
  .job-modal-actions{
    position:sticky!important;
    bottom:0!important;
    z-index:25!important;
    flex:0 0 auto!important;
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:7px!important;
    margin:0!important;
    padding:9px 10px calc(9px + env(safe-area-inset-bottom))!important;
    background:#fff!important;
    border-top:1px solid #e0d9ce!important;
    box-shadow:0 -7px 20px rgba(54,47,37,.07)!important;
  }

  #orderForm .modal-actions button{
    min-height:46px!important;
    height:46px!important;
    font-size:12px!important;
  }

  #orderForm .modal-actions #saveOrderBtn{
    grid-column:1/-1!important;
  }

  /* Keep all three Work Order card actions visible and equally sized. */
  .mobile-card-actions{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:6px!important;
  }

  .mobile-card-actions .edit-btn,
  .mobile-card-actions .lock-btn,
  .mobile-card-actions .danger-btn{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    height:38px!important;
    min-height:38px!important;
    padding:4px 5px!important;
    font-size:10px!important;
    white-space:nowrap!important;
  }

  .mobile-card-actions .lock-btn,
  .mobile-card-actions .lock-btn.is-locked{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
  }
}

@media(max-width:390px){
  .mobile-card-actions .edit-btn,
  .mobile-card-actions .lock-btn,
  .mobile-card-actions .danger-btn{
    font-size:9px!important;
    padding:3px!important;
  }
}


/* ==========================================================================
   V18 — HUMAN CHAT
   ========================================================================== */

.human-chat-launcher{
  position:fixed;
  right:22px;
  bottom:22px;
  z-index:145;
  min-width:118px;
  height:48px;
  padding:0 15px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid #9a6200;
  border-radius:999px;
  background:linear-gradient(180deg,#c98d18,#a96c05);
  color:#fff;
  font:800 13px/1 inherit;
  box-shadow:0 10px 28px rgba(95,62,8,.24);
  cursor:pointer;
}
.human-chat-launcher:hover{
  background:linear-gradient(180deg,#b97c0d,#965f00);
}
.human-chat-launcher-icon{font-size:17px}
.human-chat-unread{
  position:absolute;
  right:-4px;
  top:-6px;
  min-width:22px;
  height:22px;
  padding:0 6px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:2px solid #fff;
  border-radius:999px;
  background:#a8403b;
  color:#fff;
  font-size:10px;
  font-weight:900;
}

.human-chat-panel{
  position:fixed;
  right:22px;
  bottom:80px;
  z-index:146;
  width:390px;
  height:min(610px,calc(100dvh - 120px));
  display:flex;
  flex-direction:column;
  overflow:hidden;
  border:1px solid #d9d1c4;
  border-radius:18px;
  background:#fff;
  color:#292824;
  box-shadow:0 24px 70px rgba(54,45,33,.18);
}

.human-chat-header{
  flex:0 0 auto;
  min-height:66px;
  padding:11px 12px 10px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border-bottom:1px solid #e4ddd2;
  background:#fffdf8;
}
.human-chat-header-main{
  min-width:0;
  display:flex;
  align-items:center;
  gap:8px;
}
.human-chat-header-main>div{min-width:0}
.human-chat-header strong{
  display:block;
  color:#6f4700;
  font-size:15px;
  line-height:1.2;
}
.human-chat-header span{
  display:block;
  margin-top:3px;
  overflow:hidden;
  color:#777066;
  font-size:10px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.human-chat-icon-btn{
  width:34px;
  height:34px;
  flex:0 0 34px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid #ddd5c9;
  border-radius:9px;
  background:#fff;
  color:#5d554b;
  font-size:19px;
  cursor:pointer;
}
.human-chat-icon-btn:hover{
  background:#fff5dc;
  color:#704700;
  border-color:#c58a18;
}

.human-chat-home,
.human-chat-conversation{
  flex:1 1 auto;
  min-height:0;
  background:#fff;
}
.human-chat-home{
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.human-chat-search-wrap{
  flex:0 0 auto;
  padding:12px 12px 7px;
}
.human-chat-search-wrap input{
  width:100%;
  height:40px;
  padding:0 12px;
  border:1px solid #d9d2c7;
  border-radius:10px;
  background:#fff;
  color:#292824;
  font-size:13px;
}
.human-chat-search-wrap input:focus{
  outline:none;
  border-color:#b57908;
  box-shadow:0 0 0 2px rgba(181,121,8,.11);
}
.human-chat-section-label{
  padding:7px 13px 5px;
  color:#8b6421;
  font-size:9px;
  font-weight:900;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.human-chat-recent-label{
  border-top:1px solid #eee8df;
}
.human-chat-search-section{
  flex:0 0 auto;
  max-height:210px;
  overflow:auto;
}
.human-chat-user-list,
.human-chat-thread-list{
  overflow:auto;
}
.human-chat-thread-list{
  flex:1 1 auto;
  min-height:0;
}

.human-chat-user-row,
.human-chat-thread-row{
  width:100%;
  min-height:62px;
  padding:8px 12px;
  display:flex;
  align-items:center;
  gap:10px;
  border:0;
  border-bottom:1px solid #f0ece5;
  background:#fff;
  color:#292824;
  text-align:left;
  cursor:pointer;
}
.human-chat-user-row:hover,
.human-chat-thread-row:hover{
  background:#fff9ec;
}
.human-chat-avatar{
  width:38px;
  height:38px;
  flex:0 0 38px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid #d7b86f;
  border-radius:50%;
  background:#fff2cf;
  color:#724900;
  font-size:11px;
  font-weight:900;
}
.human-chat-user-copy,
.human-chat-thread-copy{
  min-width:0;
  flex:1;
}
.human-chat-user-copy strong,
.human-chat-thread-copy strong{
  display:block;
  overflow:hidden;
  color:#312d27;
  font-size:12px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.human-chat-user-copy small{
  display:block;
  margin-top:3px;
  overflow:hidden;
  color:#7d766d;
  font-size:9.5px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.human-chat-thread-top,
.human-chat-thread-bottom{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.human-chat-thread-top small{
  flex:0 0 auto;
  color:#978f84;
  font-size:8.5px;
}
.human-chat-thread-bottom{
  margin-top:5px;
}
.human-chat-thread-bottom>span{
  min-width:0;
  overflow:hidden;
  color:#777066;
  font-size:10px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.human-chat-thread-bottom>b{
  min-width:20px;
  height:20px;
  padding:0 5px;
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  background:#b57908;
  color:#fff;
  font-size:9px;
}

.human-chat-empty{
  padding:24px 16px;
  color:#8a8379;
  font-size:11px;
  line-height:1.5;
  text-align:center;
}
.human-chat-empty-conversation{
  margin:auto;
}

.human-chat-conversation{
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.human-chat-conversation-tools{
  flex:0 0 auto;
  padding:6px 10px;
  display:flex;
  justify-content:flex-end;
  border-bottom:1px solid #eee9e1;
  background:#fbfaf7;
}
.human-chat-clean-btn{
  padding:5px 8px;
  border:1px solid #e0d8cc;
  border-radius:7px;
  background:#fff;
  color:#746c62;
  font-size:8.5px;
  cursor:pointer;
}
.human-chat-clean-btn:hover{
  border-color:#c9a356;
  color:#754c05;
  background:#fff7e5;
}

.human-chat-messages{
  flex:1 1 auto;
  min-height:0;
  padding:14px 11px;
  overflow-y:auto;
  background:
    linear-gradient(rgba(255,255,255,.94),rgba(255,255,255,.94)),
    radial-gradient(circle at 25% 25%,#f7e5b8 0 1px,transparent 1px);
  background-size:auto,18px 18px;
}
.human-chat-message{
  display:flex;
  margin:0 0 9px;
}
.human-chat-message.mine{justify-content:flex-end}
.human-chat-message.theirs{justify-content:flex-start}
.human-chat-bubble{
  max-width:82%;
  padding:8px 10px 6px;
  border:1px solid #dfd8ce;
  border-radius:13px 13px 13px 4px;
  background:#fff;
  color:#322f2a;
  box-shadow:0 3px 10px rgba(48,42,34,.04);
}
.human-chat-message.mine .human-chat-bubble{
  border-color:#d5b970;
  border-radius:13px 13px 4px 13px;
  background:#fff4d7;
}
.human-chat-message-text{
  font-size:12px;
  line-height:1.42;
  overflow-wrap:anywhere;
}
.human-chat-message-meta{
  margin-top:5px;
  color:#948b7f;
  font-size:7.8px;
  text-align:right;
}
.human-chat-files{
  margin-top:7px;
  display:grid;
  gap:5px;
}
.human-chat-file-chip{
  width:100%;
  padding:6px 7px;
  display:flex;
  align-items:center;
  gap:7px;
  border:1px solid #ddd5c8;
  border-radius:8px;
  background:rgba(255,255,255,.8);
  color:#4e4942;
  text-align:left;
  cursor:pointer;
}
.human-chat-file-chip:hover{
  border-color:#c38b20;
  background:#fff9eb;
}
.human-chat-file-chip>span:last-child{
  min-width:0;
}
.human-chat-file-chip strong,
.human-chat-file-chip small{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.human-chat-file-chip strong{
  font-size:9.5px;
}
.human-chat-file-chip small{
  margin-top:2px;
  color:#8e867c;
  font-size:8px;
}

.human-chat-pending{
  flex:0 0 auto;
  max-height:88px;
  padding:6px 9px;
  display:flex;
  flex-wrap:wrap;
  gap:5px;
  overflow:auto;
  border-top:1px solid #eee8df;
  background:#fffdf9;
}
.human-chat-pending-file{
  max-width:100%;
  padding:4px 5px 4px 7px;
  display:flex;
  align-items:center;
  gap:5px;
  border:1px solid #e0d7c8;
  border-radius:7px;
  background:#fff8e9;
  color:#665c50;
  font-size:8px;
}
.human-chat-pending-file>span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.human-chat-pending-file button{
  width:20px;
  height:20px;
  border:0;
  border-radius:5px;
  background:#fff;
  color:#8c5c0b;
  cursor:pointer;
}

.human-chat-composer{
  flex:0 0 auto;
  min-height:62px;
  padding:8px;
  display:flex;
  align-items:flex-end;
  gap:6px;
  border-top:1px solid #e4ddd2;
  background:#fff;
}
.human-chat-attach-btn{
  width:40px;
  height:40px;
  flex:0 0 40px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid #ddd5c9;
  border-radius:9px;
  background:#fff;
  cursor:pointer;
}
.human-chat-attach-btn:hover{background:#fff6df}
.human-chat-composer textarea{
  min-width:0;
  max-height:110px;
  flex:1;
  resize:none;
  padding:9px 10px;
  border:1px solid #d8d0c5;
  border-radius:10px;
  background:#fff;
  color:#292824;
  font:12px/1.35 inherit;
}
.human-chat-composer textarea:focus{
  outline:none;
  border-color:#b57908;
  box-shadow:0 0 0 2px rgba(181,121,8,.10);
}
.human-chat-send-btn{
  height:40px;
  padding:0 12px;
  flex:0 0 auto;
  border:1px solid #8f5900;
  border-radius:9px;
  background:linear-gradient(180deg,#c58a18,#aa6e05);
  color:#fff;
  font-size:10px;
  font-weight:900;
  cursor:pointer;
}
.human-chat-send-btn:disabled{opacity:.55;cursor:wait}

@media(max-width:860px){
  .human-chat-launcher{
    right:12px;
    bottom:76px;
    min-width:54px;
    width:54px;
    height:54px;
    padding:0;
  }
  .human-chat-launcher-label{display:none}

  .human-chat-panel{
    left:8px;
    right:8px;
    bottom:8px;
    width:auto;
    height:min(78dvh,650px);
    border-radius:16px;
  }

  .human-chat-search-wrap input,
  .human-chat-composer textarea{
    font-size:16px;
  }

  .human-chat-user-row,
  .human-chat-thread-row{
    min-height:68px;
  }
}

@media(max-width:480px){
  .human-chat-panel{
    left:0;
    right:0;
    bottom:0;
    height:88dvh;
    border-radius:16px 16px 0 0;
  }

  .human-chat-bubble{
    max-width:88%;
  }
}


/* ==========================================================================
   V18.2 — GROUP CHAT + HUMAN CHAT POSITIONING
   ========================================================================== */

.human-chat-standard-home{
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.human-chat-search-actions{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:7px;
  align-items:center;
}
.human-chat-new-group-btn{
  height:40px;
  padding:0 10px;
  border:1px solid #bd8211;
  border-radius:10px;
  background:#fff4d6;
  color:#744900;
  font-size:10px;
  font-weight:900;
  cursor:pointer;
  white-space:nowrap;
}
.human-chat-new-group-btn:hover{
  background:#ffeab4;
  border-color:#a96d05;
}
.human-chat-group-creator{
  flex:1 1 auto;
  min-height:0;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  overflow:hidden;
  background:#fff;
}
.human-chat-group-intro strong{
  display:block;
  color:#704700;
  font-size:14px;
}
.human-chat-group-intro span{
  display:block;
  margin-top:3px;
  color:#7c756c;
  font-size:10px;
}
.human-chat-group-field{
  display:grid;
  gap:5px;
  color:#6b6359;
  font-size:9px;
  font-weight:800;
}
.human-chat-group-field input{
  width:100%;
  height:40px;
  padding:0 10px;
  border:1px solid #d9d2c7;
  border-radius:9px;
  background:#fff;
  color:#292824;
  font-size:12px;
}
.human-chat-group-field input:focus{
  outline:none;
  border-color:#b57908;
  box-shadow:0 0 0 2px rgba(181,121,8,.10);
}
.human-chat-group-selected{
  flex:0 0 auto;
  max-height:84px;
  padding:7px;
  display:flex;
  flex-wrap:wrap;
  gap:5px;
  overflow:auto;
  border:1px solid #e5ddcf;
  border-radius:9px;
  background:#fffbf2;
}
.human-chat-group-chip{
  max-width:100%;
  min-height:27px;
  padding:3px 6px 3px 8px;
  display:flex;
  align-items:center;
  gap:6px;
  border:1px solid #d3b263;
  border-radius:999px;
  background:#fff2cf;
  color:#684400;
  font-size:8.5px;
  font-weight:800;
  cursor:pointer;
}
.human-chat-group-chip span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.human-chat-group-chip b{
  font-size:13px;
  line-height:1;
}
.human-chat-group-results{
  flex:1 1 auto;
  min-height:110px;
  overflow:auto;
  border:1px solid #eee8df;
  border-radius:10px;
}
.human-chat-user-row.selected{
  background:#fff4d7;
}
.human-chat-user-row.selected .human-chat-avatar{
  background:#b57908;
  color:#fff;
  border-color:#9a6200;
}
.human-chat-group-actions{
  flex:0 0 auto;
  display:grid;
  grid-template-columns:1fr 1.25fr;
  gap:7px;
  padding-top:2px;
}
.human-chat-group-actions button{
  min-height:40px;
}
.human-chat-thread-row.is-group .group-avatar{
  border-radius:10px;
  background:#fff0c4;
  color:#744900;
  font-size:17px;
}

/* Human messaging now sits to the LEFT of the AI panel on desktop.
   This keeps the two chat surfaces visually separate instead of stacking them. */
@media(min-width:1181px){
  #appShell:not(.ai-collapsed):not(.doctor-role-mode):not(.dashboard-role-mode) ~ #humanChatRoot .human-chat-launcher,
  #appShell:not(.ai-collapsed):not(.doctor-role-mode):not(.dashboard-role-mode) ~ #humanChatRoot .human-chat-panel{
    right:392px;
  }
}

@media(min-width:861px) and (max-width:1180px){
  #appShell:not(.ai-collapsed):not(.doctor-role-mode):not(.dashboard-role-mode) ~ #humanChatRoot .human-chat-launcher,
  #appShell:not(.ai-collapsed):not(.doctor-role-mode):not(.dashboard-role-mode) ~ #humanChatRoot .human-chat-panel{
    right:372px;
  }
}

/* On mobile the human-chat bubble lives on the LEFT, away from the AI control. */
@media(max-width:860px){
  .human-chat-launcher{
    left:12px!important;
    right:auto!important;
  }
  .human-chat-panel{
    left:8px!important;
    right:8px!important;
  }
  .human-chat-group-field input{
    font-size:16px;
  }
}

@media(max-width:480px){
  .human-chat-panel{
    left:0!important;
    right:0!important;
  }
}


/* ==========================================================================\n   V18.3 — REFERENCE-CLOSER ODONTOGRAM GEOMETRY\n   ========================================================================== */
.reference-odontogram .tooth-svg-shape{
  stroke:#50504e!important;
  stroke-width:1.2!important;
  stroke-linejoin:round!important;
}
.reference-odontogram .tooth-anatomy{
  stroke:#70706d!important;
  stroke-width:1.02!important;
  opacity:.88!important;
  stroke-linecap:round!important;
  stroke-linejoin:round!important;
}
.reference-odontogram .tooth-cusp{
  stroke:#787875!important;
  stroke-width:.86!important;
  opacity:.72!important;
  stroke-linecap:round!important;
}
.reference-odontogram .tooth-highlight{
  stroke:rgba(255,255,255,.72)!important;
  stroke-width:1.05!important;
  opacity:.72!important;
}
.reference-odontogram .tooth-render{
  filter:drop-shadow(0 1px 1.4px rgba(30,30,30,.14))!important;
}
.reference-odontogram .tooth-svg-group:not(.selected) .tooth-svg-shape{
  fill:#d7d7d5!important;
}
.reference-odontogram .tooth-svg-group.interactive:hover .tooth-svg-shape,
.reference-odontogram .tooth-svg-group.interactive:focus .tooth-svg-shape{
  stroke:#9b6a12!important;
  stroke-width:1.8!important;
  filter:drop-shadow(0 0 4px rgba(181,121,8,.16))!important;
}
.reference-inside-label{
  font-size:15px!important;
  font-weight:800!important;
  fill:#242423!important;
  stroke:#f3f3f1!important;
  stroke-width:2.2px!important;
}


/* ==========================================================================
   V18.4 — Technician workspace
   ========================================================================== */

/* Slightly stronger lower-anterior visual presence while retaining FDI spacing. */
.reference-odontogram .tooth-svg-group[data-tooth="43"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="42"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="41"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="34"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="33"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="32"] .tooth-svg-shape,
.reference-odontogram .tooth-svg-group[data-tooth="31"] .tooth-svg-shape{
  stroke-width:1.25px!important;
}

/* Technician existing Work Order = view-only case viewer. */
.technician-view-mode .job-price-summary,
.technician-view-mode .management-field,
.technician-view-mode .technician-create-field{
  display:none!important;
}
.technician-view-mode input:disabled,
.technician-view-mode select:disabled,
.technician-view-mode textarea:disabled{
  opacity:1!important;
  -webkit-text-fill-color:#3b3731!important;
  color:#3b3731!important;
  background:#faf9f6!important;
  border-color:#ded8ce!important;
}
.technician-view-mode .order-tooth-chart{
  cursor:default;
}
.technician-case-view-btn,
.technician-production-view{
  white-space:nowrap;
}

/* Admin-like production lanes for technicians, without global status mutation. */
.technician-production-kanban{
  grid-template-columns:repeat(4,minmax(245px,1fr))!important;
}
.technician-production-card{
  cursor:default!important;
}
.technician-production-stage-wrap{
  margin-top:9px;
  padding-top:8px;
  border-top:1px solid #ece6dc;
}
.technician-production-view{
  width:100%;
  margin-top:8px;
}

/* Shared / personal calendar switch. */
.calendar-scope-switch{
  width:max-content;
  max-width:100%;
  margin-bottom:10px;
  padding:5px;
  display:flex;
  gap:5px;
  border:1px solid #ded7ca!important;
  background:#fff!important;
}
.calendar-scope-switch button{
  min-height:38px;
  padding:0 13px;
  border:1px solid transparent;
  border-radius:8px;
  background:transparent;
  color:#655f57;
  font-weight:800;
  cursor:pointer;
}
.calendar-scope-switch button.active{
  border-color:#b57908;
  background:#fff1cb;
  color:#704600;
}
.calendar-readonly-dot{
  float:right;
  margin-left:5px;
  color:#968f85;
  font-style:normal;
  font-size:8px;
}

@media(max-width:1100px){
  .technician-production-kanban{
    grid-template-columns:repeat(4,minmax(220px,1fr))!important;
    min-width:940px;
  }
}
@media(max-width:860px){
  .calendar-scope-switch{
    width:100%;
  }
  .calendar-scope-switch button{
    flex:1;
  }
}

/* V18.8 cascade lock: keep these rules last so legacy themes cannot override them. */
@media(min-width:861px){
  #orderForm .job-modal-actions{padding-right:210px!important}
}
.production-today-alert,
.production-tomorrow-alert{
  color:#c91f1a!important;
  background:#fff!important;
  border-color:#df4a44!important;
  box-shadow:0 0 0 2px rgba(201,31,26,.09)!important;
  font-size:12px!important;
  font-weight:1000!important;
  text-transform:lowercase!important;
}
.stage-na-toggle{
  display:flex!important;grid-template-columns:auto 1fr!important;align-items:center!important;gap:7px!important;
  padding:7px 8px!important;border:1px solid #e2ddd3!important;border-radius:8px!important;
  background:#fbfaf7!important;color:#5f5850!important;font-weight:800!important;
}
.stage-na-toggle input{width:17px!important;height:17px!important;margin:0!important;accent-color:#b57908!important}
.production-stage-card.stage-not-applicable{opacity:.72!important;background:#f2f0eb!important}
.production-stage-card.stage-not-applicable>label:not(.stage-na-toggle){display:none!important}
.stage-pill-na,.stage-mini-na{background:#f1efe9!important;color:#706a62!important;font-style:italic!important}
.stage-technician{font-weight:800!important;color:#5b544b!important}
.stage-pill-mine{border-color:#c89b3d!important;background:#fff8e8!important}
.dashboard-production-toolbar{display:flex!important;justify-content:flex-end!important;margin-bottom:9px!important}
.dashboard-maximize-btn{font-weight:900!important}
body.dashboard-production-maximized #appShell{display:block!important;min-height:100dvh!important}
body.dashboard-production-maximized #appShell>.sidebar,
body.dashboard-production-maximized #appShell>.ai-panel,
body.dashboard-production-maximized #appShell>.sidebar-expand-btn,
body.dashboard-production-maximized #appShell>.ai-expand-btn,
body.dashboard-production-maximized .main>.topbar,
body.dashboard-production-maximized .main>.refresh-meta,
body.dashboard-production-maximized #humanChatRoot,
body.dashboard-production-maximized #content>.date-range-filter-card,
body.dashboard-production-maximized #content>.production-drag-hint{display:none!important}
body.dashboard-production-maximized .main{width:100vw!important;min-height:100dvh!important;margin:0!important}
body.dashboard-production-maximized #content{padding:10px!important}
body.dashboard-production-maximized .kanban-wrap{height:calc(100dvh - 58px)!important;overflow:auto!important}
body.dashboard-production-maximized .kanban{min-height:100%!important;grid-template-columns:repeat(6,minmax(300px,1fr))!important}
body.dashboard-production-maximized .kanban-col{min-height:calc(100dvh - 78px)!important}
body.dashboard-production-maximized .dashboard-production-toolbar{position:sticky!important;top:0!important;z-index:40!important;margin:0 0 8px!important}

/* V18.28 — Dashboard monitor layout: fit all four visible status columns in
   the viewport and keep each ticket intentionally information-dense. */
.app-shell.dashboard-role-mode .kanban-wrap{
  overflow-x:hidden!important;
}
.app-shell.dashboard-role-mode .kanban{
  min-width:0!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:8px!important;
}
.app-shell.dashboard-role-mode .kanban-col{
  min-width:0!important;
  padding:8px!important;
}
.app-shell.dashboard-role-mode .kanban-title{
  margin-bottom:7px!important;
  font-size:15px!important;
}
.app-shell.dashboard-role-mode .kanban-card{
  padding:7px!important;
  margin-bottom:6px!important;
  border-radius:8px!important;
}
.app-shell.dashboard-role-mode .kanban-card-drag-head{gap:4px!important;}
.app-shell.dashboard-role-mode .kanban-card-drag-head>strong{
  font-size:12px!important;
  line-height:1.15!important;
}
.app-shell.dashboard-role-mode .kanban-meta{
  margin-top:3px!important;
  font-size:10px!important;
  line-height:1.15!important;
}
.app-shell.dashboard-role-mode .kanban-menu-btn{
  width:24px!important;
  height:22px!important;
  min-height:22px!important;
}
body.dashboard-production-maximized .kanban{
  min-width:0!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:8px!important;
}
body.dashboard-production-maximized .kanban-col{
  min-width:0!important;
  padding:8px!important;
}

/* ==========================================================================
   V18.11 — Stacked technician assignments sized for the production panel
   ========================================================================== */
.technician-assignment-summary{
  grid-column:1/-1;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  min-width:0;
  align-content:start;
  gap:10px;
  width:100%;
}
.technician-assignment-summary.hidden{display:none!important}
.technician-assignment-card{
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:10px;
  padding:13px;
  border:1px solid #ddd6ca;
  border-radius:12px;
  background:#fff;
  color:#302d29;
}
.technician-assignment-card.is-mine{
  border-color:#bd8521;
  background:#fff8e9;
  box-shadow:inset 0 0 0 1px rgba(189,133,33,.12);
}
.technician-assignment-card.is-not-applicable{
  background:#f3f1ed;
  color:#706a62;
}
.technician-assignment-head,
.technician-assignment-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  min-width:0;
}
.technician-assignment-head{flex-wrap:wrap;row-gap:6px}
.technician-assignment-head strong{color:#805407;font-size:14px;text-transform:uppercase;min-width:0;overflow-wrap:anywhere}
.technician-assignment-head>span,
.technician-own-stage{
  padding:3px 7px;
  border:1px solid #d6b46d;
  border-radius:999px;
  background:#fff3d2;
  color:#78510c;
  font-size:10px;
  font-weight:900;
  max-width:100%;
  white-space:normal;
  overflow-wrap:anywhere;
  flex-shrink:0;
  line-height:1.4;
}
.technician-assignment-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,2fr);
  align-items:start;
  padding-top:8px;
  border-top:1px solid #ece7df;
}
.technician-assignment-row span{color:#797269;font-size:11px;font-weight:700;min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.5}
.technician-assignment-row strong{font-size:12px;text-align:right;min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.5}
.technician-assignment-value{font-size:12px;font-weight:700;min-width:0;overflow-wrap:anywhere}

@media(max-width:1100px){
  .technician-assignment-summary{grid-template-columns:1fr}
}

/* ==========================================================================
   V18.10 — Technician salary workspace
   ========================================================================== */
.salary-stage-stack{display:grid;gap:6px;min-width:240px}
.salary-stage-row{
  display:grid;
  grid-template-columns:minmax(90px,1fr) auto auto;
  align-items:center;
  gap:8px;
  padding:7px 8px;
  border:1px solid #e3ddd4;
  border-radius:9px;
  background:#fff;
}
.salary-stage-row>div{display:grid;gap:2px}
.salary-stage-row>div strong{color:#6f4a09;font-size:11px}
.salary-stage-row>div span{color:#756f67;font-size:9px}
.salary-payment-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:66px;
  padding:4px 7px;
  border:1px solid;
  border-radius:999px;
  font-size:9px;
  font-weight:900;
}
.salary-payment-badge.is-paid{border-color:#70a982;background:#eaf7ee;color:#25683b}
.salary-payment-badge.is-unpaid{border-color:#d69a91;background:#fff0ee;color:#a3372d}
.salary-stage-amount{white-space:nowrap;color:#292824;font-size:11px}

@media(max-width:860px){
  .salary-stage-stack{min-width:0}
  .salary-stage-row{grid-template-columns:minmax(85px,1fr) auto}
  .salary-stage-amount{grid-column:1/-1;text-align:right;font-size:13px}
}

/* ==========================================================================
   V18.12 — Safe Technician case and own-stage editing
   ========================================================================== */
.technician-assignment-row .technician-stage-status-select{
  width:100%;min-width:0;min-height:38px;padding:7px 30px 7px 9px;
  border:1px solid #bf8722;border-radius:9px;background:#fff;color:#342f28;
  font-size:12px;font-weight:800;
}
#orderForm.technician-view-mode .job-tooth-panel{
  position:relative!important;z-index:120!important;overflow:visible!important;
}
#orderForm.technician-view-mode .job-production-panel{
  position:relative!important;z-index:1!important;
}
#orderForm.technician-view-mode .order-tooth-popover{z-index:1000!important}

@media(min-width:861px){
  #orderForm.technician-view-mode .job-modal-actions{
    display:grid!important;
    grid-template-columns:minmax(120px,1fr) minmax(210px,auto) minmax(240px,auto)!important;
    align-items:center!important;padding-right:210px!important;
  }
  #orderForm.technician-view-mode .job-modal-actions #saveOrderBtn{
    grid-column:auto!important;min-height:52px!important;min-width:240px!important;
    font-size:17px!important;font-weight:900!important;
  }
}
@media(max-width:860px){
  #orderForm.technician-view-mode .job-modal-actions #saveOrderBtn{
    grid-column:1/-1;min-height:52px!important;font-size:17px!important;font-weight:900!important;
  }
}

/* ==========================================================================
   V18.13 — Doctor light actions + aligned Admin Config table separators
   ========================================================================== */

/* Doctor actions now use the same light visual language as the application. */
.app-shell.doctor-role-mode .doctor-action-btn{
  --action-bg:#fff;
  --action-border:#ddd7cd;
  --action-fg:#4f4b45;
  --action-icon:#756f67;
  background:#fff!important;
  color:var(--action-fg)!important;
  border-color:var(--action-border)!important;
  box-shadow:0 3px 10px rgba(52,46,37,.07)!important;
}
.app-shell.doctor-role-mode .doctor-action-btn .doctor-action-icon{
  border-right-color:#e7e1d7!important;
}
.app-shell.doctor-role-mode .doctor-action-edit{
  --action-bg:#fff8e8;
  --action-border:#d2ae61;
  --action-fg:#76520f;
  --action-icon:#b57908;
  background:#fff8e8!important;
}
.app-shell.doctor-role-mode .doctor-action-export{
  --action-bg:#fff;
  --action-border:#d8d2c8;
  --action-fg:#504c46;
  --action-icon:#716b63;
  background:#fff!important;
}
.app-shell.doctor-role-mode .doctor-action-delete{
  --action-bg:#fff7f6;
  --action-border:#dfaaa6;
  --action-fg:#a4433e;
  --action-icon:#bd5a54;
  background:#fff7f6!important;
}
.app-shell.doctor-role-mode .doctor-action-edit:hover,
.app-shell.doctor-role-mode .doctor-action-export:hover{
  background:#fff3d4!important;
  border-color:#c99b3c!important;
  box-shadow:0 5px 13px rgba(99,76,34,.10)!important;
}
.app-shell.doctor-role-mode .doctor-action-delete:hover{
  background:#fff0ee!important;
  border-color:#cf817b!important;
  box-shadow:0 5px 13px rgba(145,56,50,.09)!important;
}
.app-shell.doctor-role-mode .doctor-action-btn:focus-visible{
  box-shadow:0 0 0 3px rgba(199,154,57,.14)!important;
}

/* A <td> must remain a table cell. The legacy flex override caused its row
   separator to sit several pixels above the separators in adjacent cells. */
.admin-config-table td.admin-row-actions{
  display:table-cell!important;
  vertical-align:middle!important;
  white-space:nowrap!important;
}
.admin-config-table td.admin-row-actions > button{
  vertical-align:middle!important;
  margin-top:0!important;
  margin-bottom:0!important;
}

/* ==========================================================================
   V18.18 — Reliable price table + explicit current tooth selection
   ========================================================================== */

.contract-derived-field{display:none!important;}

.job-price-summary .price-breakdown{
  display:block!important;
  width:100%!important;
  padding:0!important;
  overflow:hidden!important;
  background:#fff!important;
  border:1px solid #ddd6ca!important;
  border-radius:10px!important;
}

.price-breakdown-scroll{display:block!important;width:100%!important;overflow-x:auto!important;}

.job-price-summary .price-breakdown-table{
  display:table!important;
  width:100%!important;
  min-width:500px!important;
  table-layout:auto!important;
  border-collapse:collapse!important;
  background:#fff!important;
  color:#292824!important;
}

.job-price-summary .price-breakdown-table thead,
.job-price-summary .price-breakdown-table tbody,
.job-price-summary .price-breakdown-table tfoot{display:table-row-group!important;visibility:visible!important;opacity:1!important;}
.job-price-summary .price-breakdown-table thead{display:table-header-group!important;}
.job-price-summary .price-breakdown-table tfoot{display:table-footer-group!important;}
.job-price-summary .price-breakdown-table tr{display:table-row!important;visibility:visible!important;opacity:1!important;}

.job-price-summary .price-breakdown-table th,
.job-price-summary .price-breakdown-table td{
  display:table-cell!important;
  visibility:visible!important;
  opacity:1!important;
  padding:10px 9px!important;
  border:0!important;
  border-bottom:1px solid #e8e2d8!important;
  background:#fff!important;
  color:#292824!important;
  font-size:11px!important;
  line-height:1.35!important;
  text-align:right!important;
  white-space:nowrap!important;
}

.job-price-summary .price-breakdown-table th{
  background:#f7f4ee!important;
  color:#756b5c!important;
  font-size:9px!important;
  font-weight:900!important;
  text-transform:uppercase!important;
}

.job-price-summary .price-breakdown-table th:first-child,
.job-price-summary .price-breakdown-table td:first-child{
  width:46%!important;
  text-align:left!important;
  white-space:normal!important;
}

.job-price-summary .price-breakdown-table td strong{
  display:block!important;
  color:#2a2824!important;
  font-size:12px!important;
  font-weight:900!important;
}

.job-price-summary .price-breakdown-table td small{
  display:block!important;
  margin-top:3px!important;
  color:#8a8174!important;
  font-size:9px!important;
}

.job-price-summary .price-breakdown-table .price-breakdown-unmatched td{background:#fff3f1!important;}
.job-price-summary .price-breakdown-table tfoot td{background:#fbf6e9!important;font-weight:800!important;}
.job-price-summary .price-breakdown-table tfoot td:first-child{text-align:right!important;}
.job-price-summary .price-breakdown-table .price-breakdown-total td{
  border-top:2px solid #bf8215!important;
  border-bottom:0!important;
  color:#6e4908!important;
  font-size:14px!important;
  font-weight:950!important;
}

/* A tooth currently targeted by the open popup must remain unmistakable,
   even before it becomes part of the saved selection. */
.order-tooth-chart .tooth-svg-group.batch-selected{
  opacity:1!important;
  filter:drop-shadow(0 0 5px rgba(197,126,0,.95)) drop-shadow(0 0 12px rgba(244,185,66,.72))!important;
}
.order-tooth-chart .tooth-svg-group.batch-selected .tooth-svg-shape{
  fill:#f4b942!important;
  stroke:#6d4300!important;
  stroke-width:4px!important;
  transform:scale(1.12)!important;
}
.order-tooth-chart .tooth-svg-group.batch-selected .tooth-svg-label{
  fill:#17110a!important;
  stroke:#fff3cd!important;
  stroke-width:2.6px!important;
  paint-order:stroke!important;
  font-weight:950!important;
}
.order-tooth-chart .tooth-number-label.batch-selected-label{
  fill:#17110a!important;
  stroke:#fff3cd!important;
  stroke-width:3.2px!important;
  paint-order:stroke!important;
  font-weight:950!important;
}

@media(prefers-reduced-motion:no-preference){
  .order-tooth-chart .tooth-svg-group.batch-selected{animation:v1818-active-tooth-pulse 1.15s ease-in-out infinite alternate;}
  @keyframes v1818-active-tooth-pulse{
    from{filter:drop-shadow(0 0 4px rgba(197,126,0,.78)) drop-shadow(0 0 8px rgba(244,185,66,.55));}
    to{filter:drop-shadow(0 0 7px rgba(197,126,0,1)) drop-shadow(0 0 16px rgba(244,185,66,.9));}
  }
}

/* ==========================================================================
   V18.19 — Role-safe contract detail + no horizontal price scrolling
   ========================================================================== */

.job-price-summary .price-breakdown{
  max-width:100%!important;
  overflow:hidden!important;
}
.job-price-summary .price-breakdown-scroll{max-width:100%!important;overflow:hidden!important;}

.job-price-summary .price-breakdown-table{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  table-layout:fixed!important;
}

.job-price-summary .price-breakdown-table th,
.job-price-summary .price-breakdown-table td{
  min-width:0!important;
  padding:9px 7px!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  word-break:normal!important;
}

.job-price-summary .price-breakdown-table th:nth-child(1),
.job-price-summary .price-breakdown-table td:nth-child(1){width:43%!important;}
.job-price-summary .price-breakdown-table th:nth-child(2),
.job-price-summary .price-breakdown-table td:nth-child(2){width:16%!important;}
.job-price-summary .price-breakdown-table th:nth-child(3),
.job-price-summary .price-breakdown-table td:nth-child(3){width:21%!important;}
.job-price-summary .price-breakdown-table th:nth-child(4),
.job-price-summary .price-breakdown-table td:nth-child(4){width:20%!important;}

.job-price-summary .price-breakdown-table th:not(:first-child){
  font-size:8px!important;
  line-height:1.2!important;
}

.job-price-summary .price-breakdown-table td:not(:first-child){
  font-size:10px!important;
  white-space:nowrap!important;
}

.job-price-summary .price-breakdown-table tfoot td:first-child{
  width:auto!important;
  white-space:normal!important;
}
.job-price-summary .price-breakdown-table tfoot td:last-child{width:20%!important;}

@media(max-width:560px){
  .job-price-summary .price-breakdown-table th,
  .job-price-summary .price-breakdown-table td{padding:8px 4px!important;}
  .job-price-summary .price-breakdown-table th:nth-child(1),
  .job-price-summary .price-breakdown-table td:nth-child(1){width:40%!important;}
  .job-price-summary .price-breakdown-table th:nth-child(2),
  .job-price-summary .price-breakdown-table td:nth-child(2){width:17%!important;}
  .job-price-summary .price-breakdown-table th:nth-child(3),
  .job-price-summary .price-breakdown-table td:nth-child(3){width:22%!important;}
  .job-price-summary .price-breakdown-table th:nth-child(4),
  .job-price-summary .price-breakdown-table td:nth-child(4){width:21%!important;}
  .job-price-summary .price-breakdown-table td:not(:first-child){font-size:9px!important;}
}

/* V18.28 — Admin conversation cleanup actions */
.admin-data-cleanup-card{
  margin-top:16px!important;
  padding:16px!important;
  border:1px solid #e4d8c5!important;
  border-radius:14px!important;
  background:#fffaf1!important;
}
.admin-data-cleanup-card .admin-section-head{align-items:flex-start!important;}
.admin-data-cleanup-card h3{margin:0 0 4px!important;}
.admin-data-cleanup-card p{margin:0!important;color:#766c60!important;}
.admin-cleanup-warning{
  display:inline-flex!important;
  padding:5px 9px!important;
  border:1px solid #e2b5aa!important;
  border-radius:999px!important;
  color:#9a3f31!important;
  background:#fff1ee!important;
  font-size:11px!important;
  font-weight:800!important;
  white-space:nowrap!important;
}
.admin-cleanup-actions{display:flex!important;gap:10px!important;flex-wrap:wrap!important;margin:14px 0 8px!important;}
.admin-data-cleanup-card small{display:block!important;color:#887b6d!important;line-height:1.45!important;}
@media(max-width:700px){
  .admin-data-cleanup-card .admin-section-head{flex-direction:column!important;gap:10px!important;}
  .admin-cleanup-actions{flex-direction:column!important;}
  .admin-cleanup-actions button{width:100%!important;}
}

/* V18.28 — Keep the existing production action-menu background, but make all
   labels and icons clearly readable on the light menu surface. */
.kanban-card-menu,
.kanban-card-menu button,
.deadline-priority-grey .kanban-card-menu,
.deadline-priority-gold .kanban-card-menu,
.deadline-priority-red .kanban-card-menu{
  color:#3b3024!important;
}
.kanban-card-menu button>span:first-child,
.deadline-priority-grey .kanban-card-menu button>span:first-child,
.deadline-priority-gold .kanban-card-menu button>span:first-child,
.deadline-priority-red .kanban-card-menu button>span:first-child{
  color:#8b5d12!important;
}
.kanban-card-menu button:hover,
.deadline-priority-grey .kanban-card-menu button:hover,
.deadline-priority-gold .kanban-card-menu button:hover,
.deadline-priority-red .kanban-card-menu button:hover{
  color:#241b13!important;
}

/* ==========================================================================
   V18.20 — Shared tooth color control
   ========================================================================== */

.tooth-color-field .same-shade-toggle{
  display:flex!important;
  align-items:center!important;
  gap:8px!important;
  margin-top:9px!important;
  padding:8px 10px!important;
  border:1px solid #ddd5c8!important;
  border-radius:9px!important;
  background:#faf7f1!important;
  color:#5d554a!important;
  font-size:11px!important;
  font-weight:800!important;
  line-height:1.25!important;
  text-transform:none!important;
  cursor:pointer!important;
}

.tooth-color-field .same-shade-toggle.hidden{display:none!important;}
.tooth-color-field .same-shade-toggle input{
  flex:0 0 auto!important;
  width:17px!important;
  min-width:17px!important;
  height:17px!important;
  min-height:17px!important;
  margin:0!important;
  padding:0!important;
  accent-color:#bf7c08!important;
  cursor:pointer!important;
}
.tooth-color-field #orderToothShade:disabled{
  background:#f2efe9!important;
  color:#8c857a!important;
  opacity:1!important;
  cursor:not-allowed!important;
}

/* ==========================================================================
   V18.21 — Complete money labels without horizontal price scrolling
   ========================================================================== */

.job-price-summary .price-breakdown-table,
.job-price-summary .price-breakdown-table th,
.job-price-summary .price-breakdown-table td{
  box-sizing:border-box!important;
}

.job-price-summary .price-breakdown-table .price-col-type{width:37%!important;}
.job-price-summary .price-breakdown-table .price-col-count{width:14%!important;}
.job-price-summary .price-breakdown-table .price-col-unit{width:20%!important;}
.job-price-summary .price-breakdown-table .price-col-subtotal{width:29%!important;}

.job-price-summary .price-breakdown-table th,
.job-price-summary .price-breakdown-table td{
  padding-left:5px!important;
  padding-right:5px!important;
}

.job-price-summary .price-breakdown-table th:nth-child(1),
.job-price-summary .price-breakdown-table td:nth-child(1){width:37%!important;}
.job-price-summary .price-breakdown-table th:nth-child(2),
.job-price-summary .price-breakdown-table td:nth-child(2){width:14%!important;}
.job-price-summary .price-breakdown-table th:nth-child(3),
.job-price-summary .price-breakdown-table td:nth-child(3){width:20%!important;}
.job-price-summary .price-breakdown-table th:nth-child(4),
.job-price-summary .price-breakdown-table td:nth-child(4){width:29%!important;}

.job-price-summary .price-breakdown-table th:last-child,
.job-price-summary .price-breakdown-table td:last-child{
  padding-right:9px!important;
  overflow:visible!important;
  text-overflow:clip!important;
}

.job-price-summary .price-breakdown-table tfoot td:first-child{width:auto!important;}
.job-price-summary .price-breakdown-table tfoot td:last-child{width:29%!important;}

@media(max-width:560px){
  .job-price-summary .price-breakdown-table .price-col-type{width:34%!important;}
  .job-price-summary .price-breakdown-table .price-col-count{width:15%!important;}
  .job-price-summary .price-breakdown-table .price-col-unit{width:21%!important;}
  .job-price-summary .price-breakdown-table .price-col-subtotal{width:30%!important;}
  .job-price-summary .price-breakdown-table th:nth-child(1),
  .job-price-summary .price-breakdown-table td:nth-child(1){width:34%!important;}
  .job-price-summary .price-breakdown-table th:nth-child(2),
  .job-price-summary .price-breakdown-table td:nth-child(2){width:15%!important;}
  .job-price-summary .price-breakdown-table th:nth-child(3),
  .job-price-summary .price-breakdown-table td:nth-child(3){width:21%!important;}
  .job-price-summary .price-breakdown-table th:nth-child(4),
  .job-price-summary .price-breakdown-table td:nth-child(4){width:30%!important;}
  .job-price-summary .price-breakdown-table tfoot td:last-child{width:30%!important;}
}
