:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --text: #1d2522;
  --muted: #66736d;
  --line: #dfe6e1;
  --teal: #0f766e;
  --teal-soft: #d8f3ee;
  --amber: #b7791f;
  --amber-soft: #fff0cf;
  --rose: #be4b5a;
  --rose-soft: #ffe1e6;
  --indigo: #4f46a5;
  --indigo-soft: #e7e6fb;
  --shadow: 0 10px 30px rgba(31, 44, 38, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 20px 14px;
}

.brand,
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  padding: 0 8px 18px;
  border-bottom: 1px solid var(--line);
}

.brand strong,
.login-brand strong {
  display: block;
}

.brand small,
.login-brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

.side-nav {
  display: grid;
  gap: 4px;
  margin-top: 18px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  color: #33413c;
  font-size: 14px;
}

.side-link:hover,
.side-link.active {
  background: var(--teal-soft);
  color: #064e47;
}

.main-panel {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 68px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 244, .92);
  backdrop-filter: blur(10px);
}

.clinic-title {
  min-width: 0;
}

.clinic-title strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clinic-title span {
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.page-content {
  padding: 24px;
}

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

.page-heading h1 {
  margin: 0;
  font-size: 28px;
}

.page-heading p {
  margin: 5px 0 0;
  color: var(--muted);
}

.heading-actions {
  display: flex;
  gap: 8px;
}

.primary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  cursor: pointer;
}

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

.ghost-button {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.icon-button {
  width: 38px;
  padding: 0;
  background: var(--surface);
  border-color: var(--line);
}

.wide {
  width: 100%;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.user-chip span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-left-width: 5px;
}

.metric-card span,
.metric-card a {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  font-size: 28px;
  line-height: 1.1;
}

.accent-teal { border-left-color: var(--teal); }
.accent-amber { border-left-color: var(--amber); }
.accent-rose { border-left-color: var(--rose); }
.accent-indigo { border-left-color: var(--indigo); }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.wide-panel {
  padding: 28px;
}

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

.panel-header h2 {
  margin: 0;
  font-size: 17px;
}

.panel-header a {
  color: var(--teal);
  font-size: 13px;
}

.list-table {
  display: grid;
}

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

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

.row-link strong,
.row-link small {
  display: block;
}

.row-link small,
.row-link time,
.row-link em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.empty-state {
  padding: 22px 18px;
  color: var(--muted);
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(170px, .35fr) minmax(170px, .35fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.finance-shell {
  display: grid;
  gap: 0;
}

.finance-alert,
.receipt-panel {
  margin-bottom: 18px;
}

.cashbox-open-form,
.cash-entry-form {
  border-bottom: 1px solid var(--line);
}

.finance-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 18px 0;
}

.finance-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface);
  font-size: 14px;
}

.finance-tabs a.active {
  color: #064e47;
  background: var(--teal-soft);
  border-color: #b9ded8;
}

.finance-filter {
  grid-template-columns: repeat(2, minmax(145px, .22fr)) minmax(220px, 1fr) minmax(160px, .28fr) minmax(150px, .22fr) auto;
}

.finance-split,
.finance-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

.finance-split > div + div,
.finance-detail-grid > .panel + .panel {
  border-left: 1px solid var(--line);
}

.compact-header {
  padding-top: 14px;
  padding-bottom: 14px;
}

.static-row {
  cursor: default;
}

.cashbox-row {
  align-items: flex-start;
}

.cash-entry-row {
  align-items: flex-start;
}

.cashbox-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.cashbox-actions em {
  min-width: 92px;
  text-align: right;
}

.inline-close {
  position: relative;
}

.inline-close summary {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  cursor: pointer;
  background: var(--surface);
  font-size: 14px;
}

.inline-close form {
  position: absolute;
  right: 0;
  z-index: 3;
  display: grid;
  width: min(360px, 80vw);
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.inline-close input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.payable-action-cell {
  min-width: 210px;
}

.payable-action-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.payable-actions form {
  position: static;
  width: min(390px, 78vw);
  text-align: left;
}

.payable-actions label,
.payable-actions .form-row-2 {
  display: grid;
  gap: 5px;
}

.payable-actions .form-row-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.payable-actions label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.payable-actions select,
.payable-actions input,
.payable-actions textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
}

.payable-actions textarea {
  min-height: 110px;
  padding: 10px;
  resize: vertical;
}

.detail-list {
  display: grid;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.detail-list div:last-child {
  border-bottom: 0;
}

.detail-list span {
  color: var(--muted);
  font-size: 13px;
}

.detail-list strong {
  text-align: right;
  font-size: 14px;
}

.alert.warning {
  margin: 0 18px 14px;
  border: 1px solid #f2d390;
  background: var(--amber-soft);
  color: #74470c;
}

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

.field span {
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
}

.field input,
.field select {
  min-height: 40px;
  padding: 0 12px;
}

.field textarea {
  min-height: 110px;
  padding: 10px 12px;
  resize: vertical;
}

.patient-form {
  overflow: hidden;
}

.form-alert {
  margin-bottom: 14px;
}

.form-section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.form-section:last-of-type {
  border-bottom: 0;
}

.section-title {
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 17px;
}

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

.span-2 {
  grid-column: span 2;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  color: var(--text);
}

.check-option input {
  width: 17px;
  height: 17px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.table-shell {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.patient-table {
  min-width: 860px;
}

.data-table th,
.data-table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.patient-cell,
.stacked {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stacked {
  display: grid;
  gap: 3px;
}

.patient-cell strong,
.patient-cell small,
.stacked small {
  display: block;
}

.patient-cell small,
.stacked small {
  color: var(--muted);
  font-size: 12px;
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--teal-soft);
  color: #064e47;
  font-size: 13px;
  font-weight: 800;
}

.avatar.large {
  width: 64px;
  height: 64px;
  font-size: 20px;
}

.status-pill,
.soft-pill,
.conflict-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill {
  background: var(--surface-2);
  color: #33413c;
}

.soft-pill {
  margin-left: 5px;
  background: var(--amber-soft);
  color: #74470c;
}

.conflict-pill {
  background: var(--rose-soft);
  color: #8f2633;
}

.table-actions {
  text-align: right !important;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination a {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.profile-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 18px;
}

.profile-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.profile-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 20px;
}

.profile-main p {
  margin: 6px 0 0;
  color: var(--muted);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  min-width: min(440px, 100%);
}

.stat-box {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.stat-box span,
.info-grid span,
.timeline-item span,
.timeline-item time {
  color: var(--muted);
  font-size: 12px;
}

.stat-box strong {
  font-size: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, .75fr);
  gap: 18px;
  margin-bottom: 18px;
}

.record-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 18px;
}

.record-tabs a {
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.record-metrics .metric-card small {
  color: var(--muted);
  font-size: 12px;
}

.record-note-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.clinical-timeline {
  max-height: 420px;
  overflow: auto;
}

.answer-groups,
.document-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.answer-group {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.answer-group h3 {
  margin: 0;
  font-size: 15px;
}

.answer-row {
  display: grid;
  gap: 5px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.answer-row span,
.document-item small {
  color: var(--muted);
  font-size: 12px;
}

.answer-row strong {
  overflow-wrap: anywhere;
}

.treatment-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.treatment-summary span {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}

.treatment-summary strong {
  color: var(--text);
  font-size: 20px;
}

.record-table {
  min-width: 820px;
}

.odontogram-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.odontogram-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.odontogram-tabs button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.odontogram-tabs button.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.odontogram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.odontogram-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.odontogram-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.odontogram-legend .red { background: #db0c0f; }
.odontogram-legend .blue { background: #1e71bf; }
.odontogram-legend .gray { background: #626262; }
.odontogram-legend .missing { background: #ff6b1a; }

.odontogram-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 18px;
  padding: 18px;
}

.odontogram-stage {
  min-width: 0;
  overflow: auto;
}

.odontogram-mode {
  display: grid;
  gap: 0;
  width: max-content;
  min-width: 100%;
}

.dental-row {
  display: flex;
  width: max-content;
  min-width: 100%;
  justify-content: center;
}

.deciduous-row {
  max-width: 580px;
  min-width: 580px;
  margin: 0 auto;
}

.odontogram-tooth {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  width: 58px;
  min-height: 202px;
  padding: 0 3px;
  border: 0;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.odontogram-tooth strong {
  display: grid;
  place-items: center;
  min-height: 26px;
  font-size: 13px;
}

.odontogram-tooth em {
  position: absolute;
  top: 34px;
  left: 50%;
  z-index: 1;
  transform: translateX(-50%);
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(17, 24, 39, .74);
  color: #fff;
  font-size: 10px;
  font-style: normal;
}

.tooth-art {
  width: 52px;
  height: 102px;
  background-position: top center;
  background-repeat: no-repeat;
  background-size: 82% auto;
}

.odontogram-tooth.lower .tooth-art {
  background-position: bottom center;
}

.tooth-face {
  display: grid;
  place-items: center;
  width: 52px;
  height: 54px;
  border: 1px solid #b7bdc5;
  background: #fff;
}

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

.tooth-face-svg .face {
  stroke: #c9ced6;
  stroke-width: .7;
}

.tooth-face-svg .disabled {
  opacity: .18;
}

.tooth-face-svg.extraction {
  padding: 6px;
  stroke: #db0c0f;
  stroke-width: 5;
  stroke-linecap: round;
}

.odontogram-tooth.has-red .tooth-art,
.odontogram-tooth.has-blue .tooth-art,
.odontogram-tooth.has-gray .tooth-art,
.odontogram-tooth.is-missing .tooth-art {
  border-radius: 6px;
}

.odontogram-tooth.has-red .tooth-art { background-color: rgba(219, 12, 15, .10); }
.odontogram-tooth.has-blue .tooth-art { background-color: rgba(30, 113, 191, .10); }
.odontogram-tooth.has-gray .tooth-art { background-color: rgba(98, 98, 98, .12); }
.odontogram-tooth.is-missing .tooth-art { background-color: rgba(255, 107, 26, .14); }

.odontogram-tooth.active {
  background: #ff6b1a;
  color: #fff;
}

.odontogram-tooth.active .tooth-face {
  border-color: #ff6b1a;
}

.odontogram-treatment-form {
  display: grid;
  grid-template-columns: 150px minmax(240px, 1.3fr) 120px minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  min-width: 860px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.selected-tooth-label {
  display: grid;
  gap: 5px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

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

.selected-tooth-label strong {
  font-size: 16px;
}

.compact-field {
  gap: 5px;
}

.odontogram-description {
  min-width: 0;
}

.tooth-surface-options,
.odontogram-color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tooth-surface-options {
  grid-column: 1 / span 3;
}

.odontogram-color-options {
  grid-column: 4 / span 2;
}

.tooth-surface-options label,
.odontogram-color-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

.tooth-surface-options input,
.odontogram-color-options input {
  width: 14px;
  height: 14px;
}

.odontogram-treatment-form .primary-button {
  min-height: 40px;
  white-space: nowrap;
}

.odontogram-treatment-form [readonly] {
  background: #f1f5f9;
}

.hof-canvas {
  width: 500px;
  height: 500px;
  border: 1px dashed #c9ced6;
  border-radius: 8px;
  background:
    linear-gradient(#f8fafc, #f8fafc) padding-box,
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(15, 23, 42, .04) 12px 24px);
}

.odontogram-details {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.tooth-detail {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.tooth-detail h3,
.tooth-detail p {
  margin: 0;
}

.tooth-detail p,
.tooth-detail small,
.tooth-detail span {
  color: var(--muted);
  font-size: 12px;
}

.tooth-detail article {
  display: grid;
  gap: 3px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.document-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.document-item div {
  display: grid;
  gap: 6px;
}

.document-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.agenda-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.week-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.week-day {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 142px;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.week-day:last-child {
  border-right: 0;
}

.week-day.active {
  background: var(--teal-soft);
}

.week-day span,
.week-day small,
.week-day em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.week-day strong {
  font-size: 24px;
}

.week-day em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capacity-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.capacity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 1px;
  background: var(--line);
}

.capacity-slot {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 10px;
  background: var(--surface);
}

.capacity-slot.busy {
  background: var(--amber-soft);
}

.capacity-slot.full {
  background: var(--rose-soft);
}

.capacity-slot strong {
  font-size: 14px;
}

.capacity-slot span,
.capacity-slot em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.agenda-board,
.agenda-side {
  overflow: hidden;
}

.agenda-filter {
  grid-template-columns: minmax(150px, .25fr) minmax(190px, .35fr) minmax(160px, .25fr) auto;
}

.agenda-list {
  display: grid;
}

.schedule-grid-shell {
  max-height: 720px;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.doctor-schedule-table {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.doctor-schedule-table th,
.doctor-schedule-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.doctor-schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 42px;
  padding: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.doctor-schedule-table .schedule-hour-col {
  width: 64px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.schedule-cell {
  height: 54px;
  padding: 4px;
  background: #fff;
}

.schedule-cell.filled {
  padding: 0;
}

.schedule-empty-slot {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 45px;
  border-radius: 6px;
  color: transparent;
}

.schedule-empty-slot:hover {
  background: var(--surface-2);
  color: var(--teal);
}

.schedule-empty-slot span {
  font-size: 18px;
  font-weight: 900;
}

.schedule-event {
  display: grid;
  gap: 4px;
  min-height: 52px;
  padding: 8px;
  border-left: 4px solid #9aa4b2;
  background: #eef3f8;
  color: var(--text);
  font-size: 12px;
}

.schedule-event + .schedule-event {
  border-top: 1px solid rgba(255, 255, 255, .55);
}

.schedule-event strong,
.schedule-event span,
.schedule-event small,
.schedule-event em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-event span,
.schedule-event small {
  color: rgba(17, 24, 39, .78);
}

.schedule-event em {
  color: #8f2633;
  font-style: normal;
  font-weight: 800;
}

.schedule-status-1 {
  border-left-color: #1dac07;
  background: #e8f7e7;
}

.schedule-status-2 {
  border-left-color: #f04b4b;
  background: #fdecec;
}

.schedule-status-3 {
  border-left-color: #4fa1e5;
  background: #eaf4ff;
}

.schedule-status-4 {
  border-left-color: #e59e4e;
  background: #fff3e3;
}

.schedule-status-5 {
  border-left-color: #028f76;
  background: #e2f6f1;
}

.schedule-status-9 {
  border-left-color: #52615b;
  background: #e9eceb;
}

.list-subheader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.list-subheader span {
  color: var(--muted);
  font-size: 12px;
}

.agenda-event {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  border-left: 5px solid var(--teal);
}

.agenda-event:last-child {
  border-bottom: 0;
}

.agenda-event.status-1 { border-left-color: var(--teal); }
.agenda-event.status-2 { border-left-color: var(--rose); opacity: .75; }
.agenda-event.status-3 { border-left-color: var(--indigo); }
.agenda-event.status-4 { border-left-color: var(--amber); }
.agenda-event.status-5 { border-left-color: #4b8f49; }
.agenda-event.status-9 { border-left-color: #52615b; background: var(--surface-2); }

.event-time {
  display: grid;
  align-content: start;
  gap: 4px;
}

.event-time strong {
  font-size: 20px;
}

.event-time span,
.event-meta,
.mini-row small,
.mini-row em {
  color: var(--muted);
  font-size: 12px;
}

.event-main {
  min-width: 0;
}

.event-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.event-main p {
  margin: 7px 0;
  color: var(--muted);
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.event-meta a {
  color: var(--teal);
}

.event-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.danger {
  color: #8f2633;
  border-color: #fac3ca;
  background: var(--rose-soft);
}

.compact-form {
  padding: 18px;
}

.inline-note {
  margin: 14px 18px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--amber-soft);
  color: #74470c;
  font-size: 13px;
}

.slim-note {
  margin: 0;
}

.one-column {
  grid-template-columns: 1fr;
}

.compact-actions {
  padding: 14px 0 0;
  border-top: 0;
  background: transparent;
}

.whatsapp-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.whatsapp-panel .section-title h2,
.scheduled-list h3 {
  margin: 0;
  font-size: 15px;
}

.whatsapp-panel .alert,
.whatsapp-panel .empty-state {
  margin: 0;
}

.compact-empty {
  padding: 12px;
}

.scheduled-list {
  display: grid;
  gap: 10px;
}

.whatsapp-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.whatsapp-status small {
  color: var(--muted);
  font-size: 12px;
}

.whatsapp-status form {
  margin: 0;
}

.whatsapp-web-frame {
  width: 100%;
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.connection-pill.connected {
  background: var(--teal-soft);
  color: #17625a;
}

.connection-pill.disconnected {
  background: var(--amber-soft);
  color: #74470c;
}

.scheduled-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.scheduled-item span {
  min-width: 0;
}

.scheduled-item strong,
.scheduled-item small {
  display: block;
}

.scheduled-item small {
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.scheduled-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.muted-item {
  opacity: .65;
}

.whatsapp-form {
  display: grid;
  gap: 14px;
  padding: 0;
}

.whatsapp-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.whatsapp-actions button {
  width: 100%;
}

.side-list {
  border-top: 1px solid var(--line);
  padding: 16px 18px 18px;
}

.side-list h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.mini-row strong,
.mini-row small {
  display: block;
}

.search-panel {
  overflow: hidden;
}

.agenda-search {
  grid-template-columns: minmax(220px, 1fr) repeat(4, minmax(140px, .3fr)) auto;
}

.agenda-results {
  min-width: 820px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.info-grid div {
  min-width: 0;
}

.info-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.timeline {
  display: grid;
}

.timeline-item {
  display: grid;
  gap: 4px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.module-state {
  max-width: 620px;
}

.module-state h2 {
  margin: 10px 0;
  font-size: 24px;
}

.module-state p {
  color: var(--muted);
  line-height: 1.5;
}

.module-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--amber-soft);
  color: #74470c;
  font-size: 12px;
  font-weight: 700;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 420px;
}

.login-panel {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-form input[type="email"],
.login-form input[type="password"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
}

.check-line {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.check-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.check-card input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.alert {
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
}

.alert.error {
  border: 1px solid #fac3ca;
  background: var(--rose-soft);
  color: #8f2633;
}

.alert.success {
  border: 1px solid #a6ded7;
  background: var(--teal-soft);
  color: #17625a;
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

.icon-grid { mask-image: linear-gradient(#000 0 0); border-radius: 4px; }
.icon-calendar { mask-image: linear-gradient(#000 0 0); }
.icon-users { mask-image: linear-gradient(#000 0 0); }
.icon-user-plus { mask-image: linear-gradient(#000 0 0); }
.icon-wallet { mask-image: linear-gradient(#000 0 0); }
.icon-receipt { mask-image: linear-gradient(#000 0 0); }
.icon-message { mask-image: linear-gradient(#000 0 0); }
.icon-globe { mask-image: linear-gradient(#000 0 0); }
.icon-chart { mask-image: linear-gradient(#000 0 0); }
.icon-settings { mask-image: linear-gradient(#000 0 0); }
.icon-mark { mask-image: linear-gradient(#000 0 0); }
.icon-menu { mask-image: linear-gradient(#000 0 0); }
.icon-exit { mask-image: linear-gradient(#000 0 0); }

@media (max-width: 1080px) {
  .metric-grid,
  .dashboard-grid,
  .detail-grid,
  .agenda-layout,
  .week-grid,
  .treatment-summary,
  .finance-split,
  .finance-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bar,
  .agenda-search,
  .finance-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .odontogram-layout {
    grid-template-columns: 1fr;
  }

  .odontogram-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bar .primary-button {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 5;
    width: 260px;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  .app-shell:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0);
  }

  .topbar {
    padding: 10px 14px;
  }

  .page-content {
    padding: 16px;
  }

  .page-heading,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .dashboard-grid,
  .detail-grid,
  .agenda-layout,
  .week-grid,
  .treatment-summary,
  .finance-split,
  .finance-detail-grid,
  .info-grid,
  .filter-bar,
  .finance-filter,
  .agenda-search,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .finance-split > div + div,
  .finance-detail-grid > .panel + .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .week-day {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .span-2 {
    grid-column: auto;
  }

  .profile-header,
  .table-footer,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .agenda-event {
    grid-template-columns: 1fr;
  }

  .event-actions {
    justify-content: stretch;
  }

  .event-actions .ghost-button,
  .event-actions form,
  .event-actions button {
    width: 100%;
  }

  .stat-strip {
    grid-template-columns: 1fr;
  }

  .odontogram-details {
    grid-template-columns: 1fr;
  }

  .user-chip strong,
  .topbar-actions .ghost-button {
    display: none;
  }
}

body.oral-admin-shell {
  --bg: #f7f8fb;
  --surface-2: #f6f8fb;
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
  background: var(--bg);
}

.oral-admin-shell .wrapper {
  min-height: 100vh;
}

.oral-admin-shell #loader {
  display: none;
}

.oral-admin-shell .main-header .logo-box {
  border-right: 1px solid rgba(0, 0, 0, .05);
}

.siodonto-template-logo {
  gap: 12px;
}

.siodonto-logo-letter {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  font-weight: 800;
}

.siodonto-logo-name {
  display: block;
  color: #172b4d;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.siodonto-template-logo small {
  display: block;
  color: #6b7280;
  font-size: 11px;
  line-height: 1.2;
  margin-top: 3px;
}

.oral-admin-shell .main-sidebar .sidebar {
  position: relative;
  top: auto;
  height: auto;
  min-height: calc(100vh - 70px);
  padding: 0;
  border-right: 0;
  background: transparent;
  transform: none;
}

.oral-admin-shell .sidebar-menu > li > a {
  letter-spacing: 0;
}

.oral-admin-shell .sidebar-menu > li.active > a,
.oral-admin-shell .sidebar-menu > li > a:hover {
  color: #0f766e;
}

.template-sidebar-card {
  display: grid;
  gap: 4px;
  margin: 18px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(15, 118, 110, .08);
  color: #172b4d;
}

.template-sidebar-card span,
.template-sidebar-card small {
  color: #64748b;
  font-size: 11px;
}

.template-sidebar-card strong {
  line-height: 1.25;
}

.template-quick-action {
  gap: 8px;
  min-height: 38px;
  padding-inline: 14px;
}

.template-avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: #0f766e;
  color: #fff;
  font-weight: 800;
}

.template-user-toggle::after {
  display: none;
}

.oral-admin-shell .content-wrapper {
  min-height: calc(100vh - 70px);
}

.oral-admin-shell .content {
  padding: 22px 24px 28px;
}

.oral-admin-shell .page-heading {
  align-items: center;
}

.oral-admin-shell .page-heading h1 {
  color: #172b4d;
  font-size: 26px;
  font-weight: 800;
}

.oral-admin-shell .metric-card,
.oral-admin-shell .panel {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(28, 39, 60, .06);
}

.oral-admin-shell .primary-button {
  background: #0f766e;
  border-color: #0f766e;
}

.oral-admin-shell .ghost-button,
.oral-admin-shell .icon-button {
  background: #fff;
}

.oral-admin-shell .main-footer {
  display: flex;
  align-items: center;
  min-height: 54px;
  letter-spacing: 0;
}

@media (max-width: 760px) {
  .oral-admin-shell .content {
    padding: 16px;
  }

  .oral-admin-shell .page-heading {
    align-items: stretch;
  }

  .template-quick-action span,
  .siodonto-template-logo small {
    display: none;
  }
}
