/* ============================================================
   zaiko デザインシステム — トークン定義
   （UI/UX刷新。白・黒〜ダークグレー・薄いグレー＋zaikoブルーを基調に、
   Apple製品的なシンプル・ミニマル・余白の広いUIを目指す。
   業務上の意味色（在庫状態の緑/赤、作業ステータスの橙等）は識別性を
   優先してそのまま維持しつつ、彩度・背景トーンだけ新パレットに馴染ませた。
   以後追加する画面もこのトークンだけを使えばzaikoらしい見た目になる想定。
   ============================================================ */
:root {
    /* --- ベース面・文字 --- */
    --bg: #f4f5f7;              /* ページ背景（白に近い薄いグレー） */
    --bg-subtle: #eef0f3;       /* パネル内の控えめな面（ホバー・タグ・バー等） */
    --panel: #ffffff;           /* カード・パネルの面 */
    --border: #e2e4e9;          /* 薄いグレーの境界線 */
    --border-strong: #cfd2d9;
    --text: #1d1d1f;            /* 通常文字（黒〜ダークグレー） */
    --text-muted: #6e7079;
    --text-faint: #9a9ca3;

    /* --- zaikoブルー（アクセント。使いすぎない） ---
       正式ロゴ受領後は、この2行の値だけ調整すれば全画面に反映される。 */
    --accent: #0a66ff;
    --accent-dark: #0b4fc4;
    --accent-soft: #eaf1ff;     /* アクセントの薄い面（選択状態の背景等） */

    /* --- 業務上の意味色（在庫状態・作業ステータス） --- */
    --on-sale: #1f8a4c;
    --sold: #c8503b;
    --work-info-incomplete: #74757d;
    --work-photo-pending: #b06a1e;
    --work-ready: #1f8a4c;
    --work-listed: #2f6fb0;

    /* --- 形状・余白のスケール --- */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;
    --space-xs: 6px;
    --space-sm: 10px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;

    /* --- 控えめなシャドウ --- */
    --shadow-sm: 0 1px 2px rgba(20, 21, 26, 0.05);
    --shadow-md: 0 6px 20px rgba(20, 21, 26, 0.07);
    --shadow-lg: 0 16px 40px rgba(20, 21, 26, 0.10);
    --shadow-focus: 0 0 0 3px var(--accent-soft);
}

* { box-sizing: border-box; }

/* JavaScriptで要素をhidden属性のON/OFFにより表示・非表示する箇所があるため、
   display:flex等を指定したクラスに上書きされないよう、ここで明示的に優先させる。 */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ============================================================
   ヘッダー（UI/UX刷新: 左＝zaikoロゴのみ、右＝最小限のユーザー操作。
   機能名の横並びナビは廃止し、ホームハブが導線の中心になる）
   ============================================================ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
    gap: 12px;
}

.app-title {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--text);
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-header-actions a.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.1rem;
}

.app-header-actions a.icon-link:hover,
.app-header-actions a.icon-link:focus-visible {
    background: var(--bg-subtle);
    color: var(--text);
}

.nav-username {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.nav-logout-form {
    display: inline;
}

.nav-logout-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-logout-btn:hover {
    background: var(--bg-subtle);
    color: var(--text);
}

.login-panel {
    margin-top: 60px;
}

.app-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-lg) 20px 60px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.panel-narrow { max-width: 640px; }

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.panel-head h2 { margin: 0; }

.count { color: var(--text-muted); font-size: 0.9rem; }

h2 { margin-top: 0; }

.hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.error {
    color: #b3261e;
    background: #fdecea;
    border: 1px solid #f4c7c3;
    padding: 10px 14px;
    border-radius: 6px;
}

.success {
    color: #205c37;
    background: #e6f4ea;
    border: 1px solid #b7ddc3;
    padding: 10px 14px;
    border-radius: 6px;
    max-width: 640px;
    margin: 0 auto 16px;
}

.search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.search-form label {
    flex-basis: 100%;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.search-form input[type="text"] {
    flex: 1;
    min-width: 240px;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.clear-link {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.filter-row .filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-row label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.filter-row select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.92rem;
    background: #fff;
    min-width: 180px;
}

.bulk-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
}

.bulk-toolbar .selected-count {
    color: var(--text-muted);
    font-weight: 600;
}

.bulk-toolbar button {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.bulk-toolbar button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

button, input[type="submit"] {
    cursor: pointer;
    font-family: inherit;
}

/* ============================================================
   共通ボタン（要件2・11: 片手でも押しやすい最小44pxのタップ領域を
   どの文脈でも保証する、文脈を問わないグローバル定義）。
   個別フォーム用のスコープ付き定義（.product-form button.primary等）は
   互換性のため残しているが、値は揃えてある。
   ============================================================ */
a.primary, button.primary, input[type="submit"].primary,
a.secondary, button.secondary, input[type="submit"].secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-size: 0.98rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

a.primary, button.primary, input[type="submit"].primary {
    background: var(--accent);
    color: #fff;
}

a.primary:hover, button.primary:hover, input[type="submit"].primary:hover {
    background: var(--accent-dark);
}

a.secondary, button.secondary, input[type="submit"].secondary {
    background: var(--panel);
    color: var(--text);
    border-color: var(--border);
}

a.secondary:hover, button.secondary:hover, input[type="submit"].secondary:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
}

a.primary:active, button.primary:active,
a.secondary:active, button.secondary:active {
    transform: scale(0.98);
}

button.primary:disabled, input[type="submit"].primary:disabled {
    background: var(--border-strong);
    color: var(--text-faint);
    cursor: not-allowed;
}

.link-button {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.85rem;
    padding: 4px 2px;
    text-decoration: underline;
}

.search-form button,
.product-form button.primary,
.sell-form button.primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.95rem;
}

.search-form button:hover,
.product-form button.primary:hover,
.sell-form button.primary:hover {
    background: var(--accent-dark);
}

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead th {
    text-align: left;
    border-bottom: 2px solid var(--border);
    padding: 8px 10px;
    white-space: nowrap;
    color: var(--text-muted);
}

tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr:hover { background: var(--bg-subtle); }

tbody td a {
    color: var(--accent-dark);
    font-weight: 600;
    text-decoration: none;
}

tbody td a:hover { text-decoration: underline; }

.row-quick-links {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
}

.row-quick-links a {
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.7;
}

.row-quick-links a:hover { opacity: 1; }

/* スマートフォンなど狭い画面では、横スクロールの表ではなく縦積みの
   カード形式に切り替える（要件1: Windows/Mac/iPhoneのどこからでも
   操作しやすいUIにする）。各セルの見出しはdata-label属性から復元する。 */
@media (max-width: 700px) {
    .product-table thead { display: none; }

    .product-table, .product-table tbody, .product-table tr, .product-table td {
        display: block;
        width: 100%;
    }

    .product-table tr {
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 10px 12px;
    }

    .product-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding: 6px 0;
        border-bottom: 1px dashed var(--border);
        white-space: normal;
        text-align: right;
    }

    .product-table td:last-child { border-bottom: none; }

    .product-table td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.8rem;
        font-weight: 600;
        text-align: left;
        flex-shrink: 0;
    }

    .product-table td[data-label="商品管理コード"] { font-weight: 700; }
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-on_sale {
    background: #e6f4ea;
    color: var(--on-sale);
}

.badge-sold {
    background: #fbe9e6;
    color: var(--sold);
}

/* 作業ステータス用バッジ（複数スタッフでの分業用。在庫状態バッジとは別デザインにして混同を防ぐ） */
.badge-work-info_incomplete {
    background: #f0eeeb;
    color: var(--work-info-incomplete);
}

.badge-work-photo_pending {
    background: #fdf0e2;
    color: var(--work-photo-pending);
    font-weight: 700;
}

.badge-work-ready_to_list {
    background: #e6f4ea;
    color: var(--work-ready);
}

.badge-work-listed {
    background: #e5eef7;
    color: var(--work-listed);
}

/* --- 作業状況ダッシュボード（商品一覧の上部） --- */

.work-status-dashboard { margin-bottom: 16px; }

.work-status-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.work-status-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
}

.work-status-tab:hover { background: var(--bg-subtle); }

.work-status-tab.active {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
}

.work-status-tab .count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.8rem;
}

.work-status-tab.active .count-badge { background: rgba(255, 255, 255, 0.25); }

.work-status-tab-photo_pending:not(.active) { border-color: var(--work-photo-pending); color: var(--work-photo-pending); }

/* --- 商品詳細ページ: 写真未登録バナー・編集リンク --- */

.photo-pending-banner {
    background: #fdf0e2;
    color: var(--work-photo-pending);
    border: 1px solid #f0cfa0;
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 700;
    margin: 10px 0;
}

.edit-link {
    display: inline-block;
    color: var(--accent-dark);
    font-size: 0.9rem;
    white-space: nowrap;
}

.ec-update-needed-banner {
    background: #fdecea;
    color: var(--sold);
    border: 1px solid #f0b8ac;
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 700;
    margin: 10px 0;
}

/* --- 商品詳細ページ: 写真登録完了ボタン --- */

.photo-completion-area {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}

.photo-completion-area button.primary {
    background: var(--work-ready);
    color: #fff;
    border: none;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
}

.photo-completion-area button.primary:hover { opacity: 0.9; }

.photo-completion-area button.primary:disabled {
    background: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
}

.photo-completion-status {
    font-weight: 700;
    color: var(--work-ready);
    margin-bottom: 8px;
}

/* --- 商品詳細ページ: 将来の外部EC出品ボタン（準備中） --- */

.ec-listing-box {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-subtle);
}

.ec-listing-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ec-listing-buttons button {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 0.88rem;
}

.empty { color: var(--text-muted); }

.product-form .field,
.price-group .field {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-form label {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.field-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 0.92rem;
    cursor: pointer;
}

.field-checkbox .hint {
    margin: 2px 0 0 24px;
}

.required {
    color: #b3261e;
    font-size: 0.75rem;
}

.product-form input[type="text"],
.product-form input[type="number"],
.product-form select,
.product-form textarea,
.sell-form select {
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    background: #fff;
    font-family: inherit;
}

.product-form textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}

.color-tag-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.color-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 6px 4px 12px;
    font-size: 0.88rem;
}

.color-tag-remove {
    border: none;
    background: none;
    color: var(--accent-dark);
    font-size: 1rem;
    line-height: 1;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-tag-remove:hover { background: rgba(11, 79, 196, 0.12); }

.color-input-wrap { position: relative; }

.color-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    z-index: 10;
    max-height: 220px;
    overflow-y: auto;
}

.color-suggestions li {
    padding: 8px 14px;
    font-size: 0.92rem;
    cursor: pointer;
}

.color-suggestions li:hover { background: var(--bg-subtle); }

.price-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px 4px;
    margin-bottom: 18px;
}

.price-group legend {
    padding: 0 6px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.detail-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
}

.product-code-line {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 4px 0 0;
}

.product-code-line strong {
    color: var(--text);
    letter-spacing: 1px;
}

.barcode-box {
    text-align: center;
    padding: 16px;
    background: #fff;
    border: 1px dashed var(--border);
    border-radius: 8px;
    margin: 16px 0;
}

.barcode-box img { max-width: 100%; }

.barcode-code {
    font-size: 1.1rem;
    letter-spacing: 2px;
    font-weight: 700;
    margin: 6px 0 2px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.detail-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px 10px;
    width: 42%;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.detail-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

.sell-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.sell-form label {
    flex-basis: 100%;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.sell-form button.secondary {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 16px;
    border-radius: 6px;
}

.flash-messages {
    max-width: 640px;
    margin: 0 auto 16px;
}

.flash-message {
    color: #205c37;
    background: #e6f4ea;
    border: 1px solid #b7ddc3;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin: 0 0 8px;
    animation: mfxFlashIn 0.32s ease;
}

@keyframes mfxFlashIn {
    0% { opacity: 0; transform: translateY(-6px); }
    100% { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .flash-message { animation: none; }
}

.codes-row {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.code-item { text-align: center; }

.qr-image {
    max-width: 140px;
    width: 100%;
}

.main-photo-box {
    text-align: center;
    padding: 12px;
    background: #fff;
    border: 1px dashed var(--border);
    border-radius: 8px;
    margin: 16px 0 12px;
}

.main-photo {
    max-width: 100%;
    max-height: 360px;
    border-radius: 6px;
}

.cutout-toggle-form {
    margin-bottom: 10px;
    font-size: 0.92rem;
}

.cutout-toggle-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.cutout-run-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.photo-card {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
}

.photo-card-main {
    border-color: var(--accent);
    border-width: 2px;
}

.photo-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.photo-position {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.photo-main-tag {
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 999px;
}

.photo-badge {
    position: absolute;
    top: 28px;
    left: 12px;
    background: rgba(47, 122, 79, 0.9);
    color: #fff;
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.photo-card-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.photo-card-head .photo-position {
    flex: 1;
    margin-bottom: 0;
}

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    padding: 6px 8px;
    margin: -6px -8px -6px 0;
    touch-action: none; /* iPhoneでハンドルを掴んだ時にページがスクロールしないようにする */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.drag-handle:active { cursor: grabbing; }

.photo-card.dragging {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    opacity: 0.95;
    cursor: grabbing;
}

.photo-card-placeholder {
    border: 2px dashed var(--accent);
    border-radius: 8px;
    background: var(--bg-subtle);
}

/* スライド式のメインプレビュー */
.photo-slider-wrap {
    margin: 12px 0 16px;
}

.photo-slider {
    position: relative;
    border: 1px dashed var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.photo-slider-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.photo-slider-track::-webkit-scrollbar { display: none; }

.photo-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    max-height: 420px;
}

.photo-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(20, 21, 26, 0.55);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-arrow:hover { background: rgba(20, 21, 26, 0.72); }

.slider-arrow:disabled {
    opacity: 0.25;
    cursor: default;
}

.slider-arrow-prev { left: 10px; }
.slider-arrow-next { right: 10px; }

.slider-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(30, 26, 22, 0.55);
    color: #fff;
    font-size: 0.72rem;
    padding: 2px 9px;
    border-radius: 999px;
}

.slider-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    padding: 10px 0 0;
}

.slider-dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--border);
    cursor: pointer;
}

.slider-dot.active {
    background: var(--accent);
    width: 9px;
    height: 9px;
}

.photo-slider-wrap.processing .photo-slider { opacity: 0.5; }

.photo-slide img { cursor: zoom-in; }

/* --- 拡大表示（ライトボックス） --- */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(18, 15, 12, 0.94);
    z-index: 2000;
    touch-action: none; /* ピンチ・スワイプは独自のJSで処理するため、既定のブラウザ挙動を止める */
}

.lightbox-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
    will-change: transform;
    transform-origin: center center;
}

.lightbox-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(20, 17, 14, 0.55);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover { background: rgba(20, 17, 14, 0.75); }

.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 17, 14, 0.55);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 0.82rem;
    padding: 4px 14px;
    border-radius: 999px;
    z-index: 2001;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: rgba(20, 17, 14, 0.55);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-arrow:hover { background: rgba(20, 17, 14, 0.75); }

.lightbox-arrow:disabled {
    opacity: 0.2;
    cursor: default;
}

.lightbox-arrow-prev { left: 14px; }
.lightbox-arrow-next { right: 14px; }

body.lightbox-open { overflow: hidden; }

@media (max-width: 600px) {
    .lightbox-arrow { width: 40px; height: 40px; font-size: 1.5rem; }
}

.photo-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.photo-actions form { flex: 1; }

.photo-actions button {
    width: 100%;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    padding: 5px 0;
    border-radius: 4px;
    font-size: 0.8rem;
}

.photo-actions button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.photo-actions button.danger {
    color: var(--sold);
    border-color: #f0c9c3;
}

.photo-upload-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.photo-upload-form label {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.photo-upload-area {
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.photo-picker-button {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin: 6px 0 4px;
}

.photo-picker-button:hover { background: var(--accent-dark); }

.staged-photos-grid { margin-top: 16px; }

.staged-card { border-style: dashed; }

.photo-badge-error {
    background: rgba(160, 75, 60, 0.92);
}

.upload-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.upload-controls button.primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.95rem;
}

.upload-controls button.primary:hover { background: var(--accent-dark); }

.upload-controls button.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.warning-message {
    color: #8a6100;
    background: #fdf3d9;
    border: 1px solid #f0dfa0;
    padding: 10px 14px;
    border-radius: 6px;
    margin: 0 0 12px;
}

#photo-messages:empty { display: none; }

.photo-grid-busy {
    pointer-events: none;
    opacity: 0.7;
}

.main-photo-box.processing,
.photo-card.processing {
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

/* ============================================================
   倉庫管理（ラック・入出庫・ピッキング・梱包）
   ============================================================ */

.nav-sep { color: var(--border); }

.history-details {
    margin-top: 16px;
    border-top: 1px dashed var(--border);
    padding-top: 10px;
}

.history-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent-dark);
}

.history-table { font-size: 0.85rem; }

.inline-form { display: inline; }

.link-button {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent-dark);
    text-decoration: underline;
    font-size: 0.85rem;
    cursor: pointer;
}

.ec-listing-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

.ec-listing-form select,
.ec-listing-form input {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}

/* --- スキャン画面共通（入庫・ラック移動・ピッキング） --- */

.scan-panel { text-align: center; }

.scan-label {
    display: block;
    font-weight: 700;
    margin: 16px 0 8px;
    font-size: 1.05rem;
}

.scan-input {
    width: 100%;
    box-sizing: border-box;
    padding: 18px 14px;
    font-size: 1.3rem;
    text-align: center;
    border: 2px solid var(--accent);
    border-radius: 10px;
    letter-spacing: 0.02em;
}

.scan-input:focus {
    outline: none;
    border-color: var(--accent-dark);
    box-shadow: 0 0 0 3px var(--shadow-focus);
}

.scan-result {
    margin: 14px 0;
    padding: 16px;
    border-radius: 10px;
    font-size: 1.05rem;
}

.scan-result.scan-ok {
    background: #e6f4ea;
    color: var(--on-sale);
    border: 1px solid #b7ddc4;
}

.scan-result.scan-warn {
    background: #fdf0e2;
    color: var(--work-photo-pending);
    border: 1px solid #f0cfa0;
}

.scan-result.scan-error {
    background: #fbe9e6;
    color: var(--sold);
    border: 1px solid #f0b8ac;
}

.scan-big-ok, .scan-big-warn {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.scan-product-info {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    text-align: left;
}

.scan-product-code { font-size: 1.2rem; font-weight: 700; margin: 0; }
.scan-product-name { margin: 4px 0; }

#step-rack button.secondary,
.scan-step button.secondary {
    margin-top: 14px;
    width: 100%;
    padding: 14px;
    font-size: 1rem;
}

/* --- ピッキング進捗 --- */

.picking-progress-total {
    font-size: 1.3rem;
    font-weight: 800;
    text-align: center;
}

.picking-progress-racks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.picking-progress-rack {
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 600;
}

.picking-progress-rack-done {
    background: #e6f4ea;
    color: var(--on-sale);
    border-color: #b7ddc4;
}

.picking-rack-group {
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--border);
}

.picking-rack-group h3 { margin-bottom: 10px; }

.picking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.picking-item-needs-check {
    border-color: #f0b8ac;
    background: #fdf5f3;
}

.picking-item-main { flex: 1 1 auto; min-width: 200px; }

.packing-order-group {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border);
}

@media (max-width: 700px) {
    .scan-input { font-size: 1.5rem; padding: 22px 14px; }
    .scan-label { font-size: 1.15rem; }
    .picking-item { flex-direction: column; align-items: stretch; }
}

/* --- カメラQRスキャン（入庫・ラック移動、要件3・4・6） --- */

.camera-box {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 60vh;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
    margin: 14px 0;
}

.camera-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.camera-frame-guide {
    position: absolute;
    top: 12%;
    left: 12%;
    right: 12%;
    bottom: 12%;
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    pointer-events: none;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.25);
}

.camera-start-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
}

.camera-status {
    background: #fdf0e2;
    color: var(--work-photo-pending);
    border: 1px solid #f0cfa0;
    border-radius: 8px;
    padding: 10px 14px;
}

.scan-product-photo {
    display: block;
    max-width: 160px;
    max-height: 160px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 8px 0;
    background: #fff;
}

.manual-scan-fallback {
    margin-top: 16px;
    border-top: 1px dashed var(--border);
    padding-top: 10px;
}

.manual-scan-fallback summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.manual-scan-fallback .field { margin-top: 10px; }

/* --- スクエア一時出庫・返却モード --- */

.square-count-badge {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin: 10px 0 16px;
}

.square-big-ok {
    font-size: 1.7rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.square-big-warn {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.square-big-rack {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.square-return-product-info {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.square-return-product-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.square-return-product-meta {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.table-scroll {
    overflow-x: auto;
}

.square-checkout-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.square-checkout-table th,
.square-checkout-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
    vertical-align: middle;
}

.square-checkout-table th {
    background: var(--bg-subtle);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.square-list-photo {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: block;
}

.sorting-date-field {
    max-width: 220px;
}

.sorting-rack-group {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.sorting-rack-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-subtle);
    border: none;
    cursor: pointer;
    font-size: 1.05rem;
    text-align: left;
}

.sorting-rack-name { font-weight: 700; }

.sorting-rack-count {
    font-weight: 800;
    color: var(--accent-dark);
}

.sorting-item-list {
    list-style: none;
    margin: 0;
    padding: 10px 18px;
}

.sorting-item-list li {
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
}

.sorting-item-list li:last-child { border-bottom: none; }

@media (max-width: 700px) {
    .square-big-rack { font-size: 1.9rem; }
}

/* --- スクエア一時出庫: ハブ画面（ラック一括 / 単品の入口） --- */

.square-hub-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    text-align: left;
    text-decoration: none;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    color: var(--text);
    transition: transform 0.1s ease;
}

.square-hub-btn:active { transform: scale(0.99); }

.square-hub-btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent-dark);
    padding: 28px 22px;
}

.square-hub-btn-primary .square-hub-btn-desc { color: rgba(255, 255, 255, 0.85); }

.square-hub-btn-secondary {
    background: var(--bg-subtle);
}

/* 返却（スクエアからの持ち帰り品を元のラックへ戻す導線）。
   一時出庫（出す）とは逆方向の操作のため、視覚的に区別できるよう
   枠線をアクセントカラーにし、背景は控えめにする。 */
.square-hub-btn-return {
    background: var(--panel);
    border-color: var(--accent);
}

.square-hub-btn-return .square-hub-btn-num { color: var(--accent); }
.square-hub-btn-return .square-hub-btn-label { font-size: 1.15rem; font-weight: 700; }

.square-section-heading {
    margin: 22px 0 10px;
    font-size: 0.95rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.square-section-heading:first-of-type { margin-top: 8px; }

.square-hub-btn-num {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    flex: none;
}

.square-hub-btn-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.square-hub-btn-primary .square-hub-btn-label { font-size: 1.5rem; font-weight: 800; }
.square-hub-btn-secondary .square-hub-btn-label { font-size: 1.15rem; font-weight: 700; }

.square-hub-btn-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.square-session-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.square-session-name { font-weight: 700; margin-bottom: 8px; }

.square-session-racks {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.square-session-racks li {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.9rem;
}

.square-session-total { font-weight: 800; margin: 8px 0; }

.square-session-close-btn { font-size: 0.85rem; padding: 8px 14px; }

/* --- スクエア一時出庫: ラック一括の確認画面（要件4） --- */

.rack-confirm-box {
    margin-top: 16px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.rack-confirm-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 4px;
}

.rack-confirm-table th, .rack-confirm-table td {
    padding: 8px 4px;
    text-align: left;
    border-bottom: 1px dashed var(--border);
}

.rack-confirm-table td { text-align: right; font-weight: 700; }

.rack-confirm-eligible-row td { color: var(--on-sale); }
.rack-confirm-ineligible-row td { color: var(--sold); }

.rack-confirm-details {
    margin-top: 10px;
    border-top: 1px dashed var(--border);
    padding-top: 8px;
}

.rack-confirm-details summary {
    cursor: pointer;
    color: var(--accent-dark);
    font-size: 0.9rem;
}

.rack-confirm-item-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}

.rack-confirm-item-list li {
    padding: 6px 4px;
    border-bottom: 1px dashed var(--border);
    font-size: 0.9rem;
}

.rack-confirm-reason { color: var(--sold); }

.rack-confirm-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    margin-top: 16px;
}

#rack-cancel-btn {
    width: 100%;
    margin-top: 10px;
}

/* --- ラック一覧: A5 QRカード一括印刷 --- */

.racks-a5-bulk-btn {
    margin-top: 14px;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text);
}

.racks-a5-bulk-btn:hover {
    background: #f0ebe1;
}

/* --- 入庫: 入庫先ラック固定表示 --- */

.rack-lock-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0 16px;
    text-align: center;
}

.rack-lock-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.rack-lock-name {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 4px 0 8px;
}

.rack-lock-occupancy {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.rack-lock-session-count {
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

#change-rack-btn {
    margin-top: 12px;
    width: 100%;
    padding: 10px;
}

.recent-items-box {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.recent-items-box h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.recent-items-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.recent-items-list li {
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.92rem;
    color: var(--on-sale);
}

.recent-items-list li:last-child { border-bottom: none; }

.recent-items-list li.recent-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-items-list .recent-item-label {
    flex: 1 1 auto;
}

.recent-items-list .mercari-queue-add-btn {
    flex: 0 0 auto;
    padding: 4px 10px;
    font-size: 0.82rem;
}

.recent-items-list .mercari-queue-result {
    flex: 0 0 auto;
    font-size: 0.82rem;
}

/* メルカリShopsカテゴリー階層ピッカー（CSV運用方式で追加） */
.mcp-widget {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-top: 6px;
}

.mcp-current {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mcp-current-label {
    font-weight: bold;
}

.mcp-breadcrumb {
    margin: 0 0 8px;
    word-break: break-all;
}

.mcp-option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.mcp-option-btn {
    min-height: 48px;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.mcp-option-btn:active,
.mcp-option-btn:hover {
    background: var(--bg);
    border-color: var(--accent);
}

.mcp-back-btn {
    margin-bottom: 8px;
}

/* ============================================================
   zaiko ロゴ（正式版。キューブアイコン＋"zaiko"文字の2枚のPNG）
   templates/_zaiko_logo.html から呼ばれる。ロゴを差し替える場合は
   static/img/zaiko-icon.png と static/img/zaiko-wordmark.png を
   同名で上書きするだけでよい（このCSS自体の変更は不要）。
   2枚とも元画像の透明余白を基準に切り出したもので、縦横比は
   それぞれの元画像のまま（width:auto/height:autoで維持）。
   ============================================================ */
.zaiko-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.zaiko-logo-cube-wrap {
    position: relative;
    display: block;
    flex: none;
    /* zaiko-icon.png の実寸比（313:329）を維持したまま高さだけ指定する */
    width: 28.5px;
    height: 30px;
}

.zaiko-logo-cube,
.zaiko-cube-part {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.zaiko-logo-wordmark-img {
    display: block;
    height: 22.6px;
    width: auto;
}

.zaiko-logo--lg .zaiko-logo-cube-wrap { width: 60.9px; height: 64px; }
.zaiko-logo--lg .zaiko-logo-wordmark-img { height: 48.2px; }

/* アニメーション対象は、同じアイコン画像を3枚重ねて表示し、
   それぞれを下帯／中帯／上帯だけ見えるようclip-pathで隠す。
   元画像そのもの（拡大縮小も引き伸ばしもしない）を使う。
   "zaiko"の文字（.zaiko-logo-wordmark-img）は別要素のため無関係＝一切動かない。

   重要: ここではCSSの`animation`プロパティを初期表示に直接埋め込まない
   （Safariは初回ペイント時にそのようなCSSアニメーションを再生せず、
   完成形へ即座にジャンプする、またはズレた状態で固定されることが
   実機で確認されたため）。そのため既定状態は常に「完成形（積み上がり
   済み）」にしておき、実際の積み上げ演出は static/js/home_cube.js が
   Web Animations API（Element.animate）でページ読み込み後に明示的に
   開始する。JSが動かない環境でも、常に完成形の静止ロゴが表示される
   （壊れて見えることはない）。
   `inset`（position用のショートハンド）は対応していない環境が
   あり得るため使わず、top/right/bottom/leftを個別指定する。 */
.zaiko-cube-part {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 1;
}

.zaiko-cube-part[data-order="1"] {
    clip-path: inset(64% 0 0 0);
    -webkit-clip-path: inset(64% 0 0 0);
}
.zaiko-cube-part[data-order="2"] {
    clip-path: inset(32% 0 32% 0);
    -webkit-clip-path: inset(32% 0 32% 0);
}
.zaiko-cube-part[data-order="3"] {
    clip-path: inset(0 0 64% 0);
    -webkit-clip-path: inset(0 0 64% 0);
}

/* ============================================================
   ホームハブ（要件3）
   ============================================================ */
.home-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: var(--space-xl) 0 var(--space-lg);
}

.home-hero-greeting {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.home-welcome-tap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.home-welcome-tap:hover { background: var(--bg-subtle); color: var(--text); }

.home-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

@media (min-width: 720px) {
    .home-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
}

.home-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: var(--space-lg) var(--space-sm);
    min-height: 128px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

@media (min-width: 720px) {
    .home-card { min-height: 156px; }
}

.home-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.home-card:active { transform: translateY(0) scale(0.98); }

.home-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.home-card-icon svg { width: 100%; height: 100%; }

.home-card-label {
    font-size: 0.98rem;
    font-weight: 600;
    text-align: center;
}

.home-footer-links {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: var(--space-sm);
}

.home-footer-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: none;
}

.home-footer-links a:hover { color: var(--text); }

/* ============================================================
   設定画面
   ============================================================ */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border);
}

.settings-row > a.secondary,
.settings-row > .zaiko-switch {
    flex: none;
    white-space: nowrap;
}

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

.settings-row-label { font-weight: 600; }
.settings-row-desc { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }

.zaiko-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex: none;
}

.zaiko-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.zaiko-switch-track {
    position: absolute;
    inset: 0;
    background: var(--border-strong);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background 0.15s ease;
}

.zaiko-switch-track::before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.zaiko-switch input:checked + .zaiko-switch-track {
    background: var(--accent);
}

.zaiko-switch input:checked + .zaiko-switch-track::before {
    transform: translateX(20px);
}

.zaiko-switch input:focus-visible + .zaiko-switch-track {
    box-shadow: var(--shadow-focus);
}

/* ============================================================
   マイクロアニメーション（要件9。操作結果を一瞬で認識させるための
   0.2〜0.4秒の控えめな演出。static/js/micro_feedback.js から付与）
   ============================================================ */
.mfx-success {
    animation: mfxSuccessPulse 0.32s ease;
}

.mfx-error {
    animation: mfxErrorShake 0.28s ease;
}

@keyframes mfxSuccessPulse {
    0% { box-shadow: 0 0 0 0 rgba(31, 138, 76, 0.35); }
    60% { box-shadow: 0 0 0 8px rgba(31, 138, 76, 0); }
    100% { box-shadow: 0 0 0 0 rgba(31, 138, 76, 0); }
}

@keyframes mfxErrorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-2px); }
}

@media (prefers-reduced-motion: reduce) {
    .mfx-success, .mfx-error { animation: none; }
}

/* ============================================================
   商品ラベル印刷（Brother QL-800）
   ============================================================ */
.label-print-widget {
    text-align: center;
}

.label-preview-img {
    display: block;
    max-width: 100%;
    width: 320px;
    height: auto;
    margin: 12px auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
}

.label-print-widget-secondary {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}

.label-print-widget-secondary .label-preview-img {
    width: 240px;
}

.label-print-btn-lg {
    font-size: 1.1rem;
    padding: 16px 28px;
    width: 100%;
    max-width: 320px;
}

.label-print-status {
    min-height: 1.3em;
    margin-top: 10px;
    font-size: 0.92rem;
    font-weight: 600;
}

.label-status-busy { color: var(--text-muted); }
.label-status-ok { color: var(--on-sale); }
.label-status-error { color: var(--sold); }

/* ラベル印刷専用ページ（商品登録→ラベル印刷→写真登録の導線） */
#label-next-step {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed var(--border);
}

#label-next-step .label-print-btn-lg {
    margin-bottom: 8px;
}

.label-skip-hint {
    margin-top: 14px;
}
