:root{--bg:#f5f7fb;--card:#fff;--text:#17212b;--muted:#72808d;--line:#e5eaf0;--brand:#1769e0;--brand2:#0d55bd;--ok:#1b8f4d;--bad:#d24747;--warn:#b87213;--side:#0f1720;--shadow:0 10px 34px rgba(25,42,62,.07)}*{box-sizing:border-box}body{margin:0;font:14px/1.45 Inter,system-ui,-apple-system,"Segoe UI",sans-serif;background:var(--bg);color:var(--text)}button,input,select,textarea{font:inherit}button{cursor:pointer;border:1px solid var(--line);background:#fff;border-radius:10px;padding:9px 12px;color:var(--text)}button.primary,.primary{background:var(--brand);color:#fff;border-color:var(--brand)}button.primary:hover{background:var(--brand2)}input,select,textarea{width:100%;border:1px solid #d8e0e8;border-radius:10px;padding:10px 11px;outline:none;background:#fff}input:focus,select:focus,textarea:focus{border-color:#88afe9;box-shadow:0 0 0 3px #e8f1ff}.hidden{display:none!important}.login-screen{position:fixed;inset:0;background:linear-gradient(135deg,#eef4fd,#f8fafc);display:grid;place-items:center;padding:20px;z-index:20}.login-card{width:min(410px,95vw);background:#fff;border:1px solid var(--line);border-radius:22px;padding:30px;box-shadow:var(--shadow)}.mark{width:56px;height:56px;border-radius:16px;background:var(--brand);color:#fff;display:grid;place-items:center;font-weight:900;font-size:20px}.mark.small{width:38px;height:38px;border-radius:12px;font-size:14px}.login-card h1{margin:18px 0 2px}.login-card p{color:var(--muted);margin:0 0 18px}.login-card label{display:grid;gap:6px;font-weight:650;margin-top:12px}.login-card button{width:100%;margin-top:18px;background:var(--brand);color:#fff;border-color:var(--brand)}#loginErr{display:block;color:var(--bad);margin-top:12px;min-height:20px}.app{display:grid;grid-template-columns:235px 1fr;min-height:100vh}aside{background:var(--side);color:#dce5ef;padding:16px 12px;position:sticky;top:0;height:100vh;display:flex;flex-direction:column}.brand{display:flex;align-items:center;gap:10px;padding:4px 8px 20px}.brand div:last-child{display:grid}.brand span{font-size:11px;color:#8092a4}nav{display:grid;gap:5px}nav button{border:0;background:transparent;color:#afbdca;text-align:left;padding:11px 12px}nav button.active,nav button:hover{background:#1a2733;color:#fff}.sidefoot{margin-top:auto;border-top:1px solid #25323d;padding:14px 6px 0;display:grid;gap:8px}.sidefoot span{font-size:12px;color:#8fa0b0}.sidefoot button{background:#17232e;border-color:#263746;color:#c9d5df}main{min-width:0}header{height:68px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 22px;position:sticky;top:0;z-index:10}header>div:first-of-type{display:grid}header span{color:var(--muted);font-size:12px}.server{font-size:12px;color:#52616d}.server i{display:inline-block;width:8px;height:8px;border-radius:50%;background:#28a55a;margin-right:6px}#mobileMenu{display:none}.content{padding:22px;max-width:1500px}.page{display:none}.page.active{display:block}.pagehead{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;gap:15px}.pagehead h2{font-size:26px;margin:0}.pagehead p{margin:4px 0 0;color:var(--muted)}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:15px}.stat{background:#fff;border:1px solid var(--line);border-radius:15px;padding:16px;box-shadow:var(--shadow)}.stat span{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted)}.stat b{display:block;font-size:26px;margin-top:6px}.two{display:grid;grid-template-columns:1.7fr 1fr;gap:14px}.card{background:#fff;border:1px solid var(--line);border-radius:15px;box-shadow:var(--shadow);overflow:hidden}.cardhead{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);padding:14px 16px}.cardhead h3{margin:0;font-size:16px}.quick{display:grid;grid-template-columns:1fr 1fr;gap:9px;padding:16px}.quick button{padding:16px 10px}.toolbar{display:flex;gap:8px;margin-bottom:12px;align-items:center}.toolbar input{max-width:280px}.tablewrap{overflow:auto}table{width:100%;border-collapse:collapse}th,td{padding:11px 12px;text-align:left;border-bottom:1px solid var(--line);white-space:nowrap}th{font-size:11px;color:var(--muted);text-transform:uppercase;background:#fbfcfd}tbody tr:hover{background:#fafcff}.link{color:var(--brand);font-weight:700;cursor:pointer}.badge{display:inline-block;padding:4px 8px;border-radius:999px;background:#eef2f6;color:#51606d;font-size:12px}.badge.ok{background:#e9f7ee;color:#197c43}.badge.bad{background:#fff0f0;color:#a63535}.badge.warn{background:#fff4e3;color:#98611a}.money{font-variant-numeric:tabular-nums;font-weight:700}.notice{background:#eef5ff;color:#355d91;border:1px solid #dceafd;padding:12px 14px;border-radius:12px;margin-bottom:13px}.sys{padding:16px}.sys div{display:flex;justify-content:space-between;border-bottom:1px solid var(--line);padding:10px 0}.sys span{color:var(--muted)}dialog{border:0;padding:0;border-radius:18px;width:min(650px,94vw);box-shadow:0 30px 80px rgba(0,0,0,.25)}dialog::backdrop{background:rgba(10,18,26,.52)}dialog form{margin:0}.modalhead,.modalfoot{display:flex;align-items:center;justify-content:space-between;padding:14px 17px;border-bottom:1px solid var(--line)}.modalfoot{border-top:1px solid var(--line);border-bottom:0;justify-content:flex-end;gap:8px}.modalhead h3{margin:0}.modalhead button{border:0}.modalbody{padding:17px;max-height:70vh;overflow:auto}.formgrid{display:grid;grid-template-columns:1fr 1fr;gap:11px}.field{display:grid;gap:5px}.field.full{grid-column:1/-1}.field label{font-size:12px;font-weight:700;color:#566472}.patient-top{display:flex;align-items:flex-start;justify-content:space-between;gap:15px;margin-bottom:14px}.patient-top h2{margin:0}.patient-top p{margin:4px 0;color:var(--muted)}.patient-actions{display:flex;gap:7px}.detailgrid{display:grid;grid-template-columns:300px 1fr;gap:14px}.info{padding:16px}.info dl{display:grid;grid-template-columns:100px 1fr;gap:8px;margin:0}.info dt{color:var(--muted)}.dental{padding:16px}.arch{display:flex;gap:5px;justify-content:center;flex-wrap:wrap;margin:12px 0}.tooth{width:43px;height:54px;border:1px solid #ccd6df;border-radius:10px;background:#fff;padding:2px}.tooth b{display:block;font-size:11px}.tooth i{font-style:normal;font-size:18px}.tooth.caries{background:#fff2dc;border-color:#e5b05c}.tooth.treated{background:#e8f6ed;border-color:#74c38e}.tooth.missing{background:#f0f2f4;color:#9aa4ad;text-decoration:line-through}.tooth.implant{background:#e8f1ff;border-color:#79a6e9}.legend{display:flex;gap:10px;flex-wrap:wrap;color:var(--muted);font-size:12px}.plan{margin-top:14px}.planrow{display:grid;grid-template-columns:70px 1fr 120px 110px;gap:7px;padding:8px 0;border-bottom:1px solid var(--line)}.empty{padding:24px;text-align:center;color:#8b98a5}@media(max-width:950px){.app{grid-template-columns:78px 1fr}.brand>div:last-child,nav button{font-size:0}.brand{justify-content:center}.brand .mark{display:grid}nav button::first-letter{font-size:16px}.stats{grid-template-columns:1fr 1fr}.two,.detailgrid{grid-template-columns:1fr}}@media(max-width:650px){.app{display:block}aside{position:fixed;z-index:30;left:-250px;width:235px;transition:.2s}aside.open{left:0}header{height:60px;padding:0 12px}#mobileMenu{display:block}.content{padding:13px 9px}.stats{gap:8px}.stat{padding:12px}.stat b{font-size:20px}.pagehead h2{font-size:22px}.pagehead p{display:none}.formgrid{grid-template-columns:1fr}.field.full{grid-column:auto}.patient-top{display:block}.patient-actions{margin-top:10px;flex-wrap:wrap}.quick{grid-template-columns:1fr}.server{display:none}}
.three{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.patient-sections{display:grid;grid-template-columns:1fr;gap:14px;margin-top:14px}.historyrow,.filerow{display:grid;grid-template-columns:minmax(180px,260px) 1fr;gap:14px;padding:13px 16px;border-bottom:1px solid var(--line)}.historyrow small,.filerow small,.sub{display:block;color:var(--muted);font-size:12px;margin-top:3px}.historyrow p{margin:5px 0;white-space:pre-wrap}.filerow{grid-template-columns:1fr auto;align-items:center}.reportcard>div:last-child{padding:8px 16px 16px}.reportlist{display:grid;gap:13px}.reportrow>div:first-child{display:flex;justify-content:space-between;gap:8px;align-items:center}.reportrow span{color:#52616d}.bar{height:7px;border-radius:99px;background:#edf1f5;overflow:hidden;margin-top:5px}.bar i{display:block;height:100%;background:var(--brand);border-radius:99px}.notice code{background:#fff;border:1px solid #d8e5f7;padding:2px 5px;border-radius:5px}.toolbar select{max-width:200px}.patient-sections .card{overflow:visible}
@media(max-width:1100px){.three{grid-template-columns:1fr 1fr}}@media(max-width:750px){.three{grid-template-columns:1fr}.historyrow{grid-template-columns:1fr}.stats{grid-template-columns:1fr 1fr}}




/* ===== Denta Life day schedule ===== */
.schedule-pagehead{margin-bottom:12px}
.schedule-layout{display:grid;grid-template-columns:300px minmax(680px,1fr);gap:12px;align-items:start}
.schedule-sidebar{padding:14px;display:grid;gap:12px;position:sticky;top:80px;max-height:calc(100vh - 98px);overflow:auto}
.schedule-filter-row select{width:100%}
.schedule-sidebar-head{display:grid;grid-template-columns:38px 1fr 38px;align-items:center;gap:6px}.schedule-sidebar-head b{text-align:center;text-transform:capitalize;font-size:15px}.schedule-sidebar-head button{padding:6px;font-size:20px}
.mini-calendar-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}.mini-cal-weekday{text-align:center;color:var(--muted);font-size:10px;font-weight:700;padding:4px 0}.mini-cal-empty{aspect-ratio:1/1}.mini-cal-day{aspect-ratio:1/1;padding:0;border-radius:8px;border-color:transparent;background:transparent}.mini-cal-day:hover{background:#f0ecff}.mini-cal-day.selected{background:#7b4ee8;color:#fff}.mini-cal-day.today{box-shadow:inset 0 0 0 2px #b69df7}
.schedule-day-card{background:linear-gradient(135deg,#8d55ef,#6540d8);border-radius:14px;padding:15px;color:#fff}.schedule-day-card-main{display:flex;align-items:center;gap:13px}.schedule-day-card-main>b{font-size:36px;line-height:1}.schedule-day-card-main>div{display:grid}.schedule-day-card-main span{font-size:14px;opacity:.9;text-transform:capitalize}.schedule-day-card-main strong{font-size:21px}.schedule-day-card-actions{display:flex;align-items:center;justify-content:space-between;margin-top:14px}.schedule-day-card-actions button{background:#fff;color:#5b37c1;border-color:#fff}.schedule-round-btn{width:42px;height:42px;border-radius:50%;padding:0;font-size:24px}
.schedule-list-head{display:flex;align-items:center;justify-content:space-between}.schedule-list-head span{min-width:28px;text-align:center;border-radius:999px;padding:3px 8px;background:#edf1f6;color:#5d6974;font-size:11px}.schedule-day-list{display:grid;gap:7px}.day-list-item{display:grid;grid-template-columns:18px 1fr;gap:8px;text-align:left;padding:9px 10px;border-radius:10px;background:#fff}.day-list-icon{font-weight:900;color:#7a8691;padding-top:1px}.day-list-body{min-width:0;display:grid;gap:2px}.day-list-body b,.day-list-body span,.day-list-body small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.day-list-body span,.day-list-body small{font-size:11px;color:#66737e}.day-list-item.ok{border-color:#b8dfc3;background:#eef9f2}.day-list-item.warn{border-color:#edd39d;background:#fff7e9}.day-list-item.bad{border-color:#ecc0c0;background:#fff2f2}
.schedule-main{overflow:hidden}.schedule-navline{display:flex;gap:7px;align-items:center;padding:10px 12px;border-bottom:1px solid var(--line)}.schedule-navline input{max-width:180px}.schedule-board-wrap{overflow:auto;max-height:calc(100vh - 180px)}
.schedule-board{display:grid;grid-template-columns:62px repeat(var(--chairs),minmax(230px,1fr));grid-template-rows:62px repeat(var(--slots),34px);min-width:752px;position:relative;background:#fff}.schedule-corner,.schedule-colhead{position:sticky;top:0;z-index:5;border-right:1px solid var(--line);border-bottom:1px solid var(--line)}.schedule-corner{left:0;z-index:7;background:#fbfcfd;display:grid;place-content:center;text-align:center;color:#64727f}.schedule-corner b{font-size:12px}.schedule-corner span{font-size:10px;text-transform:capitalize}.schedule-colhead{padding:8px 10px;text-align:center;display:grid;gap:3px}.schedule-colhead span{font-size:11px;color:#5c6873}.schedule-colhead b{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.schedule-colhead.blue{background:#dceefc}.schedule-colhead.teal{background:#d9f3ec}.schedule-colhead.gold{background:#f9efc9}
.schedule-time{position:sticky;left:0;z-index:4;background:#fbfcfd;border-right:1px solid var(--line);border-bottom:1px solid #edf0f3;padding:7px 4px;text-align:center;color:#5e6b77;font-size:11px}.schedule-cell{border:0;border-radius:0;border-right:1px solid rgba(107,119,130,.10);border-bottom:1px solid rgba(107,119,130,.12);padding:0}.schedule-cell.blue{background:#f3f9fd}.schedule-cell.teal{background:#f2fbf8}.schedule-cell.gold{background:#fffaf0}.schedule-cell:hover{filter:brightness(.97);box-shadow:inset 0 0 0 2px rgba(23,105,224,.16)}
.schedule-appt{z-index:3;margin:2px 3px;border-radius:7px;padding:6px 7px;overflow:hidden;cursor:pointer;box-shadow:0 2px 7px rgba(35,54,77,.09)}.schedule-appt.blue{background:#cfe9f8;border:1px solid #9ecce8}.schedule-appt.teal{background:#cfeee6;border:1px solid #98d5c7}.schedule-appt.gold{background:#f8e8ae;border:1px solid #e8cf75}.schedule-appt.warn{filter:saturate(1.15)}.schedule-appt.ok{box-shadow:inset 4px 0 0 #27935a,0 2px 7px rgba(35,54,77,.09)}.schedule-appt.bad{opacity:.62;text-decoration:line-through}.schedule-appt-top{display:flex;gap:7px;align-items:center;justify-content:space-between}.schedule-appt-top b{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.schedule-appt-top span,.schedule-appt small{font-size:10px;color:#596773;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.schedule-appt small{display:block;margin-top:2px}
@media(max-width:1100px){.schedule-layout{grid-template-columns:260px minmax(650px,1fr)}.schedule-sidebar{position:static;max-height:none}}
@media(max-width:900px){.schedule-layout{display:block}.schedule-sidebar{margin-bottom:12px}.schedule-day-list{max-height:260px;overflow:auto}.schedule-board-wrap{max-height:none}}



/* Tooth status labels */
.tooth{
  width:74px;
  height:64px;
  border-radius:12px;
  padding:7px 5px;
  display:grid;
  grid-template-rows:auto 1fr;
  align-items:center;
  justify-items:center;
  gap:4px;
}
.tooth b{font-size:12px;line-height:1}
.tooth-state{
  display:block;
  font-size:10px;
  line-height:1.1;
  font-weight:700;
  text-align:center;
  white-space:normal;
  color:#5f6d79;
}
.tooth.caries .tooth-state{color:#9b6311}
.tooth.treated .tooth-state{color:#247b45}
.tooth.missing .tooth-state{color:#7f8992}
.tooth.implant .tooth-state{color:#2f65b7}

/* Odontogram: one aligned row per jaw */
.dental .arch{
  display:grid !important;
  grid-template-columns:repeat(16,minmax(42px,1fr));
  gap:5px;
  align-items:stretch;
  justify-content:stretch;
  flex-wrap:initial !important;
  overflow-x:auto;
  padding:4px 0 8px;
}

.dental .arch .tooth{
  width:100% !important;
  min-width:42px;
  max-width:none;
  height:60px;
  padding:6px 2px;
  margin:0;
}

.dental .arch .tooth:nth-child(8){
  margin-right:8px;
}

.dental .arch .tooth:nth-child(9){
  margin-left:8px;
}

.dental .tooth b{
  font-size:11px;
}

.dental .tooth-state{
  font-size:9px;
  line-height:1.05;
}

@media(max-width:1100px){
  .dental .arch{
    grid-template-columns:repeat(16,44px);
  }
}


/* Treatment plan editing */
.planrow{
  grid-template-columns:70px minmax(180px,1fr) 120px 130px auto !important;
  align-items:center;
}
.plan-actions{
  display:flex;
  gap:6px;
  justify-content:flex-end;
}
.plan-actions button{
  padding:6px 9px;
  font-size:12px;
}
.danger-lite{
  color:#a63535;
  border-color:#efc9c9;
  background:#fff7f7;
}
@media(max-width:850px){
  .planrow{grid-template-columns:60px 1fr !important}
  .planrow>span:nth-child(3),
  .planrow>span:nth-child(4),
  .plan-actions{grid-column:2}
  .plan-actions{justify-content:flex-start}
}

/* Doctor selector in cabinet headers */
.chair-doctor-select{
  width:100%;
  min-width:0;
  margin-top:2px;
  padding:5px 26px 5px 8px;
  border-radius:8px;
  border:1px solid rgba(60,75,90,.16);
  background:rgba(255,255,255,.72);
  color:#33414c;
  font-size:12px;
  font-weight:700;
  box-shadow:none;
}
.chair-doctor-select:focus{
  border-color:#78a8e9;
  box-shadow:0 0 0 2px rgba(23,105,224,.12);
}


/* Delete appointment button */
.schedule-appt{position:relative}
.schedule-appt-top{padding-right:22px}
.schedule-delete{
  position:absolute;
  right:4px;
  top:4px;
  width:20px;
  height:20px;
  min-width:20px;
  padding:0;
  border-radius:50%;
  border:1px solid rgba(120,60,60,.18);
  background:rgba(255,255,255,.82);
  color:#a33;
  font-size:15px;
  line-height:18px;
  display:grid;
  place-items:center;
}
.schedule-delete:hover{background:#fff0f0;border-color:#d7a5a5}

/* Mobile sidebar labels fix */
@media(max-width:650px){
  aside{
    width:260px;
  }

  .brand{
    justify-content:flex-start !important;
  }

  .brand>div:last-child{
    display:grid !important;
  }

  .brand>div:last-child b{
    font-size:14px !important;
  }

  .brand>div:last-child span{
    font-size:11px !important;
  }

  nav button{
    font-size:14px !important;
    display:flex;
    align-items:center;
    gap:10px;
    min-height:44px;
    white-space:nowrap;
  }

  nav button::first-letter{
    font-size:inherit !important;
  }

  .sidefoot{
    padding-bottom:18px;
  }
}
