:root {
    --accent: #f9bd2f;
    --accent-strong: #e46e5b;
    --ink: #2f2f34;
    --muted: #8d8d94;
    --line: #ececf0;
    --panel: #ffffff;
    --soft: #f6f7f8;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif; color: var(--ink); background: #f4f4f5; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[v-cloak] { display: none; }

.phone-shell { min-height: 100vh; background: #fff; max-width: 900px; margin: 0 auto; padding-bottom: 78px; }
.topbar { position: sticky; top: 0; z-index: 3; height: 60px; display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.topbar h1 { margin: 0; text-align: center; font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 600; }
.icon-btn { display: grid; place-items: center; height: 44px; border: 0; color: var(--ink); background: transparent; text-decoration: none; font-size: 2rem; }
.search-row { display: grid; grid-template-columns: 1fr 44px; gap: 12px; align-items: center; padding: 16px clamp(14px, 4vw, 28px); }
.search-box { min-width: 0; height: 48px; display: flex; gap: 8px; align-items: center; padding: 0 16px; border-radius: 24px; background: var(--soft); color: #aaa; }
.search-box input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; font-size: 1.05rem; }
.round-btn, .add-btn { border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 800; box-shadow: 0 4px 14px rgba(249,189,47,.35); }
.round-btn { width: 44px; height: 44px; font-size: 1.5rem; }
.menu-collapsed .round-btn { background: var(--ink); }
.menu-layout { display: grid; grid-template-columns: minmax(96px, 29vw) 1fr; align-items: start; }
.menu-collapsed .menu-layout { grid-template-columns: 1fr; }
.menu-collapsed .category-tabs { display: none; }
.category-tabs { position: sticky; top: 60px; max-height: calc(100vh - 60px); overflow-y: auto; background: var(--soft); border-right: 1px solid var(--line); }
.category-tabs button { width: 100%; min-height: 72px; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font-size: clamp(.98rem, 4vw, 1.3rem); line-height: 1.25; overflow-wrap: anywhere; }
.category-tabs button.active { background: #fff; color: #efa91d; border-left: 5px solid var(--accent); font-weight: 800; }
.menu-content { min-width: 0; padding: 18px clamp(14px, 4vw, 28px); }
.notice { display: grid; gap: 4px; margin-bottom: 18px; font-size: .95rem; color: var(--muted); }
.notice strong { color: var(--ink); font-size: 1.05rem; }
.category-section h2 { margin: 16px 0 12px; font-size: 1.1rem; }
.menu-item { display: grid; grid-template-columns: clamp(96px, 28vw, 150px) minmax(0, 1fr) 42px; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid #f1f1f1; }
.menu-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; background: #ddd; }
.item-copy { min-width: 0; display: grid; gap: 7px; }
.item-name { font-weight: 800; font-size: clamp(1rem, 4vw, 1.25rem); line-height: 1.35; overflow-wrap: anywhere; }
.item-copy p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.35; }
.item-copy strong { color: var(--accent-strong); font-size: 1.22rem; }
.add-btn { width: 40px; height: 40px; font-size: 1.8rem; line-height: 1; }
.mobile-cart { border: 0; font: inherit; text-align: left; position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(92vw, 520px); height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-radius: 8px; background: #222; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

.admin-shell { min-height: 100vh; padding: 16px; background: #f7f8fa; }
.admin-header { max-width: 1180px; margin: 0 auto 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.admin-header span { color: var(--muted); font-size: .9rem; }
.admin-header h1 { margin: 2px 0 0; font-size: clamp(1.4rem, 5vw, 2.2rem); }
.ghost-link { color: var(--ink); text-decoration: none; border: 1px solid var(--line); padding: 10px 14px; border-radius: 7px; background: #fff; white-space: nowrap; }
.admin-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.admin-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; box-shadow: 0 8px 22px rgba(31,36,45,.05); }
.store-panel { max-width: 1180px; margin: 0 auto 16px; display: grid; grid-template-columns: 1fr 2fr auto; gap: 12px; align-items: end; }
.admin-panel label { display: grid; gap: 6px; color: #555; font-size: .88rem; }
input, textarea, select { width: 100%; border: 1px solid #dfe1e6; border-radius: 7px; padding: 10px 11px; background: #fff; color: var(--ink); }
textarea { resize: vertical; }
.primary-btn, .panel-title button, .danger { min-height: 42px; border: 0; border-radius: 7px; padding: 0 14px; font-weight: 800; }
.primary-btn, .panel-title button { background: var(--accent); color: #fff; }
.danger { background: #feecec; color: #bf3e32; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-title h2 { margin: 0; font-size: 1.1rem; }
.edit-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid #f2f2f2; }
.tiny { text-align: center; }
.switch { display: inline-flex !important; grid-auto-flow: column; align-items: center; gap: 6px !important; white-space: nowrap; }
.switch input { width: 18px; height: 18px; }
.item-editor { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.editor-main { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.editor-main img { width: 110px; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; background: #ddd; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.full { grid-column: 1 / -1; }
.editor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 12px; }
.toast { position: fixed; right: 16px; bottom: 16px; padding: 12px 16px; border-radius: 8px; background: #20242b; color: #fff; }
.toast-error { background: #bf3e32; max-width: min(360px, calc(100vw - 32px)); }
.row-actions { display: flex; align-items: center; gap: 6px; }
.move { min-height: 42px; min-width: 38px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); padding: 0 8px; }
.move:disabled { opacity: .35; cursor: default; }
.panel-hint { margin: -4px 0 12px; font-size: .85rem; color: var(--muted); }
.auth-banner { margin-bottom: 12px; padding: 12px 14px; border-radius: 8px; background: #fdf3d6; border: 1px solid #e4c46a; color: #6b4c07; line-height: 1.5; }
.auth-banner a { color: #6b4c07; }

@media (max-width: 720px) {
    .search-row { grid-template-columns: 1fr 42px; gap: 8px; }
    .menu-item { grid-template-columns: 96px minmax(0, 1fr) 36px; gap: 10px; }
    .add-btn { width: 36px; height: 36px; font-size: 1.55rem; }
    .admin-shell { padding: 12px; }
    .store-panel, .admin-grid { grid-template-columns: 1fr; }
    .admin-header { align-items: flex-start; }
    /* 手機版改 flex：分類列有 4 個子元素（圖示／名稱／上架／刪除），
       原本的兩欄 grid 會把刪除鈕擠進 52px 的圖示欄。 */
    .edit-row { display: flex; flex-wrap: wrap; align-items: center; }
    .edit-row > .tiny { flex: 0 0 52px; }
    .edit-row > input:not(.tiny) { flex: 1 1 calc(100% - 60px); min-width: 0; }
    .edit-row > .switch { flex: 0 0 auto; margin-right: auto; }
    .edit-row > .row-actions { flex: 0 0 auto; }
    .editor-main { grid-template-columns: 88px 1fr; }
    .editor-main img { width: 88px; }
    .field-grid { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
    .phone-shell { padding-bottom: 70px; }
    .menu-layout { grid-template-columns: 94px 1fr; }
    .menu-collapsed .menu-layout { grid-template-columns: 1fr; }
    .menu-content { padding: 14px 10px; }
    .menu-item { grid-template-columns: 82px minmax(0, 1fr); }
    .item-pick { grid-column: 2; justify-self: end; }
    .search-box { padding: 0 12px; }
    .category-tabs button { min-height: 64px; }
}

.admin-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.admin-actions form { margin: 0; }
.ghost-button { min-height: 42px; border: 1px solid var(--line); border-radius: 7px; padding: 0 14px; background: #fff; color: var(--ink); font-weight: 700; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: linear-gradient(180deg, #fff 0%, #f3f5f8 100%); }
.login-card { width: min(100%, 420px); display: grid; gap: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 16px 38px rgba(31,36,45,.08); }
.login-card span { color: var(--muted); font-size: .95rem; }
.login-card h1 { margin: 4px 0 0; font-size: clamp(1.6rem, 7vw, 2.2rem); }
.login-form { display: grid; gap: 12px; }
.login-error { margin: 0; color: #bf3e32; font-weight: 700; }

@media (max-width: 720px) {
    .admin-actions { width: 100%; justify-content: flex-start; }
    .admin-actions .ghost-link, .admin-actions .ghost-button { min-height: 40px; padding: 9px 12px; }
    .login-shell { align-items: start; padding-top: 72px; }
    .login-card { padding: 18px; }
}



/* ── 推薦標記（isFeatured 原本後台勾得下去、前台完全沒用到） ── */
.featured-badge { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 800; vertical-align: middle; }

/* ── 加入鈕 ＋ 已選數量 ── */
.item-pick { display: grid; justify-items: center; gap: 4px; }
.pick-qty { font-size: .78rem; font-weight: 800; color: var(--accent-strong); }

.dropped-notice { position: fixed; left: 50%; bottom: 78px; transform: translateX(-50%); width: min(92vw, 520px); padding: 10px 14px; border-radius: 8px; background: #fdf3d6; border: 1px solid #e4c46a; color: #6b4c07; font-size: .9rem; z-index: 6; }

/* ── 已選品項面板 ── */
.cart-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 8; }
.cart-sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100vw, 560px); max-height: 76vh; display: flex; flex-direction: column; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 12px 12px 0 0; background: #fff; box-shadow: 0 -10px 30px rgba(0,0,0,.2); z-index: 9; }
.cart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.cart-head h2 { margin: 0; font-size: 1.1rem; }
.cart-lines { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line-copy { min-width: 0; display: grid; gap: 2px; }
.cart-line-copy .item-name { font-size: 1rem; }
.cart-line-copy span { color: var(--muted); font-size: .85rem; }
.cart-line-total { white-space: nowrap; color: var(--accent-strong); }
.qty-controls { display: flex; align-items: center; gap: 8px; }
.qty-controls button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-size: 1.15rem; line-height: 1; }
.qty-controls span { min-width: 18px; text-align: center; font-weight: 800; }
.link-danger { border: 0; background: transparent; color: #bf3e32; font-size: .85rem; padding: 6px; }
.cart-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; }
.cart-sum strong { color: var(--accent-strong); font-size: 1.15rem; }

@media (max-width: 420px) {
    /* 四欄在窄螢幕會把品名壓成一個字寬：改成兩列 */
    .cart-line { grid-template-columns: minmax(0, 1fr) auto; }
    .cart-line-copy { grid-column: 1 / -1; }
    .cart-line-total { justify-self: end; }
    .link-danger { grid-column: 2; justify-self: end; }
}
