:root {
  --bg: #07111f;
  --panel: #101b2c;
  --panel-soft: #16243a;
  --line: #2b4366;
  --text: #f2f7ff;
  --muted: #9fb1c9;
  --accent: #62c9ff;
  --ok: #78e3a6;
  --danger: #ff927f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.tablet-shell {
  display: grid;
  gap: 14px;
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 14px;
}

.tablet-header,
.scan-panel,
.status-card,
.manual-panel,
.worktime-panel,
.process-panel,
.number-panel,
.note-panel,
.confirm-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.section-head h2 {
  margin-bottom: 4px;
}

.section-head small {
  color: var(--muted);
}

.section-head small.error {
  color: var(--danger);
}

.mini-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 700;
  padding: 0 14px;
}

.tablet-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.tablet-header p {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.tablet-header h1 {
  margin: 0;
  font-size: 28px;
}

.tablet-header a {
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  text-decoration: none;
  font-weight: 900;
}

.scan-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.scan-actions {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
}

.scan-button,
.submit-button {
  min-height: 58px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #1762a3, #123456);
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
}

.scan-button.ghost {
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.reader {
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
}

.message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.message.error {
  color: var(--danger);
}

.message.ok {
  color: var(--ok);
}

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

.status-card {
  display: grid;
  gap: 5px;
  min-height: 94px;
  padding: 14px;
}

.status-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.status-card strong {
  font-size: 22px;
  overflow-wrap: anywhere;
}

.status-card small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.manual-panel,
.worktime-panel,
.process-panel,
.number-panel,
.note-panel,
.confirm-panel {
  padding: 14px;
}

.worktime-panel {
  display: grid;
  grid-template-columns: minmax(180px, 260px);
  align-items: end;
}

.worktime-panel input {
  min-height: 60px;
  font-size: 26px;
  font-weight: 900;
  text-align: right;
}

summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 900;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

input,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #081220;
  color: var(--text);
  padding: 10px 12px;
}

h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.process-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.process-buttons button,
.count-tab,
.keypad button {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
}

.process-buttons button.active,
.count-tab.active {
  border-color: var(--accent);
  background: #164f82;
  box-shadow: 0 0 18px rgba(98, 201, 255, 0.22);
}

.count-tab:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.count-tab:disabled strong {
  color: var(--muted);
}

.count-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.defect-process-area {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.defect-process-area > span {
  display: block;
  margin-bottom: 8px;
  font-weight: 900;
}

.defect-process-buttons {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.defect-process-buttons button {
  display: grid;
  gap: 3px;
}

.defect-process-buttons button strong {
  font-size: 18px;
}

.defect-process-buttons button small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.defect-process-buttons button.active small {
  color: var(--text);
}

.count-tab {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 62px;
  padding: 8px 10px;
  text-align: left;
}

.count-tab span {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.count-tab strong {
  min-width: 42px;
  color: var(--accent);
  font-family: Consolas, "Yu Gothic UI", monospace;
  font-size: 24px;
  text-align: right;
}

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

.keypad button {
  min-height: 70px;
  font-size: 28px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.check-row input {
  width: 24px;
  min-height: 24px;
}

.confirm-text {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.confirm-text div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #081220;
  padding: 10px;
}

.confirm-text span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.confirm-text strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.submit-button {
  width: 100%;
  min-height: 72px;
  font-size: 24px;
}

@media (max-width: 720px) {
  .status-grid,
  .manual-grid,
  .count-tabs,
  .confirm-text {
    grid-template-columns: 1fr;
  }

  .process-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
