:root {
  --text: #333333;
  --text-secondary: #666666;
  --text-tertiary: #949494;
  --placeholder: #b3b3b3;
  --border: #d9d9d9;
  --surface-gray: #f8f8f8;
  --orange: #ff9b1a;
  --orange-hover: #f08d0c;
  --orange-active: #db7f08;
  --green: #22a854;
  --gray: #8c8c8c;
  --red: #d64545;
  --blue: #1a73e8;
  --focus: #4a90e2;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: #fff;
}

.app { width: 100%; }

/* タブ */
.tabs { display: flex; border-bottom: 1.5px solid var(--border); padding-left: 24px; }
.tab {
  background: none;
  border: 1.5px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: var(--text-tertiary);
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  margin-bottom: -1.5px;
  padding: 12px 20px;
}
.tab[aria-selected="true"] { background: #fff; border-color: var(--border); color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.panel { padding: 0 24px; }

.lead { margin: 24px 0; }
.hint { color: var(--text-tertiary); }

/* 登録番号 */
.number-input {
  border: 1px solid var(--border);
  border-radius: 4px;
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  height: 160px;
  padding: 15px 20px;
  resize: vertical;
  width: 100%;
}
.number-input::placeholder, .name-input::placeholder { color: var(--placeholder); }
.number-input:focus, .name-input:focus { border-color: var(--focus); outline: none; }

.actions { align-items: center; display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 24px 0; }
.button-primary {
  background: var(--orange);
  border: 0;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 8px 40px;
}
.button-primary:hover { background: var(--orange-hover); }
.button-primary:active { background: var(--orange-active); }
.button-primary:disabled { cursor: default; opacity: .6; }
.notice { color: var(--text-secondary); font-size: 12px; }

/* 法人名コンボボックス */
.combobox { position: relative; max-width: 720px; }
.name-input {
  border: 1px solid var(--border);
  border-radius: 4px;
  display: block;
  font: inherit;
  font-size: 14px;
  padding: 12px 48px 12px 20px; /* 右端の検索中インジケータ分を空ける */
  width: 100%;
}
/* 候補を取得している間、入力ボックスの右端で回るインジケータ */
.name-loading {
  animation: name-loading-spin .8s linear infinite;
  border: 2px solid var(--border);
  border-radius: 50%;
  border-top-color: var(--blue);
  height: 18px;
  margin-top: -9px;
  position: absolute;
  right: 16px;
  top: 50%;
  width: 18px;
}
@keyframes name-loading-spin {
  to { transform: rotate(360deg); }
}
.listbox {
  background: #fff;
  border: 1px solid var(--border);
  border-top: 0;
  list-style: none;
  margin: 0;
  max-height: 340px;
  overflow-y: auto;
  padding: 0;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 10;
}
.option { border-top: 1px solid var(--border); cursor: pointer; padding: 12px 16px; }
.option:first-child { border-top: 0; }
.option[aria-selected="true"] { background: var(--blue); color: #fff; }
.option-name { font-size: 15px; }
.option-address { font-size: 12px; opacity: .85; }
.option-message { color: var(--text-secondary); padding: 16px; }
.option-message a { color: var(--blue); }

/* 結果 */
.results { margin: 8px 0 0; }
.table-wrap { overflow-x: auto; width: 100%; }
.results-table { border-collapse: collapse; min-width: 900px; width: 100%; }
.results-table th {
  background: var(--surface-gray);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}
.results-table td { border-bottom: 1px solid var(--border); padding: 14px 12px; vertical-align: middle; }
.kana { color: var(--text-secondary); font-size: 11px; }
.name { font-size: 15px; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-tertiary); }
.badge {
  border-radius: 4px;
  color: #fff;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
  padding: 2px 10px;
  vertical-align: middle;
}
.badge-active { background: var(--green); }
.badge-expired { background: var(--gray); }
.badge-revoked { background: var(--red); }
.error-text { color: var(--text-secondary); font-size: 12px; }
.row-error a { color: var(--blue); font-size: 12px; }

.empty { align-items: center; color: var(--text-secondary); display: flex; flex-direction: column; gap: 12px; padding: 40px 0; }
.empty-icon { background: var(--surface-gray); border-radius: 50%; height: 96px; position: relative; width: 96px; }
.empty-icon::before {
  border: 6px solid var(--text-secondary);
  border-radius: 50%;
  content: "";
  height: 26px;
  left: 26px;
  position: absolute;
  top: 24px;
  width: 26px;
}
.empty-icon::after {
  background: var(--text-secondary);
  border-radius: 3px;
  content: "";
  height: 6px;
  left: 54px;
  position: absolute;
  top: 58px;
  transform: rotate(45deg);
  width: 20px;
}

.disclaimer { color: var(--text-tertiary); font-size: 11px; line-height: 2; padding: 24px; }

@media (min-width: 768px) {
  body { font-size: 16px; }
  .tabs { padding-left: 40px; }
  .tab { font-size: 22px; padding: 18px 30px; }
  .panel { padding: 0; }
  .lead { font-size: 18px; margin: 32px 0; }
  .number-input, .name-input { font-size: 18px; }
  .button-primary { font-size: 24px; padding: 12px 48px; }
  .results-table { font-size: 16px; }
  .name { font-size: 18px; }
  .disclaimer { font-size: 14px; padding: 32px 0; }
}
