:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #252320;
  background: #f1ece4;
  font-synthesis: none;
  --paper: #f8f4ee;
  --paper-2: #fffdf9;
  --ink: #252320;
  --muted: #817a71;
  --line: #ddd3c7;
  --wine: #7a3341;
  --wine-dark: #5d2631;
  --wine-soft: #f2e4e7;
  --sage: #6f7b67;
  --sage-soft: #e7ebe2;
  --blue: #456f8a;
  --blue-soft: #e8f0f5;
  --danger: #a44b4b;
  --shadow: 0 20px 55px rgba(67, 50, 33, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(122,51,65,.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122,51,65,.024) 1px, transparent 1px),
    #f1ece4;
  background-size: 32px 32px;
  transition: background .2s ease, color .2s ease;
}

button, input { font: inherit; }
button { cursor: pointer; }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper-2);
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform .15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}
button:focus-visible, input:focus-visible {
  outline: 3px solid var(--wine);
  outline-offset: 3px;
}

.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;
}

.instrument-bar {
  width: min(1500px, calc(100% - 28px));
  min-height: 72px;
  margin: 14px auto 0;
  padding: 10px 12px 10px 18px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  border: 1px solid rgba(214,203,191,.95);
  border-radius: 18px;
  background: rgba(255,253,249,.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 32px rgba(67,50,33,.05);
  position: sticky;
  top: 12px;
  z-index: 20;
}

.brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.top-nav {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 4px;
  border-radius: 999px;
  background: #ece5dc;
}

.nav-item {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  background: transparent;
  color: #665f58;
  font-size: .77rem;
  font-weight: 760;
  transition: .16s ease;
}

.nav-item:hover { color: var(--ink); }
.nav-item.active {
  background: #282824;
  color: #fff;
  box-shadow: 0 5px 14px rgba(39,40,37,.12);
}

.bar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  margin-right: 4px;
  color: #6f675f;
  font-size: .71rem;
  font-weight: 720;
}

.status-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #75856c;
  box-shadow: 0 0 0 4px rgba(117,133,108,.10);
}

.icon-control,
.primary-button,
.quiet-button {
  border: 0;
  font-weight: 760;
}

.icon-control {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #eee7de;
  color: #655d55;
}

.primary-button {
  border-radius: 12px;
  padding: 11px 15px;
  background: var(--wine);
  color: #fff;
  box-shadow: 0 8px 18px rgba(122,51,65,.15);
  transition: .16s ease;
}

.primary-button:hover {
  transform: translateY(-1px);
  background: var(--wine-dark);
}

.primary-button.large { padding: 12px 17px; }

.quiet-button {
  border-radius: 12px;
  padding: 10px 13px;
  background: #ece5dc;
  color: #5f5851;
}

.quiet-button.compact {
  padding: 8px 10px;
  font-size: .74rem;
}

.workspace {
  width: min(1380px, calc(100% - 34px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.view {
  display: none;
  animation: viewIn .25s ease both;
}

.view.active { display: block; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.kicker {
  margin: 0 0 9px;
  color: var(--wine);
  font-size: .65rem;
  font-weight: 850;
  letter-spacing: .17em;
}

.editorial-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(330px, .72fr);
  gap: 42px;
  align-items: stretch;
}

.intro-panel {
  min-height: 440px;
  padding: 54px 0 34px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.intro-panel h1,
.page-title-row h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.055em;
}

.intro-panel h1 {
  max-width: 760px;
  font-size: clamp(3.5rem, 7vw, 7rem);
  line-height: .88;
}

.intro-panel h1 span {
  color: var(--wine);
  font-style: italic;
}

.intro-copy {
  max-width: 650px;
  margin: 28px 0 0;
  color: #706960;
  font-size: 1rem;
  line-height: 1.75;
}

.intro-actions {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.disclaimer-line {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-top: 34px;
  color: #6f675f;
  font-size: .73rem;
}

.signal {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 5px rgba(111,123,103,.10);
}

.clinical-board {
  min-height: 440px;
  padding: 28px;
  border: 1px solid #cfc3b5;
  border-radius: 26px;
  background: #2b2b27;
  color: #fff;
  box-shadow: 0 28px 65px rgba(43,43,39,.14);
  display: flex;
  flex-direction: column;
}

.board-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: baseline;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.board-heading span {
  color: #a8a399;
  font-size: .69rem;
  text-transform: uppercase;
  letter-spacing: .14em;
}

.board-heading strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 500;
}

.metric-stack {
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.metric-stack article {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label value"
    "small value";
  gap: 3px 14px;
  align-items: center;
  padding: 21px 0;
  border-bottom: 1px solid rgba(255,255,255,.09);
}

.metric-stack article > span {
  grid-area: label;
  color: #c2bdb5;
  font-size: .77rem;
}

.metric-stack article > strong {
  grid-area: value;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.45rem;
  font-weight: 500;
  line-height: 1;
  color: #fff9ef;
}

.metric-stack article > small {
  grid-area: small;
  color: #9f9a92;
  font-size: .69rem;
}

.board-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
}

.board-label {
  color: #9f9a92;
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .13em;
}

.board-online {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: #d4d0c9;
  font-size: .72rem;
}

.board-online i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #93a883;
}

.flow-section {
  margin-top: 64px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.flow-heading,
.page-title-row,
.ledger-toolbar,
.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
}

.flow-heading h2,
.page-title-row h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.04em;
}

.flow-heading h2 { font-size: 2rem; }

.flow-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 36px;
  margin-top: 24px;
}

.recent-list,
.patient-list,
.procedure-summary {
  display: grid;
  gap: 10px;
}

.recent-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 13px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

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

.avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--wine-soft);
  color: var(--wine);
  border: 1px solid #e6cfd4;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.recent-item strong,
.recent-item span { display: block; }

.recent-item span {
  margin-top: 3px;
  color: #7a736b;
  font-size: .78rem;
}

.recent-item time {
  color: #6f675f;
  font-size: .7rem;
}

.procedure-aside {
  padding: 24px;
  border-left: 1px solid var(--line);
}

.aside-head h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 500;
}

.procedure-item { padding: 13px 0; }
.procedure-item + .procedure-item { border-top: 1px solid var(--line); }

.procedure-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #655e57;
  font-size: .77rem;
}

.procedure-meta span:last-child { color: #6f675f; }

.bar {
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: #ded6cc;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--wine), #a85c69);
}

.empty-state {
  padding: 28px 16px;
  color: #6f675f;
  text-align: center;
  border: 1px dashed #cfc5b9;
  border-radius: 14px;
}

.page-title-row {
  min-height: 130px;
  padding: 18px 0 30px;
}

.page-title-row h1 {
  font-size: clamp(2.6rem, 5vw, 4.6rem);
  line-height: .95;
}

.page-title-row p:last-child {
  margin: 12px 0 0;
  color: #6f675f;
}

.patient-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 28px;
  align-items: start;
}

.patient-ledger {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(248,244,238,.78);
  box-shadow: 0 12px 35px rgba(67,50,33,.04);
}

.ledger-toolbar { align-items: center; }

.search-box {
  flex: 1;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #8e857b;
}

.search-box input,
.field input {
  width: 100%;
  border: 1px solid #d8cec2;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fffdf9;
  color: var(--ink);
}

.search-box input { padding-left: 40px; }

.search-box input::placeholder,
.field input::placeholder { color: #706960; }

.count-pill {
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 999px;
  background: #ebe4da;
  color: #5f5851;
  font-size: .7rem;
  font-weight: 760;
}

.patient-list { margin-top: 16px; }

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

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

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

.patient-main div:last-child { min-width: 0; }
.patient-main strong,
.patient-main span { display: block; }

.patient-main span {
  max-width: 420px;
  margin-top: 4px;
  overflow: hidden;
  color: #6f675f;
  font-size: .77rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.patient-actions button {
  border: 0;
  border-radius: 9px;
  padding: 8px 9px;
  font-size: .7rem;
  font-weight: 760;
}

.view-button {
  background: var(--sage-soft);
  color: #5b6854;
}

.edit-button {
  background: #eae4dc;
  color: #665f57;
}


.record-sheet {
  position: sticky;
  top: 102px;
  padding: 25px;
  border: 1px solid #cfc3b5;
  border-radius: 20px;
  background: #fffdf9;
  box-shadow: var(--shadow);
}

.sheet-index {
  float: right;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--wine);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: .8rem;
}

.sheet-title h2 {
  margin: 0 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  font-weight: 500;
}

form {
  display: grid;
  gap: 15px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: #5d554e;
  font-size: .77rem;
  font-weight: 760;
}

.privacy-note {
  padding: 12px 13px;
  border-left: 3px solid var(--wine);
  background: #f7efef;
}

.privacy-note strong,
.privacy-note span { display: block; }

.privacy-note strong {
  color: #6d343e;
  font-size: .73rem;
}

.privacy-note span {
  margin-top: 3px;
  color: #66575a;
  font-size: .71rem;
}

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

.message {
  min-height: 18px;
  margin: 0;
  color: #6d655d;
  font-size: .75rem;
}

.odontogram-canvas {
  padding: 26px;
  border: 1px solid #cfc3b5;
  border-radius: 24px;
  background: #fffdf9;
  box-shadow: var(--shadow);
}

.canvas-top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.legend span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: #756e66;
  font-size: .75rem;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-dot.healthy { background: #c5bdb4; }
.legend-dot.planned { background: var(--wine); }
.legend-dot.done { background: var(--blue); }

.odontogram-summary {
  display: flex;
  gap: 20px;
}

.odontogram-summary span {
  display: grid;
  gap: 2px;
}

.odontogram-summary strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.odontogram-summary small {
  color: #6f675f;
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.dental-field {
  margin-top: 18px;
  padding: 24px 18px;
  border-radius: 18px;
  background:
    linear-gradient(rgba(122,51,65,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122,51,65,.03) 1px, transparent 1px),
    #f7f1e9;
  background-size: 24px 24px;
  border: 1px solid #e1d7cb;
}

.arch-block { padding: 14px 0; }

.arch-label {
  margin: 7px 0;
  text-align: center;
  color: #6f675f;
  font-size: .64rem;
  font-weight: 820;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.teeth-row {
  display: grid;
  grid-template-columns: repeat(16, minmax(42px, 1fr));
  gap: 7px;
  overflow-x: auto;
  padding: 7px 2px 12px;
}

.tooth-button {
  min-width: 42px;
  min-height: 74px;
  border: 1px solid #d8cec2;
  border-radius: 12px;
  background: rgba(255,253,249,.84);
  color: #746d65;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  transition: .15s ease;
}

.tooth-button:hover {
  transform: translateY(-2px);
  border-color: #bfb2a4;
  background: #fff;
}

.tooth-shape {
  width: 20px;
  height: 25px;
  position: relative;
  border: 2px solid #b8afa6;
  border-radius: 47% 47% 34% 34% / 36% 36% 62% 62%;
  background: #fff;
}

.tooth-shape::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 8px;
  height: 8px;
  transform: translateX(-50%);
  border-left: 2px solid #b8afa6;
  border-right: 2px solid #b8afa6;
}

.tooth-number {
  font-size: .66rem;
  font-weight: 820;
}

.tooth-button.planned {
  border-color: #d7aeb5;
  background: #fff7f8;
  color: var(--wine);
}

.tooth-button.planned .tooth-shape {
  border-color: var(--wine);
  background: var(--wine-soft);
}

.tooth-button.planned .tooth-shape::after { border-color: var(--wine); }

.tooth-button.done {
  border-color: #a9bfce;
  background: #f6fafc;
  color: var(--blue);
}

.tooth-button.done .tooth-shape {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.tooth-button.done .tooth-shape::after { border-color: var(--blue); }

.midline {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #6f675f;
  font-size: .62rem;
  font-weight: 820;
  letter-spacing: .14em;
}

.midline::before,
.midline::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #dcd2c6;
}

.canvas-note {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  color: #6f675f;
  font-size: .73rem;
}

.canvas-note > span {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ede6dc;
  color: #6e665e;
  font-weight: 850;
}

.canvas-note p { margin: 0; }

.details-dialog {
  width: min(500px, calc(100% - 30px));
  border: 1px solid #d7ccbf;
  border-radius: 20px;
  padding: 22px;
  background: #fffdf9;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(55,42,29,.28);
}

.details-dialog::backdrop {
  background: rgba(39,36,31,.45);
  backdrop-filter: blur(4px);
}

.dialog-header { align-items: flex-start; }

.dialog-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 500;
}

.detail-rule {
  height: 1px;
  margin: 18px 0 4px;
  background: var(--line);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row span {
  color: #6f675f;
  font-size: .72rem;
}

.detail-row strong {
  max-width: 62%;
  color: #514a44;
  font-size: .8rem;
  text-align: right;
}

.detail-foot {
  display: flex;
  gap: 9px;
  align-items: center;
  padding-top: 18px;
  color: #6f675f;
  font-size: .72rem;
}

/* tema escuro */
body.dark-theme {
  --paper: #1b1a18;
  --paper-2: #201f1c;
  --ink: #f1ece5;
  --muted: #a89f95;
  --line: #3a3530;
  --wine: #b96775;
  --wine-dark: #a75362;
  --wine-soft: #3a2429;
  --sage-soft: #273029;
  --blue-soft: #22313a;
  background:
    linear-gradient(rgba(185,103,117,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(185,103,117,.018) 1px, transparent 1px),
    #171614;
  color: var(--ink);
}

body.dark-theme .instrument-bar,
body.dark-theme .patient-ledger,
body.dark-theme .record-sheet,
body.dark-theme .odontogram-canvas,
body.dark-theme .details-dialog {
  background: rgba(31,29,26,.95);
  border-color: #403a34;
}

body.dark-theme .top-nav,
body.dark-theme .icon-control,
body.dark-theme .quiet-button,
body.dark-theme .count-pill {
  background: #302c28;
  color: #d1c8be;
}

body.dark-theme .nav-item {
  color: #d1c8be;
}

body.dark-theme .nav-item.active {
  color: #fff;
}

body.dark-theme .primary-button {
  background: var(--wine-dark);
}

body.dark-theme .avatar {
  background: #3a2429;
  color: #f2c3ca;
  border-color: #6a3c45;
}

body.dark-theme .brand small,
body.dark-theme .status-dot,
body.dark-theme .intro-copy,
body.dark-theme .disclaimer-line,
body.dark-theme .page-title-row p:last-child,
body.dark-theme .recent-item span,
body.dark-theme .recent-item time,
body.dark-theme .procedure-meta,
body.dark-theme .legend span,
body.dark-theme .canvas-note,
body.dark-theme .detail-row span {
  color: #9f968c;
}

body.dark-theme .clinical-board {
  background: #ece5db;
  color: #282620;
}

body.dark-theme .board-heading {
  border-color: rgba(39,39,35,.12);
}

body.dark-theme .board-heading span,
body.dark-theme .metric-stack article > small,
body.dark-theme .board-label { color: #665f58; }

body.dark-theme .metric-stack article {
  border-color: rgba(39,39,35,.10);
}

body.dark-theme .metric-stack article > span { color: #5f5952; }
body.dark-theme .metric-stack article > strong { color: #292720; }
body.dark-theme .board-online { color: #625d56; }

body.dark-theme .bar { background: #38332e; }

body.dark-theme .search-box input,
body.dark-theme .field input,
body.dark-theme .tooth-button {
  background: #211f1c;
  border-color: #443e38;
  color: #eee8e0;
}

body.dark-theme .privacy-note {
  background: #332326;
  border-left-color: var(--wine);
}

body.dark-theme .dental-field {
  background:
    linear-gradient(rgba(185,103,117,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(185,103,117,.025) 1px, transparent 1px),
    #1d1b19;
  border-color: #3d3832;
}

body.dark-theme .tooth-shape {
  background: #282521;
  border-color: #756d64;
}

body.dark-theme .detail-row strong { color: #ded7ce; }

@media (max-width: 1050px) {
  .instrument-bar {
    grid-template-columns: 1fr auto;
  }

  .top-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }

  .bar-actions { grid-column: 2; grid-row: 1; }

  .editorial-grid,
  .flow-grid,
  .patient-workspace {
    grid-template-columns: 1fr;
  }

  .intro-panel { min-height: auto; }
  .clinical-board { min-height: 360px; }
  .procedure-aside {
    padding: 22px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .record-sheet { position: static; }
}

@media (max-width: 720px) {
  .instrument-bar {
    width: calc(100% - 16px);
    margin-top: 8px;
    top: 8px;
    padding: 9px;
    gap: 10px;
  }


  .bar-actions .status-dot { display: none; }
  .bar-actions .primary-button {
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 0;
  }

  .bar-actions .primary-button::after {
    content: "+";
    font-size: 1rem;
  }

  .top-nav {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .nav-item {
    flex: 0 0 auto;
    padding: 8px 11px;
  }

  .workspace {
    width: calc(100% - 24px);
    padding: 34px 0 50px;
  }

  .intro-panel {
    padding: 22px 0 12px;
  }

  .intro-panel h1 {
    font-size: clamp(3rem, 17vw, 5rem);
  }

  .clinical-board {
    min-height: 330px;
    padding: 22px;
  }

  .flow-section { margin-top: 42px; }

  .page-title-row,
  .flow-heading,
  .ledger-toolbar,
  .canvas-top,
  .patient-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .patient-actions { width: 100%; }
  .patient-actions button { flex: 1; }

  .odontogram-summary { width: 100%; justify-content: space-between; }
  .teeth-row { grid-template-columns: repeat(16, 50px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
.brand-logo-link {
  gap: 0;
  min-width: 178px;
}
.brand-logo-image {
  display: block;
  width: 174px;
  height: auto;
  max-height: 52px;
  object-fit: contain;
  object-position: left center;
}
body.dark-theme .brand-logo-image {
  filter: brightness(1.12) contrast(.96);
}
@media (max-width: 720px) {
  .brand-logo-link {
    min-width: 132px;
  }
  .brand-logo-image {
    width: 132px;
    max-height: 42px;
  }
}


/* Odontograma anatômico demonstrativo */
.odontogram-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: stretch;
}

.odontogram-layout .dental-field {
  min-width: 0;
}

.tooth-detail-panel {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid #d9cec1;
  border-radius: 18px;
  background: #fbf7f1;
  display: flex;
  flex-direction: column;
}

.tooth-detail-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.tooth-number-large {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.1rem;
  line-height: .9;
  color: var(--wine);
  letter-spacing: -.06em;
}

.detail-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 999px;
  font-size: .67rem;
  font-weight: 800;
}

.detail-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.detail-status.healthy {
  background: #eee8e0;
  color: #70685f;
}

.detail-status.healthy::before { background: #bcb2a8; }

.detail-status.planned {
  background: #f6e3e5;
  color: #8d3443;
}

.detail-status.planned::before { background: #b94d5e; }

.detail-status.done {
  background: #e5eff6;
  color: #356b8f;
}

.detail-status.done::before { background: #4d86ac; }

.detail-tooth-stage {
  min-height: 152px;
  margin: 18px 0 12px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 40%, rgba(122,51,65,.08), transparent 58%),
    #f3ede5;
  border: 1px solid #e4dacf;
}

.detail-tooth-shape {
  position: relative;
  display: block;
  width: 68px;
  height: 82px;
  border: 3px solid #d6c5b4;
  border-radius: 44% 44% 34% 34% / 32% 32% 66% 66%;
  background:
    radial-gradient(circle at 35% 22%, #fff 0 13%, transparent 14%),
    linear-gradient(145deg, #fffdf9 8%, #f2e5d8 62%, #d7c2ae 100%);
  box-shadow:
    inset -7px -9px 13px rgba(116,82,57,.08),
    0 13px 22px rgba(86,61,43,.10);
}

.detail-tooth-shape::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -24px;
  width: 30px;
  height: 28px;
  transform: translateX(-50%);
  border-left: 4px solid #d6c5b4;
  border-right: 4px solid #d6c5b4;
  border-radius: 0 0 38% 38%;
}

.detail-tooth-shape.planned {
  border-color: #c86d79;
  background: linear-gradient(145deg, #fff7f7, #f1d6d8 70%, #ddb5ba);
}

.detail-tooth-shape.planned::after { border-color: #c86d79; }

.detail-tooth-shape.done {
  border-color: #6d9dbe;
  background: linear-gradient(145deg, #f8fcff, #dbeaf4 70%, #bfd6e7);
}

.detail-tooth-shape.done::after { border-color: #6d9dbe; }

.tooth-detail-copy {
  display: grid;
  gap: 5px;
}

.tooth-detail-copy > strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 600;
}

.tooth-detail-copy > span {
  color: var(--wine);
  font-size: .78rem;
  font-weight: 800;
}

.tooth-detail-copy p {
  margin: 0;
  color: #675f58;
  font-size: .74rem;
  line-height: 1.55;
}

.tooth-status-button {
  width: 100%;
  margin-top: 14px;
}

.quick-example-box {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.quick-example-heading strong,
.quick-example-heading small {
  display: block;
}

.quick-example-heading strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: .95rem;
}

.quick-example-heading small {
  margin-top: 3px;
  color: #6f675f;
  font-size: .65rem;
}

.quick-example-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 11px;
}

.quick-example-grid button {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #ddd2c6;
  border-radius: 10px;
  padding: 8px 9px;
  background: #fffdf9;
  color: #554e47;
  font-size: .7rem;
  font-weight: 760;
  text-align: left;
}

.quick-example-grid button:hover {
  border-color: #bfaea0;
  background: #fff;
}

.condition-mark {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #b8aea4;
}

.condition-mark.carie { background: #9a4d39; }
.condition-mark.restauracao { background: #4d86ac; }
.condition-mark.canal {
  width: 8px;
  height: 16px;
  border-radius: 6px;
  background: #b94d5e;
}
.condition-mark.profilaxia {
  border-radius: 2px;
  background: #456f8a;
  transform: rotate(45deg);
}

.teeth-row {
  padding-top: 26px;
  overflow-y: visible;
}

.tooth-button {
  position: relative;
  min-height: 90px;
  overflow: visible;
}

.tooth-button.selected {
  border-color: rgba(122,51,65,.48);
  box-shadow: 0 0 0 3px rgba(122,51,65,.08);
  background: #fff;
}

.tooth-shape {
  width: 21px;
  height: 30px;
  border: 2px solid #c9b9aa;
  border-radius: 44% 44% 34% 34% / 32% 32% 66% 66%;
  background:
    radial-gradient(circle at 35% 23%, #fff 0 12%, transparent 13%),
    linear-gradient(145deg, #fffefa 8%, #f1e6d9 68%, #ddcdbd 100%);
  box-shadow: inset -3px -4px 6px rgba(119,87,62,.07);
}

.tooth-shape::before {
  content: "";
  position: absolute;
  width: 36%;
  height: 28%;
  left: 32%;
  top: 16%;
  border-radius: 50%;
  background: rgba(126,94,68,.07);
}

.tooth-shape::after {
  bottom: -9px;
  width: 9px;
  height: 11px;
  border-color: #c9b9aa;
}

.tooth-shape.molar {
  width: 30px;
  height: 28px;
  border-radius: 39% 39% 31% 31% / 35% 35% 62% 62%;
}

.tooth-shape.molar::after {
  width: 17px;
  height: 13px;
  bottom: -10px;
  border-left-width: 3px;
  border-right-width: 3px;
}

.tooth-shape.premolar {
  width: 24px;
  height: 31px;
}

.tooth-shape.canino {
  width: 20px;
  height: 35px;
  border-radius: 48% 48% 27% 27% / 28% 28% 72% 72%;
}

.tooth-shape.incisivo-central {
  width: 19px;
  height: 32px;
  border-radius: 34% 34% 29% 29% / 19% 19% 73% 73%;
}

.tooth-shape.incisivo-lateral {
  width: 17px;
  height: 31px;
  border-radius: 36% 36% 29% 29% / 20% 20% 72% 72%;
}

.tooth-shape.incisivo-inferior-estreito {
  width: 12px;
  height: 31px;
  border-radius: 34% 34% 25% 25% / 16% 16% 76% 76%;
}

.tooth-shape.incisivo-inferior-estreito::after {
  width: 5px;
  height: 13px;
}

.tooth-shape.canino-inferior {
  width: 17px;
  height: 35px;
}

.tooth-condition {
  position: absolute;
  top: -12px;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  padding: 3px 6px;
  border-radius: 999px;
  background: #f4e8e8;
  color: #8e3b48;
  border: 1px solid #ead0d4;
  font-size: .56rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.tooth-condition.restauracao,
.tooth-condition.profilaxia {
  background: #e7f0f6;
  color: #346b90;
  border-color: #d5e4ef;
}

.tooth-condition.canal {
  background: #f5e5e7;
  color: #8e3444;
}

body.dark-theme .tooth-detail-panel,
body.dark-theme .quick-example-grid button {
  background: #211f1c;
  border-color: #443e38;
  color: #eee8e0;
}

body.dark-theme .detail-tooth-stage {
  background: #1d1b19;
  border-color: #3d3832;
}

body.dark-theme .tooth-detail-copy p,
body.dark-theme .quick-example-heading small {
  color: #9f968c;
}

body.dark-theme .tooth-button.selected {
  background: #26231f;
  border-color: rgba(185,103,117,.62);
}

@media (max-width: 1120px) {
  .odontogram-layout {
    grid-template-columns: 1fr;
  }

  .tooth-detail-panel {
    margin-top: 0;
  }

  .quick-example-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 720px) {
  .quick-example-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tooth-detail-panel {
    padding: 17px;
  }

  .teeth-row {
    grid-template-columns: repeat(16, 52px);
    padding-top: 28px;
  }
}


/* acabamento mobile */
.teeth-row {
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: #c7b9aa transparent;
}

.tooth-button {
  scroll-snap-align: center;
}

.teeth-row::-webkit-scrollbar {
  height: 6px;
}

.teeth-row::-webkit-scrollbar-thumb {
  background: #c7b9aa;
  border-radius: 999px;
}

.teeth-row::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 720px) {
  .odontogram-canvas {
    padding: 16px;
    border-radius: 18px;
  }

  .odontogram-layout {
    gap: 12px;
  }

  .dental-field {
    padding: 16px 8px;
  }

  .tooth-detail-panel {
    margin-top: 0;
    padding: 16px;
  }

  .tooth-detail-panel .detail-tooth-stage {
    min-height: 125px;
  }

  .tooth-detail-panel .detail-tooth-shape {
    transform: scale(.88);
  }

  .quick-example-grid button {
    min-height: 44px;
  }

  .canvas-note {
    align-items: flex-start;
    line-height: 1.45;
  }
}

@media (max-width: 460px) {
  .odontogram-summary {
    gap: 12px;
  }

  .odontogram-summary strong {
    font-size: 1rem;
  }

  .odontogram-summary small {
    font-size: .56rem;
  }

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

  .tooth-detail-heading {
    align-items: center;
  }

  .tooth-number-large {
    font-size: 2.6rem;
  }
}


.temporary-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #efe7dd;
  color: #776b60;
  border: 1px solid #dfd2c4;
  font-size: .58rem;
  font-weight: 820;
  letter-spacing: .04em;
  text-transform: uppercase;
}

body.dark-theme .temporary-badge {
  background: #302a25;
  color: #bcaea1;
  border-color: #443a33;
}
