﻿:root {
  color-scheme: light;
  --bg: #edf5f8;
  --panel: #ffffff;
  --ink: #182633;
  --muted: #64748b;
  --line: #cfdce6;
  --accent: #16799a;
  --accent-dark: #0a465c;
  --accent-glow: #27c5e8;
  --steel: #40505f;
  --neon-soft: rgba(39, 197, 232, 0.22);
  --danger: #b42318;
  --soft: #e9f3f7;
  --shadow: 0 16px 38px rgba(12, 37, 54, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(245, 248, 250, 0.88), rgba(233, 240, 244, 0.95)),
    linear-gradient(115deg, rgba(255, 255, 255, 0.84), rgba(226, 235, 240, 0.76)),
    repeating-linear-gradient(90deg, rgba(90, 104, 118, 0.045) 0, rgba(90, 104, 118, 0.045) 1px, transparent 1px, transparent 28px),
    linear-gradient(180deg, #f8fafb 0%, var(--bg) 48%, #e8eef2 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Yu Gothic UI", Meiryo, sans-serif;
  min-height: 100vh;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    radial-gradient(circle at 14% 12%, rgba(39, 197, 232, 0.22), transparent 26%),
    radial-gradient(circle at 88% 8%, rgba(22, 121, 154, 0.18), transparent 26%),
    linear-gradient(rgba(31, 111, 139, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 111, 139, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 72%);
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 32%, rgba(255, 255, 255, 0.28) 32.2%, transparent 33%),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0, rgba(255, 255, 255, 0.12) 1px, transparent 1px, transparent 12px);
  opacity: 0.55;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.app-header {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 370px);
  gap: 22px;
  align-items: start;
  margin-bottom: 18px;
  padding: 26px;
  border: 1px solid rgba(145, 158, 171, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.96), rgba(230, 246, 251, 0.94)),
    radial-gradient(circle at 88% 18%, rgba(39, 197, 232, 0.18), transparent 30%),
    repeating-linear-gradient(90deg, rgba(68, 81, 94, 0.055) 0, rgba(68, 81, 94, 0.055) 1px, transparent 1px, transparent 24px);
  box-shadow: var(--shadow);
}

.app-header::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(39, 197, 232, 0.2), transparent),
    linear-gradient(135deg, transparent 0 42%, rgba(22, 121, 154, 0.08) 42.4%, transparent 43.4%);
  opacity: 0.75;
}

.app-header > * {
  position: relative;
  z-index: 1;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  max-width: 760px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
  letter-spacing: 0;
  color: #112636;
  text-shadow: 0 1px 0 #fff, 0 0 22px rgba(39, 197, 232, 0.2);
}

.hero-subtitle {
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: clamp(1rem, 1.6vw, 1.26rem);
  font-weight: 900;
  line-height: 1.35;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.1rem;
}

.lead,
.panel-title p,
.helper-text {
  color: var(--muted);
}

.lead {
  margin-bottom: 8px;
  max-width: none;
  color: var(--steel);
  font-size: 1rem;
  font-weight: 800;
}

.hero-description {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.header-actions,
.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.header-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  justify-self: end;
  width: 100%;
  max-width: 370px;
}

.header-master-control {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  max-width: none;
}

.header-master-control span {
  grid-column: 1 / -1;
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.45;
}

.header-actions > button,
.header-master-control button {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding-inline: 10px;
  white-space: normal;
}

.header-actions .current-clock {
  grid-column: 1 / -1;
}

.daily-ai-usage {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 111, 139, 0.22);
  border-radius: 10px;
  background: rgba(247, 250, 252, 0.94);
  color: var(--muted);
  font-size: 0.82rem;
}

.daily-ai-usage strong {
  color: var(--accent-dark);
  font-size: 1.45rem;
  line-height: 1.1;
}

.daily-ai-usage small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.ai-usage-details {
  margin-top: 4px;
}

.ai-usage-details summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 900;
}

.ai-usage-detail-body {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

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

.ai-usage-table-wrap {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ai-usage-table {
  min-width: 520px;
}

.ai-usage-table th,
.ai-usage-table td {
  padding: 8px 9px;
  font-size: 0.8rem;
}

.action-panel {
  margin-bottom: 8px;
  padding: 14px 18px;
  border-color: rgba(31, 111, 139, 0.28);
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0.98), rgba(232, 244, 249, 0.94));
}

.action-panel .button-row {
  align-items: center;
  margin-bottom: 0;
}

.case-mode-control {
  display: grid;
  gap: 5px;
  min-width: 190px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 111, 139, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.case-mode-control select {
  min-height: 38px;
  font-weight: 800;
}

.case-mode-prime {
  margin: 18px 0 10px;
}

.case-mode-prime .case-mode-control {
  width: min(100%, 520px);
  padding: 16px;
  border: 2px solid #f0a020;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff8e8, #fff1cf);
  box-shadow: 0 10px 24px rgba(159, 100, 13, 0.16);
  color: #784a00;
  font-size: 1.05rem;
}

.case-mode-prime .case-mode-control select {
  min-height: 54px;
  border-color: #d18a10;
  background: #fff;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 900;
}

.case-mode-prime .field-note {
  color: #805000;
  font-size: 0.9rem;
  font-weight: 800;
}

.case-mode-prime.is-next-step .case-mode-control {
  animation: caseModePrimePulse 1.05s ease-in-out infinite;
  border-color: #ff9800;
  background: linear-gradient(180deg, #fff4c4, #ffe3a3);
  box-shadow:
    0 0 0 6px rgba(255, 152, 0, 0.22),
    0 0 34px rgba(255, 152, 0, 0.52),
    0 18px 34px rgba(154, 88, 0, 0.26);
}

.case-mode-prime.is-next-step .case-mode-control select {
  border-color: #ff9800;
  box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.18);
}

@keyframes caseModePrimePulse {
  0%, 100% {
    filter: brightness(1);
    transform: translateY(0);
  }
  50% {
    filter: brightness(1.11);
    transform: translateY(-1px);
  }
}

.action-panel .primary-button {
  min-height: 62px;
  padding: 0 34px;
  font-size: 1.12rem;
  font-weight: 900;
}

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

.review-panel-compact {
  padding: 0;
  overflow: hidden;
}

.review-panel-compact details {
  padding: 0;
}

.review-panel-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  cursor: pointer;
  list-style: none;
}

.review-panel-summary::-webkit-details-marker {
  display: none;
}

.review-panel-summary strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
}

.review-panel-summary small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.45;
}

.review-panel-summary::after {
  content: "開く";
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.review-panel-compact details[open] .review-panel-summary::after {
  content: "\9589\3058\308b";
}

.review-panel-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--line);
}

.master-view {
  margin-top: 18px;
}

.master-top-actions {
  position: sticky;
  top: 10px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 251, 253, 0.96);
  box-shadow: 0 10px 28px rgba(23, 43, 61, 0.12);
  backdrop-filter: blur(8px);
}

.master-top-actions .button-row {
  margin: 0;
}

.master-top-actions #backToMainButton {
  position: sticky;
  left: 14px;
  z-index: 3;
  box-shadow: 0 8px 18px rgba(23, 43, 61, 0.12);
}

.master-top-actions .master-save-dock {
  position: static;
  z-index: auto;
  flex: 1 1 520px;
}

.status-card-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.status-card {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 14px;
  border: 1px solid rgba(145, 158, 171, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 18px rgba(23, 43, 61, 0.07);
}

.status-card strong {
  color: var(--accent-dark);
  font-size: 0.96rem;
}

.status-card span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.panel {
  margin-bottom: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(23, 43, 61, 0.055);
}

#pdfPanel {
  margin-bottom: 8px;
  padding: 16px 18px;
}

#pdfPanel .panel-title {
  margin-bottom: 10px;
}

.result-panel {
  margin-bottom: 14px;
  padding-top: 16px;
}

.result-panel .panel-title {
  margin-bottom: 10px;
}

.ai-read-step-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 18px 0 10px;
  padding-top: 4px;
}

.ai-read-step-title h2 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 1.08rem;
}

.ai-read-step-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.cost-include-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 12px 0 8px;
  padding: 12px;
  border: 1px solid #c8dbe5;
  border-radius: 8px;
  background: #eef7fa;
}

.cost-include-panel strong {
  color: var(--accent-dark);
  font-size: 0.95rem;
}

.cost-include-panel label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #d5e2e9;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.cost-include-panel input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.panel-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.step-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.file-box,
.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.file-box {
  position: relative;
  cursor: pointer;
  min-height: 132px;
  padding: 22px;
  border: 3px solid #1282a5;
  border-radius: 8px;
  background:
    linear-gradient(100deg, rgba(39, 197, 232, 0.22), rgba(255, 255, 255, 0.96)),
    repeating-linear-gradient(135deg, rgba(68, 81, 94, 0.08) 0, rgba(68, 81, 94, 0.08) 1px, transparent 1px, transparent 16px);
  place-items: center start;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.file-box input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-box:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 5px rgba(39, 197, 232, 0.16), 0 16px 30px rgba(31, 111, 139, 0.16);
  transform: translateY(-1px);
}

.file-box-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 8px;
  background: #0a465c;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
}

.file-box.is-locked {
  cursor: not-allowed;
  opacity: 0.58;
  filter: grayscale(0.2);
}

.file-box.is-locked:hover {
  border-color: #7d94a6;
  box-shadow: none;
  transform: none;
}

.file-box.is-locked .file-box-title::after {
  content: "\203b AI\8aad\8fbc\4e2d\306f\5909\66f4\3067\304d\307e\305b\3093";
  display: block;
  margin-top: 4px;
  color: #8a5a00;
  font-size: 0.78rem;
  font-weight: 800;
}

.file-box-title {
  color: var(--accent-dark);
  font-size: clamp(1.35rem, 2vw, 1.95rem);
  font-weight: 900;
}

.file-box-subtitle {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
}

.helper-text {
  margin: 8px 0 0;
  font-size: 0.9rem;
}

.field-note {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.master-initial-note {
  color: #8a5a00;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.45;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.form-grid input[readonly] {
  background: #eef5f8;
  color: var(--muted);
  cursor: default;
}

.checkbox-field {
  align-content: center;
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
}

.checkbox-field span {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
}

.laser-assist-field {
  border-left: 3px solid rgba(31, 111, 139, 0.28);
  padding-left: 10px;
}

.master-section {
  margin-top: 18px;
}

.master-section h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.master-section h4 {
  margin: 16px 0 10px;
  font-size: 0.95rem;
}

.section-note {
  margin-bottom: 12px;
  color: var(--muted);
}

.demo-note {
  margin: 10px 0 12px;
  padding: 12px 14px;
  border: 1px solid #d8b25a;
  border-radius: 8px;
  background: #fff8e6;
  color: #755100;
  font-weight: 800;
  line-height: 1.6;
}

.material-master-area {
  display: grid;
  gap: 16px;
}

.material-master-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

#materialMasterArea .material-master-card,
.processing-multiplier-section,
.base-master-section {
  border: 2px solid #1f6f8b;
  background: #eef7fa;
}

.processing-multiplier-section h3,
#materialMasterArea h4,
.base-master-section h3 {
  color: #15566e;
}

.base-master-section {
  padding: 14px;
}

.base-master-section > h3 {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #bfd0d8;
  border-radius: 8px;
  background: rgba(244, 250, 252, 0.98);
  box-shadow: 0 4px 12px rgba(31, 77, 91, 0.08);
}

.base-master-section > .section-note {
  margin: 0 0 12px;
}

.base-master-section > .master-grid {
  gap: 12px;
}

.base-master-section > .master-grid > label {
  min-width: 0;
  padding: 10px;
  border: 1px solid #bfd0d8;
  border-radius: 8px;
  background: #ffffff;
  color: #25485a;
}

.base-master-section > .master-grid > label input,
.base-master-section > .master-grid > label select {
  width: 100%;
  min-width: 0;
}

.custom-material-toolbar {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid #bfd0d8;
  border-radius: 8px;
  background: rgba(244, 250, 252, 0.98);
}

.custom-material-register {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.custom-material-register label {
  display: grid;
  gap: 6px;
  color: #25485a;
  font-weight: 800;
}

.surface-register-toolbar {
  margin: 16px 0 18px;
}

.surface-register {
  grid-template-columns: minmax(220px, 320px) auto;
}

.surface-master-card-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.surface-master-card-header h4 {
  margin: 0;
}

.surface-master-delete-button {
  flex: 0 0 auto;
  min-width: 76px;
}

.registered-material-jump-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0 14px;
  padding: 10px;
  border: 1px solid rgba(191, 208, 216, 0.9);
  border-radius: 8px;
  background: #ffffff;
}

.registered-material-jump-list strong {
  margin-right: 4px;
  color: #15566e;
}

.material-jump-item {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.material-jump-button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #bfd0d8;
  border-radius: 8px;
  background: #eef7fa;
  color: #15566e;
  cursor: pointer;
  font-weight: 900;
}

.material-jump-button:hover {
  border-color: #1f6f8b;
  background: #dff2f7;
}

.material-jump-delete-button {
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid #e0b5b5;
  border-radius: 8px;
  background: #fff5f5;
  color: #9a2f2f;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
}

.welding-price-master-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
}

.welding-price-card,
.welding-reference-panel {
  padding: 14px;
  border: 1px solid #bfd0d8;
  border-radius: 8px;
  background: #ffffff;
  color: #102a3a;
}

.welding-price-card h4 {
  margin: 0 0 12px;
  color: #15566e;
}

.welding-price-card label,
.welding-reference-panel label {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin-bottom: 10px;
  font-size: 0.92rem;
  font-weight: 800;
}

.welding-price-card input,
.welding-reference-panel input {
  width: 100%;
  min-width: 0;
}

.welding-formula-box,
.welding-reference-formula {
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #eef7fa;
  color: #25485a;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.55;
}

.welding-reference-panel {
  margin-top: 14px;
}

.welding-reference-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.welding-reference-results div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: #f6fafb;
  border: 1px solid #d5e3e8;
}

.welding-reference-results span {
  color: #4d6a78;
  font-size: 0.84rem;
  font-weight: 800;
}

.welding-reference-results strong {
  color: #15566e;
  font-size: 1.16rem;
}

.base-price-master-card .material-master-title-bar {
  position: static;
}

.base-master-badge {
  color: #4d6a78;
  font-size: 0.82rem;
  font-weight: 800;
}

.multiplier-setting-grid {
  display: grid;
  gap: 8px;
}

.multiplier-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) repeat(3, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 10px;
  border: 1px solid #bfd0d8;
  background: #fff;
}

.multiplier-row strong {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-self: center;
  align-items: center;
  min-width: 0;
  color: #15566e;
}

.multiplier-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.multiplier-row .multiplier-value-label {
  grid-template-columns: minmax(90px, 1fr) auto;
  align-items: end;
}

.multiplier-row .multiplier-value-label input {
  min-width: 0;
}

.multiplier-row .multiplier-value-label .multiplier-apply-button {
  grid-column: 2;
  grid-row: 2;
  align-self: stretch;
  white-space: nowrap;
}

.multiplier-row input[readonly] {
  background: #edf4f6;
  color: #15566e;
  font-weight: 800;
}

.material-master-card h4 {
  margin: 0;
  font-size: 1rem;
}

.material-master-title-bar {
  position: sticky;
  top: 8px;
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: -6px -6px 12px;
  padding: 8px 10px;
  border: 1px solid #bfd0d8;
  border-radius: 8px;
  background: rgba(244, 250, 252, 0.98);
  box-shadow: 0 4px 12px rgba(31, 77, 91, 0.08);
}

.mini-jump-button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #8bb8c8;
  border-radius: 999px;
  background: #ffffff;
  color: #15566e;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.mini-jump-button:hover {
  background: #e9f6fa;
}

.effective-unit-preview-section {
  border: 2px solid #1f6f8b;
  background: #f7fbfc;
}

.effective-unit-sticky-header {
  position: sticky;
  top: 8px;
  z-index: 220;
  margin: -14px -14px 14px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid #bfd0d8;
  background: rgba(247, 251, 252, 0.98);
  box-shadow: 0 8px 18px rgba(21, 86, 110, 0.12);
}

.effective-unit-preview-section h3 {
  margin: 0 0 8px;
  color: #15566e;
}

.effective-unit-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid #bfd0d8;
  background: #ffffff;
}

.effective-unit-summary strong {
  color: #15566e;
}

.effective-unit-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.effective-unit-process-grid {
  margin-top: 16px;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  overflow-x: auto;
  padding-bottom: 6px;
}

.effective-unit-preview-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #bfd0d8;
  background: #ffffff;
}

.effective-unit-preview-card h4 {
  margin: 0;
  padding: 9px 10px;
  border-bottom: 1px solid #d6e2e7;
  background: #eef7fa;
  color: #15566e;
}

.effective-unit-preview-card table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.86rem;
  background: #ffffff;
  color: #102a3a;
}

.effective-unit-preview-card th,
.effective-unit-preview-card td {
  padding: 8px 9px;
  border-bottom: 1px solid #edf2f4;
  background: #ffffff;
  color: #102a3a;
  text-align: left;
  text-shadow: none;
  overflow-wrap: anywhere;
}

.effective-unit-preview-card th:first-child,
.effective-unit-preview-card td:first-child {
  width: 42%;
}

.effective-unit-preview-card tr.has-adjustment th:nth-child(2),
.effective-unit-preview-card tr.has-adjustment td:nth-child(2) {
  width: 24%;
  text-align: center;
}

.effective-unit-preview-card th:last-child,
.effective-unit-preview-card td:last-child {
  text-align: right;
  width: 58%;
  white-space: nowrap;
}

.effective-unit-preview-card tr.has-adjustment th:last-child,
.effective-unit-preview-card tr.has-adjustment td:last-child {
  width: 34%;
}

.effective-unit-adjustment-input {
  width: 84px;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid rgba(31, 111, 139, 0.28);
  border-radius: 6px;
  background: #ffffff;
  color: #102a3a;
  font-weight: 800;
  text-align: right;
}

.effective-unit-preview-card thead th {
  background: #f4f9fb;
  color: #4b6470;
  font-size: 0.76rem;
}

.effective-unit-preview-result {
  color: #15566e;
  font-weight: 900;
}

.effective-unit-preview-card-wide {
  grid-column: auto;
}

.material-master-card h5 {
  margin: 18px 0 8px;
  padding: 8px 10px;
  border-left: 4px solid #1f6f8b;
  background: #eef5f7;
  color: #174f62;
  font-size: 0.95rem;
}

.laser-unit-grid + h5 {
  margin-top: 24px;
  border-left-color: #64748b;
  background: #f3f5f7;
  color: #3d4b56;
}

.master-input-disabled {
  opacity: 0.62;
}

.master-input-disabled input {
  background: #eef4f7;
  cursor: not-allowed;
}

.master-save-dock {
  position: sticky;
  bottom: 10px;
  z-index: 20;
  align-items: center;
  margin-top: 24px;
  padding: 14px;
  border: 2px solid #1f6f8b;
  background: rgba(247, 251, 252, 0.97);
  box-shadow: 0 8px 24px rgba(30, 60, 75, 0.2);
}

.master-view {
  padding-bottom: 104px;
}

.master-quick-save-bar {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  left: max(18px, env(safe-area-inset-left));
  z-index: 70;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto minmax(160px, 1.2fr);
  align-items: center;
  gap: 12px;
  max-width: 980px;
  margin: 0 auto;
  padding: 12px;
  border: 2px solid #1f6f8b;
  border-radius: 8px;
  background: rgba(247, 251, 252, 0.98);
  box-shadow: 0 14px 34px rgba(8, 32, 44, 0.28);
}

.master-quick-save-bar span {
  color: var(--ink);
  font-weight: 900;
}

.master-quick-save-button {
  min-height: 48px;
  padding-inline: 22px;
  white-space: nowrap;
}

.master-quick-back-button {
  min-height: 48px;
  padding-inline: 18px;
  white-space: nowrap;
}

.master-quick-save-bar .save-message {
  min-width: 0;
  font-size: 0.86rem;
}

@media (max-width: 720px) {
  .master-view {
    padding-bottom: 150px;
  }

  .master-quick-save-bar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .master-quick-save-button {
    width: 100%;
  }

  .master-quick-back-button {
    width: 100%;
  }
}

.master-overwrite-button {
  min-height: 50px;
  padding-inline: 24px;
  font-size: 1rem;
}

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

.master-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.customer-registry-inputs {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  align-items: end;
}

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

.material-thickness-availability {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #155d75;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.material-thickness-availability input {
  width: 16px;
  height: 16px;
  accent-color: #1f6f8b;
}

.pdf-operation-grid,
.ai-read-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.pdf-operation-grid {
  grid-template-columns: minmax(360px, 1.2fr) minmax(320px, 0.9fr);
  align-items: stretch;
  max-width: 1180px;
}

.operation-control-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 208, 105, 0.36);
  border-radius: 8px;
  background: rgba(4, 10, 18, 0.62);
}

.operation-control-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
}

.operation-control-head strong {
  color: var(--steel);
  font-size: 1rem;
  font-weight: 900;
}

.operator-quick-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.customer-quick-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
}

.operator-quick-row input,
.operation-control-card select {
  min-width: 0;
}

.operator-quick-row button,
.customer-quick-row button,
.operation-control-card .compact-button {
  min-height: 42px;
}

.text-danger-button {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 177, 168, 0.45);
  border-radius: 8px;
  background: rgba(73, 20, 18, 0.48);
  color: #ffb1a8;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  white-space: nowrap;
}

.text-danger-button:hover,
.text-danger-button:focus-visible {
  color: #ffffff;
  border-color: rgba(255, 225, 210, 0.7);
  background: rgba(118, 30, 24, 0.72);
}

.operator-quick-register {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid rgba(31, 111, 139, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.operator-quick-register label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.operator-quick-register button {
  min-height: 42px;
  padding-inline: 18px;
}

.operator-delete-button {
  min-height: 34px;
  width: fit-content;
  padding: 6px 12px;
  font-size: 0.78rem;
}

.pdf-clear-button {
  width: fit-content;
  min-height: 42px;
  margin-top: 10px;
  padding-inline: 18px;
}

.pdf-operation-grid label,
.result-actions label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.ai-read-actions {
  align-items: center;
  padding: 14px;
  border: 1px solid #b8c5cf;
  background: #f4f8fa;
}

#aiReadButton,
#aiHighPrecisionReadButton,
.ai-read-motion {
  grid-column: 1 / -1;
}

.dev-ai-read-button,
.dev-ai-read-note {
  display: none;
}

body.show-dev-ai-read-buttons .dev-ai-read-button {
  display: inline-flex;
}

body.show-dev-ai-read-buttons .dev-ai-read-note {
  display: block;
}

.api-diagnostic-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 111, 139, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.api-diagnostic-panel .secondary-button {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 0.88rem;
}

.api-diagnostic-panel .helper-text {
  margin: 0;
}

.deep-read-button {
  border-color: rgba(154, 95, 20, 0.42);
  background: linear-gradient(135deg, #fff7e6, #fff);
  color: #8a4f00;
  box-shadow: 0 8px 22px rgba(154, 95, 20, 0.12);
  min-height: 54px;
}

.deep-read-button:not(:disabled):hover {
  border-color: #d18a18;
  background: linear-gradient(135deg, #ffe9b8, #fff8e8);
}

.ai-read-guide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(31, 111, 139, 0.28);
  border-radius: 8px;
  background: linear-gradient(100deg, rgba(232, 248, 255, 0.96), rgba(255, 255, 255, 0.96));
  color: var(--accent-dark);
  box-shadow: 0 10px 24px rgba(31, 111, 139, 0.12);
}

.ai-read-guide .guide-arrow {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 900;
  animation: guideArrowPulse 1.1s ease-in-out infinite;
}

.ai-read-guide strong {
  font-weight: 900;
}

.ai-read-guide span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

#aiReadButton.is-next-step:not(:disabled) {
  position: relative;
  animation: aiNextStepButtonPulse 1.2s ease-in-out infinite;
  box-shadow:
    0 0 0 6px rgba(42, 157, 190, 0.2),
    0 0 34px rgba(42, 157, 190, 0.48),
    0 18px 32px rgba(21, 90, 117, 0.28);
}

#aiReadButton.is-next-step:not(:disabled)::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(42, 157, 190, 0.55);
  border-radius: inherit;
  pointer-events: none;
  animation: aiNextStepRing 1.2s ease-in-out infinite;
}

@keyframes aiNextStepButtonPulse {
  0%, 100% {
    filter: brightness(1);
    transform: translateY(0);
  }
  50% {
    filter: brightness(1.12);
    transform: translateY(-1px);
  }
}

@keyframes aiNextStepRing {
  0%, 100% {
    opacity: 0.45;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.015);
  }
}

.ai-read-motion {
  display: grid;
  grid-template-columns: 88px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 14px;
  align-items: center;
  min-height: 68px;
  padding: 10px 14px;
  border: 1px solid #c8d5dc;
  border-radius: 8px;
  background: #fff;
  color: #263945;
}

.ai-motion-scene {
  position: relative;
  grid-row: 1 / span 2;
  width: 76px;
  height: 46px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #eef6f8, #dbe8ee);
}

.ai-motion-page,
.ai-motion-eye,
.ai-motion-answer {
  position: absolute;
  display: block;
}

.ai-motion-page {
  left: 10px;
  top: 9px;
  width: 28px;
  height: 32px;
  border: 2px solid #8aa3af;
  border-radius: 4px;
  background:
    linear-gradient(90deg, transparent 0 6px, #b6c8d0 6px 18px, transparent 18px) 5px 9px / 20px 3px no-repeat,
    linear-gradient(90deg, transparent 0 6px, #b6c8d0 6px 16px, transparent 16px) 5px 17px / 18px 3px no-repeat,
    #fff;
}

.ai-motion-eye {
  left: 38px;
  top: 14px;
  width: 20px;
  height: 20px;
  border: 3px solid #1f6f8b;
  border-radius: 999px;
}

.ai-motion-eye::after {
  content: "";
  position: absolute;
  right: -9px;
  bottom: -6px;
  width: 13px;
  height: 3px;
  border-radius: 999px;
  background: #1f6f8b;
  transform: rotate(42deg);
}

.ai-motion-answer {
  right: 8px;
  bottom: 10px;
  width: 18px;
  height: 14px;
  border-radius: 4px;
  background: #1f6f8b;
  opacity: 0;
}

.ai-read-motion strong {
  font-size: 0.95rem;
}

.ai-read-motion span:not(.ai-motion-page):not(.ai-motion-eye):not(.ai-motion-answer) {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.ai-read-motion.is-reading .ai-motion-eye {
  animation: kazuScanEye 1.1s ease-in-out infinite;
}

.ai-read-motion.is-reading .ai-motion-page {
  animation: kazuReadPage 1.1s ease-in-out infinite;
}

.ai-read-motion.is-done .ai-motion-answer {
  animation: kazuAnswerPop 1.2s ease-out 1 both;
}

.ai-read-motion.is-done {
  border-color: #7fb4a2;
  background: #f1faf6;
}

.ai-read-motion.is-error {
  border-color: #e0a3a3;
  background: #fff4f4;
}

@keyframes kazuScanEye {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-16px); }
}

@keyframes kazuReadPage {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes kazuAnswerPop {
  0% { opacity: 0; transform: translateX(-18px) scale(0.8); }
  45% { opacity: 1; transform: translateX(0) scale(1.05); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

.api-charge-note,
.notice-message {
  margin: 0;
  color: #7a3b00;
  font-weight: 700;
}

.api-limit-warning {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 16px;
  border: 2px solid #b42318;
  background: #fff0ee;
  color: #8f1d14;
  box-shadow: 0 4px 14px rgba(180, 35, 24, 0.18);
}

.api-limit-warning strong { font-size: 1.08rem; }

.api-key-setting-panel {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
  padding: 14px;
  border: 1px solid rgba(31, 111, 139, 0.24);
  border-radius: 8px;
  background: #f4fbfe;
}

.api-key-setting-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--accent-dark);
  font-weight: 900;
}

.api-key-setting-head span {
  color: var(--muted);
  font-size: 0.9rem;
}

.api-key-setting-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.api-key-setting-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.api-key-setting-grid input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.api-key-setting-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

@media (max-width: 760px) {
  .api-key-setting-grid {
    grid-template-columns: 1fr;
  }
}

.ai-stop-button {
  min-height: 54px;
  padding-inline: 22px;
  font-weight: 900;
}

#resultArea table th:nth-child(1),
#resultArea table tbody > tr:not(.detail-row) > td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 6;
  min-width: 160px;
  width: 160px;
  max-width: 160px;
  background: #fff;
  box-shadow: 8px 0 12px rgba(35, 57, 72, 0.08);
}

#resultArea table thead th:nth-child(1) {
  z-index: 9;
  background: #f7fafc;
}

#resultArea.has-missing-reasons table th:nth-child(1),
#resultArea.has-missing-reasons table tbody > tr:not(.detail-row) > td:nth-child(1) {
  min-width: 260px;
  width: 260px;
  max-width: 260px;
}

#resultArea table tbody > tr:not(.detail-row) > td:nth-child(3) {
  font-weight: 800;
}

.notice-message {
  padding: 12px;
  border-left: 4px solid #d97706;
  background: #fff7ed;
}

.pdf-preview {
  width: 100%;
  height: 420px;
  margin-top: 10px;
  border: 1px solid #aebdc8;
  background: white;
}

.pdf-file-selector {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  padding: 10px;
  overflow-x: auto;
  border: 1px solid #c4d0d7;
  background: #f5f8fa;
}

.pdf-file-button {
  flex: none;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #8fa6b2;
  background: #fff;
  color: #263945;
  font-weight: 700;
  cursor: pointer;
}

.pdf-file-button.active {
  border-color: #1f6f8b;
  background: #1f6f8b;
  color: #fff;
}

.compact-log {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #c6d1d8;
  background: #f8fafb;
}

.ai-log-details {
  padding: 0;
  overflow: hidden;
}

.ai-log-summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  color: #15566e;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.ai-log-summary::-webkit-details-marker {
  display: none;
}

.ai-log-summary::after {
  flex: none;
  content: "開く";
  padding: 5px 10px;
  border: 1px solid #8fb8c7;
  border-radius: 999px;
  background: #ffffff;
  color: #15566e;
  font-size: 0.78rem;
}

.ai-log-summary small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.ai-log-details[open] .ai-log-summary {
  border-bottom: 1px solid #c6d1d8;
  background: #eef7fa;
}

.ai-log-details[open] .ai-log-summary::after {
  content: "\9589\3058\308b";
}

.ai-log-body {
  padding: 12px;
}

.pdf-queue-panel {
  margin: 14px 0 10px;
  padding: 14px;
  border: 1px solid #b8c8d1;
  background: #f7fafb;
  color: #102f40;
}

.pdf-queue-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.pdf-queue-heading h3 { margin: 0 0 4px; }

.pdf-queue-heading h3,
#pdfQueueSummary,
.pdf-queue-summary {
  color: #102f40;
}

.queue-policy {
  flex: none;
  padding: 6px 10px;
  border: 1px solid #1f6f8b;
  background: #eaf5f8;
  color: #15566e;
  font-weight: 800;
}

.pdf-page-queue {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pdf-queue-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 90px minmax(110px, auto);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #d1dbe1;
  background: #fff;
  color: #102f40;
}

.pdf-queue-item-manual {
  flex: 1 1 100%;
}

.pdf-queue-item strong {
  overflow-wrap: anywhere;
  color: #102f40;
}

.pdf-page-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid #9fb6c2;
  background: #fff;
  color: #102f40;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.pdf-page-number {
  min-width: 1ch;
  text-align: center;
}

.pdf-page-checkmark {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid #9fb6c2;
  background: #fff;
  color: #15566e;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1;
}

.pdf-page-check small {
  color: #15566e;
  font-size: 0.72rem;
  font-weight: 800;
}

.pdf-page-check.is-off {
  border-color: #c4ccd1;
  background: #eef1f3;
  color: #66727a;
}

.pdf-page-check.is-off .pdf-page-checkmark {
  border-color: #b8c1c7;
  background: #f8fafb;
}

.pdf-page-check.is-off small {
  color: #7a4b4b;
}

.pdf-page-check.is-done {
  cursor: default;
}

.queue-status {
  color: #6b4d00;
  font-weight: 800;
}

.compact-log h3 { margin-top: 0; }
.compact-log ul { margin-bottom: 0; padding-left: 20px; }

.wide-field { grid-column: 1 / -1; }
textarea { width: 100%; resize: vertical; }

.registry-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.registry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid #cbd5dc;
  background: #fff;
  color: #102b3a;
  font-weight: 800;
}

.registry-row span {
  color: #102b3a;
  overflow-wrap: anywhere;
}

.history-row {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
}

.save-message {
  margin: 0;
  align-self: center;
  color: var(--accent-dark);
  font-weight: 800;
}

.result-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.result-toolbar label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.result-actions label {
  min-width: 180px;
}

.result-actions .primary-button,
.result-actions .secondary-button {
  min-height: 56px;
}

.result-title-action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.restore-previous-button {
  min-height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}

.open-pdf-button {
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.open-pdf-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.row-open-pdf-button {
  min-width: 86px;
}

.result-toolbar .section-note,
.result-toolbar .save-message {
  grid-column: 1 / -1;
  margin: 0;
}

.calc-status {
  margin: 0;
  align-self: center;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.5;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(23, 107, 135, 0.16);
}

.primary-button,
.secondary-button {
  min-height: 46px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(180deg, #247b99, var(--accent-dark));
  color: #fff;
  box-shadow: 0 8px 18px rgba(18, 76, 96, 0.18);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover {
  border-color: #9fb0bf;
  background: #f8fbfd;
}

.secondary-button.danger {
  color: var(--danger);
}

.empty-state {
  padding: 18px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(233, 243, 247, 0.95), rgba(255, 255, 255, 0.9));
  color: var(--accent-dark);
  font-weight: 700;
}

.empty-state.is-reading {
  padding: 0;
  background: transparent;
}

.result-reading-progress {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(31, 111, 139, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(100deg, rgba(230, 248, 255, 0.98), rgba(255, 255, 255, 0.95)),
    repeating-linear-gradient(135deg, rgba(31, 111, 139, 0.06) 0, rgba(31, 111, 139, 0.06) 1px, transparent 1px, transparent 18px);
  color: var(--accent-dark);
  box-shadow: 0 12px 28px rgba(31, 111, 139, 0.12);
  animation: readingCardGlow 2.1s ease-in-out infinite;
}

.result-reading-progress::before {
  content: "";
  position: absolute;
  inset: -35% auto -35% -55%;
  width: 48%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), rgba(125, 215, 245, 0.28), transparent);
  transform: skewX(-18deg);
  animation: readingCardSweep 2.05s ease-in-out infinite;
  pointer-events: none;
}

.result-reading-progress > * {
  position: relative;
  z-index: 1;
}

.result-reading-progress strong {
  color: var(--accent-dark);
  font-size: 1.08rem;
}

.result-reading-progress > strong,
.result-reading-progress > span,
.result-reading-progress > .result-reading-flow,
.result-reading-progress > small {
  grid-column: 1;
}

.result-reading-progress .reading-stop-button {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: center;
  min-width: 180px;
  min-height: 76px;
  border-width: 2px;
  background: #fff7f6;
  box-shadow: 0 0 0 5px rgba(180, 35, 24, 0.12), 0 14px 28px rgba(180, 35, 24, 0.2);
  animation: aiStopButtonPulse 1.1s ease-in-out infinite;
}

.result-reading-progress > span,
.result-reading-progress small {
  color: var(--muted);
  font-weight: 800;
}

@keyframes aiStopButtonPulse {
  0%, 100% {
    filter: brightness(1);
    transform: translateY(0);
  }
  50% {
    filter: brightness(1.08);
    transform: translateY(-1px);
  }
}

.result-reading-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(31, 111, 139, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(100deg, rgba(230, 248, 255, 0.96), rgba(255, 255, 255, 0.94)),
    repeating-linear-gradient(135deg, rgba(31, 111, 139, 0.06) 0, rgba(31, 111, 139, 0.06) 1px, transparent 1px, transparent 18px);
  box-shadow: 0 12px 28px rgba(31, 111, 139, 0.12);
}

.result-reading-card strong {
  color: var(--accent-dark);
  font-size: 1.08rem;
}

.result-reading-card span,
.result-reading-card small {
  color: var(--muted);
  font-weight: 800;
}

.result-reading-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.result-reading-flow span {
  position: relative;
  padding: 7px 12px;
  border: 1px solid rgba(31, 111, 139, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent-dark);
  font-size: 0.84rem;
}

.result-reading-flow span:nth-child(2),
.result-reading-flow span.is-active {
  background: rgba(31, 111, 139, 0.12);
  animation: readingStepPulse 1.2s ease-in-out infinite;
}

@keyframes readingStepPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(31, 111, 139, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(31, 111, 139, 0.06); }
}

@keyframes readingCardGlow {
  0%, 100% {
    border-color: rgba(31, 111, 139, 0.26);
    box-shadow: 0 12px 28px rgba(31, 111, 139, 0.13);
  }
  50% {
    border-color: rgba(31, 111, 139, 0.48);
    box-shadow: 0 18px 38px rgba(31, 111, 139, 0.28), 0 0 0 4px rgba(125, 215, 245, 0.14);
  }
}

@keyframes readingCardSweep {
  0% { left: -45%; opacity: 0; }
  18% { opacity: 0.95; }
  72% { opacity: 0.8; }
  100% { left: 115%; opacity: 0; }
}

.hidden {
  display: none;
}

.release-hidden {
  display: none !important;
}

.current-clock {
  display: block;
  padding: 9px 12px;
  border-left: 3px solid #1f6f8b;
  background: #f4f8fa;
  color: #24424f;
  font-variant-numeric: tabular-nums;
}

.night-panel {
  border-color: #9aa9b5;
  background: #fbfcfd;
}

.night-step {
  background: #394b59;
}

.night-power-note {
  padding: 12px 14px;
  border-left: 4px solid #d78b22;
  background: #fff8e8;
  color: #5d421d;
  font-weight: 700;
}

.night-file-box {
  border-color: #718695;
  background: #f2f5f7;
}

.night-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.night-summary-grid > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid #ccd6dd;
  border-radius: 6px;
  background: #ffffff;
}

.night-summary-grid span,
.night-summary-grid strong {
  display: block;
}

.night-summary-grid span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.night-summary-grid strong {
  color: #263b48;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.night-actions {
  align-items: center;
}

.night-queue-detail {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

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

.empty-table-cell {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.night-modal,
.night-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 31, 38, 0.76);
}

.night-modal.hidden,
.night-lock-overlay.hidden {
  display: none;
}

.night-modal-card,
.night-lock-card {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
  border: 1px solid #b8c3ca;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.night-lock-overlay {
  z-index: 1100;
  background: rgba(17, 26, 32, 0.9);
}

#nightEmergencyModal {
  z-index: 1200;
}

.night-lock-card h2,
.night-modal-card h2 {
  margin-top: 0;
  color: #263b48;
}

.night-progress-grid {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(180px, 1.3fr);
  gap: 8px 14px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid #cbd5dc;
  background: #f6f8f9;
}

.night-progress-grid span {
  color: var(--muted);
}

.night-progress-grid strong {
  overflow-wrap: anywhere;
}

.night-countdown-message {
  min-height: 28px;
  color: #b34d20;
  font-size: 1.08rem;
  font-weight: 800;
}

.emergency-card {
  border-top: 6px solid #b42318;
}

.emergency-card label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

body.night-processing {
  overflow: hidden;
}

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

  .header-actions {
    justify-self: stretch;
    max-width: none;
  }
}

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

  .night-progress-grid {
    grid-template-columns: 1fr;
  }
}

.table-wrap {
  overflow-x: auto;
}

.result-top-scroll {
  position: sticky;
  top: 0;
  z-index: 8;
  height: 18px;
  margin: 4px 0 8px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #d2dde5;
  border-radius: 999px;
  background: #edf4f7;
}

.result-top-scroll-inner {
  height: 1px;
}

.result-table-wrap {
  scroll-behavior: smooth;
}

table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  background: #f7fafc;
  position: sticky;
  top: 0;
  z-index: 7;
}

#resultTable thead th {
  box-shadow: 0 2px 0 var(--line), 0 8px 16px rgba(35, 57, 72, 0.08);
}

td {
  font-size: 0.92rem;
}

.result-inline-select,
.surface-inline-select {
  min-width: 96px;
  max-width: 132px;
  padding: 7px 24px 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background-color: #f7fafc;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
}

.result-inline-select:hover,
.result-inline-select:focus,
.surface-inline-select:hover,
.surface-inline-select:focus {
  border-color: #6aa8bd;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(42, 127, 153, 0.14);
  outline: none;
}

.welding-inline-select {
  min-width: 76px;
  max-width: 88px;
}

.result-static-value {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #d5dee6;
  border-radius: 8px;
  background: #eef4f7;
  color: #526879;
  font-weight: 800;
  white-space: nowrap;
}

.result-static-value.is-excluded {
  border-style: dashed;
  background: #f3f5f6;
  color: #6c737a;
}

tr.is-excluded-result td {
  color: #58626b;
}

.estimate-number-main {
  display: block;
  white-space: nowrap;
}

.ai-read-warning-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 7px;
  border: 1px solid #d7a93b;
  border-radius: 999px;
  background: #fff6d8;
  color: #664800;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
}

.sibling-check-box {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
  max-width: 250px;
}

.sibling-check-badge,
.sibling-check-note,
.sibling-check-reason {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1.25;
  white-space: normal;
}

.sibling-check-badge {
  border: 1px solid #f0a12b;
  background: #fff3d6;
  color: #7a3d00;
}

.sibling-check-note {
  border: 1px solid #d5e4ec;
  background: #f4fbfd;
  color: #315869;
}

.sibling-check-reason {
  border: 1px solid #f2c36f;
  background: #fff8e8;
  color: #6d4300;
}

.missing-reason-box {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
  max-width: 236px;
}

.missing-reason-title,
.missing-reason-badge,
.missing-reason-more {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
}

.missing-reason-title {
  background: #f4f7fb;
  border: 1px solid #cbd7e5;
  color: #42526b;
}

.missing-reason-badge {
  background: #fff1d6;
  border: 1px solid #e5a642;
  color: #7a3d00;
}

.missing-reason-badge.is-locked {
  background: #edf2f6;
  border-color: #b9c7d2;
  color: #667789;
  cursor: not-allowed;
  opacity: 0.78;
}

.missing-reason-badge.is-locked::after {
  content: " 読込中";
  font-size: 0.7rem;
  color: #7d8b99;
}

button.missing-reason-badge {
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

button.missing-reason-badge:hover {
  background: #ffe4aa;
  border-color: #c98215;
}

.missing-reason-more {
  background: #eef6f8;
  border: 1px solid #b8d7df;
  color: #315869;
}

.jump-highlight {
  outline: 3px solid #f3b334 !important;
  box-shadow: 0 0 0 6px rgba(243, 179, 52, 0.25) !important;
  transition: box-shadow 0.2s ease, outline-color 0.2s ease;
}

td:nth-child(4),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8),
td:nth-child(9),
td:nth-child(10),
td:nth-child(11),
td:nth-child(11) {
  font-weight: 800;
  white-space: nowrap;
}

.detail-toggle {
  min-height: 36px;
  padding: 0 12px;
}

.detail-toggle.is-locked,
.detail-toggle:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.result-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.row-delete-button {
  min-height: 36px;
  padding: 0 12px;
}

.row-delete-button.is-confirming {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.16), 0 0 20px rgba(180, 35, 24, 0.42);
  animation: deleteConfirmPulse 0.85s ease-in-out infinite alternate;
}

.secondary-button.danger.row-delete-button.is-confirming,
.secondary-button.danger.row-delete-button.is-confirming:hover,
.secondary-button.danger.row-delete-button.is-confirming:focus-visible {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.2), 0 0 24px rgba(180, 35, 24, 0.5);
}

@keyframes deleteConfirmPulse {
  from {
    transform: translateY(0);
    filter: brightness(1);
  }
  to {
    transform: translateY(-1px);
    filter: brightness(1.14);
  }
}

.detail-row > td {
  padding: 0;
  background: #f8fbfd;
}

.detail-panel {
  display: grid;
  gap: 14px;
  padding: 18px 18px 104px;
  border-top: 1px solid var(--line);
}

.detail-panel-header,
.detail-bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(31, 111, 139, 0.22);
  border-radius: 8px;
  background: #eef7fb;
}

.detail-header-actions,
.estimate-number-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-return-button {
  min-height: 44px;
  padding: 0 18px;
  border-color: rgba(31, 111, 139, 0.38);
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: 0 8px 22px rgba(31, 111, 139, 0.12);
}

.detail-return-button:hover,
.detail-return-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(31, 111, 139, 0.12), 0 12px 24px rgba(31, 111, 139, 0.18);
}

.detail-advanced-toggle {
  justify-self: start;
  min-height: 44px;
  padding: 0 18px;
}

.detail-advanced-log {
  display: grid;
  gap: 14px;
}

.estimate-number-actions {
  margin-top: 8px;
}

.estimate-number-actions .secondary-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.row-delete-button.is-confirming,
.row-delete-button.is-confirming:hover,
.row-delete-button.is-confirming:focus-visible {
  border-color: #d97706;
  background: #fff1d6;
  color: #8a3f00;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.18), 0 0 22px rgba(217, 119, 6, 0.45);
  animation: deleteConfirmPulse 0.8s ease-in-out infinite alternate;
}

.detail-panel-header strong {
  color: var(--accent-dark);
  font-size: 1.02rem;
}

.detail-title-wrap {
  display: grid;
  gap: 4px;
}

.detail-edit-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.detail-bottom-actions {
  justify-content: flex-end;
}

.detail-quick-action-bar {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  left: max(18px, env(safe-area-inset-left));
  z-index: 68;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  max-width: 920px;
  margin: 0 auto;
  padding: 12px;
  border: 2px solid #1f6f8b;
  border-radius: 8px;
  background: rgba(247, 251, 252, 0.98);
  box-shadow: 0 14px 34px rgba(8, 32, 44, 0.28);
}

.detail-quick-action-bar span {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--ink);
  font-weight: 900;
}

.detail-quick-action-bar .detail-return-button,
.detail-quick-action-bar .detail-close-button {
  flex: 0 0 auto;
  min-height: 48px;
  width: auto;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .detail-panel {
    padding-bottom: 112px;
  }

  .detail-quick-action-bar {
    gap: 6px;
    padding: 8px;
  }

  .detail-quick-action-bar .detail-return-button,
  .detail-quick-action-bar .detail-close-button {
    min-height: 42px;
    padding: 0 10px;
  }
}

.detail-close-button {
  min-height: 44px;
  padding: 0 20px;
  white-space: nowrap;
}

.detail-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-quick-fix-block {
  border-color: rgba(31, 111, 139, 0.32);
  background: linear-gradient(135deg, #f7fcff 0%, #ffffff 72%);
}

.detail-picked-condition-block {
  border-color: rgba(31, 111, 139, 0.24);
  background: linear-gradient(135deg, #eef9fc 0%, #ffffff 74%);
}

.detail-picked-condition-block h3::before {
  content: "AI";
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.detail-face-table-block {
  border-color: rgba(31, 111, 139, 0.28);
  background: linear-gradient(135deg, #f0fbff 0%, #ffffff 70%);
  box-shadow: 0 10px 24px rgba(31, 111, 139, 0.12);
  overflow-anchor: none;
}

.detail-face-table-block h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-face-table-block h3::before {
  content: "\9762";
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #0f7893;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.face-count-assist-box {
  display: grid;
  gap: 10px;
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid #f1b64a;
  background: #fff8e8;
  color: #4c3900;
}

.face-count-assist-message {
  font-weight: 800;
  line-height: 1.6;
}

.face-count-assist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-face-table-wrap {
  overflow-x: auto;
}

.detail-face-table {
  width: max-content;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.detail-face-table th,
.detail-face-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.detail-face-table th {
  color: var(--steel);
  background: #eef9fc;
  font-weight: 900;
}

.detail-face-table td:first-child {
  color: var(--accent-dark);
  font-weight: 900;
}

.detail-face-amount-cell {
  color: #8a4b00;
  font-weight: 900;
}

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

.detail-amount-breakdown-block {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.detail-amount-breakdown-list {
  display: grid;
  gap: 0;
  overflow-x: auto;
}

.detail-amount-breakdown-header,
.detail-amount-breakdown-row {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(90px, 110px) minmax(280px, 1fr) minmax(190px, 240px);
  column-gap: 14px;
  align-items: center;
  min-width: 100%;
}

.detail-amount-breakdown-header {
  min-height: 40px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 212, 92, 0.5);
  background: rgba(41, 15, 16, 0.72);
  color: #fff2b8;
  font-weight: 900;
}

.detail-amount-breakdown-row {
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 212, 92, 0.34);
  border-top: 0;
  border-radius: 0;
  background: rgba(0, 5, 13, 0.82);
}

.detail-amount-breakdown-header:first-child,
.detail-amount-breakdown-row:first-child {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.detail-amount-breakdown-row:last-child {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.detail-amount-breakdown-label {
  color: #fff2b8;
  font-size: 1rem;
  font-weight: 900;
  white-space: nowrap;
}

.detail-amount-breakdown-value {
  display: block;
  align-items: baseline;
  min-width: 0;
}

.detail-amount-breakdown-basis {
  color: #ffdca7;
  font-size: 0.98rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.detail-amount-breakdown-kind {
  color: #fff2b8;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.detail-amount-breakdown-row .detail-amount-breakdown-amount {
  color: #c87500;
  font-size: 1.08rem;
  font-weight: 900;
  white-space: nowrap;
}

.detail-amount-breakdown-row .detail-amount-breakdown-amount.is-muted {
  color: #ffdca7;
  opacity: 0.72;
}

body.theme-command-room .detail-amount-breakdown-block,
body.theme-anime-command .detail-amount-breakdown-block {
  background: transparent;
  box-shadow: none;
}

body.theme-command-room .detail-amount-breakdown-row,
body.theme-anime-command .detail-amount-breakdown-row {
  border-color: rgba(255, 212, 92, 0.34);
  background: rgba(0, 5, 13, 0.82);
}

@media (max-width: 720px) {
  .detail-amount-breakdown-row {
    grid-template-columns: minmax(130px, 160px) minmax(82px, 96px) minmax(220px, 1fr) minmax(160px, 190px);
    gap: 8px;
  }

  .detail-amount-breakdown-header {
    grid-template-columns: minmax(130px, 160px) minmax(82px, 96px) minmax(220px, 1fr) minmax(160px, 190px);
  }

  .detail-amount-breakdown-value {
    align-items: flex-start;
  }
}

.detail-face-table-edit-cell .detail-inline-edit {
  margin: 0;
}

.detail-face-table-edit-cell .detail-inline-input {
  width: 100%;
  min-width: 88px;
  padding: 8px 10px;
  border-color: rgba(31, 111, 139, 0.36);
  background: #f4fbfe;
  font-size: 0.95rem;
}

.detail-face-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(31, 111, 139, 0.22);
  border-radius: 8px;
  background: #f7fcff;
}

.detail-face-apply-button {
  min-height: 44px;
  padding: 0 18px;
}

.detail-face-actions span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.detail-face-table-edit-cell .detail-inline-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 139, 0.14);
  background: #fff;
}

.detail-face-table-edit-cell .detail-inline-input.is-invalid {
  border-color: #ff4b35;
  box-shadow: 0 0 0 3px rgba(255, 75, 53, 0.22);
}

.detail-estimate-hero {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 111, 139, 0.24);
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  background: #eef9fc;
}

.detail-estimate-hero span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.detail-estimate-hero strong {
  color: var(--ink);
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.detail-estimate-hero small {
  color: var(--steel);
  font-size: 0.78rem;
  font-weight: 800;
}

.detail-block h3 {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 1rem;
}

.detail-block h4 {
  margin: 14px 0 8px;
  color: var(--steel);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.detail-quick-fix-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.detail-block h3 + .detail-grid {
  align-items: start;
}

.detail-item {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.detail-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.detail-item strong {
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.detail-inline-edit {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.detail-inline-input {
  width: min(100%, 190px);
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid rgba(31, 111, 139, 0.32);
  border-radius: 8px;
  background: #f7fcff;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
}

.detail-inline-input:focus {
  outline: 3px solid rgba(35, 166, 196, 0.18);
  border-color: var(--accent);
  background: #fff;
}

.detail-inline-input[type="number"]::-webkit-outer-spin-button,
.detail-inline-input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  opacity: 0.35;
}

.detail-dimension-pair {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 8px;
  width: min(100%, 420px);
}

.detail-dimension-field {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.detail-dimension-input {
  width: 100%;
}

.detail-dimension-result {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.detail-dimension-result strong {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 900;
}

.detail-text {
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.detail-check-list {
  margin: 0;
  padding-left: 20px;
}

.detail-check-list li {
  margin: 6px 0;
}

.check-memo {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.check-memo h3 {
  margin: 0 0 10px;
  color: var(--accent-dark);
}

.check-memo ul {
  margin: 0;
  padding-left: 20px;
}

.check-memo li {
  margin: 7px 0;
}

.pdf-page-manual {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.small-number-input {
  max-width: 110px;
  min-height: 38px;
}

@media (max-width: 760px) {
  .pdf-queue-heading,
  .pdf-queue-item {
    grid-template-columns: 1fr;
  }

  .pdf-queue-heading { display: grid; }
  .multiplier-row {
    grid-template-columns: 1fr;
  }
  .pdf-operation-grid,
  .ai-read-actions {
    grid-template-columns: 1fr;
  }

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

  .pdf-preview { height: 320px; }

  .registry-row {
    align-items: stretch;
    flex-direction: column;
  }
  .app-header {
    display: grid;
    padding: 20px;
  }

  .header-actions {
    grid-template-columns: 1fr;
    justify-content: flex-start;
  }

  .header-master-control {
    grid-template-columns: 1fr;
  }

  .header-master-control span,
  .header-actions .current-clock {
    grid-column: 1;
  }

  .status-card-grid {
    grid-template-columns: 1fr;
  }

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

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

  .custom-material-register {
    grid-template-columns: 1fr;
  }

  .welding-price-master-grid,
  .welding-reference-results {
    grid-template-columns: 1fr;
  }

  .result-toolbar {
    grid-template-columns: 1fr;
  }

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

  h1 {
    font-size: 2.1rem;
  }
}

/* AI-forward visual polish. Layout stays unchanged; only tone, depth, and feedback are enhanced. */
.app-shell {
  position: relative;
}

.app-shell::before {
  position: fixed;
  left: max(16px, calc((100vw - 1180px) / 2));
  top: 18px;
  z-index: -1;
  width: min(420px, 40vw);
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(39, 197, 232, 0.72), transparent);
  box-shadow: 0 0 18px rgba(39, 197, 232, 0.38);
}

.app-header {
  border-color: rgba(77, 166, 196, 0.36);
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.96), rgba(230, 247, 252, 0.94)),
    radial-gradient(circle at 86% 18%, rgba(39, 197, 232, 0.2), transparent 30%),
    repeating-linear-gradient(90deg, rgba(68, 81, 94, 0.055) 0, rgba(68, 81, 94, 0.055) 1px, transparent 1px, transparent 24px);
  box-shadow: 0 18px 42px rgba(12, 37, 54, 0.14);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid rgba(39, 197, 232, 0.28);
  border-radius: 999px;
  background: rgba(239, 251, 254, 0.78);
  color: #075c77;
}

.eyebrow::before {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  content: "";
  background: #27c5e8;
  box-shadow: 0 0 12px #27c5e8;
}

.panel,
.status-card,
.daily-ai-usage,
.action-panel,
.ai-read-actions,
.cost-include-panel,
.night-summary-grid > div {
  border-color: rgba(92, 159, 181, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(249, 253, 255, 0.95)),
    radial-gradient(circle at 100% 0, rgba(39, 197, 232, 0.08), transparent 28%);
  box-shadow: 0 12px 28px rgba(12, 37, 54, 0.08);
}

.status-card {
  position: relative;
  overflow: hidden;
}

.status-card::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(115deg, transparent 0 58%, rgba(39, 197, 232, 0.12) 58.4%, transparent 60%);
}

.step-mark {
  background: linear-gradient(135deg, #1892b5, #0a465c);
  box-shadow: 0 0 0 4px rgba(39, 197, 232, 0.13), 0 8px 16px rgba(10, 70, 92, 0.18);
}

.file-box {
  border-color: rgba(22, 121, 154, 0.58);
  background:
    linear-gradient(100deg, rgba(39, 197, 232, 0.14), rgba(255, 255, 255, 0.94)),
    repeating-linear-gradient(135deg, rgba(11, 82, 105, 0.08) 0, rgba(11, 82, 105, 0.08) 1px, transparent 1px, transparent 15px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 12px 26px rgba(12, 37, 54, 0.08);
}

.file-box:hover {
  box-shadow: 0 0 0 4px rgba(39, 197, 232, 0.12), 0 16px 30px rgba(12, 37, 54, 0.12);
}

.primary-button {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1b91b3, #0a465c 72%);
  box-shadow: 0 10px 22px rgba(10, 70, 92, 0.24), 0 0 0 1px rgba(39, 197, 232, 0.16);
}

.primary-button::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(110deg, transparent 0 35%, rgba(255, 255, 255, 0.24) 42%, transparent 50%);
  transform: translateX(-120%);
  transition: transform 0.35s ease;
}

.primary-button:hover {
  background: linear-gradient(135deg, #24a3c9, #073d52 72%);
  box-shadow: 0 12px 26px rgba(10, 70, 92, 0.3), 0 0 0 3px rgba(39, 197, 232, 0.12);
}

.primary-button:hover::after {
  transform: translateX(120%);
}

.secondary-button {
  border-color: rgba(151, 177, 192, 0.78);
  background: linear-gradient(180deg, #fff, #f4f9fb);
}

.secondary-button:hover {
  border-color: rgba(31, 111, 139, 0.56);
  background: #f8fdff;
  box-shadow: 0 0 0 3px rgba(39, 197, 232, 0.1);
}

.ai-read-motion {
  border-color: rgba(39, 197, 232, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(237, 250, 253, 0.95)),
    radial-gradient(circle at 16% 12%, rgba(39, 197, 232, 0.14), transparent 30%);
}

.ai-motion-scene {
  background:
    linear-gradient(135deg, #eefaff, #d9eef5),
    repeating-linear-gradient(90deg, rgba(31, 111, 139, 0.12) 0, rgba(31, 111, 139, 0.12) 1px, transparent 1px, transparent 10px);
  box-shadow: inset 0 0 0 1px rgba(39, 197, 232, 0.22);
}

.ai-read-motion.is-reading {
  border-color: rgba(39, 197, 232, 0.72);
  box-shadow: 0 0 0 3px rgba(39, 197, 232, 0.12), 0 12px 24px rgba(12, 37, 54, 0.1);
}

input:focus,
select:focus {
  border-color: #1b91b3;
  outline: 3px solid rgba(39, 197, 232, 0.18);
  box-shadow: 0 0 0 1px rgba(39, 197, 232, 0.1);
}

th {
  background: linear-gradient(180deg, #f8fcfe, #eff7fa);
}

#resultTable thead th {
  box-shadow: 0 2px 0 var(--line), 0 10px 18px rgba(12, 37, 54, 0.1);
}

.theme-mode-button,
.theme-voice-button {
  min-height: 40px;
  font-weight: 900;
}

.theme-mode-button {
  grid-column: 1;
}

.theme-voice-button {
  grid-column: 2;
}

body.theme-command-room {
  color-scheme: dark;
  --bg: #050b13;
  --panel: #0b1724;
  --ink: #eaf7ff;
  --muted: #9bb3c7;
  --line: rgba(87, 185, 215, 0.34);
  --accent: #29d8ff;
  --accent-dark: #ff4b35;
  --accent-glow: #6df0ff;
  --steel: #c9e5f2;
  --neon-soft: rgba(109, 240, 255, 0.2);
  --shadow: 0 22px 54px rgba(0, 0, 0, 0.48), 0 0 46px rgba(41, 216, 255, 0.11);
  background:
    radial-gradient(circle at 18% 8%, rgba(41, 216, 255, 0.2), transparent 24%),
    radial-gradient(circle at 80% 14%, rgba(255, 75, 53, 0.18), transparent 22%),
    linear-gradient(180deg, #03060b 0%, #08111e 48%, #02040a 100%);
  color: var(--ink);
}

body.theme-command-room::before {
  background-image:
    linear-gradient(rgba(41, 216, 255, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 216, 255, 0.12) 1px, transparent 1px),
    repeating-linear-gradient(90deg, transparent 0 52px, rgba(255, 75, 53, 0.13) 52px 54px, transparent 54px 108px);
  background-size: 30px 30px, 30px 30px, 108px 108px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.92), transparent 84%);
}

body.theme-command-room::after {
  background:
    radial-gradient(circle at 50% -20%, rgba(109, 240, 255, 0.18), transparent 40%),
    repeating-linear-gradient(180deg, rgba(109, 240, 255, 0.06) 0, rgba(109, 240, 255, 0.06) 1px, transparent 1px, transparent 7px);
  opacity: 0.72;
}

body.theme-command-room .app-header,
body.theme-command-room .panel,
body.theme-command-room .status-card,
body.theme-command-room .daily-ai-usage,
body.theme-command-room .action-panel,
body.theme-command-room .ai-read-actions,
body.theme-command-room .cost-include-panel,
body.theme-command-room .detail-panel,
body.theme-command-room .detail-block,
body.theme-command-room .master-panel,
body.theme-command-room .master-card,
body.theme-command-room .night-summary-grid > div {
  border-color: rgba(109, 240, 255, 0.34);
  background:
    linear-gradient(145deg, rgba(9, 24, 38, 0.96), rgba(5, 12, 22, 0.98)),
    radial-gradient(circle at 100% 0, rgba(255, 75, 53, 0.11), transparent 28%),
    repeating-linear-gradient(90deg, rgba(109, 240, 255, 0.04) 0, rgba(109, 240, 255, 0.04) 1px, transparent 1px, transparent 18px);
  box-shadow: var(--shadow);
}

body.theme-command-room .app-header {
  border-color: rgba(255, 75, 53, 0.42);
  background:
    linear-gradient(135deg, rgba(8, 18, 30, 0.98), rgba(5, 9, 17, 0.98)),
    radial-gradient(circle at 12% 18%, rgba(41, 216, 255, 0.16), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(255, 75, 53, 0.18), transparent 26%);
}

body.theme-command-room .app-header::before {
  opacity: 1;
  background:
    linear-gradient(90deg, transparent, rgba(109, 240, 255, 0.28), transparent),
    repeating-linear-gradient(135deg, rgba(255, 75, 53, 0.13) 0, rgba(255, 75, 53, 0.13) 2px, transparent 2px, transparent 18px);
}

body.theme-command-room h1 {
  color: #f5fbff;
  text-shadow: 0 0 14px rgba(109, 240, 255, 0.48), 0 0 34px rgba(255, 75, 53, 0.24);
}

body.theme-command-room .hero-subtitle,
body.theme-command-room h2,
body.theme-command-room h3,
body.theme-command-room .detail-panel-header strong {
  color: #dff8ff;
}

body.theme-command-room .lead,
body.theme-command-room .panel-title p,
body.theme-command-room .helper-text,
body.theme-command-room .field-note,
body.theme-command-room .section-note {
  color: #9bb3c7;
}

body.theme-command-room .eyebrow {
  border-color: rgba(255, 75, 53, 0.5);
  background: rgba(255, 75, 53, 0.11);
  color: #ffd1c8;
  box-shadow: inset 0 0 14px rgba(255, 75, 53, 0.12);
}

body.theme-command-room .eyebrow::before {
  background: #ff4b35;
  box-shadow: 0 0 16px #ff4b35;
}

body.theme-command-room .status-card strong,
body.theme-command-room .daily-ai-usage strong,
body.theme-command-room .current-clock {
  color: #ffffff;
  text-shadow: 0 0 12px rgba(109, 240, 255, 0.34);
}

body.theme-command-room .primary-button {
  color: #f9fdff;
  background: linear-gradient(135deg, #c82018 0%, #7c1414 48%, #112f42 100%);
  border-color: rgba(255, 138, 112, 0.38);
  box-shadow: 0 12px 28px rgba(255, 75, 53, 0.22), 0 0 0 1px rgba(109, 240, 255, 0.16);
}

body.theme-command-room .primary-button:hover {
  background: linear-gradient(135deg, #ff4b35 0%, #941918 48%, #124761 100%);
  box-shadow: 0 16px 34px rgba(255, 75, 53, 0.28), 0 0 0 3px rgba(109, 240, 255, 0.12);
}

body.theme-command-room .secondary-button,
body.theme-command-room .theme-mode-button {
  color: #dff8ff;
  border-color: rgba(109, 240, 255, 0.34);
  background: linear-gradient(180deg, rgba(12, 35, 53, 0.96), rgba(7, 17, 29, 0.98));
  box-shadow: inset 0 0 18px rgba(109, 240, 255, 0.06);
}

body.theme-command-room .theme-mode-button {
  border-color: rgba(255, 75, 53, 0.5);
  color: #ffe8e2;
}

body.theme-command-room .theme-voice-button {
  color: #dff8ff;
}

body.theme-command-room input,
body.theme-command-room select,
body.theme-command-room textarea {
  color: #f2fbff;
  border-color: rgba(109, 240, 255, 0.32);
  background: rgba(3, 12, 22, 0.88);
  box-shadow: inset 0 0 12px rgba(109, 240, 255, 0.06);
}

body.theme-command-room input::placeholder,
body.theme-command-room textarea::placeholder {
  color: rgba(207, 228, 239, 0.58);
}

body.theme-command-room input:focus,
body.theme-command-room select:focus,
body.theme-command-room textarea:focus {
  border-color: #6df0ff;
  outline-color: rgba(109, 240, 255, 0.28);
  box-shadow: 0 0 0 1px rgba(109, 240, 255, 0.2), 0 0 24px rgba(109, 240, 255, 0.14);
}

body.theme-command-room table {
  color: #ecf9ff;
}

body.theme-command-room th,
body.theme-command-room #resultTable thead th {
  color: #bfefff;
  background: linear-gradient(180deg, rgba(14, 43, 62, 0.98), rgba(8, 23, 36, 0.98));
  box-shadow: 0 2px 0 rgba(109, 240, 255, 0.22), 0 10px 22px rgba(0, 0, 0, 0.26);
}

body.theme-command-room td {
  border-color: rgba(109, 240, 255, 0.18);
}

body.theme-command-room #resultArea table tbody > tr:not(.detail-row) > td:nth-child(1),
body.theme-command-room #resultArea table tbody > tr:not(.detail-row) > td:nth-child(3) {
  background: rgba(14, 43, 62, 0.42);
}

body.theme-command-room .file-box {
  border-color: rgba(109, 240, 255, 0.52);
  background:
    linear-gradient(110deg, rgba(12, 45, 67, 0.92), rgba(6, 14, 24, 0.94)),
    repeating-linear-gradient(135deg, rgba(109, 240, 255, 0.09) 0, rgba(109, 240, 255, 0.09) 1px, transparent 1px, transparent 14px);
  box-shadow: inset 0 0 0 1px rgba(109, 240, 255, 0.16), 0 18px 36px rgba(0, 0, 0, 0.28);
}

body.theme-command-room .step-mark {
  color: #fff;
  background: linear-gradient(135deg, #ff4b35, #7c1414);
  box-shadow: 0 0 0 4px rgba(255, 75, 53, 0.16), 0 0 28px rgba(255, 75, 53, 0.28);
}

body.theme-command-room .ai-read-motion,
body.theme-command-room .result-reading-progress {
  border-color: rgba(109, 240, 255, 0.42);
  background:
    linear-gradient(135deg, rgba(8, 32, 48, 0.96), rgba(5, 12, 22, 0.98)),
    radial-gradient(circle at 18% 15%, rgba(109, 240, 255, 0.16), transparent 28%);
}

body.theme-command-room .ai-motion-scene {
  background:
    linear-gradient(135deg, #071827, #102e42),
    repeating-linear-gradient(90deg, rgba(109, 240, 255, 0.18) 0, rgba(109, 240, 255, 0.18) 1px, transparent 1px, transparent 9px);
  box-shadow: inset 0 0 0 1px rgba(109, 240, 255, 0.28), inset 0 0 28px rgba(109, 240, 255, 0.12);
}

body.theme-command-room .missing-reason-badge {
  color: #ffe8c7;
  border-color: rgba(255, 177, 72, 0.62);
  background: rgba(86, 46, 12, 0.5);
}

body.theme-command-room .detail-face-table input,
body.theme-command-room .detail-inline-input {
  background: rgba(4, 15, 26, 0.92);
}

body.theme-command-room .ai-read-actions.is-command-launch {
  animation: commandLaunchPulse 1.6s ease-out;
}

@keyframes commandLaunchPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 75, 53, 0.45), 0 0 0 0 rgba(109, 240, 255, 0.35);
    transform: translateY(0);
  }
  32% {
    box-shadow: 0 0 0 5px rgba(255, 75, 53, 0.24), 0 0 34px rgba(109, 240, 255, 0.28);
    transform: translateY(-1px);
  }
  100% {
    box-shadow: var(--shadow);
    transform: translateY(0);
  }
}

body.theme-anime-command {
  --bg: #020207;
  --panel: #070b16;
  --ink: #fff9e8;
  --muted: #ffce9a;
  --line: rgba(255, 212, 92, 0.42);
  --accent: #ffe66b;
  --accent-dark: #ff2d1f;
  --accent-glow: #00f7ff;
  --steel: #fff2b8;
  --neon-soft: rgba(255, 230, 107, 0.24);
  --shadow: 0 24px 62px rgba(0, 0, 0, 0.62), 0 0 54px rgba(255, 45, 31, 0.22), 0 0 34px rgba(0, 247, 255, 0.16);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 230, 107, 0.22), transparent 26%),
    radial-gradient(circle at 10% 18%, rgba(255, 45, 31, 0.26), transparent 28%),
    radial-gradient(circle at 88% 10%, rgba(0, 247, 255, 0.22), transparent 24%),
    linear-gradient(180deg, #020207 0%, #070812 46%, #010103 100%);
}

body.theme-anime-command::before {
  background-image:
    linear-gradient(rgba(255, 230, 107, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 247, 255, 0.12) 1px, transparent 1px),
    repeating-linear-gradient(135deg, transparent 0 34px, rgba(255, 45, 31, 0.18) 34px 38px, transparent 38px 74px);
  background-size: 26px 26px, 26px 26px, 74px 74px;
  opacity: 0.95;
}

body.theme-anime-command::after {
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 230, 107, 0.24), transparent 34%),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0, rgba(255, 255, 255, 0.08) 1px, transparent 1px, transparent 5px);
  opacity: 0.82;
}

body.theme-anime-command .app-header,
body.theme-anime-command .panel,
body.theme-anime-command .status-card,
body.theme-anime-command .daily-ai-usage,
body.theme-anime-command .action-panel,
body.theme-anime-command .ai-read-actions,
body.theme-anime-command .cost-include-panel,
body.theme-anime-command .detail-panel,
body.theme-anime-command .detail-block,
body.theme-anime-command .master-panel,
body.theme-anime-command .master-card,
body.theme-anime-command .night-summary-grid > div {
  border-color: rgba(255, 230, 107, 0.46);
  background:
    linear-gradient(145deg, rgba(16, 10, 14, 0.98), rgba(4, 8, 18, 0.98)),
    radial-gradient(circle at 0 0, rgba(255, 45, 31, 0.18), transparent 28%),
    radial-gradient(circle at 100% 0, rgba(0, 247, 255, 0.16), transparent 32%),
    repeating-linear-gradient(90deg, rgba(255, 230, 107, 0.05) 0, rgba(255, 230, 107, 0.05) 1px, transparent 1px, transparent 16px);
  box-shadow: var(--shadow);
}

body.theme-anime-command .app-header {
  border-color: rgba(255, 45, 31, 0.72);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.62), inset 0 0 0 1px rgba(255, 230, 107, 0.18), 0 0 44px rgba(255, 45, 31, 0.2);
}

body.theme-anime-command h1 {
  color: #fff7cf;
  text-shadow: 0 0 12px rgba(255, 230, 107, 0.72), 0 0 30px rgba(255, 45, 31, 0.48), 0 0 46px rgba(0, 247, 255, 0.3);
}

body.theme-anime-command .primary-button {
  color: #fffdf4;
  border-color: rgba(255, 230, 107, 0.54);
  background:
    linear-gradient(135deg, #ff2d1f 0%, #8f1010 40%, #061a2a 74%, #001f2a 100%);
  box-shadow: 0 15px 34px rgba(255, 45, 31, 0.34), 0 0 0 1px rgba(255, 230, 107, 0.22), inset 0 0 22px rgba(255, 230, 107, 0.12);
}

body.theme-anime-command .primary-button:hover {
  background:
    linear-gradient(135deg, #ff4c2e 0%, #b81717 42%, #09314b 74%, #003847 100%);
  box-shadow: 0 18px 42px rgba(255, 45, 31, 0.42), 0 0 0 4px rgba(255, 230, 107, 0.14), 0 0 26px rgba(0, 247, 255, 0.2);
}

body.theme-anime-command .secondary-button,
body.theme-anime-command .theme-mode-button,
body.theme-anime-command .theme-voice-button {
  color: #fff3bd;
  border-color: rgba(255, 230, 107, 0.48);
  background:
    linear-gradient(180deg, rgba(45, 24, 18, 0.96), rgba(8, 12, 22, 0.98));
  box-shadow: inset 0 0 18px rgba(255, 230, 107, 0.08), 0 0 18px rgba(255, 45, 31, 0.12);
}

body.theme-anime-command input,
body.theme-anime-command select,
body.theme-anime-command textarea {
  border-color: rgba(255, 230, 107, 0.38);
  background: rgba(2, 8, 18, 0.94);
  box-shadow: inset 0 0 12px rgba(255, 230, 107, 0.07);
}

body.theme-anime-command input:focus,
body.theme-anime-command select:focus,
body.theme-anime-command textarea:focus {
  border-color: #ffe66b;
  outline-color: rgba(255, 230, 107, 0.3);
  box-shadow: 0 0 0 1px rgba(255, 230, 107, 0.24), 0 0 26px rgba(255, 45, 31, 0.18);
}

body.theme-anime-command th,
body.theme-anime-command #resultTable thead th {
  color: #fff0a7;
  background:
    linear-gradient(180deg, rgba(47, 24, 22, 0.98), rgba(8, 14, 24, 0.98));
  box-shadow: 0 2px 0 rgba(255, 230, 107, 0.28), 0 12px 28px rgba(0, 0, 0, 0.3);
}

body.theme-anime-command .file-box,
body.theme-anime-command .ai-read-motion,
body.theme-anime-command .result-reading-progress {
  border-color: rgba(255, 230, 107, 0.56);
  background:
    linear-gradient(110deg, rgba(44, 20, 18, 0.94), rgba(5, 14, 26, 0.96)),
    repeating-linear-gradient(135deg, rgba(255, 230, 107, 0.12) 0, rgba(255, 230, 107, 0.12) 1px, transparent 1px, transparent 12px);
  box-shadow: inset 0 0 0 1px rgba(255, 230, 107, 0.16), 0 20px 42px rgba(0, 0, 0, 0.34), 0 0 34px rgba(255, 45, 31, 0.12);
}

body.theme-anime-command .step-mark {
  background: linear-gradient(135deg, #ffe66b, #ff2d1f 54%, #071827);
  color: #05070d;
  box-shadow: 0 0 0 4px rgba(255, 230, 107, 0.18), 0 0 34px rgba(255, 45, 31, 0.34);
}

body.theme-anime-command .ai-read-actions.is-command-launch {
  animation: commandAnimeLaunchPulse 1.85s ease-out;
}

@keyframes commandAnimeLaunchPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 230, 107, 0.5), 0 0 0 0 rgba(255, 45, 31, 0.34);
    transform: translateY(0) scale(1);
  }
  28% {
    box-shadow: 0 0 0 8px rgba(255, 230, 107, 0.2), 0 0 42px rgba(255, 45, 31, 0.34), 0 0 36px rgba(0, 247, 255, 0.22);
    transform: translateY(-2px) scale(1.006);
  }
  100% {
    box-shadow: var(--shadow);
    transform: translateY(0) scale(1);
  }
}


/* Keep text readable on light controls inside dark room themes. */
body.theme-command-room .cost-include-panel label,
body.theme-command-room .case-mode-control select,
body.theme-command-room .case-mode-prime .case-mode-control select,
body.theme-command-room .result-inline-select,
body.theme-command-room .surface-inline-select,
body.theme-command-room .welding-inline-select,
body.theme-command-room .result-inline-select:hover,
body.theme-command-room .result-inline-select:focus,
body.theme-command-room .surface-inline-select:hover,
body.theme-command-room .surface-inline-select:focus,
body.theme-anime-command .cost-include-panel label,
body.theme-anime-command .case-mode-control select,
body.theme-anime-command .case-mode-prime .case-mode-control select,
body.theme-anime-command .result-inline-select,
body.theme-anime-command .surface-inline-select,
body.theme-anime-command .welding-inline-select,
body.theme-anime-command .result-inline-select:hover,
body.theme-anime-command .result-inline-select:focus,
body.theme-anime-command .surface-inline-select:hover,
body.theme-anime-command .surface-inline-select:focus {
  color: #102f3d;
  text-shadow: none;
}

body.theme-command-room .cost-include-panel label,
body.theme-anime-command .cost-include-panel label {
  background: #f8fdff;
  border-color: rgba(207, 225, 234, 0.92);
}

body.theme-command-room .result-inline-select,
body.theme-command-room .surface-inline-select,
body.theme-command-room .welding-inline-select,
body.theme-anime-command .result-inline-select,
body.theme-anime-command .surface-inline-select,
body.theme-anime-command .welding-inline-select {
  background-color: #f8fdff;
}

.detail-face-table-block h3 .detail-face-add-button {
  margin-left: 8px;
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.detail-face-delete-button {
  min-height: 30px;
  width: 54px;
  padding: 0;
  font-size: 0.82rem;
  white-space: nowrap;
}

.detail-face-table .detail-inline-select {
  width: 100%;
  min-width: 92px;
}

body.theme-command-room .detail-face-table .detail-inline-select,
body.theme-anime-command .detail-face-table .detail-inline-select {
  color: #102f3d;
  background: #f8fdff;
  border-color: rgba(255, 230, 107, 0.58);
  box-shadow:
    0 0 0 1px rgba(255, 230, 107, 0.18),
    0 0 14px rgba(255, 230, 107, 0.1);
  text-shadow: none;
}

body.theme-command-room .detail-face-table .detail-inline-select:hover,
body.theme-command-room .detail-face-table .detail-inline-select:focus,
body.theme-anime-command .detail-face-table .detail-inline-select:hover,
body.theme-anime-command .detail-face-table .detail-inline-select:focus {
  border-color: rgba(255, 230, 107, 0.82);
  box-shadow:
    0 0 0 2px rgba(255, 230, 107, 0.18),
    0 0 18px rgba(255, 230, 107, 0.16);
}

.detail-face-delete-cell,
.detail-face-table th:first-child {
  width: 62px;
  min-width: 62px;
  max-width: 62px;
  padding-left: 4px;
  padding-right: 4px;
}

.detail-face-table .detail-face-delete-cell,
.detail-face-table th:first-child {
  background: transparent;
}

body.theme-command-room .detail-face-table .detail-face-delete-cell,
body.theme-command-room .detail-face-table th:first-child,
body.theme-anime-command .detail-face-table .detail-face-delete-cell,
body.theme-anime-command .detail-face-table th:first-child {
  background: transparent;
}

.detail-face-table:not(.detail-feature-table) th:nth-child(2),
.detail-face-table:not(.detail-feature-table) td:nth-child(2) {
  width: 190px;
  min-width: 190px;
  max-width: 190px;
}

.detail-feature-table {
  width: auto;
  min-width: 0;
}

.detail-feature-table th,
.detail-feature-table td {
  padding-left: 8px;
  padding-right: 8px;
}

.detail-feature-table .detail-inline-select {
  min-width: 0;
}

.detail-row-amount-cell {
  width: 86px;
  min-width: 86px;
  max-width: 96px;
  text-align: right;
}

.detail-hole-table th:nth-child(2),
.detail-hole-table td:nth-child(2),
.detail-slot-table th:nth-child(2),
.detail-slot-table td:nth-child(2),
.detail-square-hole-table th:nth-child(2),
.detail-square-hole-table td:nth-child(2) {
  width: 190px;
  min-width: 190px;
  max-width: 190px;
}

.detail-hole-table th:nth-child(4),
.detail-hole-table td:nth-child(4) {
  width: 112px;
  min-width: 112px;
  max-width: 112px;
}

.detail-slot-table th:nth-child(4),
.detail-slot-table td:nth-child(4),
.detail-slot-table th:nth-child(5),
.detail-slot-table td:nth-child(5),
.detail-slot-table th:nth-child(6),
.detail-slot-table td:nth-child(6),
.detail-square-hole-table th:nth-child(4),
.detail-square-hole-table td:nth-child(4),
.detail-square-hole-table th:nth-child(5),
.detail-square-hole-table td:nth-child(5),
.detail-square-hole-table th:nth-child(6),
.detail-square-hole-table td:nth-child(6) {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
}

.detail-slot-table th:nth-child(7),
.detail-slot-table td:nth-child(7),
.detail-slot-table th:nth-child(8),
.detail-slot-table td:nth-child(8) {
  width: 104px;
  min-width: 104px;
  max-width: 104px;
}

.detail-square-hole-table th:nth-child(7),
.detail-square-hole-table td:nth-child(7) {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
}

.detail-face-table [data-detail-edit-key$=".quantity"],
.detail-face-table [data-detail-edit-key$=".count"] {
  width: 6ch;
  min-width: 6ch;
  max-width: 7ch;
}

.detail-face-table [data-detail-edit-key$=".thickness"],
.detail-face-table [data-detail-edit-key$=".size"],
.detail-face-table [data-detail-edit-key$=".radius"],
.detail-face-table [data-detail-edit-key$=".lengthMm"],
.detail-face-table [data-detail-edit-key$=".widthMm"],
.detail-face-table [data-detail-edit-key$=".centerLength"],
.detail-face-table [data-detail-edit-key$=".overallLength"] {
  width: 7ch;
  min-width: 7ch;
  max-width: 10ch;
}

.detail-feature-table [data-detail-edit-key$=".type"] {
  width: 9.5ch;
  min-width: 9.5ch;
  max-width: 10.5ch;
}

.detail-face-table [data-detail-edit-key$=".label"] {
  width: 16ch;
  min-width: 12ch;
  max-width: 18ch;
}

.detail-face-name-cell {
  display: flex;
  align-items: center;
  min-width: 0;
}

.detail-face-name-cell span {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-face-weight-cell {
  color: var(--steel);
  font-weight: 900;
}

body.theme-command-room .detail-face-weight-cell,
body.theme-anime-command .detail-face-weight-cell {
  color: #dff8ff;
}

body.theme-command-room .detail-face-table input,
body.theme-command-room .detail-inline-input,
body.theme-anime-command .detail-face-table input,
body.theme-anime-command .detail-inline-input {
  border-color: rgba(109, 240, 255, 0.46);
  box-shadow:
    inset 0 0 0 1px rgba(109, 240, 255, 0.08),
    0 0 12px rgba(109, 240, 255, 0.1);
}

body.theme-command-room .detail-face-table input:hover,
body.theme-command-room .detail-inline-input:hover,
body.theme-anime-command .detail-face-table input:hover,
body.theme-anime-command .detail-inline-input:hover {
  border-color: rgba(109, 240, 255, 0.68);
  box-shadow:
    inset 0 0 0 1px rgba(109, 240, 255, 0.12),
    0 0 16px rgba(109, 240, 255, 0.14);
}

body.theme-command-room .detail-face-delete-button,
body.theme-anime-command .detail-face-delete-button {
  border-color: rgba(255, 230, 107, 0.72);
  box-shadow:
    inset 0 0 12px rgba(255, 230, 107, 0.1),
    0 0 12px rgba(255, 230, 107, 0.12);
}

body.theme-command-room .detail-face-delete-button:hover,
body.theme-command-room .detail-face-delete-button:focus-visible,
body.theme-anime-command .detail-face-delete-button:hover,
body.theme-anime-command .detail-face-delete-button:focus-visible {
  border-color: rgba(255, 230, 107, 0.95);
  box-shadow:
    inset 0 0 16px rgba(255, 230, 107, 0.13),
    0 0 0 2px rgba(255, 230, 107, 0.14),
    0 0 18px rgba(255, 230, 107, 0.18);
}

/* Dark room input safety: keep typed text visible while editing. */
body.theme-command-room .detail-face-table input,
body.theme-command-room .detail-face-table input:focus,
body.theme-command-room .detail-inline-input,
body.theme-command-room .detail-inline-input:focus,
body.theme-command-room input:not([type="checkbox"]):not([type="radio"]),
body.theme-command-room input:not([type="checkbox"]):not([type="radio"]):focus,
body.theme-command-room textarea,
body.theme-command-room textarea:focus,
body.theme-anime-command .detail-face-table input,
body.theme-anime-command .detail-face-table input:focus,
body.theme-anime-command .detail-inline-input,
body.theme-anime-command .detail-inline-input:focus,
body.theme-anime-command input:not([type="checkbox"]):not([type="radio"]),
body.theme-anime-command input:not([type="checkbox"]):not([type="radio"]):focus,
body.theme-anime-command textarea,
body.theme-anime-command textarea:focus {
  color: #f7fcff;
  caret-color: #6df0ff;
  background: rgba(4, 15, 26, 0.94);
  text-shadow: none;
}

body.theme-command-room input::selection,
body.theme-command-room textarea::selection,
body.theme-anime-command input::selection,
body.theme-anime-command textarea::selection {
  color: #03111d;
  background: #6df0ff;
}

body.theme-command-room input:-webkit-autofill,
body.theme-command-room input:-webkit-autofill:focus,
body.theme-anime-command input:-webkit-autofill,
body.theme-anime-command input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f7fcff;
  caret-color: #6df0ff;
  box-shadow: 0 0 0 1000px #04101a inset;
}


.estimate-number-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.estimate-number-line .estimate-number-main {
  display: inline-block;
}

.answer-no-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(12, 99, 127, 0.35);
  border-radius: 999px;
  background: #e8f6fb;
  color: #075c75;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.estimate-number-line .detail-toggle {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.78rem;
}

body.theme-command-room .cost-include-panel label *,
body.theme-anime-command .cost-include-panel label * {
  color: #102f3d;
  text-shadow: none;
}

body.theme-command-room .case-mode-control,
body.theme-command-room .case-mode-control select,
body.theme-anime-command .case-mode-control,
body.theme-anime-command .case-mode-control select {
  color: #102f3d;
  text-shadow: none;
}

body.theme-command-room #resultArea table tbody > tr:not(.detail-row) > td:nth-child(1),
body.theme-command-room #resultArea table tbody > tr:not(.detail-row) > td:nth-child(3),
body.theme-anime-command #resultArea table tbody > tr:not(.detail-row) > td:nth-child(1),
body.theme-anime-command #resultArea table tbody > tr:not(.detail-row) > td:nth-child(3) {
  color: #ecf9ff;
}


body.theme-anime-command .result-toolbar {
  border-color: rgba(255, 230, 107, 0.42);
  background:
    linear-gradient(145deg, rgba(18, 10, 15, 0.98), rgba(5, 9, 18, 0.98)),
    radial-gradient(circle at 6% 12%, rgba(255, 45, 31, 0.16), transparent 30%);
  box-shadow: inset 0 0 0 1px rgba(255, 230, 107, 0.12), 0 16px 38px rgba(0, 0, 0, 0.34);
}

body.theme-anime-command .result-toolbar .section-note,
body.theme-anime-command .result-toolbar .save-message,
body.theme-anime-command .result-toolbar .result-actions label {
  color: #ffd7a6;
  text-shadow: none;
}

body.theme-anime-command .result-toolbar select {
  color: #fff7cf;
  background: rgba(4, 8, 18, 0.96);
  border-color: rgba(255, 230, 107, 0.44);
}


body.theme-anime-command #resultArea table tbody > tr:not(.detail-row) > td:nth-child(1) {
  color: #123044;
  background: #fbfdff;
}

body.theme-anime-command #resultArea table tbody > tr:not(.detail-row) > td:nth-child(1) .estimate-number-main {
  color: #123044;
  text-shadow: none;
}

body.theme-anime-command #resultArea table tbody > tr:not(.detail-row) > td:nth-child(1) .detail-toggle {
  color: #fff3bd;
}

body.theme-command-room #resultArea .detail-face-table th:first-child,
body.theme-command-room #resultArea .detail-face-table .detail-face-delete-cell,
body.theme-anime-command #resultArea .detail-face-table th:first-child,
body.theme-anime-command #resultArea .detail-face-table .detail-face-delete-cell {
  width: 62px !important;
  min-width: 62px !important;
  max-width: 62px !important;
  padding: 0 4px !important;
  background: transparent !important;
}

body.theme-command-room #resultArea .detail-face-table .detail-face-delete-button,
body.theme-anime-command #resultArea .detail-face-table .detail-face-delete-button {
  width: 54px;
  min-width: 54px;
}


.detail-bend-table-block h3::before {
  content: "\66f2";
}

.detail-bend-table {
  min-width: 760px;
}

.detail-bend-table .detail-face-name-cell {
  gap: 8px;
}

.ai-answer-info-panel {
  border-color: rgba(34, 211, 238, 0.42);
  background: linear-gradient(145deg, rgba(5, 13, 23, 0.98), rgba(2, 8, 15, 0.98));
  color: #e8f7ff;
}

.ai-answer-info-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
}

.ai-answer-info-content {
  display: grid;
  gap: 16px;
}

.ai-answer-info-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(34, 211, 238, 0.34);
  border-radius: 8px;
  background: rgba(4, 14, 24, 0.94);
  color: #e8f7ff;
}

.ai-answer-info-summary strong {
  color: #ff3b30;
  font-size: 1.05rem;
}

.ai-answer-info-summary span {
  color: #c6e4f0;
}

.ai-answer-info-block {
  padding: 14px;
  border: 1px solid rgba(34, 211, 238, 0.24);
  border-radius: 8px;
  background: rgba(3, 11, 20, 0.96);
}

.ai-answer-info-block h3 {
  margin: 0 0 10px;
  color: #ff3b30;
  font-size: 1rem;
}

.ai-answer-info-block pre {
  max-height: 360px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: #020811;
  color: #e8f7ff;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.master-tabs {
  position: sticky;
  top: 0;
  z-index: 24;
  display: grid;
  grid-template-columns: repeat(7, minmax(104px, 1fr));
  gap: 8px;
  margin: 14px 0 18px;
  padding: 10px;
  border: 1px solid rgba(31, 111, 139, 0.28);
  border-radius: 8px;
  background: rgba(247, 251, 252, 0.96);
  box-shadow: 0 8px 22px rgba(31, 77, 91, 0.12);
}

.master-tab-button {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid #bfd0d8;
  border-radius: 8px;
  background: #ffffff;
  color: #17394a;
  text-align: left;
  cursor: pointer;
}

.master-tab-button strong {
  font-size: 0.95rem;
  line-height: 1.15;
}

.master-tab-button span {
  color: #607787;
  font-size: 0.75rem;
  font-weight: 800;
}

.master-tab-button.is-active {
  border-color: #1f6f8b;
  background: linear-gradient(180deg, #e7f7fb, #ffffff);
  color: #0f5268;
  box-shadow: inset 0 0 0 2px rgba(31, 111, 139, 0.12);
}

.master-tab-hidden {
  display: none !important;
}

.master-view .master-section:not(.master-tab-hidden) {
  animation: masterTabFade 120ms ease-out;
}

@keyframes masterTabFade {
  from { opacity: 0.7; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .master-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .master-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* Master cards must stay readable on light card backgrounds in every theme. */
.master-view .material-master-card,
.master-view .master-grid label,
.master-view .material-master-card h4,
.master-view .material-master-card h5,
.master-view .master-section h4,
.master-view .section-note {
  color: #143244;
}

.master-view .material-master-card .section-note,
.master-view .master-grid label {
  color: #25485a;
}

.master-view .material-master-card h4,
.master-view .material-master-card h5 {
  font-weight: 900;
}

body.theme-command-room .master-view .material-master-card,
body.theme-anime-command .master-view .material-master-card {
  color: #102a3a;
}

body.theme-command-room .master-view .material-master-card h4,
body.theme-command-room .master-view .material-master-card h5,
body.theme-command-room .master-view .master-grid label,
body.theme-anime-command .master-view .material-master-card h4,
body.theme-anime-command .master-view .material-master-card h5,
body.theme-anime-command .master-view .master-grid label {
  color: #102a3a;
}


/* Keep multiplier rows aligned: labels on top, controls on the same baseline. */
.multiplier-row {
  align-items: start;
}

.multiplier-row label {
  min-height: 92px;
  align-content: start;
}

.multiplier-row .multiplier-value-label {
  grid-template-columns: minmax(120px, 1fr);
}

.multiplier-row .multiplier-value-label .multiplier-apply-button {
  grid-column: 1;
  grid-row: 3;
  min-height: 44px;
  margin-top: 8px;
}

.multiplier-row input,
.multiplier-row select {
  min-height: 64px;
}

.multiplier-row input[readonly] {
  margin-top: 0;
}


/* Master labels on dark panels need bright contrast. */
.master-view .master-section > .master-grid label,
.master-view .master-section > .multiplier-setting-grid label {
  color: #ffe6b8;
}

.master-view .master-section > .master-grid label input,
.master-view .master-section > .master-grid label select,
.master-view .master-section > .multiplier-setting-grid label input,
.master-view .master-section > .multiplier-setting-grid label select {
  color: #f8fbff;
}

.master-view .material-master-card .master-grid label,
.master-view .material-master-card label {
  color: #25485a;
}

.master-view .material-master-card input,
.master-view .material-master-card select {
  color: #102a3a;
}


/* Final contrast guard: dark master panels must not inherit light-card text colors. */
body .master-view .master-section > .master-grid > label,
body .master-view .master-section > .master-grid > label > span,
body .master-view .processing-multiplier-section .multiplier-row label,
body .master-view .processing-multiplier-section .multiplier-row label > span {
  color: #ffe8bd !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

body .master-view .master-section > .master-grid > label input,
body .master-view .master-section > .master-grid > label select,
body .master-view .processing-multiplier-section .multiplier-row input,
body .master-view .processing-multiplier-section .multiplier-row select {
  color: #f8fbff !important;
}

body .master-view .material-master-card,
body .master-view .material-master-card label,
body .master-view .material-master-card .master-grid label,
body .master-view .material-master-card h4,
body .master-view .material-master-card h5,
body .master-view .material-master-card .section-note {
  color: #102a3a !important;
  text-shadow: none;
}


/* Keep master controls in normal flow on narrow side-by-side screens. */
.master-top-actions {
  position: static;
}

/* Keep master category tabs clickable above the sticky save dock. */
.master-tabs {
  z-index: 180;
}

.master-save-dock {
  z-index: 18;
}


/* Keep dark master section notes readable while preserving light material cards. */
body .master-view .master-section > .section-note,
body .master-view .master-section > p.section-note {
  color: #ffd6a6 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

body .master-view .material-master-card > .section-note,
body .master-view .material-master-card p.section-note {
  color: #25485a !important;
  text-shadow: none;
}


/* Keep dark controls readable inside light master cards. */
body .master-view .material-master-card input,
body .master-view .material-master-card select,
body .master-view .material-master-card textarea {
  color: #f8fbff !important;
}

body .master-view .material-thickness-availability {
  color: #155d75 !important;
}

body .master-view .material-thickness-availability input {
  color: #155d75 !important;
}

body .master-view .material-master-card input::placeholder,
body .master-view .material-master-card textarea::placeholder {
  color: rgba(248, 251, 255, 0.58) !important;
}

/* Base-price cards use the same light-card reading style as material cards. */
body .master-view .base-master-section,
body .master-view .base-master-section h3,
body .master-view .base-master-section > .section-note,
body .master-view .base-master-section > .master-grid > label,
body .master-view .base-price-master-card,
body .master-view .base-price-master-card h4,
body .master-view .base-price-master-card h5,
body .master-view .base-price-master-card label,
body .master-view .base-master-badge {
  color: #102a3a !important;
  text-shadow: none !important;
}

body .master-view .base-master-section > .master-grid > label input,
body .master-view .base-master-section > .master-grid > label select,
body .master-view .welding-price-card input,
body .master-view .welding-reference-panel input,
body .master-view .base-price-master-card input,
body .master-view .base-price-master-card select {
  color: #f8fbff !important;
}

body .master-view .base-master-section > .section-note,
body .master-view .welding-price-card,
body .master-view .welding-price-card h4,
body .master-view .welding-price-card label,
body .master-view .welding-reference-panel,
body .master-view .welding-reference-panel label,
body .master-view .welding-reference-results span,
body .master-view .welding-formula-box,
body .master-view .welding-reference-formula {
  color: #25485a !important;
  text-shadow: none !important;
}

body .master-view .welding-reference-results strong {
  color: #15566e !important;
  text-shadow: none !important;
}

/* The effective-unit preview is a light confirmation table even in dark master themes. */
body .master-view .effective-unit-preview-section,
body .master-view .effective-unit-preview-section .section-note,
body .master-view .effective-unit-preview-card,
body .master-view .effective-unit-preview-card h4,
body .master-view .effective-unit-preview-card table,
body .master-view .effective-unit-preview-card th,
body .master-view .effective-unit-preview-card td,
body .master-view .effective-unit-summary,
body .master-view .effective-unit-summary strong,
body .master-view .effective-unit-summary span {
  text-shadow: none !important;
}

body .master-view .effective-unit-preview-section,
body .master-view .effective-unit-preview-section .section-note,
body .master-view .effective-unit-preview-card,
body .master-view .effective-unit-preview-card table,
body .master-view .effective-unit-preview-card th,
body .master-view .effective-unit-preview-card td,
body .master-view .effective-unit-summary span {
  color: #102a3a !important;
}

body .master-view .effective-unit-preview-card th {
  background: #f4f9fb !important;
  color: #4b6470 !important;
}

body .master-view .effective-unit-preview-result,
body .master-view .effective-unit-preview-card td.effective-unit-preview-result,
body .master-view .effective-unit-summary strong {
  color: #15566e !important;
}

body .master-view .effective-unit-adjustment-input {
  background: #ffffff !important;
  color: #102a3a !important;
}


/* Keep detail action buttons close to the left for horizontal tables. */
.detail-panel-header {
  justify-content: flex-start;
  align-items: center;
}

.detail-panel-header .detail-title-wrap {
  flex: 0 1 auto;
  min-width: 0;
  margin-right: 8px;
}

.detail-panel-header .detail-return-button,
.detail-panel-header .detail-close-button {
  flex: 0 0 auto;
}

.detail-panel-header .detail-close-button {
  order: 3;
}
