html, body {
  touch-action: manipulation;
}

/* TN - Fieldworkテーマ */
:root {
  --bg:              #F2F2F2;
  --surface:         #EDEDED;
  --surface-alt:     #E4E4E4;
  --surface-raised:  #FFFFFF;
  --text:            #0A0A0A;
  --text-muted:      #6E6E6E;
  --text-dim:        #A0A0A0;
  --border:          rgba(10,10,10,0.08);
  --border-strong:   rgba(10,10,10,0.18);
  --accent:          #0A0A0A;
  --accent-soft:     rgba(10,10,10,0.06);
  --accent-text:     #FFFFFF;
  --danger:          #A8341E;
  --danger-soft:     rgba(168,52,30,0.08);
  --success:         #2E6E3F;
  --success-soft:    rgba(46,110,63,0.08);
  --warning:         #8B5A0E;
  --radius:          14px;
  --radius-sm:       8px;
  --radius-lg:       20px;
  --font-body:       "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Noto Sans JP", -apple-system, system-ui, sans-serif;
  --font-mono:       "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  --font-title:      "Archivo Black", "Helvetica Neue", "Arial Black", sans-serif;
  --header-bg:       #FFFFFF;
  --card-bg:         #FFFFFF;
  /* 機能変数 */
  --header-h: 52px;
  --footer-h: 60px;
  --index-w:  44px;
  /* 後方互換エイリアス */
  --muted: #6E6E6E;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  height: 100vh;
  overflow: hidden;
}

/* ─── HEADER ─── */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-strong);
  z-index: 100;
  display: flex;
  align-items: center;
  color: var(--text);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 4px;
}

.store-info { display: flex; flex-direction: column; gap: 1px; }
#storeName { font-size: 15px; font-weight: 700; color: var(--text); }
#tantoshaName { font-size: 12px; color: var(--text-muted); }

.cart-badge-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #FFFFFF;
  border: 1px solid rgba(10,10,10,0.18);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cart-icon { font-size: 16px; }
#cartCount { font-size: 15px; font-weight: 700; color: #0A0A0A; min-width: 14px; }

.category-tabs {
  display: flex;
  padding: 6px 12px 8px;
  gap: 8px;
}

.tab {
  flex: 1;
  padding: 5px 0;
  background: transparent;
  border: 1px solid rgba(10,10,10,0.18);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tab.active {
  background: #0A0A0A;
  border-color: #0A0A0A;
  color: #FFFFFF;
}

/* ─── MAIN AREA ─── */
#mainArea {
  position: fixed;
  top: var(--header-h);
  bottom: var(--footer-h);
  left: 0;
  right: var(--index-w);
  overflow: hidden;
  z-index: 150;
}

#productList {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  box-sizing: border-box;
}

.product-empty {
  color: var(--text-muted);
  text-align: center;
  margin-top: 80px;
  font-size: 14px;
  line-height: 2;
}

/* ─── PREFIX INDEX ─── */
#prefixIndex {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  overflow-y: hidden;
  padding: 4px 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.prefix-btn {
  width: 38px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 3px 4px;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
}

.prefix-btn.highlight {
  background: var(--accent-soft);
  color: var(--accent);
}

.prefix-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
}

/* ─── SLIDE POPUP ─── */
#slidePopup {
  position: fixed;
  right: calc(var(--index-w) + 10px);
  background: #0A0A0A;
  color: #FFFFFF;
  font-size: 22px;
  font-weight: 800;
  padding: 10px 18px;
  border-radius: 12px 12px 0 12px;
  pointer-events: none;
  z-index: 300;
  transform: translateY(-50%);
  white-space: nowrap;
  display: none;
}

/* ─── BOTTOM BAR ─── */
#bottomBar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: auto;
  min-height: 60px;
  background: var(--header-bg);
  border-top: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 8px 12px;
  z-index: 100;
}

.bottom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.summary { display: flex; flex-direction: column; gap: 2px; }

.summary-line1 { display: flex; gap: 8px; align-items: center; }

.summary-line2 {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 900;
  color: #0A0A0A;
  letter-spacing: 0.3px;
}

#totalKingaku:empty { display: none; }

#selectedCount, #totalQty { font-size: 13px; color: var(--text); font-weight: 700; }

#cartBtn {
  flex: 1;
  padding: 14px 18px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  font-family: var(--font-body);
  letter-spacing: 1px;
  text-transform: uppercase;
  background: #0A0A0A;
  color: #FFFFFF;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}

#cartBtn.disabled {
  background: var(--surface-alt);
  color: var(--text-dim);
  cursor: default;
  pointer-events: none;
}

#searchBtn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  border: none;
  border-radius: 8px;
  background: #0A0A0A;
  color: #FFFFFF;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ─── NUMPAD ─── */
#numpadOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: none;
}

#numpadOverlay.shown { display: block; }

#numpad {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #FFFFFF;
  border-top: 1px solid rgba(10,10,10,0.18);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px 28px;
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#numpad.shown { transform: translateY(0); }

.numpad-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #F2F2F2;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

.prefix-badge {
  background: #0A0A0A;
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 8px;
  min-width: 50px;
  text-align: center;
  white-space: nowrap;
}

#numpadInput {
  font-size: 30px;
  font-weight: 700;
  color: #0A0A0A;
  letter-spacing: 0.12em;
  flex: 1;
  min-width: 0;
}

.numpad-hint {
  font-size: 12px;
  color: #6E6E6E;
  text-align: center;
  margin-bottom: 14px;
}

.numpad-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.nk {
  padding: 17px 0;
  border: none;
  border-radius: 12px;
  background: #F2F2F2;
  color: #0A0A0A;
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-title);
  cursor: pointer;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.08s;
}

.nk:active { background: #E4E4E4; }
.nk.key-bs { font-size: 18px; background: #E4E4E4; color: #6E6E6E; }
.nk.key-go { background: #0A0A0A; color: #FFFFFF; font-size: 20px; font-weight: 800; }

/* ─── 品番リスト ─── */
.series-block {
  background: #FFFFFF;
  border: 1px solid rgba(10,10,10,0.08);
  border-radius: 14px;
  margin-bottom: 12px;
  padding: 16px 16px 12px;
  overflow: hidden;
}

.series-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 12px 0;
  background: transparent;
  border-bottom: 1px solid rgba(10,10,10,0.08);
  border-radius: 0;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 4px;
}

.series-base {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #0A0A0A;
}

.series-name {
  color: var(--text-muted);
  font-size: 0.85em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-allcolor {
  margin-left: auto;
  background: transparent;
  color: #0A0A0A;
  border: 1px solid rgba(10,10,10,0.18);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  background: transparent;
  border-bottom: 1px solid rgba(10,10,10,0.06);
  color: var(--text);
  transition: background 0.05s;
}

.item-row:last-child { border-bottom: none; }

.item-iro {
  width: 36px;
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #6E6E6E;
}

.item-edaban {
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #6E6E6E;
  flex-shrink: 0;
}

.item-qty {
  width: 40px;
  text-align: center;
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 0;
}

.btn-minus,
.btn-plus {
  width: 42px;
  height: 42px;
  font-size: 22px;
  font-weight: 500;
  font-family: var(--font-title);
  border: 1px solid rgba(10,10,10,0.08);
  border-radius: 8px;
  background: #FFFFFF;
  color: #0A0A0A;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-minus:active,
.btn-plus:active {
  background: #0A0A0A;
  color: #FFFFFF;
}

/* フラッシュ */
.flash-plus  { background: rgba(46, 110, 63, 0.12) !important; }
.flash-minus { background: rgba(168, 52, 30, 0.12) !important; }

/* ─── サイドカラム（大分類＋接頭辞）─── */
#sideColumn {
  position: fixed;
  right: 0;
  top: var(--header-h);
  bottom: 60px;
  width: var(--index-w);
  display: flex;
  flex-direction: column;
  z-index: 110;
  border-left: 1px solid rgba(10,10,10,0.08);
  background: #FFFFFF;
}

/* ─── 大分類アコーディオン ─── */
#categoryAccordion {
  width: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

.cat-selected {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 14px 0;
  text-align: center;
  cursor: pointer;
  background: #0A0A0A;
  color: #FFFFFF;
  border-radius: 0;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(10,10,10,0.08);
  -webkit-tap-highlight-color: transparent;
}

.cat-options {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cat-options.hidden {
  display: none;
}

.cat-option {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 14px 0;
  text-align: center;
  cursor: pointer;
  background: transparent;
  color: #0A0A0A;
  border-radius: 0;
  border-bottom: 1px solid rgba(10,10,10,0.08);
  -webkit-tap-highlight-color: transparent;
}

.cat-option:active {
  background: #0A0A0A;
  color: #FFFFFF;
}

/* ─── 検索モーダル ─── */
#searchOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
}
#searchOverlay.shown { display: block; }

#searchModal {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 70vh;
  background: #FFFFFF;
  border-radius: 16px 16px 0 0;
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
#searchModal.shown { transform: translateY(0); }

#searchModalHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 12px 8px;
  border-bottom: 1px solid rgba(10,10,10,0.08);
}

#searchInput {
  flex: 1;
  padding: 10px 12px;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(10,10,10,0.18);
  background: #F2F2F2;
  color: #0A0A0A;
  outline: none;
  -webkit-appearance: none;
}
#searchInput::placeholder { color: #A0A0A0; }

#searchClose {
  width: 36px;
  height: 36px;
  background: #E4E4E4;
  border: none;
  border-radius: 8px;
  color: #0A0A0A;
  font-size: 1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#searchResults {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0;
}

.search-series-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(10,10,10,0.08);
  cursor: pointer;
}

.search-series-row:active {
  background: #F2F2F2;
}

/* ─── 在庫バッジ ─── */
.stock-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 24px;
  text-align: center;
}

.stock-ok  { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.stock-tri { background: rgba(139,90,14,0.08); color: var(--warning); border: 1px solid var(--warning); }
.stock-ng  { background: var(--danger-soft);  color: var(--danger);  border: 1px solid var(--danger); }

/* ─── 送信済み履歴モーダル ─── */
.history-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 400;
  align-items: flex-end;
  justify-content: center;
}

.history-overlay.shown { display: flex; }

.history-modal {
  background: #FFFFFF;
  border: 1px solid rgba(10,10,10,0.12);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(10,10,10,0.08);
  flex-shrink: 0;
}

.history-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #0A0A0A;
}

.history-close-btn {
  width: 32px;
  height: 32px;
  background: #E4E4E4;
  border: none;
  border-radius: 8px;
  color: #0A0A0A;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.history-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  padding: 8px 0;
}

.history-empty {
  color: #6E6E6E;
  text-align: center;
  padding: 40px 0;
  font-size: 14px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(10,10,10,0.08);
}

.history-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.history-item-date {
  font-size: 12px;
  color: #6E6E6E;
}

.history-item-store {
  font-size: 15px;
  font-weight: 600;
  color: #0A0A0A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 8px;
}

.history-btn-detail {
  padding: 6px 12px;
  background: #F2F2F2;
  border: 1px solid rgba(10,10,10,0.18);
  border-radius: 8px;
  color: #0A0A0A;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.history-btn-delete {
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid rgba(10,10,10,0.18);
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.history-detail-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  padding: 16px;
}

.history-detail-info {
  background: #F2F2F2;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
}

.history-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid rgba(10,10,10,0.08);
  font-size: 14px;
  color: #0A0A0A;
  gap: 8px;
}

.history-detail-row:last-child { border-bottom: none; }

.history-detail-label {
  color: #6E6E6E;
  font-size: 12px;
  flex-shrink: 0;
}

.history-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}

.history-items-table th {
  text-align: left;
  color: #6E6E6E;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(10,10,10,0.12);
}

.history-items-table td {
  padding: 8px 8px;
  border-bottom: 1px solid rgba(10,10,10,0.06);
  color: #0A0A0A;
}

.history-memo {
  background: #F2F2F2;
  border-radius: 10px;
  padding: 12px;
}

.history-memo p {
  font-size: 13px;
  color: #0A0A0A;
  margin-top: 6px;
  white-space: pre-wrap;
}

/* ─── TNロゴ ─── */
#tnLogo {
  font-size: 20px;
  font-weight: 900;
  color: var(--accent-text);
  background: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: -0.05em;
  text-decoration: none;
  font-family: var(--font-title);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ─── LT（前回呼び出し）ボタン ─── */
#ltBtn {
  font-size: 20px;
  font-weight: 900;
  color: var(--accent-text);
  background: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: -0.05em;
  font-family: var(--font-title);
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  margin-right: 6px;
  -webkit-tap-highlight-color: transparent;
}

#ltBtn:active {
  opacity: 0.7;
}

/* ─── CR（現在の発注一覧）ボタン ─── */
#crBtn {
  font-size: 20px;
  font-weight: 900;
  color: var(--accent-text);
  background: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: -0.05em;
  font-family: var(--font-title);
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  margin-right: 6px;
  -webkit-tap-highlight-color: transparent;
  opacity: 0.3;
}
#crBtn:not(:disabled) { opacity: 1; }
#crBtn:not(:disabled):active { opacity: 0.7; }
#crBtn:disabled { cursor: default; }

/* ─── CR モーダル ─── */
#crOverlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
}
#crOverlay.shown { display: block; }

#crModal {
  display: none;
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 90%; max-width: 400px;
  max-height: 72vh;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  z-index: 201;
  flex-direction: column;
  overflow: hidden;
}
#crModal.shown { display: flex; }

#crModalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-strong);
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
#crClose {
  background: none; border: none;
  font-size: 18px; cursor: pointer;
  color: var(--text-muted); line-height: 1;
}
#crModalBody {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cr-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cr-item:last-child { border-bottom: none; }
.cr-item:active { background: var(--surface-alt); }
.cr-left { display: flex; flex-direction: column; gap: 2px; }
.cr-hinban { font-size: 15px; font-weight: 700; font-family: var(--font-mono); }
.cr-iro { font-size: 12px; color: var(--text-muted); }
.cr-qty {
  font-size: 22px; font-weight: 900;
  font-family: var(--font-title);
  color: var(--text);
  min-width: 36px; text-align: right;
}

/* ─── LT前回発注ハイライト ─── */
.item-row.lt-highlight {
  background: #e8f5e9;
}

/* ─── 下書き保存ボタン（cart.html ヘッダー） ─── */
#draftBtn {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(10,10,10,0.18);
  border-radius: 8px;
  color: #0A0A0A;
  font-size: 18px;
  padding: 6px 10px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

/* 履歴ボタン（index.html 用） */
.btn-history {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 12px;
  background: transparent;
  border: 1.5px solid rgba(10,10,10,0.18);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  color: #0A0A0A;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-history:active { opacity: 0.75; }

/* ─── お気に入りバー ─── */
#favBar {
  width: calc(100% - var(--index-w));
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  background: var(--header-bg);
}

#favBar.hidden { display: none; }

#favList {
  display: inline-flex;
  gap: 6px;
  padding: 0 2px;
}

.fav-btn {
  position: relative;
  display: inline-block;
  padding: 6px 14px;
  background: var(--surface-alt);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.fav-btn:active { background: #0A0A0A; color: #FFFFFF; }

.fav-del-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  background: rgba(10,10,10,0.18);
  border: none;
  border-radius: 50%;
  color: #0A0A0A;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.btn-fav-star {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  color: var(--text-dim);
}

.btn-fav-star.is-fav { color: var(--warning); }

#favSettingBtn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 16px;
  padding: 6px 8px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Fieldworkアイコンボタン（36×36 / 細線SVG） ─── */
.fw-icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  color: #0A0A0A;
  border: 1px solid rgba(10,10,10,0.12);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s, color 0.1s;
}

.fw-icon-btn:active,
.fw-icon-btn.is-active {
  background: #0A0A0A;
  color: #FFFFFF;
}

.fw-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Fieldworkテキストピル（英字極太＋日本語サブ） ─── */
.fw-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  background: #FFFFFF;
  color: #0A0A0A;
  border: 1px solid rgba(10,10,10,0.18);
  border-radius: 8px;
  font-family: "Archivo Black", "Helvetica Neue", "Arial Black", sans-serif;
  font-size: 13px;
  letter-spacing: 1.5px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}

.fw-pill small {
  font-family: "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.3px;
  color: #6E6E6E;
  text-transform: none;
}

.fw-pill.is-primary {
  background: #0A0A0A;
  color: #FFFFFF;
  border-color: #0A0A0A;
}

.fw-pill.is-primary small { color: rgba(255,255,255,0.6); }

.fw-pill:active { opacity: 0.75; }

.fw-pill.is-block {
  display: flex;
  width: 100%;
  padding: 16px 18px;
  font-size: 14px;
  letter-spacing: 2px;
}

/* ─── Fieldwork色ドット＋英字ラベル（ステータス） ─── */
.fw-status-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background: transparent;
  color: #0A0A0A;
  border: 1px solid rgba(10,10,10,0.18);
  border-radius: 8px;
  font-family: "Archivo Black", "Helvetica Neue", "Arial Black", sans-serif;
  font-size: 11px;
  letter-spacing: 1.2px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.fw-status-btn small {
  font-family: "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.3px;
  color: #6E6E6E;
  text-transform: none;
  margin-left: 2px;
}

.fw-status-btn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fw-status-btn .dot-warning { background: #D4A017; }
.fw-status-btn .dot-danger  { background: #A8341E; }

.fw-status-btn:active { background: rgba(10,10,10,0.04); }
