.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: grid;
  place-items: center;

  background: #f8fafc;
}

.lock-screen.hidden {
  display: none;
}

.lock-card {
  width: min(380px, calc(100% - 32px));
  padding: 32px;

  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);

  text-align: center;
}

.lock-card .brand-mark {
  margin: 0 auto 16px;
}

.lock-card h1 {
  margin: 0 0 6px;
}

.lock-card p {
  color: var(--muted);
}

.lock-card input {
  width: 100%;
  margin: 20px 0 12px;

  padding: 12px;
  text-align: center;

  letter-spacing: 6px;
  font-size: 22px;

  border: 1px solid var(--line);
  border-radius: 8px;
}

.pin-error {
  color: var(--danger) !important;
  min-height: 20px;
}
.app-locked {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}
.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 18px;
}
.calendar-day {
  display: grid;
  gap: 8px;
  min-height: 62px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.calendar-day span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-day b {
  font-size: 16px;
  color: var(--ink);
}
.calendar-day:hover {
  border-color: #7dd3fc;
  background: #f0f9ff;
}
.calendar-day.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #e0f2fe;
  box-shadow: 0 5px 12px rgba(2, 132, 199, 0.2);
}
.calendar-day.active b {
  color: #fff;
}
.calendar-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 11px 13px;
  margin-bottom: 14px;
  border-inline-start: 3px solid var(--primary);
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}
.calendar-summary strong {
  font-size: 22px;
  color: var(--primary);
}
.calendar-card .agenda {
  margin-top: 0;
}
.odontogram-patient-picker {
  margin-top: 10px;
  max-width: 320px;
}
.odontogram-patient-picker label {
  display: block;
  margin-bottom: 5px;
}
.odontogram-patient-picker select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: #fff;
  color: var(--ink);
}
.patient-context-picker {
  margin: 12px 0 18px;
  max-width: 420px;
}
.patient-context-picker label {
  display: block;
  margin-bottom: 5px;
}
.patient-context-picker select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}
.patient-timeline {
  position: relative;

  display: grid;
  gap: 0;

  margin-top: 16px;
  padding-inline-start: 8px;
}

.timeline-event {
  position: relative;

  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);

  gap: 12px;

  padding-bottom: 20px;
}

.timeline-event:not(:last-child)::before {
  content: "";

  position: absolute;

  top: 42px;

  bottom: 0;

  left: 20px;

  width: 1px;

  background: var(--line);
}

.timeline-marker {
  position: relative;
  z-index: 1;

  width: 40px;
  height: 40px;

  display: grid;
  place-items: center;

  border: 1px solid var(--line);
  border-radius: 50%;

  background: var(--surface);

  font-size: 17px;
}

.timeline-content {
  min-width: 0;

  padding: 12px 14px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: var(--surface);
}

.timeline-event-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 12px;
}

.timeline-event-header strong {
  display: block;
}

.timeline-event-header small {
  display: block;

  margin-top: 4px;

  color: var(--muted);
}

.timeline-content p {
  margin: 8px 0 0;

  color: var(--muted);

  font-size: 13px;
}

.timeline-empty {
  padding: 20px 0;

  color: var(--muted);

  text-align: center;
}
@media (max-width: 700px) {
  .calendar-week {
    gap: 4px;
  }
  .calendar-day {
    min-height: 56px;
    padding: 8px 2px;
    font-size: 9px;
  }
  .calendar-day b {
    font-size: 14px;
  }
  .calendar-summary {
    margin-bottom: 10px;
  }
}
.delete-patient-button {
  color: var(--danger);
  border: 1px solid #fecaca;
  background: #fff;
}
.delete-patient-button:hover {
  background: var(--danger-bg);
  color: #991b1b;
}
/* Clinical workspace refinement */
.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  box-shadow: 0 1px 0 rgba(148, 163, 184, 0.18);
}
.main {
  max-width: 1600px;
  margin-inline: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}
.page-heading {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.page-heading h1 {
  font-weight: 750;
}
.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.card {
  min-width: 0;
}
.content-grid {
  align-items: start;
}
.card-heading {
  gap: 14px;
  flex-wrap: wrap;
}
.card-heading > .button {
  margin-inline-start: auto;
}
.data-table th,
.data-table td {
  vertical-align: middle;
}
.button,
.icon-button,
.nav-item,
.surface-btn,
.action-btn {
  min-height: 38px;
}
.agenda-date-controls {
  flex-wrap: wrap;
}
@media (max-width: 900px) {
  .main {
    padding: 24px 20px;
  }
  .page-heading {
    align-items: flex-start;
  }
  .page-heading h1 {
    font-size: 24px;
  }
  .content-grid {
    gap: 14px;
  }
  .card {
    padding: 18px;
  }
  .top-actions {
    width: 100%;
  }
  .top-actions .search {
    flex: 1;
    min-width: 190px;
  }
}
@media (max-width: 560px) {
  .topbar {
    padding: 12px 14px;
  }
  .brand {
    flex: 1;
  }
  .top-actions {
    justify-content: stretch;
  }
  .top-actions .button-ghost {
    display: none;
  }
  .top-actions .icon-button {
    display: grid;
    place-items: center;
  }
  .main {
    padding: 18px 12px;
  }
  .page-heading {
    margin-bottom: 18px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .card-heading > .button {
    margin-inline-start: 0;
  }
  .form-actions {
    flex-wrap: wrap;
  }
  .form-actions .button {
    flex: 1;
  }
  .agenda-date-controls b {
    min-width: 78px;
  }
  .prescription-actions {
    width: 100%;
  }
  .prescription-actions .button {
    flex: 1;
  }
}
.agenda-date-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.agenda-date-controls b {
  font-size: 12px;
  color: var(--ink);
  min-width: 92px;
  text-align: center;
}
.agenda-date-controls .icon-button {
  color: var(--muted);
  font-size: 18px;
  padding: 3px 7px;
}
.treatment-patient-picker {
  margin-bottom: 18px;
  max-width: 420px;
}
.treatment-status-select {
  min-width: 130px;

  padding: 6px 8px;

  border: 1px solid var(--line);

  border-radius: 7px;

  background: #fff;

  color: var(--ink);

  font-size: 12px;
}
.treatment-plan-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.treatment-plan-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 14px;

  border: 1px solid var(--line);
  border-radius: 10px;

  background: #fff;
}

.treatment-plan-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.treatment-plan-main strong {
  display: block;
}

.treatment-plan-main small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.treatment-plan-tooth {
  width: 40px;
  height: 40px;

  display: grid;
  place-items: center;

  flex-shrink: 0;

  border-radius: 8px;

  background: #f0f9ff;
  color: var(--primary);

  font-weight: 700;
}

.treatment-plan-details {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 700px) {
  .treatment-plan-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .treatment-plan-details {
    width: 100%;
    flex-wrap: wrap;
  }
}
.treatment-plan-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.treatment-plan-delete {
  min-width: 36px;
  padding-inline: 10px;

  color: var(--danger);

  border: 1px solid #fecaca;

  background: #fff;
}

.treatment-plan-delete:hover {
  background: var(--danger-bg);
}

@media (max-width: 700px) {
  .treatment-plan-actions {
    width: 100%;
  }

  .treatment-plan-actions .button {
    flex: 1;
  }
}
:root {
  --surface: #fff;
  --decay: #ef4444;
  --filling: #3b82f6;
  --crown: #f59e0b;
  --rct: #8b5cf6;
  --extract: #475569;
  --implant: #10b981;
}

.legend i {
  border: 1px solid #94a3b8;
}

.prescription-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #f1f5f9;
}

.prescription-row small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.prescription-actions {
  display: flex;
  gap: 6px;
}

.prescription-print {
  display: none;
}

.prescription-edit-medication {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.prescription-edit-medication .full-span {
  grid-column: 1/-1;
}

@media print {
  body.printing-prescription * {
    visibility: hidden !important;
  }

  body.printing-prescription .prescription-print.active,
  body.printing-prescription .prescription-print.active * {
    visibility: visible !important;
  }

  body.printing-prescription .prescription-print.active {
    display: block !important;
    position: absolute;
    inset: 0;
    padding: 24mm 20mm;
    background: #fff;
    color: #000;
    font-family: Arial, sans-serif;
  }

  .prescription-print header {
    text-align: center;
    border-bottom: 2px solid #0284c7;
    padding-bottom: 12px;
  }

  .prescription-print h1 {
    font-size: 22px;
    margin: 0;
  }

  .prescription-print h2 {
    font-size: 20px;
    text-align: center;
    margin: 20px 0;
  }

  .prescription-medication {
    padding: 12px 0;
    border-bottom: 1px solid #cbd5e1;
  }

  .prescription-medication h3 {
    margin: 0 0 7px;
    font-size: 16px;
  }

  .prescription-medication p {
    margin: 4px 0;
    font-size: 13px;
  }

  .prescription-print footer {
    margin-top: 55mm;
    border-top: 1px solid #94a3b8;
    padding-top: 8px;
  }
}

.primary-odontogram .teeth-row {
  gap: 8px;
}

/* .primary-odontogram .tooth {
  width: 36px;
  height: 46px;
  border-radius: 12px 12px 8px 8px;
}

.primary-odontogram .tooth-mark {
  inset: 7px 6px 14px;
  border-radius: 6px;
}

.primary-odontogram .tooth-label {
  font-size: 12px;
  bottom: 2px;
} */

.primary-odontogram .tooth {
  width: 40px;
  height: 60px;
}

.primary-odontogram .tooth-visual {
  width: 40px;
  height: 60px;
}

.primary-odontogram .tooth-label {
  font-size: 16px;
}
.teeth-row {
  direction: ltr;
}

.odontogram-direction-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;

  width: 50%;
  margin: 0 auto 12px;

  direction: ltr;

  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
}

.odontogram-direction-labels .right,
.odontogram-direction-labels .left {
  width: 60px;
  text-align: center;
}

input[name="phone"] {
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
}

.action-btn.active {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0369a1;
  font-weight: 700;
}

.appointment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.appointment-delete {
  flex: 0 0 auto;
  color: #b91c1c;
  background: transparent;
  border: 1px solid #fecaca;
  border-radius: 5px;
  width: 25px;
  height: 25px;
  font-size: 17px;
  line-height: 1;
}

.appointment-delete:hover {
  background: #fef2f2;
}

@media (max-width: 900px) {
  body:not(.sidebar-collapsed) .sidebar {
    width: 248px !important;
    padding: 25px 14px !important;
  }

  body:not(.sidebar-collapsed) .profile {
    padding-inline: 10px !important;
    justify-content: flex-start !important;
  }

  body:not(.sidebar-collapsed) .profile > div:last-child,
  body:not(.sidebar-collapsed) .sidebar-foot span:last-child,
  body:not(.sidebar-collapsed) .nav-item span:last-child {
    display: block !important;
  }

  body:not(.sidebar-collapsed) .nav-item {
    justify-content: flex-start !important;
    padding: 11px 12px !important;
  }
}

html[dir="rtl"] .sidebar-toggle {
  inset-inline-start: auto;
  inset-inline-end: 10px;
  transform: scaleX(-1);
}

.sidebar-toggle {
  position: absolute;
  inset-inline-end: 10px;
  top: 12px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.sidebar-toggle:hover {
  background: #e0f2fe;
  color: var(--primary);
}

.sidebar {
  position: relative;
}

.sidebar-collapsed .sidebar {
  width: 72px;
  padding: 18px 8px;
}

.sidebar-collapsed .profile {
  padding-inline: 0;
  justify-content: center;
}

.sidebar-collapsed .profile > div:last-child,
.sidebar-collapsed .sidebar-foot span:last-child,
.sidebar-collapsed .nav-item span:last-child {
  display: none;
}

.sidebar-collapsed .nav-item {
  justify-content: center;
  padding-inline: 5px;
}

.sidebar-collapsed .sidebar-toggle {
  inset-inline-end: 22px;
}

.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

html[dir="rtl"] .context-drawer {
  transform: translateX(-105%) !important;
  box-shadow: 12px 0 30px rgba(15, 23, 42, 0.14);
}

html[dir="rtl"] body.drawer-open .context-drawer {
  transform: translateX(0) !important;
}

:root {
  --canvas: #f8fafc;
  --surface: #fff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #0284c7;
  --sky: #0ea5e9;
  --navy: #0b2942;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --purple: #8b5cf6;
  --teal: #10b981;
  --radius: 12px;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  font-family: Cairo, "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  font-size: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #bae6fd;
  outline-offset: 1px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 76px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 24px;
}

.brand,
.profile,
.top-actions,
.heading-date,
.stat,
.card-heading,
.timeline-item,
.patient-summary,
.form-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 11px;
  min-width: 220px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: var(--sky);
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 22px;
  overflow: hidden;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.brand strong,
.brand span,
.profile small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.2px;
}

.brand span,
.profile small {
  color: #8fa9bd;
  font-size: 11px;
  margin-top: 2px;
}

.top-actions {
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9db4c6;
  background: #173b58;
  border: 1px solid #285474;
  border-radius: 9px;
  width: min(300px, 30vw);
  padding: 0 12px;
}

.search input {
  border: 0;
  background: transparent;
  color: #fff;
  min-width: 0;
  width: 100%;
  height: 38px;
}

.search input::placeholder {
  color: #9db4c6;
}

.button {
  border-radius: 8px;
  padding: 9px 13px;
  transition: transform 0.15s, background 0.15s;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--primary);
  color: #fff;
}

.button-primary:hover {
  background: #036fa6;
}

.button-ghost {
  background: transparent;
  color: inherit;
  border: 1px solid #41627a;
}

.icon-button {
  background: transparent;
  color: inherit;
  border-radius: 7px;
  padding: 7px;
  font-size: 20px;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.clock {
  font-size: 12px;
  color: #b6c7d4;
  white-space: nowrap;
}

.workspace {
  display: flex;
  min-height: calc(100vh - 76px);
}

.sidebar {
  width: 248px;
  background: #fff;
  border-inline-end: 1px solid var(--line);
  padding: 25px 14px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.profile {
  gap: 10px;
  padding: 0 10px 25px;
  border-bottom: 1px solid var(--line);
}

.avatar {
  background: #e0f2fe;
  color: var(--primary);
  font-weight: 700;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.profile b {
  font-size: 13px;
}

.sidebar nav {
  padding-top: 20px;
  display: grid;
  gap: 4px;
}

.nav-item {
  display: flex;
  gap: 11px;
  align-items: center;
  color: var(--muted);
  background: transparent;
  text-align: start;
  padding: 11px 12px;
  border-radius: 8px;
}

.nav-item:hover,
.nav-item.active {
  background: #e0f2fe;
  color: #0369a1;
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-foot {
  margin-top: auto;
  color: #94a3b8;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--teal);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 31px 38px;
  overflow: auto;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 27px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #94a3b8;
  margin: 0 0 7px;
  text-transform: uppercase;
}

.page-heading h1 {
  font-size: 26px;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.3px;
}

.heading-date {
  text-align: end;
  align-items: flex-end;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.heading-date b {
  color: var(--ink);
  font-size: 13px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 24px;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 19px;
  gap: 15px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #e0f2fe;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 2px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.card-heading {
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-heading h2,
.card-heading h3 {
  font-size: 15px;
  margin: 0;
}

.muted {
  color: var(--muted);
}

.patient-row {
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.patient-row:last-child {
  border-bottom: 0;
}

.patient-row:hover {
  color: var(--primary);
}

.patient-row small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  padding: 4px 8px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fca5a5;
}

.badge-blue {
  background: #e0f2fe;
  color: #0369a1;
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  align-items: flex-start;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid #f1f5f9;
}

.timeline-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--sky);
  margin-top: 5px;
  flex-shrink: 0;
}

.timeline-item b {
  font-size: 12px;
}

.timeline-item small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.workspace-card {
  padding: 0;
  overflow: hidden;
}

.workspace-toolbar {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.segmented {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.segmented button {
  padding: 7px 11px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.segmented button.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 3px #cbd5e1;
}

.odontogram-wrap {
  padding: 22px;
  overflow: auto;
}

.arch-title {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  margin: 4px 0 9px;
}

.teeth-row {
  display: flex;
  gap: 6px;
  min-width: 630px;
  justify-content: center;
}
/*
.tooth {
  width: 38px;
  height: 50px;
  border: 1px solid #cbd5e1;
  border-radius: 14px 14px 10px 10px;
  background: #fff;
  position: relative;
  padding: 0;
  color: #475569;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

.tooth:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 10px #cbd5e1;
}

.tooth-label {
  font-size: 9px;
  position: absolute;
  bottom: 3px;
  inset-inline: 0;
}

.tooth-mark {
  position: absolute;
  inset: 9px 8px 16px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #94a3b8;
}

.tooth.decay .tooth-mark {
  background: #ef4444;
  border-color: #ef4444;
}

.tooth.filling .tooth-mark {
  background: #3b82f6;
  border-color: #3b82f6;
}

.tooth.crown .tooth-mark {
  background: #f59e0b;
  border-color: #f59e0b;
}

.tooth.rct .tooth-mark {
  background: #8b5cf6;
  border-color: #8b5cf6;
}

.tooth.implant .tooth-mark {
  background: #10b981;
  border-color: #10b981;
}

.tooth.extract .tooth-mark {
  background: #475569;
  border-color: #475569;
}

.tooth.extract .tooth-mark:after {
  content: "×";
  color: #fff;
  font-size: 25px;
  position: absolute;
  inset: -7px 0 0;
  text-align: center;
}
*/

.tooth {
  width: 38px;
  height: 64px;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0;
  color: #64748b;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
}

.tooth:hover {
  transform: translateY(-3px);
  filter: drop-shadow(0 5px 6px rgba(148, 163, 184, 0.5));
}

.tooth-visual {
  position: relative;
  width: 40px;
  height: 60px;
}

.tooth-shape {
  width: 100%;
  height: 100%;
  display: block;
}

.tooth-shape path {
  fill: #ffffff;
  stroke: #94a3b8;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  transition: fill 0.15s, stroke 0.15s;
}

.tooth-label {
  font-size: 16px;
  line-height: 1;
}

.tooth-mark {
  display: none;
}

.tooth.decay .tooth-shape path {
  fill: #ef4444;
  stroke: #ef4444;
}
.tooth.filling .tooth-shape path {
  fill: #3b82f6;
  stroke: #3b82f6;
}
.tooth.crown .tooth-shape path {
  fill: #f59e0b;
  stroke: #f59e0b;
}
.tooth.rct .tooth-shape path {
  fill: #8b5cf6;
  stroke: #8b5cf6;
}
.tooth.implant .tooth-shape path {
  fill: #10b981;
  stroke: #10b981;
}

.tooth.extract .tooth-shape path {
  fill: #cbd5e1;
  stroke: #94a3b8;
  opacity: 0.6;
}

.tooth.extract .tooth-mark {
  display: flex;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
}

.tooth.extract .tooth-mark::after {
  content: "×";
  color: #dc2626;
  font-size: 26px;
  font-weight: 700;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-inline-end: 4px;
  vertical-align: -1px;
  border: 1px solid #94a3b8;
}

.patient-summary {
  justify-content: space-between;
  gap: 15px;
  padding: 14px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 20px;
}

.patient-summary h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.patient-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.alert-banner {
  background: var(--danger-bg);
  border: 1px solid #fca5a5;
  color: #991b1b;
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  margin-bottom: 18px;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  text-align: start;
  padding: 12px 9px;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

.data-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 13px;
}

.field {
  display: grid;
  gap: 5px;
}

.field.full-span {
  grid-column: 1/-1;
}

.field label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.field input,
.field textarea,
.field select,
textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  min-width: 0;
}

.field textarea,
textarea {
  resize: vertical;
}

.form-actions {
  justify-content: flex-end;
  gap: 9px;
  margin-top: 19px;
}

.agenda {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.agenda-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  min-height: 55px;
  border-bottom: 1px solid #f1f5f9;
}

.agenda-row:last-child {
  border: 0;
}

.agenda-time {
  padding: 12px;
  color: var(--muted);
  font-size: 11px;
  border-inline-end: 1px solid var(--line);
}

.appointment {
  margin: 7px 10px;
  background: #e0f2fe;
  border-inline-start: 3px solid var(--primary);
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.appointment > div:first-child {
  flex: 1 1 auto;
}

.appointment b {
  display: block;
}

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  z-index: 8;
}

.context-drawer {
  position: fixed;
  z-index: 9;
  inset-block: 0;
  inset-inline-end: 0;
  width: min(360px, 100vw);
  background: #fff;
  box-shadow: -12px 0 30px rgba(15, 23, 42, 0.14);
  padding: 25px;
  transform: translateX(105%);
  transition: transform 0.22s ease;
  overflow: auto;
}

.drawer-open .context-drawer {
  transform: translateX(0);
}

.drawer-open .drawer-backdrop {
  display: block;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  font-size: 27px;
  margin: 0;
}

.drawer-head p {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 0;
}

.drawer-head .icon-button,
.modal-close {
  color: var(--muted);
}

.surface-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  padding: 18px 0;
}

.surface-btn {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 11px;
}

.surface-btn.active {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

.drawer-section {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin-top: 10px;
}

.action-btn {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  text-align: start;
  font-size: 11px;
}

.action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.full {
  width: 100%;
  margin-top: 9px;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 20;
  place-items: center;
  padding: 20px;
}

.modal.show {
  display: grid;
}

.modal-card {
  position: relative;
  background: #fff;
  border-radius: 14px;
  width: min(700px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 28px;
  box-shadow: 0 20px 60px #0f172a33;
}

.modal-close {
  position: absolute;
  inset-inline-end: 15px;
  top: 13px;
}

.modal-card h2 {
  margin: 0 0 20px;
  font-size: 20px;
}

.modal-card .card {
  box-shadow: none;
  padding: 0;
  border: 0;
}
.modal-card:has(.xray-viewer) {
  width: min(1200px, calc(100vw - 32px));

  max-width: 1200px;
}
.xray-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.xray-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.xray-item img {
  width: 100%;
  aspect-ratio: 1.3;
  object-fit: cover;
  background: #0f172a;
}

.xray-item div {
  padding: 9px;
  font-size: 11px;
}
.xray-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.xray-delete-button {
  flex: 0 0 auto;

  width: 30px;
  height: 30px;

  display: grid;
  place-items: center;

  border: 1px solid #fecaca;
  border-radius: 7px;

  background: #fff;
  color: var(--danger);

  font-size: 18px;
  line-height: 1;
}

.xray-delete-button:hover {
  background: var(--danger-bg);
}

.xray-upload-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;

  margin: 18px 0 24px;

  padding: 18px;

  background: #f8fafc;

  border: 1px solid var(--line);

  border-radius: 10px;
}

.xray-upload-form .full-span {
  grid-column: 1 / -1;
}

.xray-upload-form > .button {
  width: fit-content;
}

.xray-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;

  margin-top: 6px;
}

.xray-meta span {
  padding: 3px 7px;

  border-radius: 5px;

  background: #f1f5f9;

  color: var(--muted);

  font-size: 11px;
}

.xray-notes {
  margin: 8px 0 0;

  color: var(--muted);

  font-size: 12px;

  line-height: 1.5;
}
.xray-viewer {
  width: min(1100px, 90vw);
}

.xray-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 14px;

  margin-bottom: 14px;

  flex-wrap: wrap;
}

.xray-viewer-info {
  display: flex;
  align-items: center;

  gap: 6px;

  flex-wrap: wrap;
}

.xray-viewer-actions {
  display: flex;
  align-items: center;

  gap: 6px;

  flex-wrap: wrap;
}

.xray-zoom-label {
  min-width: 52px;

  text-align: center;

  font-size: 12px;

  color: var(--muted);
}

.xray-viewer-stage {
  position: relative;

  width: 100%;
  min-height: 55vh;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;

  padding: 20px;

  background: #0f172a;

  border-radius: 10px;
}

.xray-viewer-stage img {
  display: block;

  max-width: 100%;
  max-height: 65vh;

  object-fit: contain;

  transform-origin: center center;

  transition: transform 0.2s ease;

  user-select: none;
}

.xray-viewer-stage.is-pannable {
  cursor: grab;
  touch-action: none;
}

.xray-viewer-stage.is-panning {
  cursor: grabbing;
}

.xray-viewer-stage.is-panning img {
  transition: none;
}

.xray-viewer-notes {
  margin-top: 14px;

  padding: 12px 14px;

  border: 1px solid var(--line);

  border-radius: 8px;

  background: var(--surface);
}

.xray-viewer-notes p {
  margin: 6px 0 0;

  color: var(--muted);

  line-height: 1.6;
}

.timeline-event-clickable,
.xray-item-clickable {
  cursor: pointer;
}

.timeline-event-clickable:hover .timeline-content,
.xray-item-clickable:hover {
  border-color: var(--primary);
}

@media (max-width: 700px) {
  .xray-viewer {
    width: 100%;
  }

  .xray-viewer-stage {
    min-height: 45vh;

    padding: 10px;
  }

  .xray-viewer-actions {
    width: 100%;
  }

  .xray-viewer-actions .button {
    flex: 1;
  }
}
@media (max-width: 700px) {
  .xray-upload-form {
    grid-template-columns: 1fr;
  }

  .xray-upload-form .full-span {
    grid-column: auto;
  }
}

.toast {
  position: fixed;
  bottom: 22px;
  inset-inline-end: 22px;
  background: var(--navy);
  color: #fff;
  padding: 11px 15px;
  border-radius: 8px;
  z-index: 40;
  font-size: 12px;
  animation: rise 0.2s ease;
}

/* Professional Footer */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  margin-top: auto;
  padding: 22px 4px 6px;

  border-top: 1px solid var(--line);

  color: var(--muted);
  font-size: 14px;
}

.footer-left,
.footer-center,
.footer-right {
  display: flex;
  align-items: center;
  gap: 7px;
}

.footer-center {
  text-align: center;
}

.footer-right a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.footer-right a:hover {
  color: var(--primary);
}

/* Mobile */
@media (max-width: 700px) {
  .app-footer {
    flex-direction: column;
    justify-content: center;
    gap: 9px;

    padding-top: 18px;

    text-align: center;
  }

  .footer-left,
  .footer-center,
  .footer-right {
    justify-content: center;
    flex-wrap: wrap;
  }
}

.undo-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.undo-toast button {
  padding: 5px 10px;

  background: transparent;

  border: 1px solid currentColor;
  border-radius: 6px;

  color: inherit;

  font-weight: 700;

  cursor: pointer;
}

.undo-toast button:hover {
  background: rgba(255, 255, 255, 0.12);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
    min-height: 76px;
    flex-wrap: wrap;
    padding: 15px 18px;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .search {
    width: 100%;
    order: 5;
  }

  .sidebar {
    width: 72px;
    padding: 18px 8px;
  }

  .profile {
    padding: 0 0 18px;
    justify-content: center;
  }

  .profile > div:last-child,
  .sidebar-foot span:last-child,
  .nav-item span:last-child {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 11px 5px;
  }

  .main {
    padding: 24px 18px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .page-heading {
    align-items: flex-start;
    gap: 10px;
  }

  .heading-date {
    display: none;
  }
}

@media (max-width: 560px) {
  .brand {
    min-width: auto;
  }

  .brand span,
  .clock {
    display: none;
  }

  .top-actions {
    gap: 5px;
  }

  .top-actions .button-primary span {
    display: none;
  }

  .main {
    padding: 20px 13px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .page-heading h1 {
    font-size: 22px;
  }

  .card {
    padding: 16px;
  }

  .workspace-toolbar {
    padding: 14px 16px;
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid {
    gap: 9px;
  }

  .stat {
    padding: 13px;
  }

  .stat-value {
    font-size: 20px;
  }
}

@media print {
  .topbar,
  .sidebar,
  .page-heading,
  .button,
  .workspace-toolbar,
  .drawer-backdrop,
  .context-drawer {
    display: none !important;
  }

  .main {
    padding: 0;
  }

  .app-shell,
  .card {
    box-shadow: none;
  }

  .print-only {
    display: block !important;
  }

  .invoice-print {
    border: 0 !important;
  }
}
.hidden {
  display: none !important;
}

.demo-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;

  display: flex;
  align-items: center;
  gap: 8px;

  padding: 7px 12px;

  border: 1px solid var(--line);
  border-radius: 999px;

  background: var(--surface);
  color: var(--muted);

  font-size: 11px;

  box-shadow: var(--shadow);
}

.demo-banner span {
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.4px;
}

.demo-banner small {
  font-size: 10px;
}

@media (max-width: 560px) {
  .demo-banner {
    top: 8px;
    padding: 6px 10px;
  }

  .demo-banner small {
    display: none;
  }
}
