:root {
  --c-bg: #eceff1;
  --c-panel: #ffffff;
  --c-border: #b0bec5;
  --c-border-light: #cfd8dc;
  --c-header: #1f3a5f;
  --c-header-sub: #2c4a73;
  --c-text: #212121;
  --c-text-sub: #546e7a;
  --c-label-bg: #f5f7fa;
  --c-accent: #1565c0;
  --c-accent-h: #0d47a1;
  --c-sub: #455a64;
  --c-sub-h: #263238;
  --c-warn: #c62828;
  --c-readonly: #fafafa;
  --c-nfc: #2e7d32; /* NFC用グリーン */
  --c-nfc-h: #1b5e20;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
header.app-bar {
  background: var(--c-header);
  color: #fff;
  padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #0d2240;
}
header.app-bar .title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
header.app-bar .ver {
  font-size: 11px;
  font-family: "SF Mono", Consolas, monospace;
  opacity: 0.8;
}
nav.crumb {
  background: var(--c-header-sub);
  color: #e3f2fd;
  font-size: 11px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--c-border);
}
main {
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  max-width: 720px;
  margin: 0 auto;
}
.panel {
  background: var(--c-panel);
  border: 1px solid var(--c-border);
  margin-bottom: 8px;
}
.panel > .panel-head {
  background: linear-gradient(to bottom, #f5f7fa, #e4e9ee);
  border-bottom: 1px solid var(--c-border);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel > .panel-head .badge {
  font-size: 10px;
  font-weight: normal;
  background: var(--c-header);
  color: #fff;
  padding: 1px 6px;
  border-radius: 2px;
}
table.form {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
table.form th, table.form td {
  border-bottom: 1px solid var(--c-border-light);
  padding: 6px 8px;
  vertical-align: middle;
  font-weight: normal;
  text-align: left;
}
table.form tr:last-child th,
table.form tr:last-child td { border-bottom: none; }
table.form th {
  background: var(--c-label-bg);
  width: 32%;
  color: var(--c-header);
  font-size: 12px;
  border-right: 1px solid var(--c-border-light);
}
table.form th .req {
  color: var(--c-warn);
  font-size: 10px;
  margin-left: 4px;
}
table.form th .hint {
  display: block;
  color: var(--c-text-sub);
  font-size: 10px;
  font-weight: normal;
  margin-top: 2px;
}
input[type="text"], textarea {
  width: 100%;
  border: 1px solid var(--c-border);
  background: #fff;
  padding: 5px 6px;
  font-size: 13px;
  font-family: "SF Mono", Consolas, "Courier New", monospace;
  color: var(--c-text);
  border-radius: 0;
  -webkit-appearance: none;
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, textarea:focus {
  outline: 1px solid var(--c-accent);
  border-color: var(--c-accent);
}
textarea[readonly], input[readonly] {
  background: var(--c-readonly);
  color: var(--c-text-sub);
}
.btn-row {
  padding: 6px 8px;
  background: var(--c-label-bg);
  border-top: 1px solid var(--c-border-light);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
button {
  font-family: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--c-border);
  background: linear-gradient(to bottom, #ffffff, #e8edf1);
  color: var(--c-text);
  cursor: pointer;
  border-radius: 2px;
  min-height: 32px;
  flex: 1 1 auto;
}
button:hover { background: linear-gradient(to bottom, #f0f4f8, #d8dee4); }
button:active { background: #d0d6dc; }
button.primary {
  background: linear-gradient(to bottom, var(--c-accent), var(--c-accent-h));
  color: #fff;
  border-color: var(--c-accent-h);
  font-weight: 600;
}
button.primary:hover { background: var(--c-accent-h); }
button.sub {
  background: linear-gradient(to bottom, #607d8b, var(--c-sub));
  color: #fff;
  border-color: var(--c-sub-h);
}
button.sub:hover { background: var(--c-sub-h); }

/* ★追加: NFC用のアクションボタン */
button.nfc-btn {
  background: linear-gradient(to bottom, var(--c-nfc), var(--c-nfc-h));
  color: #fff;
  border-color: var(--c-nfc-h);
  font-weight: 600;
}
button.nfc-btn:hover { background: var(--c-nfc-h); }

.output {
  background: #fafbfc;
  border: 1px solid var(--c-border-light);
  padding: 6px 8px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11px;
  color: var(--c-text);
  word-break: break-all;
  min-height: 60px;
  max-height: 180px;
  overflow-y: auto;
  margin: 6px 8px;
}
.status-bar {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  background: var(--c-label-bg);
  border-top: 1px solid var(--c-border-light);
  font-size: 11px;
  color: var(--c-text-sub);
  font-family: "SF Mono", Consolas, monospace;
}
.status-bar .ok { color: #2e7d32; font-weight: 600; }
.status-bar .ng { color: var(--c-warn); font-weight: 600; }
.note {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--c-text-sub);
  background: #fff8e1;
  border-top: 1px solid var(--c-border-light);
}
footer.foot {
  text-align: center;
  font-size: 10px;
  color: var(--c-text-sub);
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
@media (max-width: 480px) {
  table.form, table.form tbody, table.form tr, table.form th, table.form td { display: block; width: 100%; }
  table.form th {
    border-right: none;
    border-bottom: 1px solid var(--c-border-light);
    padding: 4px 8px;
  }
  table.form td { padding: 6px 8px 8px; }
}
