@font-face {
  font-family: "JoshunReportKai";
  src: url("assets/fonts/report-kai.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --soft: #f7fafb;
  --soft-teal: #fff5e8;
  --text: #102033;
  --muted: #65758a;
  --line: #d7e2ea;
  --line-strong: #b9cbd7;
  --primary: #f28c18;
  --primary-dark: #bd6505;
  --navy: #12314e;
  --green: #157347;
  --amber: #a76300;
  --red: #b42318;
  --shadow: 0 18px 44px rgba(18, 49, 78, 0.1);
  --radius: 8px;
  --sidebar: 286px;
  --sidebar-closed: 72px;
  --main-fixed: 864px;
  --rightbar-min: 360px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
}

html.is-modal-open,
body.is-modal-open,
html.is-power-modal-open,
body.is-power-modal-open {
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  overflow: hidden !important;
}

body.is-modal-open .app-shell,
body.is-modal-open .main,
body.is-modal-open .workspace,
body.is-power-modal-open .app-shell,
body.is-power-modal-open .main,
body.is-power-modal-open .workspace {
  max-height: 100dvh;
  overflow: hidden !important;
}

body {
  margin: 0;
  color: var(--text);
  font-family:
    "Noto Sans TC",
    "Microsoft JhengHei",
    "PingFang TC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

[hidden] {
  display: none !important;
}

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

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) var(--main-fixed) minmax(var(--rightbar-min), 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.18s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-closed) var(--main-fixed) minmax(var(--rightbar-min), 1fr);
}

.sidebar,
.rightbar {
  background: var(--surface);
}

.sidebar {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 20px;
  transition: padding 0.18s ease;
}

.sidebar.is-collapsed {
  padding: 16px 10px;
}

.rightbar {
  display: grid;
  align-content: start;
  border-left: 1px solid var(--line);
  padding: 18px;
}

.main {
  min-width: 0;
  padding: 22px;
}

.panel,
.record-form,
.choice-row,
.field,
.owner-panel,
.record-panel,
.internal-panel {
  min-width: 0;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
}

.sidebar.is-collapsed .sidebar-top {
  align-items: center;
  flex-direction: column;
}

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

.brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: transparent;
  object-fit: contain;
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.1;
}

.case-header h2 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.18;
}

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

.case-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mobile-header-back {
  display: none;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.panel h3,
.modal-card h3 {
  margin-bottom: 0;
  font-size: 19px;
}

.signature-section h4 {
  margin-bottom: 4px;
  font-size: 16px;
}

.kicker {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.sidebar-toggle {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--navy);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.sidebar.is-collapsed .brand-copy,
.sidebar.is-collapsed .sidebar-content {
  display: none;
}

.sidebar.is-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.mobile-next-actions,
.mobile-panel-nav,
.mobile-internal-title {
  display: none;
}

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

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

.btn-secondary:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--soft);
}

.btn-danger {
  border-color: rgba(180, 35, 24, 0.24);
  background: #fff1f0;
  color: var(--red);
}

.btn-danger:hover:not(:disabled) {
  border-color: rgba(180, 35, 24, 0.42);
  background: #ffe7e3;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: #eef4f7;
  color: var(--navy);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.case-section {
  margin-top: 24px;
}

.case-section-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.case-section-head > div {
  min-width: 0;
  margin-right: auto;
}

.add-case-button {
  width: 34px;
  height: 34px;
  background: var(--primary);
  color: #fff;
  font-size: 24px;
}

.case-section-head h2,
.storage-note h2 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

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

.case-filter-buttons {
  display: grid;
  grid-template-columns: repeat(2, 52px);
  gap: 6px;
}

.case-filter-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 900;
}

.case-filter-button.is-active {
  border-color: rgba(242, 140, 24, 0.42);
  background: #fff7ec;
  color: var(--primary-dark);
}

.case-list,
.record-list {
  display: grid;
  gap: 10px;
}

.case-card {
  display: grid;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
  color: inherit;
  text-align: left;
}

.case-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.case-open {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  text-align: left;
}

.case-card-top-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  justify-content: end;
  width: 96px;
}

.case-top-action {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--navy);
  padding: 7px 6px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.case-top-action[data-case-order] {
  min-width: 0;
}

.case-top-action:hover {
  border-color: rgba(242, 140, 24, 0.42);
  background: #fff8ed;
  color: var(--primary-dark);
}

.case-card:hover,
.case-card.is-active {
  border-color: rgba(242, 140, 24, 0.52);
  box-shadow: 0 10px 24px rgba(242, 140, 24, 0.12);
}

.case-card strong {
  display: block;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.case-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.case-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.trash-button {
  margin-top: 14px;
}

.import-button {
  margin-top: 14px;
}

.import-button input {
  display: none;
}

.storage-note {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.storage-note p,
.helper,
.signature-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.case-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

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

.pending-sync-button {
  border: 1px solid rgba(167, 99, 0, 0.24);
  cursor: pointer;
}

.pill,
.autosave,
.tag,
.status-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.pill-ok,
.tag-record,
.status-ok {
  border: 1px solid rgba(21, 115, 71, 0.18);
  background: #eaf7f0;
  color: var(--green);
}

.pill-warn,
.status-warn {
  border: 1px solid rgba(167, 99, 0, 0.24);
  background: #fff6e5;
  color: var(--amber);
}

.pill-offline,
.tag-defect,
.status-defect {
  border: 1px solid rgba(180, 35, 24, 0.18);
  background: #fff1f0;
  color: var(--red);
}

.autosave,
.tag-neutral {
  border: 1px solid rgba(242, 140, 24, 0.2);
  background: #fff3df;
  color: var(--primary-dark);
}

.workspace {
  display: grid;
  grid-template-columns: 360px 442px;
  gap: 18px;
  align-items: start;
}

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

.rightbar .panel {
  box-shadow: none;
}

.record-panel,
.owner-panel,
.internal-panel {
  padding: 18px;
}

.internal-panel {
  display: grid;
  min-height: calc(100vh - 36px);
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field span,
.choice-row legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 16px;
  padding: 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(242, 140, 24, 0.14);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.record-form,
.modal-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 14px;
}

.auth-card {
  max-width: 460px;
  grid-template-columns: 1fr;
}

.auth-message {
  grid-column: 1 / -1;
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.record-choice-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-inline-size: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.choice-row legend {
  grid-column: 1 / -1;
}

.choice-row label {
  position: relative;
}

.choice-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-row label span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.choice-row input:checked + span {
  border-color: var(--primary);
  background: #fff3df;
  color: var(--primary-dark);
}

.field-full,
.photo-box,
.photo-preview,
.form-actions,
.modal-actions,
.modal-card .panel-head {
  grid-column: 1 / -1;
}

.photo-box {
  display: grid;
  gap: 4px;
  border: 1px dashed #9fb5c3;
  border-radius: var(--radius);
  background: var(--soft-teal);
  padding: 16px;
}

.photo-box input,
.photo-action input {
  display: none;
}

.photo-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

#recordForm .photo-title,
#recheckNewDefectForm .photo-title {
  display: none;
}

.photo-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.photo-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.photo-action {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px solid rgba(242, 140, 24, 0.28);
  border-radius: var(--radius);
  background: #fff;
  color: var(--primary-dark);
  padding: 0 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.photo-box .photo-action > span {
  display: inline;
  min-height: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: inherit;
  font: inherit;
  padding: 0;
  box-shadow: none;
}

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

.layout-picker label {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  padding: 0 8px;
}

.layout-picker select {
  width: 44px;
  min-width: 0;
  min-height: 42px;
  border: 0;
  background: transparent;
  padding: 8px 2px;
  appearance: auto;
  -webkit-appearance: menulist;
  text-align: center;
  text-align-last: center;
  font-weight: 900;
}

.layout-picker select::-ms-expand {
  display: none;
}

.layout-picker span {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.case-time-control {
  display: grid;
  min-width: 0;
}

.native-picker-shell,
.case-time-native-shell {
  position: relative;
  display: grid;
  min-width: 0;
}

.case-time-native-shell {
  display: none;
}

.native-picker-display {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.field .native-picker-display {
  color: var(--text);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.25;
}

.native-picker-display.is-empty {
  color: rgba(101, 117, 138, 0.72);
}

.native-picker-shell input,
.case-time-native-shell input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-width: 0;
  opacity: 0;
}

.case-time-desktop {
  display: grid;
  grid-template-columns: minmax(64px, 76px) minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.case-time-desktop select,
.case-time-desktop input,
.case-time-native {
  box-sizing: border-box;
  min-width: 0;
  min-height: 44px;
}

.case-time-desktop span {
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
}

.case-time-native {
  display: none;
}

.case-recheck-options,
.case-building-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.case-recheck-option,
.case-building-option {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
}

.case-recheck-option.is-active,
.case-building-option.is-active {
  border-color: rgba(242, 140, 24, 0.42);
  background: #fff7ec;
  color: var(--primary-dark);
}

.address-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.copy-address-button {
  min-height: 42px;
  padding: 8px 12px;
  white-space: nowrap;
}

.case-photo-field input {
  padding: 10px;
}

.case-photo-preview {
  display: grid;
  min-height: 150px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #9fb5c3;
  border-radius: var(--radius);
  background: #f7fafb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.case-photo-preview-button {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 150px;
  place-items: center;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}

.case-photo-preview img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 230px;
  object-fit: contain;
}

.description-picker {
  min-height: 42px;
  border: 1px solid rgba(242, 140, 24, 0.28);
  border-radius: var(--radius);
  background: #fff;
  color: var(--primary-dark);
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 900;
}

.description-picker:hover {
  border-color: var(--primary);
}

.description-selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.description-selected-list:empty {
  display: none;
}

.selected-option-button {
  border: 1px solid rgba(242, 140, 24, 0.2);
  cursor: pointer;
  min-height: 42px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.selected-option-button:hover {
  border-color: var(--primary);
  background: #ffe8c3;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}

.photo-box .photo-preview {
  margin-top: 8px;
}

.photo-box .photo-preview:empty {
  display: none;
}

.photo-tile {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #e8f0f4;
}

.photo-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
}

.photo-loading {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.photo-loading-error {
  color: #b42318;
  background: #fff4f2;
}

.photo-tile.is-processing {
  border-color: #f3c37b;
}

.photo-tile.is-failed {
  border-color: #f2a7a0;
}

.photo-status-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  z-index: 2;
  border-radius: 999px;
  background: rgba(10, 28, 48, 0.78);
  color: #fff;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.photo-status-badge.is-error {
  background: rgba(180, 35, 24, 0.88);
}

.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 0;
  border-radius: 6px;
  background: rgba(16, 32, 51, 0.78);
  color: #fff;
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 900;
}

.form-actions,
.modal-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.form-actions .btn,
.modal-actions .btn {
  min-width: 0;
}

.case-modal-actions {
  grid-template-columns: auto;
  align-items: center;
  justify-content: end;
}

.condition-table-wrap {
  overflow-x: hidden;
  overflow-y: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.condition-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  background: #fff;
  table-layout: fixed;
}

.condition-table th:nth-child(2),
.condition-table td:nth-child(2) {
  width: 220px;
}

.condition-table th,
.condition-table td {
  border-bottom: 1px solid var(--line);
  height: 58px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  vertical-align: middle;
}

.condition-table th {
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

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

.condition-table select {
  min-width: 124px;
  padding: 9px 10px;
  font-size: 13px;
}

.condition-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  justify-content: stretch;
  gap: 8px;
  width: 100%;
}

.condition-result .status-badge {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  justify-content: center;
  padding: 5px 10px;
}

.condition-result .small-action.is-icon {
  justify-self: start;
  width: 30px;
  min-width: 30px;
  height: 30px;
  font-size: 17px;
}

.condition-choice-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.condition-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.condition-choice button {
  min-width: 70px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.condition-choice [data-condition-value="ok"] {
  border-color: rgba(21, 115, 71, 0.22);
  background: #eaf7f0;
  color: var(--green);
}

.condition-choice [data-condition-value="defect"] {
  border-color: rgba(180, 35, 24, 0.2);
  background: #fff1f0;
  color: var(--red);
}

.required-warning {
  margin-bottom: 12px;
  border: 1px solid rgba(167, 99, 0, 0.25);
  border-radius: var(--radius);
  background: #fff8e8;
  padding: 12px;
  color: #754500;
  font-size: 13px;
  line-height: 1.55;
}

.required-warning strong {
  display: block;
  margin-bottom: 4px;
}

.power-system-card {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
  border: 1px solid rgba(242, 140, 24, 0.26);
  border-radius: var(--radius);
  background: #fffaf2;
  padding: 9px 12px;
}

.power-system-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.power-system-head h4 {
  margin: 0;
  color: var(--navy);
  font-size: 16px;
  line-height: 1.2;
}

.power-system-head .btn {
  display: grid;
  align-self: center;
  min-height: 38px;
  place-items: center;
  padding: 7px 12px;
}

.power-system-summary {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.power-summary-state {
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
}

.power-summary-state.is-empty {
  color: #b42318;
}

.power-result-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  table-layout: fixed;
}

.power-result-table th,
.power-result-table td {
  border: 1px solid var(--line);
  padding: 8px;
  vertical-align: middle;
  word-break: break-word;
}

.power-result-table th {
  background: #fff2df;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.power-defect-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--red);
  font-weight: 900;
}

.power-modal {
  width: min(760px, calc(100vw - 18px));
  overflow: hidden;
}

.power-modal-card {
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  height: calc(100dvh - 22px);
  max-height: calc(100dvh - 22px);
  overflow: hidden;
}

.power-system-tabs {
  display: none;
}

.power-titlebar {
  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  grid-column: 1 / -1;
}

.power-titlebar h3 {
  margin: 0;
  color: #111827;
  font-size: 28px;
  letter-spacing: 0.02em;
}

.power-title-actions {
  display: grid;
  grid-template-columns: max-content max-content;
  align-items: center;
  gap: 10px;
}

.power-title-actions .power-title-nav[hidden] {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}

.power-title-nav.is-invisible {
  visibility: hidden;
  pointer-events: none;
}

.power-title-extra {
  display: flex;
  min-width: 0;
  justify-content: center;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.power-title-nav {
  border: 0;
  background: transparent;
  color: #111827;
  padding: 4px 6px;
  font-size: 24px;
  font-weight: 900;
}

.power-title-nav:disabled {
  color: #aeb8c2;
}

.power-system-editor {
  grid-column: 1 / -1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 0;
}

.power-system-editor[data-power-page="0"],
.power-system-editor[data-power-page="1"] {
  overflow-y: auto;
}

.power-system-editor[data-power-page="0"] .power-sheet {
  grid-template-rows: auto auto auto;
  align-content: start;
  height: auto;
  min-height: 100%;
}

.power-system-editor[data-power-page="1"] .power-sheet {
  grid-template-rows: auto auto;
  align-content: start;
  height: auto;
  min-height: 100%;
}

.power-panel-note {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.power-summary-screen {
  display: grid;
  gap: 14px;
}

.power-sheet {
  display: grid;
  --power-branch-row-height: 52px;
  --power-branch-border-width: 2px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  gap: 12px;
  color: #111827;
}

.power-mini-btn,
.power-add-row {
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: #fff7ec;
  color: var(--primary-dark);
  width: auto;
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.power-mini-btn {
  min-width: 104px;
}

.power-main-table,
.power-voltage-table {
  display: grid;
  width: calc(100% - 68px);
  margin-inline: auto;
  grid-template-columns: repeat(var(--power-main-cols, 5), minmax(0, 1fr));
  border-top: 2px solid #111827;
  border-left: 2px solid #111827;
  background: #fff;
}

.power-voltage-table {
  --power-main-cols: 5;
}

.power-result-top {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.power-preview-main,
.power-preview-voltage {
  display: grid;
  border-top: 2px solid #111827;
  border-left: 2px solid #111827;
  background: #fff;
}

.power-preview-main {
  grid-template-columns: repeat(var(--power-main-cols, 5), minmax(0, 1fr));
}

.power-preview-voltage {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.power-preview-voltage.is-l3 .power-table-cell {
  min-height: 46px;
}

.power-preview-voltage:not(.is-l3) .power-preview-title {
  min-height: 52px;
}

.power-preview-voltage:not(.is-l3) .power-table-cell {
  min-height: 78px;
}

.power-preview-voltage .power-table-na-span {
  grid-column: span 2;
}

.power-preview-title {
  grid-column: 1 / -1;
  display: grid;
  min-height: 40px;
  place-items: center;
  border-right: 2px solid #111827;
  border-bottom: 2px solid #111827;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.power-result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.power-result-frame {
  --power-result-width: 612px;
  --power-result-height: 792px;
  --power-result-scale: 1;
  width: 100%;
  max-width: var(--power-result-width);
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
  touch-action: pan-y pinch-zoom;
}

.power-result-screen {
  display: grid;
  gap: 9px;
  width: var(--power-result-width);
  min-height: var(--power-result-height);
  height: auto;
  align-content: start;
  min-width: 0;
  overflow: visible;
  transform: scale(var(--power-result-scale));
  transform-origin: top left;
}

.power-preview-main .power-table-cell:not(.power-table-head):not(.power-table-empty),
.power-preview-voltage .power-table-cell:not(.power-table-head):not(.power-table-empty) {
  display: grid;
  place-items: center;
  padding: 5px;
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.power-table-cell,
.power-cell-input {
  min-width: 0;
  min-height: 52px;
  border-right: 2px solid #111827;
  border-bottom: 2px solid #111827;
  background: #fff;
}

.power-table-head,
.power-table-empty {
  display: grid;
  place-items: center;
  padding: 5px;
  text-align: center;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
}

.power-result-screen .power-table-head {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.power-table-empty {
  color: transparent;
}

.power-table-hole {
  border: 0;
  background: transparent;
}

.power-table-na {
  position: relative;
  overflow: hidden;
}

.power-table-na::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom right, transparent calc(50% - 1px), #111827 50%, transparent calc(50% + 1px));
  pointer-events: none;
}

.power-cell-input {
  display: grid;
  place-items: center;
  position: relative;
  padding: 5px;
  text-align: center;
}

.power-cell-input input,
.power-cell-input select {
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 6px;
  background: #fff7ec;
  padding: 7px 4px;
  text-align: center;
  text-align-last: center;
  font-size: 13px;
  font-weight: 800;
}

.power-cell-input select {
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
  cursor: pointer;
}

.power-cell-input select::-ms-expand {
  display: none;
}

.power-cell-input input::placeholder {
  color: #111827;
  opacity: 1;
  font-weight: 900;
}

.power-branch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  width: calc(100% - 68px);
  margin-inline: auto;
  min-width: 0;
  min-height: 0;
}

.power-branch-layout.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.power-branch-panel {
  display: grid;
  grid-template-rows: auto auto;
  gap: 8px;
  min-height: 0;
  align-content: start;
}

.power-branch-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.power-branch-scroll {
  min-height: 0;
  overflow: visible;
}

.power-branch-table {
  display: grid;
  width: 100%;
  border-top: 2px solid #111827;
  border-left: 2px solid #111827;
  background: #fff;
}

.power-branch-table tbody {
  display: grid;
  grid-auto-rows: var(--power-branch-row-height);
}

.power-branch-line {
  display: grid;
  grid-template-columns: 14% 34% 34% 18%;
  grid-row: span var(--power-row-span, 1);
  height: auto;
  min-height: 0;
  line-height: 1;
}

.power-branch-empty-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.power-branch-line.is-holding > td {
  outline: 3px solid rgba(242, 140, 24, 0.55);
  outline-offset: -3px;
}

.power-branch-table td {
  display: grid;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-items: center;
  border: 0;
  border-right: 2px solid #111827;
  border-bottom: 2px solid #111827;
  box-sizing: border-box;
  padding: 0;
  text-align: center;
  height: auto;
}

.power-branch-number-cell {
  color: #111827;
  font-size: 14px;
  font-weight: 900;
}

.power-branch-number-cell:empty {
  color: transparent;
}

.power-branch-control-cell,
.power-branch-leakage-cell,
.power-branch-use-cell {
  padding: 4px;
}

.power-branch-use-cell {
  grid-column: span 3;
}

.power-branch-control-cell .power-cell-input {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 0;
  width: 100%;
  border: 0;
  padding: 0;
}

.power-branch-control-cell .power-cell-input input,
.power-branch-control-cell .power-cell-input select {
  min-height: 36px;
}

.power-branch-leakage-cell input {
  width: 28px;
  height: 28px;
  accent-color: var(--primary);
}

.power-branch-empty-row td {
  grid-column: 1 / -1;
  height: var(--power-branch-row-height);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.power-add-row {
  justify-self: start;
  margin-left: 34px;
  margin-top: 12px;
  min-width: 136px;
}

.power-result-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.power-result-grid th,
.power-result-grid td {
  border: 2px solid #111827;
  padding: 5px 3px;
  text-align: center;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.16;
  word-break: normal;
  overflow-wrap: normal;
  white-space: normal;
}

.power-result-grid th {
  height: 46px;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.power-result-grid th:nth-child(5) {
  font-size: 0;
  white-space: normal;
}

.power-result-grid th:nth-child(5)::before {
  content: "漏電\A保護";
  white-space: pre-line;
  font-size: 10px;
  line-height: 1.05;
}

.power-result-grid td:nth-child(2) {
  line-height: 1.16;
  white-space: normal;
  overflow-wrap: anywhere;
}

.power-result-grid td:nth-child(3),
.power-result-grid td:nth-child(4),
.power-result-grid td:nth-child(6) {
  white-space: nowrap;
  overflow-wrap: normal;
}

.power-result-grid td {
  height: calc(58px * var(--power-row-span, 1));
}

.power-result-branch-col {
  width: 10%;
}

.power-result-usage-col {
  width: 36%;
}

.power-result-voltage-col {
  width: 12%;
}

.power-result-wire-col {
  width: 18%;
}

.power-result-leakage-col {
  width: 10.5%;
}

.power-result-load-col {
  width: 13.5%;
}

.power-use-button,
.power-use-placeholder {
  display: flex;
  min-height: 0;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
  border: 0;
  background: #fff;
  overflow: hidden;
  padding: 5px 8px;
  color: #111827;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.18;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.power-use-placeholder {
  background: #fff;
}

.power-branch-line,
.power-branch-table,
.power-table-cell,
.power-cell-input {
  touch-action: manipulation;
}

.power-usage-modal {
  width: min(940px, calc(100vw - 22px));
}

.power-usage-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100dvh - 34px);
  overflow: hidden;
}

.power-usage-card .panel-head {
  align-items: center;
  flex-direction: row;
  justify-content: space-between;
}

.power-usage-card .panel-head > div {
  order: 1;
  min-width: 0;
}

.power-usage-card .panel-head > .icon-btn {
  order: 2;
  flex: 0 0 auto;
}

.power-usage-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-content: start;
  gap: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
}

.power-usage-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 54px;
  align-items: center;
  column-gap: 16px;
  row-gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.power-usage-option span {
  min-width: 0;
  overflow: visible;
  white-space: nowrap;
  text-overflow: clip;
  font-size: 13px;
  font-weight: 900;
}

.power-usage-option input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}

.power-usage-option input[type="text"],
.power-usage-option input[inputmode] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px;
  text-align: center;
}

.signature-section {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.signature-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
}

.signature-title-row p {
  grid-column: 1;
}

.signature-title-row .btn {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.signature-pad {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 390 / 128;
  border: 1px dashed #9fb5c3;
  border-radius: var(--radius);
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(18, 49, 78, 0.06) 36px);
  touch-action: none;
}

.signature-preview {
  display: grid;
  min-height: 116px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #9fb5c3;
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.signature-preview img {
  display: block;
  width: 100%;
  height: 116px;
  object-fit: contain;
}

.record-list {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.rightbar .record-list {
  grid-template-columns: repeat(auto-fill, minmax(360px, 360px));
  align-content: start;
  align-items: start;
}

.record-card {
  display: grid;
  align-self: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.record-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.record-photo {
  appearance: none;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0;
  cursor: zoom-in;
  text-align: left;
}

.record-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff;
}

.record-card.is-locked {
  background: #f8fafc;
}

.record-card.is-locked .record-body,
.record-card.is-locked .record-photos {
  opacity: 0.76;
}

.record-card.is-locked .small-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.record-body {
  min-width: 0;
}

.duplicate-warning {
  margin-bottom: 8px;
  border: 1px solid rgba(167, 99, 0, 0.26);
  border-radius: 8px;
  background: #fff7e8;
  color: #8a5200;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.record-body strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.record-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.record-index {
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
}

.record-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.record-note {
  display: block;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.review-check {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-width: 0;
  margin-top: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.review-check input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.review-check span {
  white-space: nowrap;
}

.record-actions {
  display: flex;
  flex: 1 1 auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
}

.record-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.small-action {
  flex: 1 1 0;
  min-width: 56px;
  border: 0;
  border-radius: 6px;
  background: #f1f5f8;
  color: var(--navy);
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 900;
}

.small-action.is-icon {
  display: inline-grid;
  width: 32px;
  min-width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  font-size: 18px;
}

.small-action-danger {
  background: #fff1f0;
  color: var(--red);
}

.empty-state {
  border: 1px dashed #b9c8d2;
  border-radius: var(--radius);
  background: var(--soft);
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}

.rightbar-footer {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.rightbar-footer:has(> button[hidden]:only-child) {
  display: none;
}

.internal-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.internal-head-actions .autosave {
  white-space: nowrap;
}

.internal-head-actions #generateReportButton {
  min-height: 38px;
  padding: 8px 16px;
  white-space: nowrap;
}

.report-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 14px;
}

.report-stat-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 11px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.report-stat-card.is-active {
  border-color: var(--primary);
  background: var(--soft-teal);
}

.report-stats span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.report-stats strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  max-width: min(380px, calc(100vw - 32px));
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.app-version-blocker {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 32, 51, 0.62);
}

.app-version-card {
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-version-card h2 {
  margin: 0 0 12px;
  font-size: 24px;
}

.app-version-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.app-version-card dl {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
}

.app-version-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.app-version-card dt {
  color: var(--muted);
  font-weight: 700;
}

.app-version-card dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
}

.modal,
.report-modal,
.signature-modal {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
}

.modal {
  width: min(620px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px);
  border: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior: contain;
}

.record-edit-modal {
  width: min(720px, calc(100vw - 28px));
}

.modal::backdrop,
.report-modal::backdrop,
.signature-modal::backdrop {
  background: rgba(16, 32, 51, 0.46);
}

.modal-card {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  padding: 20px;
}

#recordEditModal .modal-card,
#recheckNewDefectModal .modal-card,
#recheckItemEditModal .modal-card,
.trash-modal .modal-card {
  max-height: calc(100dvh - 28px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  align-content: start;
}

#caseModal .modal-card {
  box-sizing: border-box;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: calc(100dvh - 28px);
  max-width: min(900px, calc(100vw - 28px));
  overflow-x: hidden;
  overflow-y: auto;
  align-content: start;
}

#recheckInfoModal .modal-card {
  box-sizing: border-box;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  align-content: start;
}

.description-modal-card {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

.modal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

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

.description-clear-button {
  min-height: 44px;
  padding: 0 14px;
}

.confirm-icon {
  background: var(--primary);
  color: #fff;
}

.modal-back-button {
  background: #fff;
  color: var(--navy);
}

.description-options {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  flex: 1 1 auto;
  box-sizing: border-box;
  min-height: 0;
  max-height: none;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  gap: 10px;
  padding-right: 2px;
}

.description-options.is-grouped {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  min-width: 0;
  overflow-x: hidden;
}

.description-group {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 9px;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  overflow: visible;
  padding: 10px 0 16px;
}

.description-group + .description-group {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.description-group-title {
  flex: 0 0 100%;
  margin: 0 0 2px;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.description-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  max-inline-size: 100%;
  gap: 8px;
  border: 1px solid rgba(242, 140, 24, 0.36);
  border-radius: 999px;
  background: #fff;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.description-option span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.description-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.description-option:has(input:checked) {
  border-color: var(--primary);
  background: #fff3df;
  color: var(--primary-dark);
}

.photo-viewer-modal {
  width: min(960px, calc(100vw - 24px));
}

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

.photo-viewer-frame {
  display: grid;
  height: min(70vh, 720px);
  min-height: 320px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
}

.photo-viewer-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.photo-viewer-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.option-search {
  grid-column: 1 / -1;
  min-height: 54px;
  border-radius: 12px;
  background: var(--soft);
  font-size: 16px;
}

.report-modal {
  flex-direction: column;
  width: min(1080px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: min(860px, calc(100vh - 24px));
  overflow: hidden;
}

.report-modal[open] {
  display: flex;
}

.report-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.report-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

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

.report-document {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #edf2f6;
  padding: 22px;
}

.report-page-preview {
  width: min(100%, 760px);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto 22px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(18, 49, 78, 0.16);
  overflow: hidden;
}

.report-page-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.report-document.is-order-preview {
  background: #eef2f5;
  padding: 18px;
}

.order-page-preview {
  width: min(100%, 794px);
}

.report-loading {
  display: grid;
  min-height: 320px;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
}

.report-loading-error {
  color: var(--red);
}

.report-cover {
  margin-bottom: 22px;
  border-bottom: 2px solid var(--navy);
  padding-bottom: 18px;
}

.report-cover h2 {
  margin: 0 0 8px;
  font-size: 32px;
}

.report-section {
  margin: 22px 0;
}

.report-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid #ccd8e0;
}

.report-info-grid div {
  border-bottom: 1px solid #ccd8e0;
  padding: 10px;
}

.report-info-grid div:nth-child(odd) {
  border-right: 1px solid #ccd8e0;
}

.report-info-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.report-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.report-table th,
.report-table td {
  border: 1px solid #ccd8e0;
  padding: 9px;
  font-size: 13px;
  text-align: left;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
}

.report-table th {
  background: #f7fafb;
  color: var(--navy);
  font-weight: 900;
}

.report-record-summary td:nth-child(5) {
  width: 72px;
  text-align: center;
  white-space: normal;
}

.report-record-summary th:nth-child(1),
.report-record-summary td:nth-child(1) {
  width: 44px;
  text-align: center;
}

.trash-modal .panel-head {
  align-items: flex-start;
  flex-direction: row;
  justify-content: space-between;
}

.missing-data {
  color: var(--red) !important;
  font-weight: 900;
}

.report-record {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid #ccd8e0;
  padding: 14px 0;
  break-inside: avoid;
}

.report-photos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.report-photos img,
.report-photo-empty {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid #ccd8e0;
  object-fit: contain;
  background: #fff;
}

.report-photo-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.signature-image {
  max-width: 250px;
  border: 1px solid #ccd8e0;
  border-radius: 6px;
}

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

.trash-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

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

.trash-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.trash-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.signature-modal {
  width: min(980px, calc(100vw - 18px));
}

.signature-modal-card {
  display: grid;
  gap: 12px;
  background: #fff;
  padding: 12px;
}

.signature-modal-bar,
.signature-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.signature-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.signature-pad-large {
  height: min(54vh, 314px, calc((100vw - 62px) / 3.046875));
  max-height: none;
}

@media (orientation: landscape) and (max-height: 560px) {
  .signature-modal {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
  }

  .signature-modal-card {
    gap: 8px;
    max-height: calc(100dvh - 12px);
    overflow: hidden;
    padding: 8px;
  }

  .signature-modal-bar {
    min-height: 32px;
  }

  .signature-modal-actions {
    gap: 8px;
  }

  .signature-modal-actions .btn {
    min-height: 36px;
    padding: 7px 10px;
  }

  .signature-pad-large {
    height: min(58dvh, calc(100dvh - 104px));
  }
}

.recheck-workspace {
  grid-column: 2 / -1;
  min-width: 0;
  min-height: 100vh;
  padding: 26px;
}

.app-shell.is-recheck-mode {
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.app-shell.sidebar-collapsed.is-recheck-mode {
  grid-template-columns: var(--sidebar-closed) minmax(0, 1fr);
}

.app-shell.is-recheck-mode .main,
.app-shell.is-recheck-mode .rightbar {
  display: none;
}

.recheck-page-head,
.recheck-info-panel,
.recheck-item-head,
.recheck-list-item,
.recheck-list-info {
  min-width: 0;
}

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

.recheck-page-head h2 {
  margin-bottom: 0;
  font-size: 31px;
  line-height: 1.18;
}

.recheck-head-actions,
.recheck-info-actions,
.recheck-current-actions,
.recheck-list-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.recheck-head-actions {
  justify-content: flex-end;
  margin-left: auto;
}

.recheck-pending-sync-button {
  min-height: 34px;
}

.recheck-content {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: none;
}

.recheck-empty-panel,
.recheck-info-panel,
.recheck-current-card,
.recheck-list-panel {
  display: grid;
  gap: 10px;
}

.recheck-list-panel .panel-head {
  margin-bottom: 0;
}

.recheck-list-panel .panel-head h3 {
  margin-bottom: 0;
}

.recheck-info-panel {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
  padding: 16px;
}

.recheck-info-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  min-width: 0;
}

.recheck-info-panel h3 {
  margin-bottom: 0;
  font-size: 19px;
}

.recheck-info-panel p {
  margin-bottom: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.recheck-round-stack {
  display: flex;
  justify-items: stretch;
  min-width: 0;
  justify-content: end;
}

.recheck-round-list {
  display: flex;
  justify-content: end;
  gap: 8px;
}

.recheck-round-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.recheck-round-tab {
  min-width: 50px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 900;
  padding: 4px 9px;
  font-size: 13px;
  white-space: nowrap;
}

.recheck-round-tab.is-active {
  border-color: var(--primary);
  background: var(--soft-teal);
  color: var(--primary-dark);
}

.recheck-create-next {
  width: 32px;
  min-height: 30px;
  padding: 4px 0;
  font-size: 18px;
  line-height: 1;
}

.recheck-create-next:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.recheck-info-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
}

.recheck-info-actions .btn {
  width: 100%;
}

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

.recheck-info-status {
  display: grid;
  gap: 10px;
}

.recheck-status-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--text);
  text-align: left;
  padding: 12px;
}

.recheck-status-card.is-active {
  border-color: var(--primary);
  background: var(--soft-teal);
}

.recheck-status-card strong,
.recheck-status-card span {
  display: block;
}

.recheck-status-card strong {
  font-size: 28px;
  line-height: 1;
}

.recheck-status-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.recheck-signature-summary {
  margin-top: 0;
}

.recheck-list-panel {
  padding: 14px;
}

.recheck-list-panel .panel-head {
  padding: 0 2px;
}

.recheck-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.recheck-item-head h3 {
  margin-bottom: 0;
  font-size: 20px;
}

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

.recheck-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.recheck-compare-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.recheck-compare-card h4 {
  margin-bottom: 0;
  font-size: 16px;
}

.recheck-compare-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.recheck-compare-card.is-empty {
  background: var(--soft);
}

.recheck-pending-item .recheck-compare-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.recheck-pending-item .recheck-photo-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.recheck-pending-item .recheck-compare-card.is-empty {
  padding: 10px 12px;
}

.recheck-pending-item .recheck-compare-card.is-empty p {
  font-size: 14px;
  line-height: 1.45;
}

.recheck-photo-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  touch-action: pan-x pinch-zoom;
}

.recheck-photo-strip img,
.recheck-photo-empty {
  flex: 0 0 132px;
  width: 132px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.recheck-photo-strip img {
  object-fit: cover;
  transition: transform 160ms ease;
  transform-origin: center;
}

.recheck-photo-strip img.is-zoomed {
  position: relative;
  z-index: 5;
  transform: scale(1.8);
}

.recheck-photo-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.recheck-current-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.recheck-current-actions .btn {
  min-height: 44px;
  padding: 8px 6px;
}

.recheck-current-actions .btn.is-selected {
  border-color: var(--primary);
  background: var(--soft-teal);
  color: var(--primary-dark);
}

.recheck-pending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 360px));
  align-items: start;
  justify-content: start;
  gap: 12px;
}

.recheck-defect-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0;
}

.recheck-defect-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--text);
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.recheck-defect-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
}

.recheck-defect-summary h3,
.recheck-note-inline {
  overflow-wrap: anywhere;
}

.recheck-defect-detail {
  display: grid;
  gap: 6px;
  min-width: 0;
  border-left: 1px solid var(--line);
  padding-left: 10px;
}

.recheck-note-inline {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

#recheckNewDefectModal .panel-head {
  align-items: flex-start;
  flex-direction: row;
  justify-content: space-between;
  margin-bottom: 2px;
}

#recheckNewDefectModal .modal-actions {
  grid-template-columns: minmax(0, 1fr);
}

#recheckItemEditModal .panel-head {
  align-items: flex-start;
  flex-direction: row;
  justify-content: space-between;
  margin-bottom: 2px;
}

#recheckItemEditModal .modal-actions {
  grid-template-columns: minmax(0, 1fr);
}

.recheck-item-edit-original {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.recheck-edit-original-head {
  display: grid;
  gap: 6px;
}

.recheck-item-edit-photo-box {
  gap: 10px;
  padding: 12px;
}

.recheck-item-edit-photo-box .photo-preview {
  grid-template-columns: repeat(auto-fill, minmax(112px, 140px));
  align-items: start;
  margin-top: 0;
}

.recheck-item-edit-photo-box .photo-preview:empty {
  display: none;
}

.recheck-item-edit-photo-box .photo-tile {
  max-width: 150px;
}

.recheck-item-edit-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.recheck-item-edit-status .btn {
  min-height: 44px;
}

.recheck-item-edit-status .btn.is-selected {
  border-color: var(--primary);
  background: #fff3df;
  color: var(--primary-dark);
  box-shadow: none;
}

#recordEditModal .panel-head {
  align-items: flex-start;
  flex-direction: row;
  justify-content: space-between;
}

#recordEditModal .modal-actions {
  grid-template-columns: minmax(0, 1fr);
}

#recheckNewDefectNoteInput {
  min-height: 52px;
}

.recheck-unfinished-editor {
  display: grid;
  gap: 10px;
  border-top: 0;
  padding-top: 0;
}

.recheck-item-photo-box {
  gap: 10px;
  padding: 12px;
}

.recheck-item-photo-box .photo-preview {
  grid-template-columns: repeat(auto-fill, minmax(112px, 140px));
  align-items: start;
  margin-top: 0;
}

.recheck-item-photo-box .photo-preview:empty {
  display: none;
}

.recheck-item-photo-box .photo-tile {
  max-width: 150px;
}

.recheck-item-photo-box .photo-action-row {
  margin-top: 0;
}

.recheck-item-photo-box .photo-copy {
  margin-top: 0;
}

.recheck-unfinished-editor .recheck-description-checks {
  margin-top: -2px;
}

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

.recheck-final-actions .btn[data-recheck-draft-complete] {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
  box-shadow: none;
}

.recheck-final-actions .btn[data-recheck-draft-complete].is-selected {
  border-color: var(--primary);
  background: #fff3df;
  color: var(--primary-dark);
  box-shadow: none;
}

.recheck-photo-frame {
  position: relative;
  display: inline-flex;
  flex: 0 0 132px;
  min-width: 132px;
}

.recheck-photo-frame img {
  width: 100%;
  cursor: zoom-in;
}

.recheck-description-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recheck-description-checks label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.recheck-description-checks input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.recheck-description-checks span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}

.recheck-description-checks input:checked + span {
  border-color: var(--primary);
  background: #fff3df;
  color: var(--primary-dark);
}

.recheck-item-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 360px));
  align-items: start;
  justify-content: start;
  gap: 12px;
}

.recheck-list-item {
  display: grid;
  align-self: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.recheck-list-info {
  display: grid;
  gap: 4px;
}

.recheck-list-info strong,
.recheck-list-info span {
  min-width: 0;
}

.recheck-list-info span {
  color: var(--muted);
  line-height: 1.45;
}

.recheck-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.recheck-judged-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.recheck-judged-item .status-badge {
  width: auto;
  align-self: start;
  justify-self: end;
  justify-content: center;
  min-height: 30px;
  white-space: nowrap;
}

.recheck-current-only-grid {
  grid-template-columns: minmax(0, 1fr);
}

.recheck-judged-note {
  margin: 0;
}

.recheck-judged-item .recheck-list-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.muted-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1520px) {
  .app-shell {
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-closed) minmax(0, 1fr);
  }

  .rightbar {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .internal-panel {
    min-height: 0;
  }
}

@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .case-header {
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  .app-shell,
  .app-shell.sidebar-collapsed {
    display: block;
  }

  .sidebar,
  .main,
  .rightbar,
  .recheck-workspace {
    display: none;
  }

  .app-shell.mobile-view-cases .sidebar,
  .app-shell.mobile-view-record .main,
  .app-shell.mobile-view-owner .main,
  .app-shell.mobile-view-internal .rightbar,
  .app-shell.mobile-view-recheck .recheck-workspace {
    display: block;
  }

  .app-shell.mobile-view-record .sidebar,
  .app-shell.mobile-view-owner .sidebar,
  .app-shell.mobile-view-internal .sidebar,
  .app-shell.mobile-view-recheck .sidebar {
    display: none;
  }

  .app-shell.mobile-view-record .owner-panel,
  .app-shell.mobile-view-owner .record-panel {
    display: none;
  }

  .sidebar,
  .sidebar.is-collapsed {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    min-height: 100vh;
    border-right: 0;
    border-bottom: 0;
    padding: 16px;
  }

  .sidebar-content {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    overflow-x: hidden;
  }

  .case-section-head {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 38px;
    padding-right: 92px;
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }

  .case-section-head > div {
    margin-right: 0;
  }

  .case-list,
  .case-card-top,
  .case-open,
  .compact-filter,
  .storage-note {
    min-width: 0;
    max-width: 100%;
  }

  .case-card {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }

  .case-filter-buttons {
    position: absolute;
    top: 2px;
    right: 0;
  }

  .case-card-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .case-card-top-actions {
    grid-template-columns: minmax(82px, 1fr) minmax(78px, 1fr);
    width: auto;
  }

  .case-top-action {
    min-height: 38px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .sidebar.is-collapsed .sidebar-content,
  .sidebar.is-collapsed .brand-copy {
    display: block;
  }

  .sidebar.is-collapsed .sidebar-top,
  .sidebar-top {
    flex-direction: row;
    margin-bottom: 18px;
  }

  .sidebar-toggle {
    display: none;
  }

  .sidebar,
  .main,
  .rightbar,
  .recheck-workspace {
    padding: 16px;
  }

  .main,
  .rightbar,
  .recheck-workspace {
    min-height: 100vh;
  }

  .rightbar {
    border-top: 0;
    border-left: 0;
  }

  .workspace {
    display: block;
  }

  .mobile-next-actions,
  .mobile-panel-nav,
  .mobile-internal-title {
    display: grid;
    gap: 10px;
  }

  .mobile-internal-title {
    gap: 0;
    margin-bottom: 14px;
  }

  .mobile-internal-title h2 {
    margin: 0;
    font-size: 23px;
    line-height: 1.18;
  }

  .mobile-next-actions {
    grid-template-columns: 1fr 1fr;
    margin-top: 14px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
  }

  .mobile-next-actions p {
    grid-column: 1 / -1;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
  }

  .mobile-panel-nav {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 14px;
  }

  .mobile-internal-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .recheck-page-head,
  .recheck-info-panel,
  .recheck-item-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .recheck-page-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
  }

  .recheck-page-head h2 {
    font-size: 25px;
  }

  .recheck-info-panel {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }

  .recheck-info-top {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
  }

  .recheck-round-stack {
    min-width: 0;
    justify-content: end;
  }

  .recheck-round-list {
    justify-content: end;
    gap: 6px;
  }

  .recheck-round-tab {
    min-width: 50px;
    min-height: 30px;
    padding: 4px 9px;
    font-size: 13px;
  }

  .recheck-create-next {
    width: 32px;
    min-height: 30px;
  }

  .recheck-info-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .recheck-head-actions {
    display: grid;
    grid-template-columns: auto auto auto;
    justify-content: end;
    align-items: start;
    width: auto;
    gap: 8px;
  }

  .recheck-head-actions .btn {
    width: auto;
    min-height: 42px;
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .recheck-info-actions .btn {
    width: 100%;
    min-height: 42px;
    padding: 8px 6px;
    font-size: 13px;
    white-space: nowrap;
  }

  .recheck-status-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .recheck-status-card {
    padding: 8px 6px;
  }

  .recheck-status-card strong {
    font-size: 24px;
  }

  .recheck-status-card span {
    font-size: 11px;
    line-height: 1.25;
  }

  .recheck-compare-grid,
  .recheck-description-checks {
    grid-template-columns: 1fr;
  }

  .recheck-current-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .recheck-current-actions .btn {
    font-size: 12px;
    white-space: normal;
  }

  .recheck-pending-grid {
    grid-template-columns: 1fr;
  }

  .recheck-item-list {
    grid-template-columns: 1fr;
  }

  .recheck-list-row {
    grid-template-columns: 1fr;
  }

  .recheck-list-item .recheck-judged-head,
  .recheck-list-item .recheck-list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .recheck-list-item .status-badge {
    justify-self: end;
    align-self: start;
    width: auto;
  }

  .recheck-photo-strip img,
  .recheck-photo-empty {
    flex-basis: 128px;
    width: 128px;
  }

  .app-shell.mobile-view-owner .case-header,
  .app-shell.mobile-view-internal .case-header {
    margin-bottom: 12px;
  }

  .mobile-header-back {
    display: inline-flex;
  }

  .case-title-row {
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
  }

  .case-title-actions {
    flex: 0 0 auto;
    margin-left: auto;
    align-self: center;
    transform: translateY(-2px);
  }

  .case-title-actions .pending-sync-button {
    min-height: 34px;
    padding: 6px 9px;
    white-space: nowrap;
  }

  .case-header h2 {
    font-size: 23px;
  }

  .record-form,
  .modal-card,
  .modal-actions,
  .report-record {
    grid-template-columns: 1fr;
  }

  #descriptionModal.modal {
    position: fixed;
    inset: auto 12px 0 12px;
    box-sizing: border-box;
    width: auto;
    max-width: calc(100vw - 24px);
    height: calc(100dvh - 76px);
    max-height: calc(100dvh - 76px);
    margin: 0;
    border-radius: 18px 18px 0 0;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    touch-action: pan-y;
  }

  #descriptionModal .description-modal-card {
    box-sizing: border-box;
    min-height: 100%;
    max-height: 100%;
    padding: 14px;
    border-radius: 18px 18px 0 0;
    overflow-x: hidden;
  }

  #recordEditModal.modal,
  #recheckNewDefectModal.modal,
  #recheckItemEditModal.modal {
    position: fixed;
    inset: auto 12px 0 12px;
    box-sizing: border-box;
    width: auto;
    max-width: calc(100vw - 24px);
    height: calc(100dvh - 36px);
    max-height: calc(100dvh - 36px);
    margin: 0;
    border-radius: 18px 18px 0 0;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    touch-action: pan-y;
  }

  #trashModal.modal {
    position: fixed;
    inset: auto 0 0 0;
    width: 100vw;
    max-width: 100vw;
    height: calc(100dvh - 24px);
    max-height: calc(100dvh - 24px);
    margin: 0;
    border-radius: 18px 18px 0 0;
    overflow-x: hidden;
  }

  #recordEditModal .modal-card,
  #recheckNewDefectModal .modal-card,
  #recheckItemEditModal .modal-card {
    box-sizing: border-box;
    width: 100%;
    min-height: 100%;
    max-height: 100%;
    padding: 16px 16px max(16px, env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: 90px;
  }

  #trashModal .modal-card {
    width: 100%;
    min-height: 100%;
    max-height: 100%;
    padding: 14px;
    border-radius: 18px 18px 0 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #recordEditModal .modal-card,
  #recheckNewDefectModal .modal-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }

  #recheckInfoModal .modal-actions,
  #recordEditModal .modal-actions,
  #recheckNewDefectModal .modal-actions,
  #recheckItemEditModal .modal-actions,
  #descriptionModal .modal-actions,
  #trashModal .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: #fff;
    padding: 10px 0 max(10px, env(safe-area-inset-bottom));
  }

  .description-options.is-grouped {
    gap: 0;
  }

  .description-group {
    padding: 10px 0 16px;
  }

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

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

  .rightbar .record-list {
    grid-template-columns: 1fr;
  }

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

  .panel-head,
  .report-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-modal .report-bar {
    align-items: center;
    flex-direction: row;
  }

  .trash-modal .panel-head {
    align-items: flex-start;
    flex-direction: row;
  }

  #caseModal .panel-head {
    align-items: flex-start;
    flex-direction: row;
  }

  #recheckInfoModal .panel-head {
    align-items: flex-start;
    flex-direction: row;
  }

  #caseModal .modal-card {
    box-sizing: border-box;
    width: min(366px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-inline: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #recheckInfoModal .modal-card {
    box-sizing: border-box;
    width: min(366px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-inline: auto;
    overflow-x: hidden;
  }

  #caseModal .field,
  #recheckInfoModal .field {
    min-width: 0;
  }

  #caseModal .native-picker-shell,
  #caseModal .case-time-control,
  #caseModal .case-time-native-shell,
  #recheckInfoModal .native-picker-shell,
  #recheckInfoModal .case-time-control,
  #recheckInfoModal .case-time-native-shell {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-inline-size: 0;
    max-width: 100%;
    overflow: hidden;
  }

  #caseModal .native-picker-display,
  #recheckInfoModal .native-picker-display {
    width: 100%;
    min-width: 0;
    text-align: center;
  }

  #caseDateInput,
  #caseTimeNativeInput,
  #recheckDateInput,
  #recheckTimeNativeInput {
    border: 0;
    padding: 0;
    font-size: 16px;
  }

  #caseModal .case-modal-actions,
  #recheckInfoModal .case-modal-actions {
    grid-template-columns: auto;
    justify-content: end;
  }

  .record-panel > .panel-head {
    align-items: flex-start;
    flex-direction: row;
  }

  .owner-panel > .panel-head,
  .internal-panel > .panel-head {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .owner-panel > .panel-head .autosave,
  .internal-panel > .panel-head .autosave {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .internal-head-actions #generateReportButton {
    display: none;
  }

  .panel {
    box-shadow: none;
  }

  .record-panel,
  .owner-panel,
  .internal-panel {
    padding: 14px;
  }

  .app-shell.mobile-view-record .record-panel {
    margin-top: -12px;
  }

  .app-shell.mobile-view-owner .owner-panel {
    margin-top: -12px;
  }

  .condition-table th:nth-child(2),
  .condition-table td:nth-child(2) {
    width: 188px;
  }

  .condition-table th,
  .condition-table td {
    height: 54px;
    padding: 9px 6px;
    font-size: 12px;
  }

  .condition-choice {
    gap: 5px;
  }

  .condition-choice button {
    min-width: 68px;
    padding: 5px 5px;
    font-size: 11px;
  }

  .condition-result .status-badge {
    min-width: 68px;
    padding: 5px 5px;
  }

  .layout-picker {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.2fr);
    gap: 5px;
  }

  .layout-picker label {
    gap: 3px;
    padding: 0 5px;
  }

  .layout-picker select {
    width: 42px;
    padding: 8px 2px;
  }

  .layout-picker span {
    font-size: 13px;
  }

  .case-time-desktop {
    display: none;
  }

  .case-time-native-shell {
    display: grid;
  }

  .case-time-native {
    display: block;
  }

  .power-system-head {
    align-items: center;
    flex-direction: row;
  }

  .power-modal.modal {
    position: fixed;
    inset: auto 0 0 0;
    width: 100vw;
    max-width: 100vw;
    height: calc(100dvh - 44px);
    max-height: calc(100dvh - 44px);
    margin: 0;
    border-radius: 18px 18px 0 0;
  }

  .power-modal-card {
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    padding: 14px;
    border-radius: 18px 18px 0 0;
  }

  .power-titlebar {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
  }

  .power-titlebar h3 {
    font-size: 20px;
  }

  .power-title-nav {
    padding: 3px;
    font-size: 17px;
  }

  .power-title-actions {
    gap: 4px;
  }

  .power-mini-btn {
    min-width: 96px;
    font-size: 12px;
  }

  .power-sheet {
    gap: 9px;
  }

  .power-table-cell,
  .power-cell-input {
    min-height: 48px;
  }

  .power-main-table,
  .power-voltage-table {
    width: calc(100% - 54px);
  }

  .power-table-head {
    padding: 3px;
    font-size: 10px;
    line-height: 1.25;
  }

  .power-cell-input,
  .power-branch-leakage-cell {
    padding: 3px;
  }

  .power-cell-input input,
  .power-cell-input select {
    padding: 6px 2px;
    font-size: 11px;
  }

  .power-branch-layout {
    gap: 6px;
    width: calc(100% - 54px);
  }

  .power-result-top {
    grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
    gap: 5px;
  }

  .power-preview-title {
    min-height: 40px;
    font-size: 11px;
  }

  .power-preview-voltage:not(.is-l3) .power-preview-title {
    min-height: 56px;
  }

  .power-preview-voltage:not(.is-l3) .power-table-cell {
    min-height: 84px;
  }

  .power-result-grid th,
  .power-result-grid td {
    padding: 3px 2px;
    font-size: 11px;
  }

  .power-result-grid th {
    height: 46px;
  }

  .power-result-screen .power-table-cell,
  .power-result-screen .power-cell-input {
    min-height: 56px;
  }

  .power-result-screen .power-table-head {
    font-size: 11px;
  }

  .power-branch-title {
    font-size: 10px;
  }

  .power-branch-scroll {
    max-height: none;
  }

  .power-branch-line,
  .power-branch-table td {
    height: auto;
    min-height: 0;
  }

  .power-use-button,
  .power-use-placeholder {
    height: 100%;
    min-height: 0;
  }

  .power-branch-number-cell {
    font-size: 14px;
  }

  .power-branch-leakage-cell input {
    width: 24px;
    height: 24px;
  }

  .power-add-row {
    margin-left: 27px;
    min-width: 118px;
    font-size: 12px;
  }

  .power-use-button {
    padding: 8px 4px;
    font-size: 12px;
  }

  .power-usage-modal.modal {
    position: fixed;
    inset: auto 0 0 0;
    width: 100vw;
    max-width: 100vw;
    height: calc(100dvh - 70px);
    max-height: calc(100dvh - 70px);
    margin: 0;
    border-radius: 18px 18px 0 0;
  }

  .power-usage-card {
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    padding: 14px;
    border-radius: 18px 18px 0 0;
  }

  .power-usage-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-x: hidden;
    gap: 8px;
  }

  .power-usage-option {
    grid-template-columns: 22px minmax(0, 1fr) 40px;
    column-gap: 14px;
    row-gap: 6px;
    padding: 8px;
  }

  .power-usage-option span {
    font-size: 11px;
  }

  .record-actions,
  .report-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    width: 100%;
  }

  .record-foot .record-actions {
    display: flex;
    width: auto;
    min-width: 0;
  }

  .record-foot .small-action {
    min-width: 54px;
  }

  .report-info-grid div:nth-child(odd) {
    border-right: 0;
  }

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

  .report-document .report-info-grid div:nth-child(odd) {
    border-right: 1px solid #ccd8e0;
  }

  .report-document.is-order-preview {
    padding: 10px;
  }

  .report-modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }

  .report-document {
    padding: 10px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  p,
  span,
  strong,
  h1,
  h2,
  h3,
  h4,
  button,
  input,
  select,
  textarea {
    overflow-wrap: anywhere;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-shell,
  .toast,
  .report-bar {
    display: none !important;
  }

  .report-modal {
    position: static;
    display: block !important;
    width: auto;
    max-height: none;
    box-shadow: none;
  }

  .report-document {
    max-height: none;
    overflow: visible;
    padding: 0;
  }
}
