/* ボトルキープ — 夜のカウンター
   暗い店内・片手・接客中で読めることを最優先にした、モバイルファーストのダークUI。
   テーマカラー(--accent*)は app.js の applyThemeColor() が書き換えます。 */

:root {
  color-scheme: dark;

  /* surfaces: warm near-black, layered */
  --bg: #0d0c0b;
  --surface: #181614;
  --surface-2: #211e1b;
  --surface-3: #2b2723;
  --line: rgba(255, 244, 230, .08);
  --line-strong: rgba(255, 244, 230, .18);

  /* text */
  --text: #f5f0e8;
  --text-2: #b6ada1;
  --text-3: #80786d;

  /* theme (overridden at runtime) */
  --accent: #f5a524;
  --accent-dark: #b4750e;
  --accent-hover: #ffc35d;
  --accent-rgb: 245, 165, 36;
  --accent-ink: #2a1a04;

  /* status */
  --ok: #8fd19e;
  --warn: #ff8a4c;
  --danger: #ff6b6b;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 64px;

  font-family: -apple-system, "SF Pro Text", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120% 50% at 50% -8%, rgba(var(--accent-rgb), .11), transparent 62%),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
}
button, input, select { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
b, strong { font-weight: 700; }
small { font-size: .8em; }
/* iOS zooms into focused inputs below 16px */
input, select, textarea { font-size: 16px; }

/* ---------- Top bar ---------- */
.topbar {
  align-items: center;
  background: rgba(13, 12, 11, .8);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  min-height: 60px;
  padding: calc(var(--safe-top) + 8px) 16px 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title { flex: 1; min-width: 0; }
.brand-caption { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .16em; margin: 0; }
.topbar h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; margin: 1px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-button { align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 50%; display: inline-flex; flex: 0 0 auto; height: 44px; justify-content: center; margin-left: -4px; width: 44px; }
.back-button svg { height: 22px; width: 22px; }
.back-button:disabled { display: none; }

/* ---------- Page frame ---------- */
.main-content { margin: 0 auto; max-width: 600px; padding: 18px 16px calc(var(--nav-height) + var(--safe-bottom) + 36px); }
.page-view { animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-heading { margin: 2px 0 18px; }
.page-heading h2 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; margin: 0; }
.page-heading p { color: var(--text-2); font-size: 14px; margin: 4px 0 0; }
.section-heading { align-items: flex-start; display: flex; gap: 12px; justify-content: space-between; }
.section-count { color: var(--text-3); font-size: 15px; font-weight: 500; margin-left: 10px; }

/* ---------- Buttons ---------- */
.primary-button, .secondary-button, .text-button {
  align-items: center;
  border-radius: var(--radius);
  display: inline-flex;
  font-weight: 700;
  gap: 6px;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.primary-button:active, .secondary-button:active, .remaining-choice:active, .editor-actions button:active { transform: scale(.97); }
.primary-button { background: var(--accent); border: 0; color: var(--accent-ink); font-size: 16px; }
.primary-button:hover { background: var(--accent-hover); }
.primary-button svg { height: 18px; stroke-width: 2.4; width: 18px; }
.secondary-button { background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); font-size: 15px; }
.secondary-button.wide { margin-top: 10px; width: 100%; }
.secondary-button.danger { color: var(--danger); }
.text-button { background: none; border: 0; color: var(--accent); font-size: 15px; }

/* ---------- Search & filters ---------- */
.customer-toolbar { align-items: center; display: flex; gap: 10px; margin-bottom: 14px; }
.customer-register-button { flex: 0 0 auto; }
.search-box { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex: 1; gap: 10px; min-height: 50px; padding: 0 14px; width: 100%; }
.search-box svg { color: var(--text-3); flex: 0 0 auto; height: 20px; width: 20px; }
.search-box input { background: transparent; border: 0; flex: 1; min-width: 0; outline: 0; padding: 12px 0; }
.search-box input::placeholder { color: var(--text-3); }
.search-box:focus-within { border-color: rgba(var(--accent-rgb), .6); }
.top-search { margin-bottom: 12px; }
.is-empty .customer-toolbar { display: none; }

.filter-row { display: flex; gap: 6px; margin: 0 -16px 14px; overflow-x: auto; padding: 2px 16px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text-2); display: inline-flex; flex: 1 0 auto; font-size: 14px; font-weight: 600; gap: 6px; justify-content: center; min-height: 44px; padding: 0 12px; white-space: nowrap; }
.filter-chip.active { background: rgba(var(--accent-rgb), .14); border-color: rgba(var(--accent-rgb), .55); color: var(--accent); }
.chip-count { background: var(--surface-3); border-radius: 8px; color: var(--text); font-size: 12px; min-width: 22px; padding: 1px 7px; text-align: center; }
.chip-count.expired-badge { background: rgba(255, 107, 107, .2); color: var(--danger); }

/* ---------- Bottle cards ---------- */
.bottle-list { display: grid; gap: 12px; }
.bottle-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 16px;
  position: relative;
  transition: border-color .15s ease, background .15s ease;
}
.bottle-row:active { background: var(--surface-2); }
.bottle-row.editing { background: var(--surface-2); border-color: rgba(var(--accent-rgb), .5); }
.bottle-main { display: grid; gap: 10px; min-width: 0; }
.bottle-head { align-items: center; display: flex; gap: 10px; justify-content: space-between; }
.customer-name { font-size: 20px; font-weight: 800; letter-spacing: -.01em; line-height: 1.3; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-visit-name { background: none; border: 0; color: var(--text); padding: 0; text-align: left; }
.expiry { align-items: baseline; background: var(--surface-3); border-radius: 9px; color: var(--text-2); display: inline-flex; flex: 0 0 auto; font-size: 13px; font-weight: 700; gap: 6px; padding: 4px 11px; white-space: nowrap; }
.expiry small { color: var(--text-3); font-weight: 500; }
.expiry.warning { background: rgba(255, 138, 76, .15); color: var(--warn); }
.expiry.expired { background: rgba(255, 107, 107, .17); color: var(--danger); }
.expiry.warning small, .expiry.expired small { color: inherit; opacity: .75; }
.bottle-sub { align-items: center; display: flex; gap: 10px; justify-content: space-between; }
.bottle-brand { color: var(--text-2); font-size: 17px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.number-badge { background: rgba(var(--accent-rgb), .14); border-radius: 9px; color: var(--accent); flex: 0 0 auto; font-size: 15px; font-weight: 800; letter-spacing: .02em; padding: 3px 10px; }
.bottle-label { color: var(--text-3); flex: 0 1 auto; font-size: 13px; margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottle-gauge { align-items: center; display: flex; gap: 10px; }
.gauge { display: inline-flex; gap: 4px; }
.gauge i { background: var(--surface-3); border-radius: 4px; display: block; height: 10px; width: 26px; }
.gauge i.on { background: var(--accent); }
.gauge.low i.on { background: var(--warn); }
.level-value { color: var(--text); font-size: 15px; font-weight: 700; }
.low-flag { background: rgba(255, 138, 76, .15); border-radius: 8px; color: var(--warn); font-size: 12px; font-weight: 700; padding: 2px 9px; }

/* expanded details */
.remaining-editor { border-top: 1px solid var(--line); display: none; gap: 14px; margin-top: 16px; padding-top: 16px; }
.bottle-row.editing .remaining-editor { display: grid; }
.meta-chips { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.meta-chips > div { background: var(--surface-3); border-radius: var(--radius-sm); min-width: 0; padding: 9px 12px; }
.meta-chips span { color: var(--text-3); display: block; font-size: 12px; }
.meta-chips > div > b { display: block; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-chips .meta-wide { grid-column: 1 / -1; }
.editor-label { color: var(--text-3); font-size: 13px; font-weight: 600; margin-bottom: -6px; }
.remaining-choices { display: grid; gap: 8px; grid-template-columns: repeat(5, 1fr); }
.remaining-choice { background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--radius); font-size: 18px; font-weight: 700; min-height: 56px; }
.remaining-choice.dim { opacity: .55; }
.remaining-choice.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); opacity: 1; }
.editor-actions { display: grid; gap: 8px; grid-template-columns: 1fr 1.5fr 1fr; }
.editor-actions button { background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text-2); font-size: 15px; font-weight: 700; min-height: 50px; transition: transform .12s ease; white-space: nowrap; }
.editor-actions .new-bottle-button { border-color: rgba(var(--accent-rgb), .5); color: var(--accent); }
.editor-actions .visit-button { background: rgba(var(--accent-rgb), .14); border-color: transparent; color: var(--accent); }
.editor-actions .visit-button.visiting { background: rgba(255, 138, 76, .16); color: var(--warn); }
.editor-actions .edit-button.save-remaining-mode { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.remaining-history { border-top: 1px solid var(--line); color: var(--text-3); display: grid; gap: 6px; padding-top: 12px; }
.remaining-history > span { font-size: 13px; font-weight: 600; }
.remaining-history div { align-items: center; display: flex; gap: 14px; }
.remaining-history small { color: var(--text-3); font-size: 14px; }
.remaining-history b { color: var(--text-2); font-size: 15px; }
.drink-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.drink-badge { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text); font-size: 14px; padding: 2px 11px; }
.drink-badge.empty { color: var(--text-3); }

/* visit mode */
.bottle-row.visit-mode { display: grid; gap: 0 12px; grid-template-columns: 40px 1fr; }
.bottle-row.visit-mode .remaining-editor { grid-column: 1 / -1; }
.visit-card-sort { display: flex; flex-direction: column; gap: 6px; }
.visit-card-sort button { background: var(--surface-3); border: 1px solid var(--line); border-radius: 10px; color: var(--text-2); font-size: 12px; height: 40px; width: 40px; }
.visit-card-sort button:disabled { opacity: .3; }
.visit-table-group { margin-bottom: 26px; }
.visit-table-group h3 { align-items: center; color: var(--text-2); display: flex; font-size: 14px; font-weight: 700; gap: 10px; letter-spacing: .06em; margin: 0 0 10px 2px; }
.visit-table-group h3::after { background: linear-gradient(90deg, var(--line-strong), transparent); content: ""; flex: 1; height: 1px; }
.visit-table-group-list { display: grid; gap: 12px; }
.customer-visit-card { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); display: grid; gap: 10px 12px; grid-template-columns: 40px minmax(0, 1fr) auto; padding: 14px 16px; }
.customer-visit-card .visit-card-sort { align-self: stretch; grid-column: 1; grid-row: 1 / span 3; justify-content: center; }
.customer-visit-card .customer-visit-name { font-size: 20px; font-weight: 800; grid-column: 2; justify-self: start; max-width: 100%; }
.customer-visit-card .customer-staff-badge { grid-column: 3; }
.customer-visit-card .new-bottle-button, .customer-visit-card .customer-visit-exit { align-items: center; border-radius: var(--radius); display: inline-flex; font-size: 15px; font-weight: 700; grid-column: 2 / -1; justify-content: center; min-height: 48px; width: 100%; }
.customer-visit-card .new-bottle-button { background: transparent; border: 1px solid rgba(var(--accent-rgb), .5); color: var(--accent); }
.customer-visit-card .customer-visit-exit { background: rgba(255, 138, 76, .16); border: 0; color: var(--warn); display: none; }
.customer-visit-card.editing .customer-visit-exit { display: inline-flex; }
.bottle-row.visit-highlight, .customer-visit-card.visit-highlight, .customer-row.just-registered { animation: flash 2.2s ease; border-color: var(--accent); }
@keyframes flash { 0%, 55% { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .55); } 100% { box-shadow: 0 0 0 3px transparent; } }

/* ---------- Customers ---------- */
.customer-list { display: grid; gap: 10px; }
.customer-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.customer-row.expanded { background: var(--surface-2); border-color: rgba(var(--accent-rgb), .4); }
.customer-summary { align-items: center; display: flex; gap: 10px; min-height: 66px; padding: 8px 16px; }
.customer-name-button { background: none; border: 0; flex: 1; font-size: 19px; font-weight: 800; letter-spacing: -.01em; min-height: 48px; min-width: 0; overflow: hidden; padding: 0; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.customer-last-visited { color: var(--text-3); flex: 0 0 auto; font-size: 13px; white-space: nowrap; }
.customer-staff-badge { background: var(--surface-3); border-radius: 8px; color: var(--text-2); flex: 0 0 auto; font-size: 12px; font-weight: 600; padding: 3px 10px; white-space: nowrap; }
.customer-summary > b { background: rgba(var(--accent-rgb), .15); border-radius: 10px; color: var(--accent); flex: 0 0 auto; font-size: 16px; min-width: 44px; padding: 3px 11px; text-align: center; }
.customer-summary > b small { font-size: 11px; font-weight: 600; margin-left: 1px; }
.customer-details { display: none; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }
.customer-row.expanded .customer-details { display: flex; }
.customer-details > .visit-history-button, .customer-details > .customer-new-bottle-button, .customer-details > .customer-edit-button { background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text-2); flex: 1; font-size: 14px; font-weight: 700; min-height: 46px; white-space: nowrap; }
.customer-details > .customer-new-bottle-button { border-color: rgba(var(--accent-rgb), .5); color: var(--accent); }
.customer-detail, .customer-no-bottles { align-items: center; background: var(--surface-3); border-radius: var(--radius); display: grid; flex-basis: 100%; gap: 12px; grid-template-columns: 64px minmax(0, 1fr) 72px; padding: 10px 12px; }
.customer-no-bottles { color: var(--text-3); font-size: 14px; grid-template-columns: 64px 1fr; }
.customer-visit-button { background: rgba(var(--accent-rgb), .15); border: 0; border-radius: 10px; color: var(--accent); font-size: 14px; font-weight: 700; min-height: 44px; }
.customer-visit-button.visiting { background: rgba(255, 138, 76, .17); color: var(--warn); }
.customer-detail-name { display: grid; min-width: 0; }
.customer-brand { background: none; border: 0; font-size: 17px; font-weight: 700; overflow: hidden; padding: 0; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.customer-detail-name span { color: var(--text-3); font-size: 13px; }
.customer-detail-remaining { display: grid; gap: 5px; justify-items: end; }
.customer-detail-remaining b { font-size: 16px; }
.level-track { background: var(--surface); border-radius: 4px; height: 6px; overflow: hidden; width: 100%; }
.level-track span { background: var(--accent); border-radius: inherit; display: block; height: 100%; }
.level-track.low span { background: var(--warn); }
.customer-visit-history { display: none; gap: 6px; padding: 0 16px 16px; }
.customer-row.history-open .customer-visit-history { display: grid; }
.customer-visit-history > div { align-items: center; background: var(--surface-3); border-radius: var(--radius-sm); display: grid; gap: 8px; grid-template-columns: auto 1fr auto; padding: 9px 12px; }
.customer-visit-history b { font-size: 15px; }
.customer-visit-history span { color: var(--text-2); font-size: 14px; }
.customer-visit-history .visit-brand { color: var(--text); text-align: right; }
.list-note { color: var(--text-3); padding: 28px 0; text-align: center; }

/* ---------- Empty states ---------- */
.empty-state { color: var(--text-2); display: grid; justify-items: center; padding: 44px 16px; text-align: center; }
.empty-illustration { align-items: center; background: rgba(var(--accent-rgb), .1); border-radius: 28px; color: var(--accent); display: flex; height: 92px; justify-content: center; margin-bottom: 16px; width: 92px; }
.empty-illustration svg { height: 46px; stroke-width: 2; width: 46px; }
.empty-state h3 { color: var(--text); font-size: 19px; font-weight: 800; margin: 0 0 6px; }
.empty-state p { font-size: 14px; margin: 0 0 20px; max-width: 300px; }
.empty-state .primary-button { min-width: 220px; }
.empty-state .text-button { margin-top: 6px; }
.first-run { padding-top: 56px; }

/* ---------- Inventory ---------- */
.inventory-list { display: grid; gap: 8px; }
.inventory-row { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; gap: 12px; justify-content: space-between; min-height: 60px; padding: 8px 16px; text-align: left; width: 100%; }
.inventory-row strong { font-size: 17px; font-weight: 700; }
.inventory-stock-control { background: rgba(var(--accent-rgb), .15); border-radius: 10px; color: var(--accent); font-size: 18px; min-width: 56px; padding: 3px 14px; text-align: center; }
.inventory-stock-control small { font-size: 12px; margin-left: 2px; }
.inventory-stock-control.untracked { background: var(--surface-3); color: var(--text-3); }
.inventory-modal-summary { align-items: baseline; display: flex; justify-content: space-between; margin-bottom: 16px; }
.inventory-modal-summary span { color: var(--text-2); }
.inventory-modal-summary strong { color: var(--accent); font-size: 30px; font-weight: 800; }
.inventory-update-form { display: grid; gap: 14px; }
.inventory-update-form label { color: var(--text-2); display: grid; font-size: 14px; gap: 7px; }
.inventory-update-form input { text-align: right; }
.inventory-history { margin-top: 22px; }
.inventory-history h3 { color: var(--text-2); font-size: 14px; margin: 0 0 8px; }
.inventory-history > div { border-top: 1px solid var(--line); display: flex; gap: 14px; padding: 10px 0; }
.inventory-history span { color: var(--text-3); }
.inventory-history p { color: var(--text-3); margin: 0; }
.inventory-update-button { margin-bottom: 4px; width: 100%; }

/* ---------- Settings ---------- */
.settings-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 12px; padding: 18px 16px; }
.settings-card h3 { font-size: 16px; font-weight: 800; margin: 0 0 12px; }
.settings-help { color: var(--text-2); font-size: 13px; margin: -6px 0 12px; }
.setting-field { color: var(--text-2); display: grid; font-size: 14px; gap: 8px; }
.setting-input-suffix { align-items: center; display: flex; gap: 10px; }
.setting-field .setting-input-suffix input { flex: 0 0 110px; width: 110px; }
.setting-input-suffix span { color: var(--text-2); white-space: nowrap; }
.option-form, .brand-form { display: flex; gap: 8px; }
.option-form input, .brand-form input, .setting-field input, .setting-field select, .modal input, .modal select, .modal textarea, .whisky-age-select {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  min-height: 52px;
  outline: 0;
  padding: 10px 14px;
  width: 100%;
}
.option-form input, .brand-form input { flex: 1; min-width: 0; }
.option-form .secondary-button, .brand-form .secondary-button { flex: 0 0 auto; }
input:focus, select:focus { border-color: rgba(var(--accent-rgb), .7) !important; }
.brand-list, .option-list { margin-top: 10px; }
.brand-row { align-items: center; border-top: 1px solid var(--line); display: flex; font-size: 15px; justify-content: space-between; min-height: 50px; }
.brand-row button { background: none; border: 0; color: var(--text-3); font-size: 22px; height: 44px; width: 44px; }
.theme-color-options { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.theme-color-option { align-items: center; background: var(--surface-2); border: 2px solid transparent; border-radius: var(--radius); color: var(--text-3); display: grid; font-size: 12px; gap: 6px; justify-items: center; padding: 12px 6px; }
.theme-color-sample { background: var(--sample-color); border: 1px solid rgba(255, 255, 255, .22); border-radius: 10px; display: block; height: 36px; width: 36px; }
.theme-color-option.selected { border-color: var(--sample-color); color: var(--text); }
.brand-catalog { margin-bottom: 12px; }
.brand-category { border-top: 1px solid var(--line); }
.brand-category summary { align-items: center; cursor: pointer; display: flex; font-size: 15px; font-weight: 700; justify-content: space-between; list-style: none; min-height: 50px; }
.brand-category summary::-webkit-details-marker { display: none; }
.brand-category summary span { color: var(--text-3); transition: transform .2s ease; }
.brand-category[open] summary span { transform: rotate(180deg); }
.brand-category-list { display: grid; padding-bottom: 8px; }
.catalog-brand-row { align-items: center; display: flex; gap: 8px; justify-content: space-between; min-height: 48px; }
.catalog-brand-row > span { flex: 1; font-size: 15px; min-width: 0; }
.whisky-age-select { min-height: 40px; padding: 4px 8px; width: 98px; }
.catalog-add-button { background: transparent; border: 1px solid rgba(var(--accent-rgb), .5); border-radius: 10px; color: var(--accent); font-size: 14px; font-weight: 700; min-height: 40px; padding: 0 14px; }
.catalog-add-button.added { background: rgba(var(--accent-rgb), .15); border-color: transparent; }

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  background: rgba(20, 18, 16, .86);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border-top: 1px solid var(--line);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: 6px max(8px, calc((100vw - 600px) / 2)) calc(var(--safe-bottom) + 4px);
  position: fixed;
  right: 0;
  z-index: 30;
}
.bottom-nav a { align-items: center; border-radius: 14px; color: var(--text-3); display: flex; flex: 1; flex-direction: column; font-size: 11px; font-weight: 700; gap: 3px; justify-content: center; min-height: 54px; position: relative; transition: color .15s ease; }
.bottom-nav svg { height: 25px; width: 25px; }
.bottom-nav a.active { color: var(--accent); }
.bottom-nav a.active::before { background: var(--accent); border-radius: 0 0 3px 3px; content: ""; height: 3px; left: 28%; position: absolute; right: 28%; top: -7px; }
.nav-badge { background: var(--danger); border-radius: 8px; color: #fff; font-size: 11px; font-weight: 700; left: calc(50% + 6px); min-width: 18px; padding: 1px 5px; position: absolute; text-align: center; top: 3px; }

/* ---------- Sheets / modals ---------- */
.modal-backdrop { align-items: flex-end; animation: fade .2s ease both; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); background: rgba(0, 0, 0, .62); display: flex; inset: 0; justify-content: center; overflow: hidden; position: fixed; z-index: 40; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal, .bottle-popup {
  animation: sheet .28s cubic-bezier(.2, .9, .3, 1) both;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  max-height: 92dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 20px calc(var(--safe-bottom) + 22px);
  position: relative;
  width: min(100%, 600px);
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-handle { background: var(--line-strong); border-radius: 3px; display: block; height: 5px; margin: 0 auto 14px; width: 40px; }
.modal h2 { font-size: 21px; font-weight: 800; margin: 0 0 16px; padding-right: 44px; }
.modal-close { align-items: center; background: var(--surface-3); border: 0; border-radius: 12px; color: var(--text-2); display: flex; font-size: 22px; height: 40px; justify-content: center; line-height: 1; position: absolute; right: 16px; top: 14px; width: 40px; z-index: 2; }
.modal form { display: grid; gap: 16px; }
.modal label { color: var(--text-2); display: grid; font-size: 14px; font-weight: 600; gap: 7px; min-width: 0; }
.field-note { color: var(--text-3); font-size: 12px; font-weight: 400; margin-left: 4px; }
.modal select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-repeat: no-repeat; background-size: 6px 6px; padding-right: 36px; }
.modal input[type="date"] { -webkit-appearance: none; appearance: none; display: block; height: 52px; max-width: 100%; min-width: 0; }
.modal input[type="date"]::-webkit-date-and-time-value { min-width: 0; text-align: left; }
.modal .locked-field { background: var(--surface-3); color: var(--text-3); opacity: .85; }
.modal-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.modal-actions .primary-button { min-height: 54px; width: 100%; }
.field-group { display: grid; gap: 8px; }
.field-title { color: var(--text-2); font-size: 14px; font-weight: 600; }
.brand-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.brand-chip { background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 12px; color: var(--text); font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 16px; }
.brand-chip.selected { background: rgba(var(--accent-rgb), .16); border-color: var(--accent); color: var(--accent); }
.form-more { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.form-more summary { align-items: center; color: var(--text); cursor: pointer; display: flex; font-size: 15px; font-weight: 700; gap: 10px; list-style: none; min-height: 52px; padding: 0 16px; }
.form-more summary::-webkit-details-marker { display: none; }
.form-more summary::after { border-bottom: 2px solid var(--text-3); border-right: 2px solid var(--text-3); content: ""; height: 8px; margin-left: auto; transform: rotate(45deg); transition: transform .2s ease; width: 8px; }
.form-more[open] summary::after { transform: rotate(-135deg); }
.form-more summary small { color: var(--text-3); font-size: 12px; font-weight: 400; }
.form-more-body { border-top: 1px solid var(--line); display: grid; gap: 16px; padding: 16px; }
.drink-options { border: 0; display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); margin: 0; padding: 0; }
.drink-options legend { color: var(--text-2); font-size: 14px; font-weight: 600; margin-bottom: 7px; padding: 0; }
.drink-options label { align-items: center; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); display: flex; font-size: 15px; gap: 9px; min-height: 48px; padding: 0 12px; }
.drink-options input { accent-color: var(--accent); height: 20px; margin: 0; min-height: 0; padding: 0; width: 20px; }
.table-choice-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.table-choice-button { background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); font-size: 24px; font-weight: 800; min-height: 72px; }
.table-choice-button:active { background: var(--accent); color: var(--accent-ink); }
.bottle-popup .bottle-row { margin-top: 30px; }
.auth-description, .auth-message { color: var(--text-2); font-size: 14px; }
.auth-provider-list { display: grid; gap: 10px; margin-top: 12px; }
.auth-provider-button { align-items: center; background: #fff; border: 1px solid #fff; border-radius: var(--radius); color: #171514; display: flex; font-size: 16px; font-weight: 700; gap: 10px; justify-content: center; min-height: 54px; width: 100%; }
.apple-auth-button { background: #000; border-color: var(--line-strong); color: #fff; }
.auth-account p { margin: 0 0 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-signout-button { width: 100%; }

/* ---------- Toast ---------- */
.toast {
  align-items: center;
  background: #f5f0e8;
  border-radius: 16px;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  color: #1b1815;
  display: flex;
  font-size: 15px;
  font-weight: 700;
  gap: 4px;
  left: 50%;
  max-width: min(92vw, 520px);
  width: max-content;
  opacity: 0;
  padding: 6px 8px 6px 18px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 14px);
  transition: opacity .22s ease, transform .22s ease;
  z-index: 60;
}
.toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast button { background: none; border: 0; border-radius: 10px; color: #8a5a06; font-size: 15px; font-weight: 800; min-height: 44px; padding: 0 12px; }
.toast #toast-ok { color: #6d655b; display: none; }
.toast.saved-toast #toast-ok { display: block; }
/* Save confirmation: centred, stays until OK is pressed, so the bottle can be shelved from it. */
.toast.saved-toast { align-items: stretch; bottom: auto; flex-direction: column; font-size: 16px; gap: 6px; padding: 22px 20px 12px; text-align: center; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 340px); }
.toast.saved-toast.show { transform: translate(-50%, -50%); }
.saved-customer { color: #6d655b; font-size: 15px; }
.saved-brand { display: block; font-size: 22px; line-height: 1.3; }
.saved-shelf, .saved-number { background: #1b1815; border-radius: 12px; color: var(--accent); font-size: 20px; font-weight: 800; padding: 8px; }
.saved-number { font-size: 32px; letter-spacing: .06em; }
.toast.saved-toast #toast-ok { background: #1b1815; color: #f5f0e8; font-size: 17px; margin-top: 8px; min-height: 50px; }

/* ---------- Wide screens: keep the phone column centred ---------- */
@media (min-width: 700px) {
  .topbar { padding-left: max(16px, calc((100vw - 600px) / 2)); padding-right: max(16px, calc((100vw - 600px) / 2)); }
  .modal-backdrop { align-items: center; }
  .modal, .bottle-popup { border-bottom: 1px solid var(--line); border-radius: 26px; }
}
@media (max-width: 360px) {
  .meta-chips { grid-template-columns: 1fr; }
  .gauge i { width: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Depth & gradients ----------
   Light comes from the top-right. Surfaces get a soft sheen, status is a tint (never a side bar),
   and every accent fill is a short two-stop gradient so it reads as lit rather than flat. */
body {
  background:
    radial-gradient(90% 38% at 100% -4%, rgba(var(--accent-rgb), .16), transparent 62%),
    radial-gradient(80% 34% at 0% 104%, rgba(var(--accent-rgb), .08), transparent 62%),
    linear-gradient(180deg, #131110 0%, var(--bg) 46%);
  background-attachment: fixed;
}
.topbar h1 { background: linear-gradient(180deg, #ffffff 10%, #d8cbb8 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.topbar { background: linear-gradient(180deg, rgba(20, 18, 16, .92), rgba(13, 12, 11, .72)); }

.bottle-row, .customer-row, .customer-visit-card, .settings-card, .inventory-row {
  background:
    linear-gradient(155deg, rgba(255, 244, 230, .075) 0%, rgba(255, 244, 230, .018) 48%, rgba(255, 244, 230, .04) 100%),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 10px 26px -14px rgba(0, 0, 0, .7);
}
.bottle-row.warning { background-image: radial-gradient(120% 100% at 100% 0%, rgba(255, 138, 76, .16), transparent 58%), linear-gradient(155deg, rgba(255, 244, 230, .06), rgba(255, 244, 230, .015) 55%); }
.bottle-row.expired { background-image: radial-gradient(120% 100% at 100% 0%, rgba(255, 107, 107, .2), transparent 58%), linear-gradient(155deg, rgba(255, 244, 230, .06), rgba(255, 244, 230, .015) 55%); }
.bottle-row.editing, .customer-row.expanded { background-image: radial-gradient(130% 90% at 100% 0%, rgba(var(--accent-rgb), .16), transparent 60%), linear-gradient(155deg, rgba(255, 244, 230, .07), rgba(255, 244, 230, .02) 55%); }

.primary-button, .remaining-choice.selected, .editor-actions .edit-button.save-remaining-mode {
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 58%, var(--accent-dark) 140%);
}
.primary-button { box-shadow: 0 8px 22px -8px rgba(var(--accent-rgb), .6), inset 0 1px 0 rgba(255, 255, 255, .35); }
.primary-button:hover { background: linear-gradient(135deg, var(--accent-hover), var(--accent)); filter: brightness(1.06); }
.remaining-choice.selected { box-shadow: 0 6px 16px -6px rgba(var(--accent-rgb), .7); }
.secondary-button { background: linear-gradient(180deg, rgba(255, 244, 230, .09), rgba(255, 244, 230, .03)); }

.number-badge, .customer-summary > b, .inventory-stock-control { background: linear-gradient(135deg, rgba(var(--accent-rgb), .32), rgba(var(--accent-rgb), .1)); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .25); }
.expiry { background: linear-gradient(135deg, rgba(255, 244, 230, .12), rgba(255, 244, 230, .05)); }
.expiry.warning { background: linear-gradient(135deg, rgba(255, 138, 76, .3), rgba(255, 138, 76, .1)); }
.expiry.expired { background: linear-gradient(135deg, rgba(255, 107, 107, .32), rgba(255, 107, 107, .1)); }
.gauge i.on, .level-track span { background: linear-gradient(90deg, var(--accent-hover), var(--accent)); }
.gauge.low i.on, .level-track.low span { background: linear-gradient(90deg, #ffb27d, var(--warn)); }
.gauge i { background: linear-gradient(180deg, rgba(255, 244, 230, .1), rgba(255, 244, 230, .05)); }

.filter-chip.active { background: linear-gradient(135deg, rgba(var(--accent-rgb), .3), rgba(var(--accent-rgb), .1)); }
.brand-chip.selected { background: linear-gradient(135deg, rgba(var(--accent-rgb), .32), rgba(var(--accent-rgb), .1)); }
.customer-visit-button, .editor-actions .visit-button { background: linear-gradient(135deg, rgba(var(--accent-rgb), .28), rgba(var(--accent-rgb), .08)); }

.empty-illustration { background: linear-gradient(145deg, rgba(var(--accent-rgb), .3), rgba(var(--accent-rgb), .05)); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .25), 0 18px 40px -16px rgba(var(--accent-rgb), .5); }

.bottom-nav { background: linear-gradient(180deg, rgba(26, 23, 20, .82), rgba(13, 12, 11, .96)); }
.bottom-nav a.active::before { background: linear-gradient(90deg, transparent, var(--accent-hover), transparent); box-shadow: 0 2px 14px 1px rgba(var(--accent-rgb), .7); }
.bottom-nav a.active svg { filter: drop-shadow(0 0 7px rgba(var(--accent-rgb), .55)); }
.nav-badge { background: linear-gradient(135deg, #ff8a8a, var(--danger)); }

.modal, .bottle-popup { background: linear-gradient(180deg, rgba(var(--accent-rgb), .1), transparent 160px), var(--surface); }
.form-more, .meta-chips > div, .customer-detail, .customer-no-bottles { background: linear-gradient(160deg, rgba(255, 244, 230, .06), rgba(255, 244, 230, .02)), var(--surface-2); }
.toast { background: linear-gradient(160deg, #fffaf2, #eadfce); }

/* ---------- Ledger import ---------- */
.import-lead { color: var(--text-2); font-size: 14px; margin: 0 0 16px; }
.import-pick { margin-bottom: 18px; width: 100%; }
.import-hint { background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px; }
.import-hint h3 { font-size: 14px; margin: 0 0 8px; }
.import-hint p { font-size: 14px; margin: 0 0 4px; }
.import-hint b { color: var(--accent); margin-right: 6px; }
.import-hint ul { color: var(--text-2); font-size: 13px; margin: 10px 0 0; padding-left: 18px; }
.import-error { background: rgba(255, 107, 107, .14); border-radius: var(--radius-sm); color: var(--danger); font-size: 14px; margin: 0 0 14px; padding: 10px 12px; }
.import-file { align-items: baseline; display: flex; gap: 10px; justify-content: space-between; margin: 0 0 8px; }
.import-file span { color: var(--text-3); font-size: 13px; }
.import-file b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal .import-check { align-items: center; color: var(--text-2); display: flex; font-size: 14px; gap: 10px; margin-bottom: 12px; min-height: 44px; }
.modal .import-check input { accent-color: var(--accent); height: 20px; width: 20px; }
.map-list { display: grid; gap: 8px; }
.map-row { align-items: center; background: var(--surface-2); border-radius: var(--radius); display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) 150px; padding: 8px 8px 8px 14px; }
.map-source { min-width: 0; }
.map-source b, .map-source small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-source small { color: var(--text-3); font-size: 12px; }
.map-row select { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); min-height: 46px; padding: 0 8px; width: 100%; }
.import-actions { background: linear-gradient(180deg, transparent, var(--surface) 28%); bottom: 0; display: grid; gap: 10px; grid-template-columns: 1fr 1.5fr; margin: 12px -4px 0; padding: 18px 4px 4px; position: sticky; z-index: 1; }
.import-actions .primary-button:disabled { filter: grayscale(1); opacity: .45; }
.import-summary { display: grid; gap: 8px; grid-template-columns: repeat(4, 1fr); margin-bottom: 12px; }
.import-summary div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 6px; text-align: center; }
.import-summary b { display: block; font-size: 22px; line-height: 1.2; }
.import-summary span { color: var(--text-3); font-size: 11px; }
.import-summary .warn b { color: var(--warn); }
.import-summary .dup b { color: var(--text-2); }
.import-summary .err b { color: var(--danger); }
.import-note { color: var(--text-2); font-size: 13px; margin: 0 0 10px; }
.import-rows { display: grid; gap: 8px; max-height: 46dvh; overflow-y: auto; padding-right: 2px; }
.import-row { background: var(--surface-2); border-radius: var(--radius); display: grid; gap: 4px; grid-template-columns: 40px minmax(0, 1fr); padding: 10px 12px 10px 4px; }
.import-row.warn { box-shadow: inset 0 0 0 1px rgba(255, 138, 76, .35); }
.import-row.error { box-shadow: inset 0 0 0 1px rgba(255, 107, 107, .4); }
.import-row.duplicate { opacity: .6; }
.modal .import-include { align-items: flex-start; display: flex; justify-content: center; padding-top: 4px; }
.import-include input { accent-color: var(--accent); height: 22px; width: 22px; }
.import-body { min-width: 0; }
.import-line { align-items: center; display: flex; gap: 8px; justify-content: space-between; }
.import-line b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-line small { color: var(--text-3); font-size: 13px; margin-right: auto; white-space: nowrap; }
.import-scope { margin: 6px 0 10px; }
.import-status { background: var(--surface-3); border-radius: 8px; color: var(--text-2); flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 2px 8px; }
.import-row.warn .import-status { color: var(--warn); }
.import-row.error .import-status { color: var(--danger); }
.import-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.import-messages { color: var(--warn); font-size: 12px; list-style: none; margin: 6px 0 0; padding: 0; }
.import-messages li { margin-top: 2px; }
.import-row.duplicate .import-messages, .import-row.error .import-messages { color: var(--text-3); }

/* ---------- Sign-in gate, sync status, members ---------- */
.sync-pill { background: var(--surface-3); border-radius: 10px; color: var(--text-2); font-size: 12px; font-weight: 700; padding: 5px 10px; white-space: nowrap; }
.sync-pill.warn { background: rgba(255, 138, 76, .18); color: var(--warn); }
body.gate-open { overflow: hidden; }
.gate { align-items: center; background: radial-gradient(90% 45% at 50% 0%, rgba(var(--accent-rgb), .18), transparent 65%), linear-gradient(180deg, #151210, var(--bg)); display: flex; inset: 0; justify-content: center; overflow-y: auto; padding: calc(var(--safe-top) + 24px) 24px calc(var(--safe-bottom) + 24px); position: fixed; z-index: 90; }
.gate-card { display: grid; gap: 14px; justify-items: center; max-width: 380px; text-align: center; width: 100%; }
.gate-logo { align-items: center; background: linear-gradient(145deg, rgba(var(--accent-rgb), .3), rgba(var(--accent-rgb), .05)); border-radius: 28px; box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .25), 0 18px 40px -16px rgba(var(--accent-rgb), .5); color: var(--accent); display: flex; height: 96px; justify-content: center; width: 96px; }
.gate-logo svg { height: 52px; stroke-width: 2; width: 52px; }
.gate h1 { font-size: 26px; font-weight: 800; margin: 4px 0 0; }
.gate-sub { color: var(--text-2); margin: -6px 0 10px; }
.gate-loading { color: var(--text-2); }
.gate-fine { color: var(--text-3); font-size: 12px; line-height: 1.7; margin: 0; max-width: 300px; }
.gate-error { color: var(--danger); font-size: 14px; margin: 0; min-height: 1.4em; }
.apple-button { align-items: center; background: #fff; border: 0; border-radius: 14px; color: #000; display: flex; font-size: 18px; font-weight: 600; gap: 8px; justify-content: center; min-height: 56px; width: 100%; }
.apple-button:disabled { opacity: .6; }
.apple-glyph { height: 22px; width: 22px; }
.gate-section { background: linear-gradient(160deg, rgba(255, 244, 230, .07), rgba(255, 244, 230, .02)), var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); display: grid; gap: 10px; padding: 16px; text-align: left; width: 100%; }
.gate-section h2 { font-size: 15px; margin: 0; }
.gate-section input { background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); min-height: 52px; outline: 0; padding: 0 14px; width: 100%; }
.gate-section input:focus { border-color: rgba(var(--accent-rgb), .7); }
.gate-or { color: var(--text-3); font-size: 13px; margin: 0; }
.gate-stores { display: grid; gap: 10px; width: 100%; }
.gate-store { align-items: center; background: linear-gradient(160deg, rgba(255, 244, 230, .07), rgba(255, 244, 230, .02)), var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; justify-content: space-between; min-height: 62px; padding: 8px 16px; text-align: left; width: 100%; }
.gate-store span { color: var(--text-3); font-size: 13px; }
.members-block { margin-bottom: 20px; }
.members-block h3 { font-size: 15px; margin: 0 0 8px; }
.members-list { display: grid; gap: 8px; }
.member-row { align-items: center; background: var(--surface-2); border-radius: var(--radius); display: flex; gap: 10px; justify-content: space-between; padding: 10px 12px; }
.member-row b, .member-row small { display: block; }
.member-row small { color: var(--text-3); font-size: 12px; }
.member-row .secondary-button { min-height: 40px; padding: 0 12px; }
.invite-result { align-items: center; background: var(--surface-2); border-radius: var(--radius); display: grid; gap: 6px; justify-items: center; margin-bottom: 12px; padding: 14px; }
.invite-code { color: var(--accent); font-size: 32px; letter-spacing: .12em; }
.invite-result small { color: var(--text-3); }
.primary-button.wide { width: 100%; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 16px; }

/* ---------- Onboarding (ボトルくん) ---------- */
body.onboarding-open { overflow: hidden; }
.onboarding { animation: fade .25s ease both; inset: 0; position: fixed; z-index: 95; }
.onboarding.leaving { opacity: 0; transition: opacity .25s ease; }
.ob-spot {
  border-radius: 18px;
  box-shadow: 0 0 0 200vmax rgba(6, 5, 4, .74);
  pointer-events: none;
  position: fixed;
  transition: left .4s cubic-bezier(.2, .8, .2, 1), top .4s cubic-bezier(.2, .8, .2, 1), width .4s cubic-bezier(.2, .8, .2, 1), height .4s cubic-bezier(.2, .8, .2, 1);
}
.ob-spot.has-target { animation: ob-pulse 1.6s ease-in-out infinite; }
@keyframes ob-pulse {
  0%, 100% { outline: 2px solid rgba(var(--accent-rgb), .9); outline-offset: 0; }
  50% { outline: 2px solid rgba(var(--accent-rgb), .25); outline-offset: 6px; }
}
.ob-dock { align-items: flex-end; display: flex; gap: 4px; left: 16px; position: fixed; right: 16px; transition: top .4s ease, bottom .4s ease; }
.ob-dock.bottom { bottom: calc(var(--safe-bottom) + var(--nav-height) + 20px); }
.ob-dock.top { top: calc(var(--safe-top) + 16px); }
.ob-dock.centered { align-items: center; bottom: auto; flex-direction: column; gap: 0; top: 50%; transform: translateY(-55%); }
.ob-kun { cursor: pointer; flex: 0 0 auto; height: 156px; touch-action: manipulation; width: 108px; }
.ob-dock.centered .ob-kun { height: 280px; max-height: 38dvh; width: 240px; }
.ob-bubble {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .8);
  flex: 1 1 auto;
  margin-bottom: 18px;
  max-width: 420px;
  min-width: 0;
  padding: 16px 16px 10px;
  position: relative;
}
.ob-bubble::before { background: inherit; border-bottom: 1px solid var(--line-strong); border-left: 1px solid var(--line-strong); bottom: 28px; content: ""; height: 14px; left: -8px; position: absolute; transform: rotate(45deg); width: 14px; }
.ob-dock.centered .ob-bubble { margin-bottom: 0; text-align: center; width: 100%; }
.ob-dock.centered .ob-bubble::before { border: 0; border-left: 1px solid var(--line-strong); border-top: 1px solid var(--line-strong); bottom: auto; left: calc(50% - 7px); top: -8px; }
.ob-text { font-size: 16px; font-weight: 600; line-height: 1.65; margin: 0; min-height: 3.3em; white-space: pre-line; }
.ob-footer { align-items: center; display: flex; gap: 4px; justify-content: flex-end; margin-top: 6px; }
.ob-dots { display: flex; gap: 5px; margin-bottom: 8px; }
.ob-dock.centered .ob-dots { justify-content: center; }
.ob-dock.centered .ob-footer { justify-content: center; }
.ob-dots i { background: var(--surface-3); border-radius: 99px; height: 6px; transition: width .25s ease, background .25s ease; width: 6px; }
.ob-dots i.on { background: var(--accent); width: 18px; }
.ob-footer .text-button { color: var(--text-3); min-height: 44px; padding: 0 10px; white-space: nowrap; }
.ob-footer .primary-button { min-height: 44px; min-width: 96px; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .ob-spot, .ob-dock { transition: none; }
  .ob-spot.has-target { animation: none; outline: 2px solid rgba(var(--accent-rgb), .9); }
}

.bottle-memo { font-weight: 500; white-space: pre-wrap; }
.modal textarea { font-family: inherit; line-height: 1.5; min-height: 64px; padding: 10px 14px; resize: vertical; }

/* PC 取り込みページ: 台帳の画面は出さず、コード入力と取り込みだけを見せる */
html.pc-mode .topbar, html.pc-mode .main-content, html.pc-mode .bottom-nav { visibility: hidden; }
