:root {
  --ink: #10283a;
  --paper: #edf8ff;
  --surface: #ffffff;
  --line: #bfd7e7;
  --brand: #1677b8;
  --brand-2: #0f659d;
  --accent: #7ed3ff;
  --bad: #a72c2c;
  --focus: #1677ff;
  --app-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  --weight-strong: 600;
  --weight-bold: 700;
  --weight-heavy: 800;
  --line-body: 1.4;
  --line-control: 1.25;
  color-scheme: light;
  font-family: var(--app-font);
}

* { box-sizing: border-box; }
html, body { touch-action: pan-x pan-y; }
body {
  margin: 0;
  padding-bottom: 144px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--app-font);
  line-height: var(--line-body);
}
button, input, select, textarea, dialog, table, output {
  font-family: var(--app-font);
  font-style: normal;
}
button, input, select, textarea { font-size: inherit; line-height: var(--line-control); }
button, input, select { min-height: 44px; border: 1px solid #8dbbd7; border-radius: 9px; background: #fff; color: var(--ink); }
button { padding: 9px 13px; font-weight: var(--weight-bold); cursor: pointer; touch-action: manipulation; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: not-allowed; }
a { color: #0d5d74; }

.app-header {
  position: relative;
  z-index: 20;
  padding: max(10px, env(safe-area-inset-top)) 10px 10px;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 3px 14px rgba(12, 76, 119, .22);
}

.brand { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; max-width: 1500px; margin: 0 auto 10px; }
.brand h1 { margin: 0; font-size: clamp(1.45rem, 5vw, 2.2rem); letter-spacing: .02em; }
.eyebrow { margin: 0 0 2px; color: #d9f2ff; font-size: .68rem; font-weight: var(--weight-bold); letter-spacing: .1em; text-transform: uppercase; }
.brand-links {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  align-items: center;
  justify-content: end;
  gap: 3px 6px;
  font-size: .73rem;
}
.brand-links a {
  grid-column: 1 / -1;
  color: #fff;
  font-weight: var(--weight-strong);
  text-align: right;
  white-space: nowrap;
}
.support-button,
.share-button { min-height: 38px; padding: 6px 9px; border-color: #bce8ff; color: #07334f; background: #d9f4ff; }
.share-button {
  display: grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  padding: 4px;
  color: #fff;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.share-button svg {
  width: 22px;
  height: 30px;
  overflow: visible;
}
.share-button path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.history-buttons { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.history-buttons button {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 7px 4px;
  border: 0;
  border-radius: 10px;
  color: #0877bb;
  background: transparent;
  box-shadow: none;
}
.history-buttons button:active { background: #dff3ff; }
.history-buttons svg { width: 38px; height: 26px; overflow: visible; }
.history-buttons path { fill: none; stroke: currentColor; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.history-buttons button:disabled { color: #a8c9db; background: transparent; }

.summary { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 7px; max-width: 1500px; margin: 0 auto 9px; }
.summary-card, .tolerance-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 62px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 11px;
  color: #fff;
  background: rgba(0,0,0,.18);
}
.summary-card span,
.tolerance-summary-button > span:first-child,
.tolerance-result-row span {
  color: #d8f2ff;
  font-size: .73rem;
  font-weight: var(--weight-strong);
}
.summary-card strong { font-size: clamp(1rem, 2.5vw, 1.4rem); font-variant-numeric: tabular-nums; }
.summary-card em { grid-column: 1 / -1; justify-self: end; padding: 1px 7px; border-radius: 999px; font-size: .68rem; font-style: normal; font-weight: var(--weight-bold); }
.closure.pass em { background: #b8f0d1; color: #0c5434; }
.closure.fail em { background: #ffd1cc; color: #7a1818; }
.closure.pending em { background: #dae2df; color: #46514e; }
.tolerance-card {
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  gap: 2px;
}
.tolerance-summary-button {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  width: 100%;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #fff;
  background: transparent;
  text-align: left;
}
.tolerance-summary-button:active { transform: none; }
.tolerance-summary-button strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.tolerance-settings-mark {
  align-self: center;
  padding: 1px 5px;
  border-radius: 999px;
  color: #155f84;
  background: #d8f2ff;
  font-size: .62rem;
  line-height: 1.35;
}
.tolerance-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 5px;
  min-width: 0;
}
.tolerance-result-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calculated-tolerance {
  justify-self: end;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tolerance-settings-dialog {
  width: min(360px, calc(100vw - 24px));
}
.action-dialog.plan-height-bulk-dialog {
  width: min(520px, calc(100vw - 18px));
}
.plan-height-bulk-dialog > form {
  display: grid;
  gap: 10px;
}
.plan-height-bulk-sheet {
  margin: -4px 0 0;
  color: #41677e;
  font-size: .86rem;
  font-weight: var(--weight-strong);
}
.plan-height-bulk-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.plan-height-bulk-tools button {
  min-height: 42px;
  padding: 7px 5px;
  border: 1px solid #93c8e3;
  border-radius: 9px;
  color: #145979;
  background: #f4fbff;
  font-size: .86rem;
}
.plan-height-bulk-tools button[aria-pressed="true"] {
  color: #fff;
  border-color: #147eb7;
  background: #147eb7;
}
.plan-height-range-status {
  min-height: 1.4em;
  margin: 0;
  color: #547188;
  font-size: .79rem;
  line-height: 1.4;
}
.plan-height-point-list {
  display: grid;
  max-height: min(43dvh, 420px);
  gap: 6px;
  padding: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.plan-height-point-list:empty::before {
  content: "点名が入力されている行はありません。";
  padding: 18px 10px;
  border: 1px dashed #a9c8d9;
  border-radius: 10px;
  color: #547188;
  text-align: center;
}
.plan-height-point-option {
  display: grid;
  grid-template-columns: 32px 54px minmax(0, 1fr) auto;
  min-height: 48px;
  padding: 6px 5px 6px 9px;
  align-items: center;
  gap: 7px;
  border: 1px solid #b5d4e4;
  border-radius: 11px;
  color: #173f56;
  background: #fff;
  text-align: left;
}
.plan-height-point-option[aria-pressed="true"] {
  border-color: #1595d2;
  background: #e2f5ff;
  box-shadow: inset 0 0 0 1px #1595d2;
}
.plan-height-point-option.range-start {
  border-color: #ef9c22;
  background: #fff4df;
  box-shadow: inset 0 0 0 1px #ef9c22;
}
.plan-height-point-check {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 2px solid #83b8d3;
  border-radius: 50%;
  color: transparent;
  background: #fff;
  font-weight: var(--weight-bold);
}
.plan-height-point-option[aria-pressed="true"] .plan-height-point-check {
  color: #fff;
  border-color: #168bc8;
  background: #168bc8;
}
.plan-height-point-number {
  color: #477086;
  font-size: .82rem;
}
.plan-height-point-name {
  min-width: 0;
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plan-height-elevation {
  justify-self: end;
  padding-right: 1px;
  color: #718a99;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-regular);
  text-align: right;
  white-space: nowrap;
}
.plan-height-value-field {
  display: grid;
  grid-template-columns: auto minmax(130px, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  color: #174f73;
  font-weight: var(--weight-bold);
}
.plan-height-value-field input {
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 2px solid #86bfdc;
  border-radius: 10px;
  background: #fff;
  font-size: 1.15rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.plan-height-value-field input[aria-invalid="true"] {
  border-color: #d34949;
  background: #fff3f3;
}
.plan-height-bulk-footer {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr);
  align-items: center;
  gap: 10px;
}
.plan-height-bulk-footer output {
  color: #315f78;
  font-size: .83rem;
  font-weight: var(--weight-strong);
}
.plan-height-bulk-footer .primary-button {
  min-height: 48px;
  color: #fff;
  border-color: #137fb9;
  background: #137fb9;
}
@media (max-width: 420px) {
  .plan-height-point-option {
    grid-template-columns: 30px 42px minmax(0, 1fr) auto;
  }
  .plan-height-bulk-footer {
    grid-template-columns: 1fr;
  }
}
.tolerance-dialog-field {
  display: grid;
  grid-template-columns: minmax(82px, .75fr) minmax(0, 1.25fr);
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-weight: var(--weight-bold);
}
.tolerance-dialog-field select,
.tolerance-dialog-field input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 7px 30px 7px 10px;
  font-size: 16px;
  font-weight: var(--weight-bold);
}
.manual-tolerance-distance {
  display: grid;
}
.manual-tolerance-distance[hidden] { display: none; }
.tolerance-dialog-field input {
  padding-right: 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tolerance-dialog-formula {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  color: #174b67;
  background: #edf8ff;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(82px, 180px));
  gap: 7px;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
}
.toolbar button {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 8px 5px;
  border-color: #b6d2e3;
  border-radius: 9px;
  color: #17384e;
  background: #f8fcff;
  font-size: clamp(.78rem, 2vw, .96rem);
  font-weight: var(--weight-strong);
  white-space: nowrap;
}
.toolbar .danger-outline {
  border-color: #e4b3b3;
  color: #8d2020;
  background: #fff8f8;
}

main { max-width: 1540px; margin: 0 auto; padding: 9px 8px 28px; }
.notice {
  position: fixed;
  z-index: 110;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  width: min(520px, calc(100vw - 20px));
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #e6a15d;
  border-radius: 9px;
  color: #693500;
  background: #fff3df;
  box-shadow: 0 5px 16px rgba(10, 70, 110, .22);
  font-weight: var(--weight-strong);
  pointer-events: none;
  transform: translateX(-50%);
}
.notice.error { border-color: #dc7c7c; color: #7f1717; background: #fff0f0; }
.notice.success { border-color: #70b893; color: #155c39; background: #ecfff4; }
.sheet-heading {
  position: sticky;
  z-index: 45;
  top: 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 52px;
  padding: 0 4px 7px;
  border-bottom: 1px solid transparent;
  color: #174f73;
  background: #eef8ff;
  overflow: visible;
}
.sheet-heading.is-stuck {
  border-bottom-color: #9fc9e2;
  box-shadow: 0 3px 12px rgba(10, 70, 110, .2);
}
.sheet-toggle-button {
  min-width: 82px;
  min-height: 42px;
  margin-left: 0;
  padding: 6px 12px;
  border: 2px solid #168bd1;
  border-radius: 12px;
  color: #fff;
  background: #168bd1;
  font-size: .9rem;
}
body.back-sheet-active .sheet-toggle-button {
  border: 0;
  color: #164f2d;
  background: #c6ebd1;
  box-shadow: none;
  outline: none;
}
body.back-sheet-active .sheet-toggle-button:focus,
body.back-sheet-active .sheet-toggle-button:focus-visible {
  box-shadow: none;
  outline: none;
}
body.back-sheet-active .sheet-heading {
  color: #245b39;
  background: #f0faf3;
}
body.back-sheet-active .sheet-heading.is-stuck {
  border-bottom-color: #9bcfaf;
}
.hidden-column-buttons {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  height: 42px;
  margin: 0 8px;
  gap: 5px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.hidden-column-buttons[hidden] { display: none; }
.hidden-column-buttons::-webkit-scrollbar { display: none; }
.hidden-column-buttons button {
  flex: 0 0 auto;
  min-width: 54px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid #9fcde7;
  border-radius: 9px;
  color: #145779;
  background: #fff;
  font-size: .78rem;
  font-weight: var(--weight-bold);
  white-space: nowrap;
}
.hidden-column-buttons button:active {
  color: #fff;
  background: #168bd1;
}

.table-shell {
  position: relative;
  overflow: visible;
}

.table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  padding-top: 0;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #9fc9e2;
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(22, 91, 135, .1);
}

.sticky-table-header {
  position: absolute;
  z-index: 1;
  top: 100%;
  left: 0;
  width: 100%;
  overflow: visible;
  padding-top: 0;
  border: 1px solid #9fc9e2;
  background: #2588c5;
  box-shadow: 0 3px 12px rgba(10, 70, 110, .28);
}
body.back-sheet-active .sticky-table-header {
  border-color: #9bcfaf;
  background: #c6ebd1;
}
.sticky-table-header[hidden] { display: none; }
.sticky-table-viewport {
  width: 100%;
  overflow: hidden;
}
.sticky-table-header table {
  will-change: transform;
}
.sticky-table-header thead th {
  position: static;
  border-bottom-color: transparent;
  box-shadow: none;
}

table { width: 100%; min-width: var(--table-min-width, 790px); border-collapse: separate; border-spacing: 0; table-layout: fixed; }
th, td { height: var(--row-height, 48px); padding: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
th { height: var(--row-height, 48px); padding: 5px 2px; color: #fff; background: #2588c5; font-size: var(--header-font-size, 12px); white-space: nowrap; }
body.back-sheet-active .table-wrap thead th,
body.back-sheet-active .sticky-table-header thead th {
  border-bottom-color: transparent;
  color: #164f2d;
  background: #c6ebd1;
  box-shadow: none;
}
body.back-sheet-active .table-wrap {
  border-color: #9bcfaf;
  background: #f8fcf9;
}
body.back-sheet-active .table-wrap th,
body.back-sheet-active .table-wrap td {
  border-right-color: #bddfca;
  border-bottom-color: #bddfca;
}
.table-wrap thead th {
  position: static;
  z-index: 14;
  top: 0;
  border-bottom-color: transparent;
  box-shadow: none;
}
th:nth-child(1), td:nth-child(1) { width: var(--number-width, 42px); }
th:nth-child(2), td:nth-child(2) { width: var(--point-width, 139.2px); }
th:nth-child(3), td:nth-child(3) { width: var(--distance-width, 94px); }
th:nth-child(4), td:nth-child(4), th:nth-child(5), td:nth-child(5) { width: var(--reading-width, 96px); }
th:nth-child(6), td:nth-child(6) { width: var(--round-trip-width, 104px); }
th:nth-child(7), td:nth-child(7) { width: var(--difference-width, 100px); }
th:nth-child(8), td:nth-child(8) { width: var(--elevation-width, 134px); }
th:nth-child(9), td:nth-child(9) { width: var(--determined-elevation-width, 124px); }
th:nth-child(10), td:nth-child(10) { width: var(--plan-height-width, 112px); }
th:nth-child(11), td:nth-child(11) { width: var(--plan-difference-width, 112px); }
th:nth-child(12), td:nth-child(12) { width: var(--note-width, 180px); }
.column-heading-label {
  display: block;
  overflow: hidden;
  text-overflow: clip;
}
.column-hide-trigger { cursor: pointer; }
.column-hide-trigger:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -3px;
}
th.column-collapsed,
td.column-collapsed {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border-right: 0 !important;
  color: transparent !important;
}
th.column-collapsed .column-heading-label,
td.column-collapsed > * {
  visibility: hidden !important;
  pointer-events: none !important;
}
.table-wrap thead th.point-heading { position: static; z-index: 20; }
td.point-clipboard-anchor {
  position: relative;
  overflow: visible;
}
.point-clipboard-popover {
  position: absolute;
  z-index: 45;
  top: calc(100% + 4px);
  left: calc(100% + 4px);
  display: flex;
  align-items: flex-start;
  width: max-content;
  max-width: min(252px, calc(100vw - 16px));
  gap: 0;
  padding: 0;
  border: 0;
  background: transparent;
  filter: drop-shadow(0 5px 8px rgba(8, 70, 109, .28));
}
.point-clipboard-popover[hidden] { display: none; }
.point-clipboard-popover button {
  width: auto;
  min-width: 0;
  min-height: 44px;
  padding: 3px 9px;
  border: 2px solid #168bd1;
  border-radius: 0;
  color: #0b527b;
  background: rgba(255, 255, 255, .9);
  font-size: 12px;
  line-height: 1;
}
.point-clipboard-popover button[hidden] { display: none; }
.point-paste-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}
#pointCopyBtn {
  border-radius: 10px 0 0 10px;
}
#pointPasteBtn,
#pointIncrementPasteBtn {
  max-width: 104px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--weight-bold);
}
#pointPasteBtn {
  border-left-width: 0;
}
#pointIncrementPasteBtn {
  width: calc(100% + 2px);
  max-width: calc(100% + 2px);
  margin-left: -2px;
  border-top-width: 0;
  border-radius: 0 0 10px 10px;
  border-color: #4ca9d9;
  color: #074f79;
  background: rgba(223, 244, 255, .9);
}
#planHeightBulkBtn {
  border-radius: 10px 0 0 10px;
  color: #07557f;
  background: rgba(230, 247, 255, .94);
  font-weight: var(--weight-bold);
}
#pointClearBtn {
  border-left-width: 0;
  border-radius: 0 10px 10px 0;
  border-color: #dc8c8c;
  color: #9b2020;
  background: rgba(255, 241, 241, .9);
  font-weight: var(--weight-bold);
}
.point-clipboard-popover.clear-only #pointClearBtn {
  border-left-width: 2px;
  border-radius: 10px;
}
.point-clipboard-popover.plan-height-actions #pointClearBtn {
  border-left-width: 0;
  border-radius: 0 10px 10px 0;
}
.point-clipboard-popover button:disabled {
  opacity: .42;
  color: #31596e;
  background: #d8e8f0;
}
td input { width: 100%; height: 100%; min-height: var(--input-height, 47px); padding: 6px; border: 0; border-radius: 0; outline: none; background: transparent; text-align: center; font-size: var(--input-font-size, 16px); font-variant-numeric: tabular-nums; }
td input[data-field="pointName"], td input[data-field="note"] {
  text-align: left;
  transition: font-size 80ms ease-out;
}
td input:focus { position: relative; z-index: 8; box-shadow: inset 0 0 0 3px var(--focus); background: #eef6ff; }
td input.voice-selected { position: relative; z-index: 7; box-shadow: inset 0 0 0 3px #28a6e8; background: #e7f7ff; }
.voice-session-active td input,
.voice-mode-active td input { caret-color: transparent; }
.voice-session-active td input[readonly],
.voice-mode-active td input[readonly] { user-select: none; -webkit-user-select: none; }
tr:nth-child(even) td { background-color: rgba(46, 145, 203, .035); }
td.calc { padding: 4px; background: #eaf6fc !important; font-size: var(--input-font-size, 16px); font-weight: var(--weight-strong); font-variant-numeric: tabular-nums; }
body.back-sheet-active .table-wrap tbody td {
  background-color: #f1faf4;
}
body.back-sheet-active .table-wrap tbody tr:nth-child(even) td {
  background-color: #e3f4e8;
}
body.back-sheet-active .table-wrap td.calc,
body.back-sheet-active .table-wrap td.determined-elevation,
body.back-sheet-active .table-wrap td.elevation-cell,
body.back-sheet-active .table-wrap td.elevation-cell input {
  background-color: #ddf1e3 !important;
}
body.back-sheet-active .table-wrap td input:focus,
body.back-sheet-active .table-wrap td input.voice-selected {
  background-color: #e8f7ed;
}
tr.incomplete .diff { color: #9b5700; }
td.round-trip-diff.negative { color: #c52c2c; }
td.plan-difference.negative { color: #c52c2c; }
td.determined-elevation {
  background: #e8f5fc;
  font-weight: 700;
}
td.starting-elevation-cell,
td.starting-elevation-cell input {
  background-color: #fff4cf !important;
}
body.back-sheet-active td.starting-elevation-cell,
body.back-sheet-active td.starting-elevation-cell input {
  background-color: #ddf1e3 !important;
}
td.elevation-cell.locked-elevation-cell,
td.elevation-cell.locked-elevation-cell input {
  background-color: #eaf6fc !important;
}
td.elevation-cell.locked-elevation-cell input {
  color: #173f56;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}
tbody td,
tbody td input,
tbody .row-selector,
tbody td.calc { font-size: var(--input-font-size, 16px); }
.row-selector {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: var(--input-height, 47px);
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #0f527c;
  background: #dff3ff;
  font-size: var(--input-font-size, 16px);
  font-weight: var(--weight-heavy);
  font-variant-numeric: tabular-nums;
}
body.back-sheet-active .row-selector {
  color: #245b39;
  background: #d5eedd;
}
body.back-sheet-active #notebook tbody td.calc,
body.back-sheet-active #notebook tbody td.determined-elevation,
body.back-sheet-active #notebook tbody td.elevation-cell,
body.back-sheet-active #notebook tbody td.elevation-cell input {
  background-color: #ddf1e3 !important;
}
body.back-sheet-active #notebook tbody tr:nth-child(even) td:not(.calc):not(.elevation-cell) {
  background-color: #e3f4e8 !important;
}
body.back-sheet-active #notebook tbody .row-selector {
  background-color: #d5eedd !important;
}
/* 行操作中は、No.を含む行全体をシートと反対の色で明示する。
   復路用のセル背景や計算列の背景より必ず優先させる。 */
body:not(.back-sheet-active) #notebook tbody tr.row-action-selected > td,
body:not(.back-sheet-active) #notebook tbody tr.row-action-selected > td > input,
body:not(.back-sheet-active) #notebook tbody tr.row-action-selected .row-selector {
  background-color: #e7f6e8 !important;
}
body.back-sheet-active #notebook tbody tr.row-action-selected > td,
body.back-sheet-active #notebook tbody tr.row-action-selected > td > input,
body.back-sheet-active #notebook tbody tr.row-action-selected .row-selector {
  background-color: #eaf6fc !important;
}
.row-selector.is-active {
  font-size: clamp(1.8rem, 6vw, 2.35rem);
  font-weight: var(--weight-heavy);
  line-height: .7;
  letter-spacing: .08em;
}
.row-selector:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

.row-action-anchor {
  position: relative;
  overflow: visible;
}
.row-action-popover {
  position: absolute;
  z-index: 46;
  top: calc(100% + 4px);
  left: calc(100% + 4px);
  width: max-content;
  max-width: min(290px, calc(100vw - 16px));
  padding: 0;
  border: 0;
  background: transparent;
  filter: drop-shadow(0 5px 8px rgba(8, 70, 109, .28));
}
.row-action-popover[hidden],
.row-action-popover [hidden] {
  display: none;
}
.row-action-buttons {
  display: flex;
  align-items: stretch;
}
.row-action-popover button {
  min-height: 44px;
  padding: 7px 11px;
  border: 2px solid #168bd1;
  border-radius: 0;
  color: #0b527b;
  background: rgba(255, 255, 255, .94);
  font-size: 13px;
  font-weight: var(--weight-bold);
  line-height: 1;
  white-space: nowrap;
}
.row-action-buttons > :first-child {
  border-radius: 10px 0 0 10px;
}
.row-action-buttons > :last-child {
  border-radius: 0 10px 10px 0;
}
.row-action-buttons > :not(:first-child) {
  border-left-width: 0;
}
.row-action-popover .row-delete-button {
  border-color: #dc7474;
  color: #942222;
  background: rgba(255, 237, 237, .96);
}
.elevation-cell { position: relative; }

.voice-dock {
  position: fixed;
  z-index: 50;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(180px, 520px);
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  border-top: 1px solid #7eb9dc;
  color: #fff;
  background: rgba(13, 101, 157, .97);
  box-shadow: 0 -4px 18px rgba(0,0,0,.18);
  transform: none;
}
body.suggestion-keyboard-active .voice-dock {
  transform: translateY(calc(var(--suggestion-keyboard-shift, 0px) * -1));
}
body.external-ui-recovery .voice-dock {
  visibility: hidden;
  transform: none !important;
  transition: none !important;
}
.voice-dock button { width: 100%; min-height: 116px; border: 2px solid #d9f4ff; color: #07334f; background: var(--accent); font-size: 1.12rem; }
.voice-dock button.voice-mode { color: #fff; background: #d9473f; }
.voice-dock button.listening { color: #fff; background: #981f1a; animation: pulse 1s infinite; }
.voice-dock .keyboard-mode-button { min-height: 40px; border-color: #d9f4ff; color: #0d527b; background: #fff; font-size: .82rem; }
.voice-dock button[hidden] { display: none; }
.point-name-keyboard {
  display: grid;
  width: min(100%, 560px);
  height: 213px;
  gap: 3px;
  padding: 5px;
  border: 1px solid #9fd5f1;
  border-radius: 12px;
  color: #07334f;
  background: #e9f8ff;
}
.point-name-keyboard[hidden] { display: none; }
.point-name-keyboard-display {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 41px;
  align-items: center;
  gap: 5px;
}
.point-name-keyboard-display strong {
  font-size: .8rem;
  white-space: nowrap;
}
.point-name-keyboard-display output {
  display: block;
  min-height: 41px;
  padding: 4px 8px;
  overflow: hidden;
  border: 2px solid #168dcc;
  border-radius: 7px;
  background: #fff;
  font-size: 1.62rem;
  font-weight: var(--weight-heavy);
  line-height: 29px;
  text-overflow: ellipsis;
  touch-action: none;
  user-select: none;
  white-space: nowrap;
  cursor: text;
}
.point-name-keyboard-char {
  display: inline-block;
  min-width: .2em;
}
.point-name-keyboard-char.selected {
  color: #fff;
  background: #168dcc;
  border-radius: 2px;
}
.point-name-keyboard-caret {
  display: inline-block;
  position: relative;
  width: 0;
  height: 1.05em;
  margin: 0;
  vertical-align: -2px;
}
.point-name-keyboard-caret::after {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: #087ec0;
  content: "";
  animation: point-keyboard-caret 1s steps(1) infinite;
}
.point-name-keyboard-keys {
  display: grid;
  gap: 2px;
}
.point-name-keyboard-row {
  display: flex;
  justify-content: center;
  gap: 2px;
}
.voice-dock .point-name-keyboard button {
  min-width: 0;
  min-height: 30px;
  padding: 1px;
  border: 1px solid #9ac9e1;
  border-radius: 6px;
  color: #07334f;
  background: #fff;
  box-shadow: 0 1px 2px rgba(5, 59, 91, .12);
  font-size: clamp(.9rem, 4.2vw, 1.1rem);
  font-weight: var(--weight-bold);
  line-height: 1;
}
.point-name-keyboard-row button {
  flex: 1 1 0;
  max-width: 48px;
}
.point-name-keyboard-actions {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, .55fr))
    minmax(0, 1.1fr)
    minmax(0, .65fr)
    minmax(0, .78fr)
    minmax(0, 1.1fr);
  gap: 2px;
}
.point-name-keyboard-actions button {
  overflow: hidden;
  writing-mode: horizontal-tb;
  text-overflow: clip;
  white-space: nowrap;
}
.point-name-keyboard-actions .numeric-keyboard-sign {
  display: none;
}
.point-name-keyboard-actions .numeric-keyboard-nav {
  display: none;
}
.voice-dock .point-name-keyboard-actions .point-name-keyboard-space {
  color: #0d527b;
  background: #f7fcff;
  font-size: .78rem;
}
.voice-dock .point-name-keyboard-display .point-name-native-keyboard-text {
  min-height: 30px;
  padding: 1px 6px;
  border-color: #168dcc;
  color: #0d527b;
  background: #fff;
  font-size: .72rem;
  white-space: nowrap;
}
.point-name-keyboard-actions .point-name-native-keyboard-numeric {
  display: none;
}
.voice-dock .point-name-keyboard-actions .point-name-keyboard-clear,
.voice-dock .point-name-keyboard-row .point-name-keyboard-backspace,
.voice-dock .point-name-keyboard[data-keyboard-layout="numeric"] .numeric-keyboard-backspace {
  color: #942222;
  border-color: #e2aaaa;
  background: #fff1f1;
}
.voice-dock .point-name-keyboard-actions .custom-keyboard-voice {
  color: #fff;
  border-color: #b82e29;
  background: #d9473f;
  font-size: 1rem;
}
.voice-dock .point-name-keyboard-actions .point-name-keyboard-done {
  border-color: #087ec0;
  color: #fff;
  background: #168dcc;
}
.numeric-keyboard-keys {
  display: none;
}
.point-name-keyboard[data-keyboard-layout="numeric"] {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: 41px minmax(0, 1fr);
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-display {
  grid-column: 1;
  grid-row: 1;
  grid-template-columns: auto minmax(0, 1fr);
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-display .point-name-native-keyboard-text {
  display: none;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-display strong {
  font-size: .7rem;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-native-keyboard {
  width: auto;
  padding-inline: 1px;
  font-size: .82rem;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-keys {
  display: none;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-actions {
  grid-column: 1;
  grid-row: 2;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-content: stretch;
  min-height: 0;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-actions > [data-point-keyboard-action="backspace"] {
  display: none;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-actions .text-keyboard-symbol {
  display: none;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-actions .numeric-keyboard-nav {
  display: block;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-actions .numeric-keyboard-sign {
  display: block;
  color: #07334f;
  border-color: #9ac9e1;
  background: #fff;
  font-size: 1.05rem;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-actions .point-name-native-keyboard-numeric {
  display: block;
  grid-column: 1;
  grid-row: 2;
  font-size: .84rem;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-actions .custom-keyboard-voice {
  grid-column: 2 / span 2;
  grid-row: 2;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-actions .point-name-keyboard-done {
  grid-column: span 2;
}
.voice-dock .point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-actions button {
  min-height: 0;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .point-name-keyboard-space {
  display: none;
}
.point-name-keyboard[data-keyboard-layout="numeric"] .numeric-keyboard-keys {
  display: grid;
  grid-column: 2;
  grid-row: 1 / 3;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 3px;
}
.voice-dock .point-name-keyboard[data-keyboard-layout="numeric"] .numeric-keyboard-keys button {
  min-height: 0;
  font-size: 1.3rem;
}
.voice-dock .point-name-keyboard[data-keyboard-layout="numeric"] .numeric-keyboard-backspace {
  color: #942222;
  border-color: #e2aaaa;
  background: #fff1f1;
  font-size: 1.35rem;
}
body.point-keyboard-active .voice-dock {
  grid-template-columns: minmax(280px, 560px);
}
body.point-keyboard-active .voice-dock > :not(.point-name-keyboard):not(.point-suggestions) {
  display: none;
}
body.point-keyboard-active.point-suggestions-visible .point-suggestions {
  order: 1;
  width: min(100%, 560px);
  padding-block: 5px;
}
body.point-keyboard-active.point-suggestions-visible .point-name-keyboard {
  order: 2;
}
@keyframes point-keyboard-caret { 50% { opacity: 0; } }
.voice-action {
  position: relative;
  width: 100%;
}
.voice-action > #voiceBtn {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.last-voice-value {
  display: block;
  width: calc(100% - 20px);
  min-height: 30px;
  color: inherit;
  font-size: clamp(1.75rem, 8vw, 2.6rem);
  font-weight: var(--weight-heavy);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
}
.last-voice-value[hidden] { display: none; }
.point-script-controls {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid #b7d7e9;
  border-radius: 12px;
  color: #07334f;
  background: #eefaff;
}
.point-script-controls label {
  display: flex;
  min-height: 48px;
  padding: 7px 10px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #c9e1ee;
  border-radius: 9px;
  background: #fff;
  font-size: 1rem;
  font-weight: var(--weight-bold);
  white-space: nowrap;
}
.point-script-controls input {
  width: 28px;
  height: 28px;
  margin: 0;
  accent-color: #1587c7;
}
.voice-settings-dialog {
  width: min(500px, calc(100vw - 24px));
}
.toggle-setting {
  display: flex;
  min-height: 54px;
  margin-top: 16px;
  padding: 10px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #c9e1ee;
  border-radius: 10px;
  background: #f7fcff;
}
.toggle-setting span {
  display: grid;
  gap: 2px;
}
.toggle-setting strong {
  color: #174f73;
  font-size: .95rem;
}
.toggle-setting small {
  color: #547188;
  font-size: .74rem;
  line-height: 1.35;
}
.toggle-setting input {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin: 0;
  accent-color: #1587c7;
}
.point-script-description {
  margin: 0;
  color: #547188;
  font-size: .86rem;
  line-height: 1.5;
}
.script-settings,
.alias-settings {
  margin-top: 18px;
}
body.voice-mode-active .voice-action > #voiceBtn {
  min-height: 109px;
  font-size: 1.22rem;
}
body.software-keyboard-open:not(.voice-mode-active) .voice-dock {
  display: none;
}
body.voice-mode-active { padding-bottom: calc(212px + env(safe-area-inset-bottom)); }
body.voice-mode-active.point-keyboard-active {
  padding-bottom: calc(240px + env(safe-area-inset-bottom));
}
body.point-suggestions-visible { padding-bottom: calc(322px + env(safe-area-inset-bottom)); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255,105,97,.2); } }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

dialog { max-width: min(500px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; border: 0; border-radius: 17px; color: var(--ink); box-shadow: 0 24px 70px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(7,20,18,.6); }
dialog form { position: relative; padding: 18px; }
dialog h2 { width: calc(100% - 58px); min-height: 42px; margin: 2px 0 10px; line-height: var(--line-control); }
dialog .eyebrow { color: var(--brand-2); }
.dialog-close { position: absolute; top: 8px; right: 8px; min-width: 42px; padding: 4px; border: 0; background: #edf8ff; font-size: 1.5rem; }
.dialog-actions { display: grid; gap: 9px; margin-top: 17px; }
.dialog-actions a { display: flex; min-height: 46px; align-items: center; justify-content: center; border: 1px solid #9eaaa6; border-radius: 10px; font-weight: var(--weight-bold); text-decoration: none; }
.dialog-actions .support-link { border-color: #e0a341; color: #352508; background: #ffdd96; }
.action-dialog {
  width: min(420px, calc(100vw - 24px));
  font-family: inherit;
}
.action-dialog h2 {
  margin-bottom: 10px;
  font-size: 1.25rem;
  font-weight: var(--weight-bold);
  letter-spacing: 0;
  line-height: 1.3;
}
.action-dialog .dialog-actions {
  gap: 9px;
  margin-top: 14px;
}
.action-dialog .dialog-actions button {
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: var(--weight-bold);
  letter-spacing: 0;
  line-height: 1.35;
}
.share-dialog {
  width: min(390px, calc(100vw - 24px));
}
.share-dialog > form {
  display: grid;
  gap: 12px;
}
.share-dialog h2,
.share-dialog p {
  margin: 0;
}
.share-qr {
  display: block;
  width: min(230px, 70vw);
  height: auto;
  margin: 2px auto;
  border: 8px solid #fff;
  border-radius: 12px;
  background: #fff;
}
.share-url {
  display: block;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #17445f;
  background: #f3faff;
  font-size: .85rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  user-select: all;
}
.share-dialog .primary-button {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}
.install-dialog > form {
  display: grid;
  gap: 12px;
}
.install-dialog h2,
.install-dialog p {
  margin: 0;
}
.install-steps {
  margin: 0;
  padding-left: 1.5em;
  line-height: 1.65;
}
.install-settings {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #b7d7e9;
}
.install-settings h3 {
  margin: 0 0 9px;
}
.install-settings-button {
  width: 100%;
  min-height: 48px;
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}
.clear-confirmation {
  margin-top: 14px;
}
.clear-confirmation p {
  margin: 0 0 14px;
  padding: 14px 12px;
  border: 1px solid #e7b2b2;
  border-radius: 10px;
  color: #742020;
  background: #fff3f3;
  font-size: 1rem;
  font-weight: var(--weight-strong);
  line-height: 1.45;
  text-align: center;
}
.clear-confirmation-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.clear-confirmation-actions button {
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: var(--weight-bold);
}
.danger-button { border-color: #bd5151; color: #fff; background: #b83232; }
.setting-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; font-weight: var(--weight-bold); }
.setting-field output { color: var(--brand-2); font-variant-numeric: tabular-nums; }
.point-name-wait-setting { margin-top: 14px; }
.point-name-wait-setting select {
  min-width: 112px;
  padding: 7px 34px 7px 12px;
  font-size: 1rem;
  font-weight: var(--weight-bold);
}
.rate-slider { width: 100%; margin-top: 12px; accent-color: var(--brand); }
.rate-labels { display: flex; justify-content: space-between; color: #547188; font-size: .72rem; }
.alias-settings { margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); }
.alias-settings h3 { margin: 0 0 4px; color: #174f73; font-size: 1rem; }
.alias-settings > p { margin: 0 0 10px; color: #547188; font-size: .76rem; line-height: 1.5; }
.alias-headings, .alias-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(110px, 1.15fr) 44px; gap: 6px; align-items: center; }
.alias-headings { margin-bottom: 4px; padding: 0 3px; color: #42647a; font-size: .68rem; font-weight: var(--weight-bold); }
.alias-list { display: grid; gap: 7px; }
.alias-row input { width: 100%; min-width: 0; padding: 7px 8px; font-size: 16px; }
.alias-remove { min-width: 44px; padding: 5px; border-color: #e5a7a7; color: #8d2020; background: #fff7f7; }
.add-alias-button { width: 100%; margin-top: 9px; color: #0f527c; background: #e9f7ff; }
.feedback-settings {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.feedback-settings h3 {
  margin: 0 0 4px;
  color: #174f73;
  font-size: 1rem;
}
.feedback-settings p {
  margin: 0 0 10px;
  color: #547188;
  font-size: .8rem;
  line-height: 1.5;
}
.feedback-mail-button {
  width: 100%;
  min-height: 48px;
  border-color: #6aaed3;
  color: #0f527c;
  background: #e9f7ff;
  font-size: 1rem;
  font-weight: var(--weight-bold);
}
.table-wrap.pinching { border-color: #1b8dce; box-shadow: 0 0 0 3px rgba(27,141,206,.18); }
.point-suggestions {
  width: 100%;
  max-width: 720px;
  padding: 8px 10px;
  border: 1px solid #76b9df;
  border-radius: 12px;
  background: rgba(240, 250, 255, .98);
  box-shadow: 0 5px 22px rgba(10, 70, 110, .25);
}
.point-suggestions-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.point-suggestions-heading strong { color: #174f73; font-size: .75rem; }
.point-suggestions-heading span { color: #55798f; font-size: .68rem; }
.point-suggestion-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.point-suggestion-buttons button {
  min-width: 0;
  height: 42px;
  min-height: 42px;
  padding: 2px 5px;
  overflow-wrap: anywhere;
  color: #0f527c;
  background: #fff;
  font-size: 1rem;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.point-suggestion-buttons .primary-point-suggestion {
  position: relative;
  height: 48px;
  min-height: 48px;
  padding-top: 13px;
  border: 3px solid #087ec0;
  background: #c8edff;
  font-size: 1.05rem;
  font-weight: var(--weight-heavy);
}
.point-suggestion-buttons .primary-point-suggestion::before {
  position: absolute;
  top: 2px;
  left: 7px;
  content: "候補";
  color: #46768f;
  font-size: .56rem;
  font-weight: var(--weight-strong);
  line-height: 1;
}
.point-suggestion-buttons .increment-point-suggestion {
  position: relative;
  padding-top: 13px;
  border: 3px solid #087ec0;
  background: #c8edff;
  font-weight: var(--weight-heavy);
}
.point-suggestion-buttons .increment-point-suggestion::before {
  position: absolute;
  top: 2px;
  left: 7px;
  content: "増番";
  color: #46768f;
  font-size: .56rem;
  font-weight: var(--weight-strong);
  line-height: 1;
}
.point-suggestion-buttons .current-point-suggestion {
  position: relative;
  padding-top: 13px;
  border-color: #168bd1;
  background: #e4f6ff;
}
.point-suggestion-buttons .current-point-suggestion::before {
  position: absolute;
  top: 2px;
  left: 5px;
  content: "現在値";
  color: #4f758c;
  font-size: .55rem;
  font-weight: var(--weight-strong);
  line-height: 1;
}
.point-suggestion-buttons .confusion-point-suggestion {
  border-color: #91c9e8;
  background: #f7fcff;
}
.point-suggestion-editor {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) 72px 64px;
  gap: 6px;
}
.point-suggestion-editor input {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 7px 9px;
  border: 2px solid #168bd1;
  border-radius: 9px;
  font-size: 16px;
  -webkit-user-select: text;
  user-select: text;
}
.point-suggestion-editor button { height: 54px; min-height: 54px; }
.point-suggestion-editor .suggestion-edit-cancel { color: #714040; background: #fff4f4; }
@media (max-width: 760px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .summary-card, .tolerance-card { min-height: 58px; }
}

@media (max-width: 430px) {
  .brand-links { max-width: 52%; }
  .brand-links a { font-size: .65rem; }
  .brand-links .share-button,
  .brand-links .support-button {
    min-height: 34px;
    padding: 4px 7px;
  }
  .brand-links .share-button {
    width: 34px;
    min-width: 34px;
    padding: 4px;
  }
  .summary-card, .tolerance-card { padding: 7px 8px; }
  .toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }
  .toolbar button {
    min-height: 46px;
    padding-inline: 3px;
    font-size: clamp(.75rem, 3.25vw, .9rem);
  }
  .voice-dock { grid-template-columns: 1fr; gap: 3px; }
  .voice-dock button { min-height: 116px; }
  body { padding-bottom: 144px; }
  .history-buttons { gap: 5px; margin-left: auto; }
  .history-buttons button { width: 42px; min-width: 42px; }
  .history-buttons svg { width: 36px; }
  .sheet-toggle-button { min-width: 76px; margin-left: 0; padding-inline: 9px; }
}

/* 音声ボタン用の高さ指定を、候補ボタンには引き継がせない。 */
.voice-dock .point-suggestion-buttons > button {
  height: 42px;
  min-height: 42px;
}
.voice-dock .point-suggestion-buttons > .primary-point-suggestion {
  height: 48px;
  min-height: 48px;
}
.voice-dock .point-suggestion-editor button {
  height: 54px;
  min-height: 54px;
}
body.voice-mode-active .point-suggestions {
  padding-block: 6px;
}
body.voice-mode-active .point-suggestion-buttons {
  gap: 6px;
}
body.voice-mode-active .voice-dock .point-suggestion-buttons > button {
  height: 40px;
  min-height: 40px;
  line-height: 1;
}
body.voice-mode-active .voice-dock .point-suggestion-buttons > .primary-point-suggestion {
  height: 40px;
  min-height: 40px;
}
body.voice-mode-active .point-suggestion-buttons .primary-point-suggestion,
body.voice-mode-active .point-suggestion-buttons .increment-point-suggestion,
body.voice-mode-active .point-suggestion-buttons .current-point-suggestion {
  display: grid;
  padding: 2px 5px;
  place-items: center;
  line-height: 1;
}
body.voice-mode-active .voice-dock .point-suggestion-editor button {
  height: 43px;
  min-height: 43px;
}

/* 通常入力では、右上固定の縦型候補にする。 */
body.point-suggestions-visible:not(.voice-mode-active) {
  padding-bottom: 144px;
}
body.point-suggestions-visible:not(.voice-mode-active) .voice-dock {
  top: 0;
  right: max(7px, env(safe-area-inset-right));
  bottom: auto;
  left: auto;
  display: flex;
  width: min(42vw, 220px);
  min-width: 166px;
  max-height: var(--normal-suggestion-max-height, calc(100dvh - 16px));
  flex-direction: column;
  gap: 5px;
  padding: 5px;
  overflow-y: auto;
  border: 1px solid #7eb9dc;
  border-radius: 11px;
  background: rgba(13, 101, 157, .97);
  box-shadow: 0 5px 18px rgba(0,0,0,.23);
  transform: translate3d(0, var(--normal-suggestion-y, 8px), 0);
  transition: transform 110ms ease-out;
  will-change: transform;
}
body.point-suggestions-visible:not(.voice-mode-active) .voice-dock > .keyboard-mode-button {
  display: none;
}
body.point-suggestions-visible:not(.voice-mode-active) .voice-action {
  order: 2;
}
body.point-suggestions-visible:not(.voice-mode-active) .voice-action > #voiceBtn {
  height: 46px;
  min-height: 46px;
  padding: 4px;
  border-width: 1px;
  font-size: .82rem;
  line-height: var(--line-control);
}
body.point-suggestions-visible:not(.voice-mode-active) .point-suggestions {
  order: 1;
  width: 100%;
  max-width: none;
  padding: 4px;
  border-radius: 9px;
  box-shadow: 0 4px 14px rgba(10, 70, 110, .24);
}
body.point-suggestions-visible:not(.voice-mode-active) .point-suggestions-heading {
  display: flex;
  min-height: 13px;
  margin: 0 0 3px;
  justify-content: flex-start;
}
body.point-suggestions-visible:not(.voice-mode-active) .point-suggestions-heading strong {
  display: none;
}
body.point-suggestions-visible:not(.voice-mode-active) .point-suggestions-heading span {
  font-size: .62rem;
  line-height: 1.1;
}
body.point-suggestions-visible:not(.voice-mode-active) .point-suggestion-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}
body.point-suggestions-visible:not(.voice-mode-active) .point-suggestion-buttons > button,
body.point-suggestions-visible:not(.voice-mode-active) .point-suggestion-buttons > .primary-point-suggestion {
  grid-column: auto;
  height: 40px;
  min-height: 40px;
  padding: 2px 4px;
  font-size: .88rem;
}
body.point-suggestions-visible:not(.voice-mode-active) .point-suggestion-buttons > .primary-point-suggestion {
  border-color: #087ec0;
  color: #063e62;
  background: #bfe9ff;
  font-weight: var(--weight-heavy);
}
body.point-suggestions-visible:not(.voice-mode-active) .point-suggestion-editor {
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
body.point-suggestions-visible:not(.voice-mode-active) .point-suggestion-editor input {
  grid-column: 1 / -1;
  min-height: 42px;
}
body.point-suggestions-visible:not(.voice-mode-active) .point-suggestion-editor button {
  height: 40px;
  min-height: 40px;
}

body.software-keyboard-open:not(.voice-mode-active) {
  padding-bottom: calc(var(--keyboard-row-clearance, 208px) + env(safe-area-inset-bottom));
}
