:root {
  color-scheme: light;
  --bg: #f3f4f8;
  --panel: #ffffff;
  --panel-soft: #f8f8fb;
  --panel-strong: #ececf3;
  --text: #1a1b24;
  --muted: #686b78;
  --faint: #9194a2;
  --border: #dfe1e8;
  --border-strong: #c9ccd7;
  --primary: #6d4aff;
  --primary-strong: #5635df;
  --primary-soft: #eeeaff;
  --accent: #24c9a9;
  --danger: #d9465f;
  --danger-soft: #fff0f2;
  --warning: #d88b25;
  --existing: #2f6fdd;
  --required: #d9435a;
  --completed: #168b68;
  --shadow-sm: 0 4px 14px rgba(17, 18, 28, .06);
  --shadow-md: 0 18px 55px rgba(17, 18, 28, .16);
  --radius: 12px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11131a;
  --panel: #181b24;
  --panel-soft: #20232d;
  --panel-strong: #292d38;
  --text: #f1f2f7;
  --muted: #b4b7c4;
  --faint: #858997;
  --border: #343846;
  --border-strong: #484d5e;
  --primary: #8d73ff;
  --primary-strong: #aa97ff;
  --primary-soft: #2d264a;
  --danger-soft: #361e25;
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .22);
  --shadow-md: 0 20px 60px rgba(0, 0, 0, .5);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #11131a;
    --panel: #181b24;
    --panel-soft: #20232d;
    --panel-strong: #292d38;
    --text: #f1f2f7;
    --muted: #b4b7c4;
    --faint: #858997;
    --border: #343846;
    --border-strong: #484d5e;
    --primary: #8d73ff;
    --primary-strong: #aa97ff;
    --primary-soft: #2d264a;
    --danger-soft: #361e25;
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, .22);
    --shadow-md: 0 20px 60px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-width: 320px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.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; }
.noscript { padding: 16px; text-align: center; background: #fff4cf; color: #6b4b00; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-header { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 9px 14px; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 400; }
.brand-area { min-width: 0; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: max-content; color: var(--text); text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); }
.brand-mark svg { width: 40px; height: 40px; stroke: none; }
.brand-bg { fill: #111322; }
.brand-tooth { fill: #6d4aff; }
.brand-accent { fill: #2ce0b8; }
.brand-text { font-size: 20px; font-weight: 820; letter-spacing: -.6px; }
.brand-text span { color: var(--primary-strong); }
.document-meta { min-width: 0; }
.record-title { width: min(330px, 32vw); min-width: 130px; border: 0; outline: none; background: transparent; padding: 2px 4px; border-radius: 5px; font-weight: 700; font-size: 14px; }
.record-title:focus { background: var(--primary-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.save-line { display: flex; align-items: center; gap: 6px; padding: 2px 4px 0; color: var(--muted); font-size: 10.5px; }
.save-dot, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--completed); flex: 0 0 auto; }
.save-dot.dirty { background: var(--warning); }
.privacy-chip { display: inline-flex; align-items: center; min-height: 19px; padding: 2px 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-strong); font-size: 9.5px; font-weight: 750; letter-spacing: .02em; }
.header-actions { display: flex; align-items: center; gap: 4px; }
.header-button, .icon-button, .secondary-button, .primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; min-height: 36px; padding: 0 12px; transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease; }
.header-button:hover, .icon-button:hover { background: var(--panel-strong); }
.header-button:active, .icon-button:active, .secondary-button:active, .primary-button:active { transform: translateY(1px); }
.header-button svg, .icon-button svg, .secondary-button svg, .primary-button svg { width: 18px; height: 18px; }
.text-button { font-size: 12px; font-weight: 690; }
.icon-button { width: 36px; padding: 0; }
.icon-button.small { width: 30px; min-height: 30px; }
.language-button { min-width: 62px; }
.locale-label { font-size: 11px; font-weight: 780; }
.compact-menu-wrap { position: relative; }
.compact-menu { position: absolute; right: 0; top: calc(100% + 7px); min-width: 190px; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); z-index: 110; }
.compact-menu button { width: 100%; text-align: left; padding: 9px 11px; border-radius: 7px; background: transparent; }
.compact-menu button:hover, .compact-menu button[aria-checked="true"] { background: var(--primary-soft); color: var(--primary-strong); }
.theme-button { position: relative; overflow: hidden; }
.theme-icon-stage::before { content: "◐"; font-size: 17px; line-height: 1; }
html[data-theme="light"] .theme-icon-stage::before { content: "☀"; }
html[data-theme="dark"] .theme-icon-stage::before { content: "☾"; }

.menu-bar { min-height: 31px; display: flex; align-items: center; gap: 1px; padding: 0 11px; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 66px; z-index: 390; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.menu-bar::-webkit-scrollbar { display: none; }
.menu-root > button { height: 28px; padding: 0 10px; border-radius: 6px; background: transparent; font-size: 13px; }
.menu-root > button:hover, .menu-root > button.active { background: var(--panel-strong); }
.dropdown-layer { position: fixed; z-index: 460; min-width: 230px; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); }
.dropdown-item { width: 100%; min-height: 34px; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 7px; background: transparent; text-align: left; font-size: 12.5px; color: var(--text); text-decoration: none; }
.dropdown-item:hover { background: var(--primary-soft); color: var(--primary-strong); }
.dropdown-item svg { width: 17px; height: 17px; }
.dropdown-item kbd { color: var(--faint); font-size: 10px; font-family: inherit; }
.dropdown-divider { height: 1px; margin: 5px 2px; background: var(--border); }

.module-bar { min-height: 48px; display: flex; align-items: end; gap: 2px; padding: 6px 14px 0; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 97px; z-index: 380; overflow-x: auto; }
.module-tab { min-height: 41px; display: inline-flex; align-items: center; gap: 8px; padding: 0 15px; border-radius: 8px 8px 0 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; border-bottom: 3px solid transparent; }
.module-tab svg { width: 18px; height: 18px; }
.module-tab:hover { background: var(--panel-soft); color: var(--text); }
.module-tab.is-active { color: var(--primary-strong); border-bottom-color: var(--primary); background: var(--primary-soft); }

.patient-strip { background: var(--panel); border-bottom: 1px solid var(--border); padding: 12px 16px 14px; }
.patient-strip-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.patient-strip-head > div { display: flex; flex-direction: column; gap: 1px; }
.patient-strip-head strong { font-size: 14px; }
.eyebrow { color: var(--primary-strong); font-size: 9px; font-weight: 820; letter-spacing: .09em; text-transform: uppercase; }
.text-link { background: transparent; color: var(--primary-strong); font-size: 11px; font-weight: 700; }
.patient-fields { display: grid; grid-template-columns: minmax(220px, 1.8fr) repeat(7, minmax(105px, 1fr)); gap: 9px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .form-label { color: var(--muted); font-size: 10px; font-weight: 720; }
.field input, .field textarea, .search-control input, .rows-control select { width: 100%; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-soft); outline: none; padding: 8px 9px; font-size: 12px; }
.field input { height: 34px; }
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .search-control input:focus, .rows-control select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); background: var(--panel); }
.field-small { max-width: 90px; }

.workspace { flex: 1; padding: 14px; }
.view { display: none; }
.view.is-active { display: block; }
.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); }
.segment { min-height: 30px; padding: 0 11px; border-radius: 6px; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 720; }
.segment:hover { color: var(--text); background: var(--panel-soft); }
.segment.is-active { background: var(--primary-soft); color: var(--primary-strong); }
.context-hint { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.context-hint svg { width: 18px; height: 18px; }
.secondary-button { border-color: var(--border); background: var(--panel); font-size: 12px; font-weight: 720; }
.secondary-button:hover { background: var(--panel-strong); }
.secondary-button.outline { background: transparent; }
.secondary-button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 32%, var(--border)); }
.secondary-button.danger:hover { background: var(--danger-soft); }
.secondary-button.full { width: 100%; }
.primary-button { background: var(--primary); color: #fff; font-size: 12px; font-weight: 760; }
.primary-button:hover { background: var(--primary-strong); }
.primary-button.large, .secondary-button.large { min-height: 40px; padding: 0 15px; }

.clinical-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel-heading.compact { min-height: 67px; }
.panel-heading h1, .panel-heading h2 { margin: 2px 0 0; letter-spacing: -.35px; }
.panel-heading h1 { font-size: 21px; }
.panel-heading h2 { font-size: 18px; }
.legend-inline, .perio-legend { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; color: var(--muted); font-size: 10.5px; }
.legend-inline > span, .perio-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-color { width: 10px; height: 10px; border-radius: 3px; }
.legend-color.existing { background: var(--existing); }
.legend-color.required { background: var(--required); }
.legend-color.completed { background: var(--completed); }

.odontogram-workspace { display: block; position: relative; }
.odontogram-panel { min-width: 0; overflow: hidden; }
.odontogram { padding: 28px 18px 32px; overflow-x: auto; scrollbar-gutter: stable; }
.arch-section + .arch-section { margin-top: 0; padding-top: 0; border-top: 0; }
.arch-label { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 5px 0 12px; color: var(--faint); font-size: 9.5px; font-weight: 820; letter-spacing: .1em; text-transform: uppercase; }
.arch-label::before, .arch-label::after { content: ""; width: 130px; height: 1px; background: var(--border); }
.arch-row { width: max-content; min-width: 100%; display: flex; align-items: flex-start; justify-content: center; gap: 4px; }
.arch-row .midline { width: 18px; height: 142px; position: relative; flex: 0 0 auto; }
.arch-row .midline::after { content: ""; position: absolute; inset: 4px 50% 4px auto; width: 1px; background: var(--border-strong); }
.tooth-card { width: 86px; flex: 0 0 86px; min-height: 146px; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
.tooth-card.arch-upper .tooth-diagram { order: 1; }
.tooth-card.arch-upper .tooth-number { order: 2; }
.tooth-card.arch-upper .tooth-meta { order: 3; }
.tooth-card.arch-lower .tooth-number { order: 1; }
.tooth-card.arch-lower .tooth-diagram { order: 2; }
.tooth-card.arch-lower .tooth-meta { order: 3; }
.tooth-number { width: 44px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: var(--panel-soft); color: var(--muted); border: 1px solid transparent; font-size: 12px; font-weight: 840; }
.tooth-number:hover, .tooth-number.is-selected { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 34%, var(--border)); color: var(--primary-strong); }
.tooth-number.has-whole::after { content: ""; width: 7px; height: 7px; border-radius: 50%; position: absolute; top: 3px; right: 8px; background: var(--tooth-stage-color, var(--primary)); box-shadow: 0 0 0 2px var(--panel); }
.tooth-diagram { width: 82px; height: 110px; overflow: visible; filter: drop-shadow(0 4px 7px rgba(22, 24, 35, .08)); }
.tooth-anatomy { fill: var(--panel-soft); stroke: var(--border-strong); stroke-width: 1.35; vector-effect: non-scaling-stroke; }
.root-detail { fill: none; stroke: color-mix(in srgb, var(--border-strong) 72%, transparent); stroke-width: .85; vector-effect: non-scaling-stroke; }
.tooth-diagram .surface { fill: color-mix(in srgb, var(--panel) 74%, transparent); stroke: color-mix(in srgb, var(--border-strong) 88%, transparent); stroke-width: 1.05; cursor: pointer; transition: fill .12s ease, stroke .12s ease, filter .12s ease; vector-effect: non-scaling-stroke; }
.tooth-diagram .surface:hover, .tooth-diagram .surface.is-selected { fill: var(--primary-soft); stroke: var(--primary); stroke-width: 1.8; filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--primary) 28%, transparent)); }
.tooth-diagram .surface.stage-existing { fill: color-mix(in srgb, var(--existing) 68%, var(--panel)); stroke: var(--existing); }
.tooth-diagram .surface.stage-required { fill: color-mix(in srgb, var(--required) 66%, var(--panel)); stroke: var(--required); }
.tooth-diagram .surface.stage-completed { fill: color-mix(in srgb, var(--completed) 67%, var(--panel)); stroke: var(--completed); }
.tooth-meta { order: 3; min-height: 15px; max-width: 82px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 8.5px; text-align: center; }
.tooth-card.is-missing .tooth-diagram { opacity: .3; }
.tooth-card.is-missing::after { content: ""; position: absolute; left: 11px; right: 11px; top: 59px; height: 2px; transform: rotate(-42deg); background: var(--required); border-radius: 2px; }
.arch-section:first-child { padding-bottom: 10px; }
.arch-section:last-child { padding-top: 6px; }

.chart-inspector { display: none; position: fixed; z-index: 280; top: 154px; right: 14px; bottom: 14px; width: min(380px, calc(100vw - 28px)); min-height: 0; overflow: auto; box-shadow: var(--shadow-md); }
.chart-inspector.is-open { display: block; animation: inspector-in .16s ease-out; }
@keyframes inspector-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }
.inspector-empty { min-height: 418px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; color: var(--muted); }
.inspector-icon { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 18px; background: var(--primary-soft); color: var(--primary-strong); margin-bottom: 15px; }
.inspector-icon svg { width: 42px; height: 42px; }
.inspector-empty h2 { margin: 0 0 7px; font-size: 16px; color: var(--text); }
.inspector-empty p { max-width: 240px; margin: 0; font-size: 11.5px; line-height: 1.6; }
.inspector-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px; border-bottom: 1px solid var(--border); }
.inspector-header h2 { margin: 3px 0 0; font-size: 18px; }
.current-charting { padding: 13px 16px; border-bottom: 1px solid var(--border); background: var(--panel-soft); }
.current-charting .current-empty { color: var(--muted); font-size: 11px; }
.current-mark { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.current-mark i { width: 10px; height: 10px; border-radius: 3px; background: var(--stage-color); }
.form-block { padding: 14px 16px 0; }
.stage-grid { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 8px; }
.stage-option { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); text-align: left; font-size: 11.5px; }
.stage-option i { width: 9px; height: 9px; border-radius: 3px; background: var(--stage-color); }
.stage-option.is-active { border-color: var(--stage-color); box-shadow: inset 3px 0 0 var(--stage-color); background: color-mix(in srgb, var(--stage-color) 7%, var(--panel)); }
.search-control { min-height: 35px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-soft); padding: 0 9px; }
.search-control svg { width: 16px; height: 16px; color: var(--faint); }
.search-control input { min-width: 0; border: 0; box-shadow: none; background: transparent; padding: 0; height: 33px; }
.condition-grid { display: grid; gap: 4px; max-height: 250px; overflow: auto; margin-top: 8px; padding-right: 2px; }
.condition-option { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 9px; border-radius: 7px; background: transparent; text-align: left; font-size: 11.5px; }
.condition-option:hover, .condition-option.is-active { background: var(--primary-soft); color: var(--primary-strong); }
.condition-option small { color: var(--faint); font-size: 8.5px; font-weight: 800; }
#removeChartingBtn { margin: 14px 16px 16px; width: calc(100% - 32px); }

.chart-context-menu { position: fixed; z-index: 350; width: min(330px, calc(100vw - 18px)); max-height: min(620px, calc(100vh - 18px)); overflow: hidden; background: var(--panel); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow-md); }
.context-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 13px; border-bottom: 1px solid var(--border); }
.context-menu-head strong { font-size: 13px; }
.context-menu-head span { color: var(--muted); font-size: 9.5px; }
.context-stage-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 10px 10px 7px; }
.context-stage { min-height: 31px; display: flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); font-size: 9.5px; font-weight: 730; }
.context-stage i { width: 7px; height: 7px; border-radius: 2px; background: var(--stage-color); }
.context-stage.is-active { border-color: var(--stage-color); background: color-mix(in srgb, var(--stage-color) 8%, var(--panel)); }
.context-search { padding: 0 10px 7px; }
.context-condition-list { max-height: 330px; overflow: auto; padding: 0 6px 6px; }
.context-condition-list .condition-option { width: 100%; }
.context-clear { width: calc(100% - 12px); margin: 0 6px 6px; min-height: 34px; border-radius: 7px; background: var(--danger-soft); color: var(--danger); font-size: 11px; font-weight: 730; }

.secondary-button svg, .primary-button svg { width: 16px; height: 16px; }
.perio-chart { min-width: 1180px; height: auto; }
.arch-band { fill: color-mix(in srgb, var(--panel-soft) 86%, transparent); stroke: var(--border); }
.perio-tooth path:first-child { fill: var(--panel); stroke: var(--border-strong); stroke-width: 1.15; vector-effect: non-scaling-stroke; }
.perio-tooth .root-detail { fill: none; stroke: var(--border-strong); stroke-width: .7; opacity: .6; vector-effect: non-scaling-stroke; }
.perio-tooth.is-missing { opacity: .22; }
.arch-gum-line { fill: none; stroke: color-mix(in srgb, #d86f8c 72%, var(--border)); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.arch-tooth-number { fill: var(--muted); font-size: 10px; font-weight: 800; }
.arch-missing { fill: none; stroke: var(--required); stroke-width: 2.2; stroke-linecap: round; }

.findings-panel { margin-top: 12px; overflow: hidden; }
.count-badge { min-width: 28px; height: 28px; display: grid; place-items: center; border-radius: 999px; background: var(--primary-soft); color: var(--primary-strong); font-size: 11px; font-weight: 800; }
.table-controls { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel-soft); border-bottom: 1px solid var(--border); }
.table-search { width: min(420px, 50vw); }
.rows-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; margin-left: auto; }
.rows-control select { width: 68px; height: 33px; padding: 0 6px; }
.pagination { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.data-table-wrap { overflow-x: auto; position: relative; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.data-table th, .data-table td { padding: 10px 13px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.data-table th { background: var(--panel-soft); color: var(--muted); font-size: 9.5px; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.data-table th button { background: transparent; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; padding: 0; }
.data-table tbody tr:hover { background: var(--panel-soft); }
.table-stage { display: inline-flex; align-items: center; gap: 6px; }
.table-stage i { width: 8px; height: 8px; border-radius: 2px; background: var(--stage-color); }
.table-action { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; background: transparent; color: var(--muted); }
.table-action:hover { background: var(--danger-soft); color: var(--danger); }
.empty-state { padding: 38px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); margin-bottom: 6px; }
.empty-state p { margin: 0; font-size: 11px; }

.metrics-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.metrics-row article { min-height: 72px; display: flex; flex-direction: column; justify-content: center; padding: 12px 13px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-sm); }
.metrics-row span { color: var(--muted); font-size: 9.5px; font-weight: 700; }
.metrics-row strong { margin-top: 5px; font-size: 19px; letter-spacing: -.4px; }
.perio-panel { overflow: hidden; }
.perio-switches { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.perio-legend { padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--panel-soft); }
.line-key { width: 22px; height: 0; border-top: 2px solid currentColor; }
.line-key.cej { color: var(--faint); border-top-style: dashed; }
.line-key.margin { color: var(--primary); }
.line-key.pocket { color: var(--required); }
.dot-key { width: 8px; height: 8px; border-radius: 50%; background: var(--required); }
.diamond-key { width: 8px; height: 8px; transform: rotate(45deg); background: var(--existing); }
.perio-chart-shell { overflow-x: auto; padding: 8px 10px 14px; background: var(--panel); }
.perio-chart { display: block; width: max(100%, 1180px); min-width: 1180px; height: 430px; }
.perio-chart .grid-line { stroke: var(--border); stroke-width: 1; }
.perio-chart .grid-line.major { stroke: var(--border-strong); }
.perio-chart .cej-line { stroke: var(--faint); stroke-width: 1.4; stroke-dasharray: 6 5; }
.perio-chart .margin-line { stroke: var(--primary); stroke-width: 2.3; fill: none; }
.perio-chart .pocket-line { stroke: var(--required); stroke-width: 2.3; fill: none; }
.perio-chart .margin-point { fill: var(--primary); stroke: #fff; stroke-width: 1.1; }
.perio-chart .pocket-point { fill: var(--required); stroke: #fff; stroke-width: 1.1; }
.perio-chart .clinical-fill { fill: color-mix(in srgb, var(--required) 10%, transparent); stroke: none; }
.perio-chart .tooth-separator { stroke: var(--border-strong); stroke-width: 1; }
.perio-chart .chart-label { fill: var(--muted); stroke: none; font-size: 10px; font-family: var(--font); }
.perio-chart .tooth-label { fill: var(--text); stroke: none; font-size: 10px; font-weight: 800; font-family: var(--font); }
.perio-chart .bop-dot { fill: var(--required); stroke: #fff; stroke-width: 1.5; }
.perio-chart .plaque-diamond { fill: var(--existing); stroke: #fff; stroke-width: 1.2; }
.perio-chart .supp-dot { fill: var(--warning); stroke: #fff; stroke-width: 1.2; }
.perio-entry-panel { margin-top: 12px; overflow: hidden; }
.keyboard-note { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
kbd { min-width: 28px; display: inline-grid; place-items: center; padding: 3px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--panel-soft); color: var(--muted); font-size: 9px; }
.perio-matrix-wrap { overflow: auto; max-height: 590px; }
.perio-matrix { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 10px; }
.perio-matrix th, .perio-matrix td { min-width: 32px; height: 34px; padding: 2px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; background: var(--panel); }
.perio-matrix thead th { position: sticky; top: 0; z-index: 5; background: var(--panel-soft); }
.perio-matrix thead tr:nth-child(2) th { top: 34px; }
.perio-matrix .row-label { min-width: 145px; width: 145px; position: sticky; left: 0; z-index: 7; padding: 0 10px; text-align: left; background: var(--panel-soft); color: var(--muted); font-weight: 750; }
.perio-matrix thead .row-label { z-index: 9; }
.perio-matrix .tooth-head { min-width: 96px; color: var(--text); font-weight: 820; border-left: 1px solid var(--border-strong); }
.perio-matrix .site-head { color: var(--faint); font-size: 8px; }
.perio-matrix .tooth-start { border-left: 1px solid var(--border-strong); }
.perio-number { width: 29px; height: 27px; border: 1px solid transparent; border-radius: 5px; outline: none; background: transparent; text-align: center; font-size: 10.5px; }
.perio-number:hover { border-color: var(--border); background: var(--panel-soft); }
.perio-number:focus { border-color: var(--primary); background: var(--panel); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent); }
.perio-number.pd-high { color: var(--required); font-weight: 800; background: color-mix(in srgb, var(--required) 8%, transparent); }
.perio-cal { color: var(--muted); font-weight: 740; }
.perio-cal.high { color: var(--required); }
.perio-check { width: 24px; height: 24px; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 5px; background: var(--panel); color: transparent; }
.perio-check:hover { border-color: var(--primary); }
.perio-check.is-on { color: #fff; background: var(--check-color, var(--primary)); border-color: var(--check-color, var(--primary)); }
.perio-check.is-on::after { content: "✓"; font-size: 11px; font-weight: 900; }
.perio-select { width: 88px; height: 28px; border: 1px solid var(--border); border-radius: 5px; background: var(--panel); font-size: 9.5px; }

.summary-panel { overflow: hidden; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 18px; }
.summary-grid .full { grid-column: 1 / -1; }
.signature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; padding: 50px 20px 28px; }
.signature-grid div { border-top: 1px solid var(--border-strong); padding-top: 8px; text-align: center; color: var(--muted); font-size: 10px; }

.status-bar { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 13px; background: var(--panel); border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.status-bar > div { display: flex; align-items: center; gap: 10px; }
.status-bar button { background: transparent; color: var(--muted); font-size: 10px; }
.status-bar button:hover { color: var(--primary-strong); }

.toast-region { position: fixed; right: 16px; bottom: 48px; z-index: 700; display: grid; gap: 8px; }
.toast { min-width: 230px; max-width: 360px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); box-shadow: var(--shadow-md); color: var(--text); font-size: 11px; animation: toast-in .2s ease; }
.toast.success { border-left: 4px solid var(--completed); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(7, 9, 15, .55); backdrop-filter: blur(4px); z-index: 500; }
.modal { position: fixed; left: 50%; top: 50%; width: min(660px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 28px)); transform: translate(-50%, -50%); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-md); z-index: 510; overflow: hidden; }
.modal.wide { width: min(920px, calc(100vw - 28px)); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 19px 21px 14px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 2px 0 0; font-size: 20px; letter-spacing: -.3px; }
.modal-eyebrow { color: var(--primary-strong); text-transform: uppercase; font-size: 10px; font-weight: 800; letter-spacing: .09em; }
.modal-body { padding: 20px 21px; overflow: auto; }
.modal-footer { min-height: 58px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 10px 20px; background: var(--panel-soft); border-top: 1px solid var(--border); }
.modal-footer.split-footer { justify-content: space-between; }
.modal-footer .footer-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal.institutional { width: min(980px, calc(100vw - 34px)); max-height: min(820px, calc(100vh - 28px)); border-radius: 20px; }
.modal.institutional .modal-header { padding: 23px 25px 18px; }
.modal.institutional .modal-header h2 { font-size: 24px; letter-spacing: -.45px; }
.modal.institutional .modal-body { padding: 24px 25px; }
.modal.institutional .modal-footer { min-height: 70px; padding: 12px 25px; background: var(--panel); }
.modal.bug-modal { width: min(820px, calc(100vw - 34px)); }
.modal.donate-modal { width: min(760px, calc(100vw - 34px)); }
.modal.about-modal { width: min(1040px, calc(100vw - 34px)); max-height: min(940px, calc(100vh - 24px)); }
.institutional-intro { margin: 0 0 14px; color: var(--muted); line-height: 1.65; font-size: 14px; }
.info-callout { padding: 14px 15px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-soft); color: var(--muted); line-height: 1.6; font-size: 13px; }
.privacy-list { margin: 12px 0 0; padding-left: 20px; color: var(--muted); line-height: 1.75; }
.info-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-soft); font-size: 12px; }
.info-row a { color: var(--primary-strong); text-decoration: none; }
.tech-panel { margin-top: 12px; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.tech-panel-header { padding: 9px 12px; background: var(--panel-soft); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.tech-report { max-height: 260px; margin: 0; padding: 13px; overflow: auto; background: var(--panel); color: var(--muted); font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.privacy-note { margin-top: 12px; display: flex; gap: 10px; align-items: flex-start; padding: 12px 13px; border: 1px solid color-mix(in srgb, var(--primary) 38%, var(--border)); border-radius: 11px; background: var(--primary-soft); color: var(--primary-strong); font-size: 12px; line-height: 1.5; }
.privacy-note svg { flex: 0 0 auto; width: 18px; height: 18px; }
.about-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.about-identity { display: flex; align-items: center; gap: 18px; min-width: 0; }
.about-logo-inline { width: 76px; height: 76px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 18px; overflow: hidden; box-shadow: 0 8px 22px rgba(91,57,221,.22); }
.about-logo-inline svg { display: block; width: 100%; height: 100%; stroke: none; }
.about-identity h3 { margin: 0; font-size: 27px; letter-spacing: -.45px; }
.about-identity p { margin: 5px 0 0; color: var(--muted); }
.about-badges { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.about-badge { padding: 7px 11px; border: 1px solid color-mix(in srgb, var(--primary) 55%, var(--border)); border-radius: 999px; color: var(--primary-strong); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.about-feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-top: 20px; }
.about-feature-card { min-height: 176px; padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-soft); }
.about-feature-card h4 { margin: 10px 0 9px; font-size: 14px; }
.about-feature-card p, .about-feature-card ul { margin: 0; color: var(--muted); line-height: 1.62; font-size: 12px; }
.about-feature-card ul { padding-left: 18px; }
.feature-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary-strong); font-size: 18px; }
.about-link-strip { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border: 1px solid color-mix(in srgb, var(--primary) 55%, var(--border)); border-radius: 12px; background: var(--primary-soft); }
.about-link-strip a { color: var(--primary-strong); font-weight: 750; text-decoration: none; }
.about-link-strip span { color: var(--muted); font-size: 11px; }
.about-info-grid { display: grid; grid-template-columns: 1.05fr 1.05fr 1.15fr 1.25fr; margin-top: 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.about-info-item { min-width: 0; padding: 16px 15px; border-right: 1px solid var(--border); }
.about-info-item:first-child { padding-left: 0; }
.about-info-item:last-child { border-right: 0; padding-right: 0; }
.about-info-item small { display: block; margin-bottom: 8px; color: var(--faint); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.about-info-item strong, .about-info-item a, .about-info-item span { display: block; color: var(--text); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; text-decoration: none; }
.about-info-item a:hover { color: var(--primary-strong); }
.about-more { margin-top: 17px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 13px; background: var(--panel-soft); }
.about-more-title { margin-bottom: 11px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.about-more-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px 24px; }
.about-more-item { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.about-more-item::before { content: "✓"; color: var(--primary-strong); font-weight: 800; }
.donate-hero { text-align: center; padding: 0 20px 18px; }
.donate-heart { width: 74px; height: 74px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 20px; background: #f9d7e4; color: #f04578; }
.donate-heart svg { width: 35px; height: 35px; stroke-width: 1.7; }
.donate-hero h3 { margin: 0; font-size: 25px; letter-spacing: -.4px; }
.donate-hero p { max-width: 600px; margin: 10px auto 0; color: var(--muted); line-height: 1.65; }
.donate-explain { display: grid; gap: 10px; }
.donate-card { display: grid; grid-template-columns: 42px minmax(0,1fr); align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--panel-soft); color: var(--muted); line-height: 1.55; }
.donate-card-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--primary-soft); color: var(--primary-strong); }
.donate-support-title { margin: 18px 0 10px; font-size: 14px; }
.donate-support-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; }
.donate-support-item { display: flex; align-items: center; gap: 9px; min-height: 54px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-soft); font-size: 12px; }
.donate-support-item span:first-child { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; background: var(--primary-soft); color: var(--primary-strong); }
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.help-card { padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-soft); }
.help-card h3 { margin: 0 0 8px; font-size: 13px; }
.help-card p, .help-card ul { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.help-card ul { padding-left: 18px; }

@media (max-width: 1180px) {
  .patient-fields { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .field-wide { grid-column: span 2; }
  .tooth-card { width: 78px; flex-basis: 78px; }
  .tooth-diagram { width: 74px; }
  .metrics-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .app-header { align-items: flex-start; padding: 8px 10px; }
  .brand-area { gap: 10px; }
  .brand-text { font-size: 18px; }
  .document-meta { display: none; }
  .header-button span { display: none; }
  .header-button { width: 36px; padding: 0; }
  .menu-bar { top: 57px; }
  .module-bar { top: 88px; }
  .patient-fields { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .field-wide { grid-column: 1 / -1; }
  .workspace { padding: 9px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .legend-inline { width: 100%; }
  .arch-row { justify-content: flex-start; }
  .metrics-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .perio-switches { justify-content: flex-start; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-grid .full { grid-column: auto; }
  .signature-grid { grid-template-columns: 1fr; gap: 50px; }
  .status-bar { display: none; }
  .about-top { align-items: flex-start; flex-direction: column; }
  .about-feature-grid, .about-info-grid, .donate-support-grid, .help-grid { grid-template-columns: 1fr; }
  .about-info-item { border-right: 0; border-bottom: 1px solid var(--border); padding: 13px 0; }
  .about-info-item:last-child { border-bottom: 0; }
  .about-more-grid { grid-template-columns: 1fr; }
  .modal-footer, .modal-footer.split-footer { align-items: stretch; flex-direction: column; }
  .modal-footer .footer-group { width: 100%; }
  .modal-footer .footer-group > * { flex: 1; }
}

@media (max-width: 520px) {
  .patient-fields { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .module-tab { padding: 0 11px; }
  .module-tab span { font-size: 11px; }
  .section-toolbar { align-items: flex-start; flex-direction: column; }
  .context-hint { display: none; }
  .table-controls { align-items: stretch; flex-wrap: wrap; }
  .table-search { width: 100%; }
  .rows-control { margin-left: 0; }
  .metrics-row { grid-template-columns: 1fr 1fr; }
  .perio-switches { align-items: stretch; flex-direction: column; width: 100%; }
  .perio-switches .segmented { width: 100%; }
  .perio-switches .segment { flex: 1; }
}

@media print {
  :root { --bg: #fff; --panel: #fff; --panel-soft: #fff; --text: #111; --muted: #444; --border: #aaa; --border-strong: #777; }
  @page { size: A4 landscape; margin: 8mm; }
  @page summaryPage { size: A4 portrait; margin: 12mm; }
  body { background: #fff; }
  .no-print, .status-bar, .menu-bar, .module-bar, .chart-inspector, .findings-panel .table-controls { display: none !important; }
  .app-shell, .workspace { display: block !important; }
  .view { display: none !important; }
  body[data-print-mode="odontogram"] .view[data-view-panel="odontogram"],
  body[data-print-mode="periodontogram"] .view[data-view-panel="periodontogram"],
  body[data-print-mode="summary"] .view[data-view-panel="summary"],
  body[data-print-mode="all"] .view { display: block !important; }
  .patient-strip { display: block !important; padding: 0 0 5mm; border: 0; }
  .patient-strip-head { margin-bottom: 3mm; }
  .patient-fields { display: grid !important; grid-template-columns: 2fr 1fr 1fr .55fr 1fr 1.5fr 1fr 1.5fr; gap: 2.5mm; }
  .field-wide { grid-column: span 1; }
  .field input, .field textarea { border: 0; border-bottom: 1px solid #777; border-radius: 0; background: transparent; padding: 1.5mm 0; font-size: 9pt; }
  .field span { font-size: 7pt; }
  .view { page-break-after: always; }
  .view:last-child { page-break-after: auto; }
  .view[data-view-panel="summary"] { page: summaryPage; }
  .clinical-panel { box-shadow: none; border-color: #999; break-inside: avoid; }
  .panel-heading { padding: 4mm; }
  .odontogram-workspace { display: block; }
  .odontogram { overflow: visible; padding: 3mm 1mm 4mm; }
  .arch-row { transform: scale(.88); transform-origin: top center; }
  .tooth-card { min-height: 118px; }
  .findings-panel { margin-top: 4mm; }
  .data-table { font-size: 8pt; }
  .metrics-row { grid-template-columns: repeat(7, 1fr); gap: 2mm; }
  .metrics-row article { box-shadow: none; padding: 2mm; }
  .perio-chart-shell { overflow: visible; }
  .perio-chart { min-width: 0; width: 100%; height: auto; }
  .perio-entry-panel { page-break-before: always; }
  .perio-matrix-wrap { max-height: none; overflow: visible; }
  .perio-matrix { width: 147%; transform: scale(.68); transform-origin: top left; }
  .summary-grid textarea { min-height: 34mm; }
  .signature-grid { grid-template-columns: repeat(2, 1fr); gap: 25mm; }
}

/* LumeDental 0.5.0 — clinical chart refinement */
.odontogram { padding: 34px 24px 40px; }
.arch-row { gap: 2px; }
.arch-row .midline { width: 22px; height: 176px; }
.tooth-card { width: 96px; flex-basis: 96px; min-height: 182px; gap: 3px; }
.tooth-diagram { width: 92px; height: 144px; filter: drop-shadow(0 5px 8px rgba(22,24,35,.08)); }
.tooth-number { width: 46px; height: 26px; }
.tooth-meta { max-width: 92px; min-height: 16px; font-size: 9px; font-weight: 670; }
.tooth-root, .tooth-crown, .implant-crown, .implant-fixture, .implant-abutment, .pontic-crown, .perio-root, .perio-crown {
  fill: var(--panel-soft); stroke: var(--border-strong); stroke-width: 1.25; vector-effect: non-scaling-stroke;
}
.tooth-root { fill: color-mix(in srgb, var(--panel-soft) 80%, #fff); }
.tooth-crown { fill: color-mix(in srgb, var(--panel) 82%, var(--panel-soft)); }
.anatomy-detail { fill: none; stroke: color-mix(in srgb, var(--border-strong) 60%, transparent); stroke-width: .75; vector-effect: non-scaling-stroke; pointer-events: none; }
.tooth-diagram .surface { fill: color-mix(in srgb, var(--panel) 78%, transparent); stroke: color-mix(in srgb, var(--border-strong) 82%, transparent); stroke-width: .95; }
.tooth-diagram .surface:hover, .tooth-diagram .surface.is-selected { stroke-width: 1.8; }
.tooth-diagram .surface.stage-existing { fill: color-mix(in srgb, var(--existing) 63%, var(--panel)); }
.tooth-diagram .surface.stage-required { fill: color-mix(in srgb, var(--required) 63%, var(--panel)); }
.tooth-diagram .surface.stage-completed { fill: color-mix(in srgb, var(--completed) 63%, var(--panel)); }
.implant-crown { fill: color-mix(in srgb, var(--panel) 74%, #fff); }
.implant-abutment, .implant-fixture { fill: color-mix(in srgb, #aeb7c6 34%, var(--panel)); stroke: color-mix(in srgb, #667084 72%, var(--border-strong)); }
.implant-thread, .implant-apex { fill: none; stroke: color-mix(in srgb, #667084 80%, var(--border-strong)); stroke-width: 1.05; vector-effect: non-scaling-stroke; }
.pontic-crown { fill: color-mix(in srgb, var(--clinical-color) 8%, var(--panel)); }
.pontic-link, .bridge-link, .space-maintainer { fill: none; stroke: var(--clinical-color); stroke-width: 2.7; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.residual-root { fill: color-mix(in srgb, var(--required) 10%, var(--panel-soft)); }
.whole-overlay { color: var(--clinical-color); pointer-events: none; }
.prosthetic-overlay { fill: color-mix(in srgb, var(--clinical-color) 14%, transparent); stroke: var(--clinical-color); stroke-width: 2.1; vector-effect: non-scaling-stroke; }
.veneer-line, .inlay-shape, .clinical-line, .post-core, .clinical-cross, .denture-base, .mobility-arrow, .sound-check {
  fill: none; stroke: var(--clinical-color); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke;
}
.inlay-shape { fill: color-mix(in srgb, var(--clinical-color) 18%, transparent); }
.post-core { fill: color-mix(in srgb, var(--clinical-color) 18%, transparent); }
.periapical-lesion { fill: color-mix(in srgb, var(--clinical-color) 18%, transparent); stroke: var(--clinical-color); stroke-width: 2; vector-effect: non-scaling-stroke; }
.denture-base { stroke-width: 5; opacity: .75; }
.sound-check { stroke-width: 4; }
.tooth-card.condition-missing .tooth-diagram { opacity: .42; }
.tooth-card.condition-impacted .tooth-diagram { transform: rotate(58deg) translateY(4px); }
.tooth-card.condition-unerupted .tooth-diagram .tooth-root,
.tooth-card.condition-unerupted .tooth-diagram .tooth-crown { stroke-dasharray: 4 3; opacity: .62; }
.tooth-card.condition-extraction .tooth-diagram,
.tooth-card.condition-missing .tooth-diagram { filter: none; }

.condition-option { min-height: 42px; padding: 6px 9px; }
.condition-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.condition-icon { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 7px; background: var(--panel-soft); }
.condition-icon svg { width: 22px; height: 22px; }
.ci-tooth, .ci-crown { fill: var(--panel); stroke: var(--muted); stroke-width: 1.3; }
.ci-line { fill: var(--panel-soft); stroke: var(--muted); stroke-width: 1.2; }
.ci-detail, .ci-accent { fill: none; stroke: var(--required); stroke-width: 1.8; stroke-linecap: round; }
.ci-accent-fill { fill: color-mix(in srgb, var(--required) 22%, var(--panel)); stroke: var(--required); stroke-width: 1.3; }
.condition-option.is-active .condition-icon { border-color: var(--primary); background: var(--primary-soft); }

.metrics-row { grid-template-columns: repeat(9, minmax(0, 1fr)); }
.perio-chart-shell { overflow: auto; padding: 10px; background: color-mix(in srgb, var(--panel) 94%, var(--panel-soft)); }
.perio-chart { width: max(100%, 1360px); min-width: 1360px; height: auto; min-height: 1130px; }
.perio-sheet-title { fill: var(--text); font-size: 16px; font-weight: 850; font-family: var(--font); }
.perio-exam-label { fill: var(--primary-strong); font-size: 11px; font-weight: 800; font-family: var(--font); }
.perio-section-bg { fill: var(--panel); stroke: var(--border); }
.perio-section-title { fill: var(--text); font-size: 12px; font-weight: 850; font-family: var(--font); }
.perio-row-label { fill: var(--muted); font-size: 7.4px; font-weight: 720; font-family: var(--font); }
.perio-tooth-number { fill: var(--text); font-size: 8.5px; font-weight: 850; font-family: var(--font); }
.perio-status-letter, .perio-small-value { fill: var(--muted); font-size: 7.5px; font-weight: 800; font-family: var(--font); }
.perio-site-value { fill: var(--text); font-size: 7px; font-weight: 690; font-family: var(--font); }
.perio-site-value.severe { fill: var(--required); font-weight: 900; }
.perio-tooth-separator { stroke: var(--border); stroke-width: .65; }
.perio-grid-line { stroke: color-mix(in srgb, var(--border) 72%, transparent); stroke-width: .7; }
.perio-grid-line.cej { stroke: var(--border-strong); stroke-width: 1.2; stroke-dasharray: 5 4; }
.perio-axis-label { fill: var(--faint); font-size: 7px; font-family: var(--font); }
.perio-tooth-drawing .perio-root, .perio-tooth-drawing .perio-crown { fill: color-mix(in srgb, var(--panel-soft) 70%, #fff); stroke: color-mix(in srgb, var(--border-strong) 90%, transparent); stroke-width: .9; vector-effect: non-scaling-stroke; }
.perio-tooth-drawing .anatomy-detail { stroke-width: .55; }
.perio-tooth-drawing.is-missing { opacity: .23; }
.perio-tooth-drawing.is-implant .implant-crown { fill: var(--panel-soft); }
.perio-missing-cross { fill: none; stroke: var(--required); stroke-width: 1.8; stroke-linecap: round; }
.perio-meta-mark { fill: var(--primary-strong); font-size: 8px; font-weight: 900; font-family: var(--font); }
.furcation-symbol { fill: var(--panel); stroke: var(--required); stroke-width: 1.4; }
.furcation-symbol.filled { fill: var(--required); }
.plaque-square, .chart-plaque { fill: var(--existing); }
.bop-square, .chart-bop { fill: var(--required); }
.chart-supp { fill: var(--warning); }
.periodontal-pocket-fill { fill: color-mix(in srgb, var(--existing) 12%, transparent); }
.perio-margin-line { fill: none; stroke: #d85c72; stroke-width: 2.15; stroke-linecap: round; stroke-linejoin: round; }
.perio-attachment-line { fill: none; stroke: #3c5fd7; stroke-width: 2.15; stroke-linecap: round; stroke-linejoin: round; }
.perio-entry-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.perio-convention { padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--panel-soft); color: var(--muted); font-size: 10px; }
.perio-matrix .row-label.is-toggleable { cursor: pointer; color: var(--primary-strong); }
.perio-matrix .row-label.is-toggleable:hover { background: var(--primary-soft); }
.perio-status-buttons { display: flex; align-items: center; justify-content: center; gap: 3px; }
.perio-status { width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 5px; background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 900; }
.perio-status:hover { border-color: var(--primary); }
.perio-status.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }
.perio-status.implant.is-active { border-color: var(--existing); background: color-mix(in srgb, var(--existing) 10%, var(--panel)); }
.perio-status.missing.is-active { border-color: var(--required); background: color-mix(in srgb, var(--required) 10%, var(--panel)); color: var(--required); }
.mini-tooth-icon { width: 12px; height: 16px; border: 1.5px solid currentColor; border-radius: 7px 7px 5px 5px; position: relative; }
.mini-tooth-icon::after { content:""; position:absolute; left:3px; right:3px; bottom:-5px; height:7px; border-left:1.5px solid currentColor; border-right:1.5px solid currentColor; }
.mini-implant-icon { width: 12px; height: 17px; position: relative; border: 1.5px solid currentColor; clip-path: polygon(12% 0,88% 0,75% 100%,25% 100%); }
.mini-implant-icon::after { content:""; position:absolute; inset:3px 1px; background: repeating-linear-gradient(to bottom, transparent 0 2px, currentColor 2px 3px); }
.perio-note { width: 88px; height: 27px; border: 1px solid transparent; border-radius: 5px; background: transparent; padding: 0 5px; font-size: 9px; }
.perio-note:hover, .perio-note:focus { border-color: var(--primary); background: var(--panel); }

@media (max-width: 1280px) {
  .tooth-card { width: 88px; flex-basis: 88px; }
  .tooth-diagram { width: 86px; }
  .metrics-row { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media print {
  .perio-chart { width: 100%; min-width: 0; min-height: 0; }
  .perio-chart-shell { padding: 0; }
  .perio-entry-panel { display: none !important; }
  body[data-print-mode="periodontogram"] .perio-panel { border: 0; }
  body[data-print-mode="periodontogram"] .perio-panel .panel-heading { padding: 2mm 3mm; }
  body[data-print-mode="periodontogram"] .perio-legend { padding: 2mm 3mm; }
  .metrics-row { grid-template-columns: repeat(9,1fr); }
  .metrics-row article { min-height: 15mm; }
  .odontogram { padding: 2mm 0; }
  .arch-row { transform: scale(.78); transform-origin: top center; }
  .tooth-card { min-height: 145px; }
}

/* 0.5.0 visual contrast refinements */
.tooth-root, .tooth-crown { stroke: color-mix(in srgb, var(--border-strong) 92%, var(--text)); stroke-width: 1.42; }
.tooth-root { fill: color-mix(in srgb, var(--panel-soft) 88%, #fff); }
.tooth-crown { fill: color-mix(in srgb, var(--panel) 90%, #fff); }
.perio-tooth-drawing .perio-root, .perio-tooth-drawing .perio-crown { stroke: color-mix(in srgb, var(--border-strong) 92%, var(--text)); stroke-width: 1.12; fill: color-mix(in srgb, var(--panel) 92%, #fff); }
.perio-row-label { font-size: 8px; }
.perio-site-value { font-size: 7.6px; }
.perio-section-title { font-size: 12.5px; }
.line-key.margin { color: #d85c72; }
.line-key.pocket { color: #3c5fd7; }


/* 0.6.0 — readable periogram and responsive charting sheets */
.odontogram { padding-inline: 24px; }
.tooth-card { width: 94px; flex-basis: 94px; min-height: 158px; }
.tooth-diagram { width: 90px; height: 121px; }
.tooth-number { width: 48px; height: 28px; font-size: 13px; }
.tooth-anatomy, .tooth-root, .tooth-crown { stroke-width: 1.65; }
.tooth-diagram .surface { stroke-width: 1.2; }

.chart-inspector {
  top: auto;
  right: 18px;
  bottom: 18px;
  width: min(348px, calc(100vw - 36px));
  max-height: min(690px, calc(100vh - 180px));
  border-radius: 16px;
  overflow: hidden;
}
.chart-inspector.is-open { display: flex; flex-direction: column; }
.chart-inspector #inspectorContent { min-height: 0; overflow: auto; }
.chart-inspector .inspector-header { padding: 13px 14px 11px; position: sticky; top: 0; z-index: 3; background: var(--panel); }
.chart-inspector .inspector-header h2 { font-size: 15px; }
.chart-inspector .current-charting { padding: 9px 14px; }
.chart-inspector .form-block { padding: 10px 14px 0; }
.chart-inspector .stage-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; }
.chart-inspector .stage-option { min-height: 36px; justify-content: center; padding: 5px 6px; text-align: center; font-size: 9.5px; line-height: 1.15; }
.chart-inspector .condition-grid { max-height: 246px; }
.chart-inspector #removeChartingBtn { margin: 10px 14px 14px; width: calc(100% - 28px); }
.sheet-handle { display: none; }

.chart-context-menu { width: min(292px, calc(100vw - 16px)); max-height: min(480px, calc(100vh - 16px)); border-radius: 14px; }
.context-menu-head { padding: 10px 11px; }
.context-stage-row { padding: 8px 8px 6px; gap: 4px; }
.context-stage { min-height: 29px; font-size: 8.8px; }
.context-search { padding: 0 8px 6px; }
.context-condition-list { max-height: 230px; padding: 0 4px 4px; }
.chart-context-menu .condition-option { min-height: 36px; padding-block: 4px; font-size: 10.5px; }
.chart-context-menu .condition-icon { width: 25px; height: 25px; flex-basis: 25px; }
.chart-context-menu .condition-icon svg { width: 19px; height: 19px; }

.perio-chart-grid { display: grid; gap: 16px; padding: 14px; background: color-mix(in srgb, var(--panel) 92%, var(--panel-soft)); }
.perio-view-card { overflow: hidden; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow-sm); }
.perio-card-head { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 15px; border-bottom: 1px solid var(--border); }
.perio-card-head h2 { margin: 2px 0 0; font-size: 17px; color: var(--text); }
.perio-card-exam { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-strong); font-size: 9.5px; font-weight: 800; }
.perio-card-graphic { overflow-x: auto; border-bottom: 1px solid var(--border-strong); background: var(--panel); scrollbar-gutter: stable; }
.perio-card-graphic svg { display: block; width: max(100%, 1320px); min-width: 1320px; height: auto; }
.perio-card-graphic .perio-tooth-number { font-size: 12px; fill: var(--text); }
.perio-card-graphic .perio-axis-label { font-size: 10px; fill: var(--muted); font-weight: 750; }
.perio-card-graphic .perio-grid-line { stroke: color-mix(in srgb, var(--border-strong) 72%, transparent); stroke-width: 1; }
.perio-card-graphic .perio-grid-line.cej { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 6 5; }
.perio-card-graphic .perio-tooth-separator { stroke: var(--border); stroke-width: 1; }
.perio-card-graphic .perio-tooth-drawing .perio-root,
.perio-card-graphic .perio-tooth-drawing .perio-crown { stroke: color-mix(in srgb, var(--text) 42%, var(--border-strong)); stroke-width: 1.35; fill: color-mix(in srgb, var(--panel) 94%, #fff); }
.perio-card-graphic .perio-tooth-drawing .anatomy-detail { stroke: color-mix(in srgb, var(--text) 34%, var(--border-strong)); stroke-width: .8; }
.perio-card-graphic .perio-margin-line { stroke-width: 2.7; }
.perio-card-graphic .perio-attachment-line { stroke-width: 2.7; }

.perio-inline-entry { background: var(--panel); }
.perio-inline-entry .perio-convention { padding: 8px 12px; color: var(--muted); font-size: 10.5px; }
.perio-inline-scroll { overflow-x: auto; scrollbar-gutter: stable; }
.perio-inline-table { min-width: 1320px; font-size: 10.5px; }
.perio-inline-table th, .perio-inline-table td { min-width: 27px; height: 34px; border-color: var(--border-strong); }
.perio-inline-table .row-label { min-width: 154px; width: 154px; font-size: 9.5px; color: var(--text); background: var(--panel-soft); }
.perio-inline-table .tooth-head { min-width: 78px; font-size: 10.5px; background: var(--panel-soft); }
.perio-inline-table .site-head { font-size: 8.5px; color: var(--muted); background: var(--panel-soft); }
.perio-inline-table .perio-number { width: 25px; height: 28px; font-size: 11px; border-color: var(--border); background: var(--panel); }
.perio-inline-table .perio-cal { font-size: 11px; color: var(--text); }
.perio-inline-table .perio-select { width: 70px; height: 27px; font-size: 9px; }
.perio-inline-table .perio-status { width: 23px; height: 23px; }
.legacy-perio-entry { display: none !important; }

@media (max-width: 980px) {
  .chart-inspector,
  .chart-context-menu {
    position: fixed;
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: 8px !important;
    width: auto;
    max-height: min(72vh, 650px);
    border-radius: 18px 18px 12px 12px;
    z-index: 620;
    box-shadow: 0 -18px 50px rgba(15,18,30,.22);
  }
  .chart-inspector.is-open { animation: sheet-in .18s ease-out; }
  .sheet-handle,
  .chart-context-menu::before { content: ""; display: block; width: 42px; height: 4px; flex: 0 0 auto; margin: 7px auto 2px; border-radius: 999px; background: var(--border-strong); }
  .chart-inspector .stage-grid { grid-template-columns: repeat(3, 1fr); }
  .chart-inspector .condition-grid { max-height: 32vh; }
  .chart-context-menu .context-condition-list { max-height: 32vh; }
  .odontogram { padding-inline: 12px; }
  .tooth-card { width: 90px; flex-basis: 90px; }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }
}

@media (max-width: 620px) {
  .chart-inspector,
  .chart-context-menu { left: 0 !important; right: 0 !important; bottom: 0 !important; border-radius: 18px 18px 0 0; max-height: 76vh; }
  .chart-inspector .inspector-header { padding-inline: 12px; }
  .chart-inspector .form-block { padding-inline: 12px; }
  .chart-inspector .stage-option { font-size: 8.8px; }
  .perio-chart-grid { padding: 8px; gap: 12px; }
  .perio-card-head { padding: 10px 12px; }
  .perio-card-head h2 { font-size: 15px; }
  .perio-card-graphic svg, .perio-inline-table { min-width: 1180px; width: 1180px; }
}

@media print {
  .perio-chart-grid { padding: 0; gap: 4mm; background: #fff; }
  .perio-view-card { break-inside: avoid; box-shadow: none; border-color: #aeb3c0; }
  .perio-card-head { min-height: 10mm; padding: 2mm 3mm; }
  .perio-card-graphic { overflow: visible; }
  .perio-card-graphic svg { width: 100%; min-width: 0; }
  .perio-inline-scroll { overflow: visible; }
  .perio-inline-table { width: 100%; min-width: 0; font-size: 6.5pt; }
  .perio-inline-table .row-label { min-width: 23mm; width: 23mm; font-size: 6.2pt; }
  .perio-inline-table th, .perio-inline-table td { min-width: 0; height: 5mm; padding: .4mm; }
  .perio-inline-table .perio-number { width: 5mm; height: 4mm; font-size: 6.5pt; border: 0; }
  .perio-inline-table .perio-select, .perio-inline-table .perio-status-buttons { transform: scale(.72); transform-origin: center; }
  .perio-inline-entry .perio-convention { display: none; }
}

/* 0.7.0 — single odontogram editor, synchronized periodontal sheet */
.chart-inspector:not(.is-open) { display: none !important; }

.perio-chart-grid {
  gap: 18px;
  padding: 14px;
}
.perio-view-card { min-width: 0; }
.perio-card-head { position: relative; z-index: 3; }
.perio-mobile-hint {
  display: none;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 10px;
  font-weight: 700;
}
.perio-sheet-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-gutter: stable;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
}
.perio-sheet {
  width: var(--perio-sheet-width);
  min-width: var(--perio-sheet-width);
  background: var(--panel);
}
.perio-tooth-strip,
.perio-plot-row {
  display: grid;
  grid-template-columns: var(--perio-label-width) repeat(16, var(--perio-tooth-width));
  width: var(--perio-sheet-width);
}
.perio-tooth-strip {
  min-height: 136px;
  align-items: stretch;
  border-bottom: 1px solid var(--border-strong);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--panel-soft) 38%, var(--panel)), var(--panel));
}
.perio-strip-label,
.perio-plot-label {
  position: sticky;
  left: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 12px;
  border-right: 1px solid var(--border-strong);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
}
.perio-plot-label small { margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 650; }
.perio-strip-tooth {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  border-right: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  scroll-snap-align: start;
}
.perio-strip-tooth.is-midline { border-left: 2px solid var(--border-strong); }
.perio-strip-number {
  width: 100%;
  min-height: 27px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--panel-soft) 72%, var(--panel));
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
}
.perio-strip-svg {
  width: 58px;
  height: 102px;
  margin-top: 3px;
  overflow: visible;
  filter: drop-shadow(0 4px 5px rgba(24,28,40,.08));
}
.perio-strip-svg .perio-root,
.perio-strip-svg .perio-crown,
.perio-strip-svg .implant-crown,
.perio-strip-svg .implant-abutment,
.perio-strip-svg .implant-fixture {
  stroke: color-mix(in srgb, var(--text) 42%, var(--border-strong));
  stroke-width: 1.45;
  vector-effect: non-scaling-stroke;
}
.perio-strip-svg .perio-root { fill: color-mix(in srgb, #e7d5bc 32%, var(--panel)); }
.perio-strip-svg .perio-crown,
.perio-strip-svg .implant-crown { fill: color-mix(in srgb, #ffffff 92%, var(--panel)); }
.perio-strip-svg .anatomy-detail { stroke: color-mix(in srgb, var(--text) 28%, var(--border)); stroke-width: .9; }
.perio-strip-svg.is-missing { opacity: .32; }
.perio-strip-svg .perio-missing-cross { stroke-width: 2.4; }
.perio-plot-row {
  grid-template-columns: var(--perio-label-width) calc(var(--perio-sheet-width) - var(--perio-label-width));
  min-height: 130px;
  border-bottom: 1px solid var(--border-strong);
}
.perio-plot-svg {
  display: block;
  width: calc(var(--perio-sheet-width) - var(--perio-label-width));
  height: 130px;
  background: var(--panel);
}
.perio-plot-svg .perio-grid-line { stroke: color-mix(in srgb, var(--border-strong) 62%, transparent); stroke-width: 1; }
.perio-plot-svg .perio-grid-line.cej { stroke: var(--muted); stroke-width: 1.55; stroke-dasharray: 6 5; }
.perio-plot-svg .perio-tooth-separator { stroke: color-mix(in srgb, var(--border) 85%, transparent); stroke-width: 1; }
.perio-plot-svg .perio-tooth-separator.midline { stroke: var(--border-strong); stroke-width: 2; }
.perio-plot-svg .perio-margin-line,
.perio-plot-svg .perio-attachment-line { stroke-width: 2.8; }
.perio-sheet > .perio-convention {
  width: var(--perio-sheet-width);
  padding-left: calc(var(--perio-label-width) + 10px);
  font-size: 10px;
}
.perio-inline-entry { width: var(--perio-sheet-width); }
.perio-inline-table {
  width: var(--perio-sheet-width);
  min-width: var(--perio-sheet-width);
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 10px;
}
.perio-inline-table col.perio-label-col { width: var(--perio-label-width); }
.perio-inline-table col.perio-site-col { width: var(--perio-site-width); }
.perio-inline-table th,
.perio-inline-table td {
  width: var(--perio-site-width);
  min-width: var(--perio-site-width);
  height: 34px;
  padding: 2px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
  background: var(--panel);
}
.perio-inline-table .row-label {
  position: sticky;
  left: 0;
  z-index: 7;
  width: var(--perio-label-width);
  min-width: var(--perio-label-width);
  padding: 5px 10px;
  border-right: 1px solid var(--border-strong);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 9.5px;
  line-height: 1.2;
  text-align: left;
}
.perio-inline-table thead .row-label { z-index: 9; }
.perio-inline-table .site-head {
  height: 27px;
  background: color-mix(in srgb, var(--panel-soft) 78%, var(--panel));
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 780;
}
.perio-inline-table .tooth-start { border-left: 1px solid var(--border-strong); }
.perio-inline-table .arch-midline { border-left: 2px solid var(--border-strong) !important; }
.perio-inline-table .perio-number {
  width: 20px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  font-size: 11px;
  font-weight: 720;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}
.perio-inline-table .perio-number::-webkit-outer-spin-button,
.perio-inline-table .perio-number::-webkit-inner-spin-button { margin: 0; appearance: none; -webkit-appearance: none; }
.perio-inline-table .perio-number:focus {
  position: relative;
  z-index: 2;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
  outline: none;
}
.perio-inline-table .perio-cal { color: var(--text); font-size: 11px; font-weight: 760; }
.perio-inline-table .perio-cal.high { color: var(--required); }
.perio-check { width: 19px; height: 19px; }
.perio-cycle-control {
  width: 31px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}
.perio-cycle-control:hover,
.perio-cycle-control:focus-visible { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }
.perio-cycle-control.is-disabled { opacity: .28; cursor: default; }
.perio-cycle-control.status-implant { color: var(--existing); border-color: color-mix(in srgb, var(--existing) 45%, var(--border)); }
.perio-cycle-control.status-missing { color: var(--required); border-color: color-mix(in srgb, var(--required) 45%, var(--border)); }
.perio-status-x { font-size: 16px; line-height: 1; }
.perio-cycle-control .mini-tooth-icon { width: 12px; height: 13px; }
.perio-cycle-control .mini-implant-icon { width: 10px; height: 15px; }

@media (max-width: 980px) {
  .chart-inspector,
  .chart-context-menu { max-height: min(68vh, 590px); }
  .chart-inspector .condition-grid,
  .chart-context-menu .context-condition-list { max-height: 28vh; }
  .perio-mobile-hint { display: block; }
  .perio-chart-grid { padding: 8px; gap: 12px; }
  .perio-card-head { min-height: 52px; padding: 9px 11px; }
  .perio-card-head h2 { font-size: 15px; }
}

@media (max-width: 620px) {
  .workspace { padding: 7px; }
  .perio-view-card { border-radius: 10px; }
  .perio-card-exam { display: none; }
  .perio-sheet { --perio-label-width: 118px !important; --perio-tooth-width: 62px !important; --perio-site-width: 20.6667px !important; --perio-sheet-width: 1110px !important; }
  .perio-tooth-strip,
  .perio-plot-row,
  .perio-inline-table,
  .perio-inline-entry,
  .perio-sheet > .perio-convention { width: var(--perio-sheet-width); min-width: var(--perio-sheet-width); }
  .perio-plot-svg { width: calc(var(--perio-sheet-width) - var(--perio-label-width)); }
  .perio-inline-table .row-label { font-size: 8.8px; padding-inline: 7px; }
  .perio-strip-label,
  .perio-plot-label { padding-inline: 8px; }
  .perio-strip-svg { width: 54px; height: 96px; }
  .chart-inspector,
  .chart-context-menu { max-height: 70vh; }
}

@media print {
  .perio-mobile-hint { display: none !important; }
  .perio-sheet-scroll { overflow: visible; }
  .perio-sheet { width: 100% !important; min-width: 0 !important; --perio-label-width: 23mm !important; --perio-tooth-width: calc((100% - 23mm) / 16) !important; --perio-site-width: calc((100% - 23mm) / 48) !important; --perio-sheet-width: 100% !important; }
  .perio-tooth-strip,
  .perio-plot-row,
  .perio-inline-table,
  .perio-inline-entry,
  .perio-sheet > .perio-convention { width: 100% !important; min-width: 0 !important; }
  .perio-strip-svg { width: 10mm; height: 18mm; }
  .perio-tooth-strip { min-height: 24mm; }
  .perio-plot-svg { width: calc(100% - 23mm); height: 22mm; }
  .perio-plot-row { min-height: 22mm; }
  .perio-inline-table .row-label { width: 23mm; min-width: 23mm; font-size: 6pt; }
  .perio-inline-table th,
  .perio-inline-table td { height: 4.6mm; padding: .2mm; }
  .perio-inline-table .perio-number { width: 4mm; height: 3.7mm; font-size: 6pt; border: 0; }
  .perio-cycle-control { width: 4.4mm; height: 3.8mm; border: 0; font-size: 6pt; }
}
