@charset "UTF-8";
* { box-sizing: border-box; }
body {
    font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
    background: #f4f5f7;
    margin: 0;
    color: #222;
}
.container { max-width: 1000px; margin: 0 auto; padding: 24px 16px; }
h1 { font-size: 20px; margin-bottom: 16px; }
.topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.btn {
    display: inline-block; padding: 8px 16px; border-radius: 6px;
    background: #2563eb; color: #fff; text-decoration: none; font-size: 14px; border: none; cursor: pointer;
}
.btn.secondary { background: #6b7280; }
.btn.danger { background: #dc2626; }
form.search { display: flex; gap: 8px; flex-wrap: wrap; }
input, select, textarea {
    padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
th, td { padding: 10px 12px; border-bottom: 1px solid #eee; text-align: left; font-size: 14px; }
th { background: #f0f1f3; }
tr:hover { background: #fafbff; }
.low-stock { color: #dc2626; font-weight: bold; }
.actions a { margin-right: 8px; font-size: 13px; }
.card { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); max-width: 480px; }
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; color: #555; }
.field input, .field textarea { width: 100%; }
.note { color: #888; font-size: 12px; margin-top: 4px; }

.store-list { display: flex; flex-direction: column; gap: 10px; max-width: 400px; }
.store-card {
    display: flex; justify-content: space-between; align-items: center;
    background: #fff; padding: 16px 18px; border-radius: 8px; text-decoration: none;
    color: #222; box-shadow: 0 1px 3px rgba(0,0,0,.08); font-size: 15px;
}
.store-card:hover { background: #f0f4ff; }
.store-arrow { color: #999; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
    padding: 8px 16px; border-radius: 20px; text-decoration: none; font-size: 14px;
    background: #e5e7eb; color: #444;
}
.tab.active { background: #2563eb; color: #fff; }

.breadcrumb { font-size: 13px; color: #888; margin-bottom: 8px; }
.breadcrumb a { color: #2563eb; text-decoration: none; }

.checkbox-field { display: flex; align-items: center; gap: 8px; flex-direction: row; }
.checkbox-field input { width: auto; }
.threshold-row { display: flex; gap: 8px; align-items: center; }

/* ドラムピッカー */
.picker-wrap { position: relative; display: flex; align-items: center; justify-content: center; gap: 4px; margin: 16px 0; user-select: none; }
.wheel-col { position: relative; height: 132px; width: 64px; overflow-y: scroll; scroll-snap-type: y mandatory; -webkit-overflow-scrolling: touch; }
.wheel-col::-webkit-scrollbar { display: none; }
.wheel-col { scrollbar-width: none; }
.wheel-col .wheel-pad { height: 44px; }
.wheel-col .wheel-item {
    height: 44px; display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #aaa; scroll-snap-align: center;
}
.wheel-col .wheel-item.selected { color: #111; font-weight: bold; }
.picker-frame {
    position: absolute; top: 44px; left: 0; right: 0; height: 44px;
    border-top: 1px solid #d1d5db; border-bottom: 1px solid #d1d5db;
    pointer-events: none; z-index: 5;
}
.picker-sep { font-size: 22px; color: #333; padding-bottom: 2px; }
.picker-unit { font-size: 15px; color: #555; margin-left: 6px; }
.picker-readout { text-align: center; font-size: 14px; color: #666; margin-bottom: 4px; }
.purchase-mode-toggle { display: flex; gap: 8px; margin-bottom: 12px; }
.purchase-mode-toggle button {
    flex: 1; padding: 10px; border-radius: 6px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; font-size: 14px;
}
.purchase-mode-toggle button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.action-section { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 20px; }
.action-section h2 { font-size: 15px; margin: 0 0 12px; }
.roll-info { text-align: center; font-size: 14px; color: #444; margin-bottom: 14px; }

/* カレンダー */
.calendar-wrap { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; max-width: 320px; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 14px; font-weight: bold; }
.calendar-header button { background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px 10px; color: #2563eb; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 12px; color: #888; margin-bottom: 4px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.calendar-day {
    display: flex; align-items: center; justify-content: center; height: 36px; border-radius: 6px;
    font-size: 13px; cursor: pointer; color: #333;
}
.calendar-day:hover { background: #f0f4ff; }
.calendar-day.other-month { visibility: hidden; }
.calendar-day.selected { background: #2563eb; color: #fff; font-weight: bold; }

/* ---------- モバイル向け新UI ---------- */
:root {
    /* ==== デザイン差し替えポイント ====
       ボタンやタブの色味はここを書き換えるだけで全体に反映されます */
    --brand-ink: #1C2A3A;      /* ヘッダー・ボトムナビの濃色 */
    --brand-accent: #2563EB;   /* アクティブタブ・在庫数などの強調色 */
    --brand-use: #C2571B;      /* 使用ボタンの色 */
    --brand-purchase: #0F6E6B; /* 仕入れの色 */
    --brand-line: #1C2A3A;     /* 行の区切り線・タブの縁取り */
}
body { padding-bottom: 68px; background: #F3F4F7; } /* ボトムナビ分の余白 */

/* 店舗切り替えドロップダウン */
.store-switch {
    display: flex; align-items: center; justify-content: space-between;
    background: #fff; margin: 10px 10px 0; padding: 10px 14px;
    border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.07);
    font-weight: bold; font-size: 14px;
}
.store-switch select {
    border: none; background: none; font-weight: bold; font-size: 14px;
    -webkit-appearance: none; appearance: none; color: var(--brand-ink); width: 100%;
}

/* カテゴリタブ(塗りで区別・線は使わない) */
.header-tabs {
    display: flex; gap: 6px; overflow-x: auto; padding: 10px 10px 0;
    background: transparent; position: sticky; top: 0; z-index: 20;
}
.header-tabs a {
    flex: 0 0 auto; padding: 9px 18px; margin: 0;
    font-size: 13px; font-weight: bold; text-decoration: none; color: #6B7480;
    background: #E7E9EE; border-radius: 8px 8px 0 0; white-space: nowrap;
}
.header-tabs a.active {
    background: var(--brand-ink); color: #fff;
}
.header-tabs a.new {
    margin-left: auto; background: #fff; color: var(--brand-ink);
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
    border-radius: 50%; width: 36px; height: 36px; padding: 0;
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}

.page-title-bar { padding: 10px 14px 4px; font-size: 12px; color: #888; }

/* カード型 在庫一覧(線を使わず、塗り+影で区切る) */
.film-card-list { padding: 0 10px; display: flex; flex-direction: column; gap: 8px; }
.film-card {
    background: #fff; border-radius: 10px;
    padding: 10px 14px 12px; display: flex; align-items: center; gap: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.film-card .film-info { flex: 1; min-width: 0; }
.film-card .maker {
    font-size: 10.5px; color: #9AA3AF; letter-spacing: .5px; padding-bottom: 3px;
    border-bottom: 1px solid #EEF0F3; margin-bottom: 6px;
}
.film-card .code { font-size: 17px; font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.film-card .meters { font-size: 13px; color: var(--brand-accent); font-weight: bold; margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.film-card .meters.low { color: #dc2626; }
.film-card .meters svg { width: 14px; height: 14px; }

.icon-btn {
    flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
    background: #F0F1F4; box-shadow: 0 1px 2px rgba(0,0,0,.08);
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; color: var(--brand-ink); border: none;
}
.icon-btn.use { background: var(--brand-use); color: #fff; }
.icon-btn svg { width: 18px; height: 18px; }

/* 在庫一覧の「使用」ボタン: 丸ボタンより押しやすい横長の角丸ボタンに */
.icon-btn.use {
    width: auto; height: 46px; min-width: 64px; border-radius: 14px;
    padding: 0 14px; gap: 6px;
}
.icon-btn.use .use-label { font-size: 13px; font-weight: bold; white-space: nowrap; }

/* ボトムナビ(SVGアイコン・線は使わずアクティブは塗りで表現) */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: 62px;
    background: var(--brand-ink); display: flex; z-index: 30;
    box-shadow: 0 -1px 6px rgba(0,0,0,.15);
}
.bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #8FA2B8; text-decoration: none; font-size: 10px; gap: 3px;
    border-top: 3px solid transparent;
}
.bottom-nav a svg { width: 20px; height: 20px; stroke: #8FA2B8; fill: none; stroke-width: 1.8; }
.bottom-nav a.active {
    color: #fff; font-weight: bold; background: rgba(255,255,255,.08);
    border-top: 3px solid var(--brand-accent);
}
.bottom-nav a.active svg { stroke: #fff; stroke-width: 2.2; }

/* 詳細ページ */
.detail-box { background: #fff; border-radius: 10px; margin: 0 12px 12px; padding: 4px 4px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.detail-row { display: flex; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid #F3F4F6; font-size: 14px; }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: #888; }
.detail-row .v { font-weight: bold; text-align: right; }
.detail-actions { display: flex; gap: 8px; padding: 0 12px 12px; }
.detail-actions a, .detail-actions button { flex: 1; text-align: center; }

/* ---------- 並べ替え(▲▼) ---------- */
.reorder-toggle {
    font-size: 12px; padding: 5px 12px; border-radius: 14px; display: inline-flex; align-items: center; gap: 4px;
    text-decoration: none; color: var(--brand-ink); background: #fff; font-weight: bold;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.reorder-toggle svg { width: 13px; height: 13px; }
.reorder-toggle.on { background: var(--brand-accent); color: #fff; }
.reorder-btns { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.reorder-arrow {
    width: 46px; height: 30px; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; background: #F0F1F4; box-shadow: 0 1px 2px rgba(0,0,0,.08);
    color: var(--brand-ink); text-decoration: none; font-size: 14px;
}
.reorder-arrow.disabled { opacity: .25; box-shadow: none; }

/* ---------- 引っ張って更新 ---------- */
.ptr-indicator {
    position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 50;
    display: flex; align-items: center; justify-content: center;
    transform: translateY(-60px); opacity: 0; pointer-events: none;
    transition: transform .2s, opacity .2s;
}
.ptr-spinner {
    width: 26px; height: 26px; border-radius: 50%; background: #fff;
    border: 3px solid #cfd6df; border-top-color: var(--brand-accent);
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.ptr-indicator.loading .ptr-spinner { animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* ---------- メーター数入力ポップアップ ---------- */
.wheel-col { touch-action: pan-y; overscroll-behavior: contain; }

.mp-trigger {
    width: 100%; padding: 14px; border-radius: 10px; border: none;
    background: #F0F1F4; font-size: 20px; font-weight: bold; color: var(--brand-ink);
    text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.mp-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
    display: none; align-items: flex-end; justify-content: center;
    touch-action: none;
}
.mp-backdrop.open { display: flex; }
.mp-sheet {
    background: #fff; width: 100%; max-width: 480px; border-radius: 16px 16px 0 0;
    padding: 14px 18px 26px; box-shadow: 0 -4px 24px rgba(0,0,0,.2);
}
.mp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mp-header .mp-cancel { background: none; border: none; color: #888; font-size: 14px; padding: 6px; }
.mp-header .mp-done { background: none; border: none; color: var(--brand-accent); font-size: 15px; font-weight: bold; padding: 6px; }
.mp-title { font-size: 14px; font-weight: bold; color: var(--brand-ink); }
.mp-mode-toggle { display: flex; gap: 8px; margin-bottom: 8px; }
.mp-mode { flex: 1; padding: 8px; border-radius: 8px; border: none; background: #F0F1F4; font-size: 12.5px; color: #667; }
.mp-mode.active { background: var(--brand-ink); color: #fff; font-weight: bold; }
.mp-wheel-mode .picker-wrap { touch-action: pan-y; }
.wheel-col.mp-small { width: 44px; }
.mp-keyboard-mode { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 20px 0; }
.mp-text-input {
    font-size: 30px; text-align: center; border: none; border-bottom: 2px solid var(--brand-ink);
    background: transparent; width: 140px; padding: 6px 0; outline: none;
}
