/* 後台(沿用 style.css 的色票與按鈕) */
#app.admin { height: auto; min-height: 100dvh; }
body:has(.admin:not([hidden])) { user-select: text; }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); background: var(--panel); }
.tabs button { padding: 12px 18px; border: 0; background: none; border-bottom: 3px solid transparent; cursor: pointer; font-size: 1rem; }
.tabs button.on { border-bottom-color: var(--accent); font-weight: 700; }
.tab { padding: 12px 12px 96px; width: 100%; max-width: 980px; margin: 0 auto; }
.banner { margin: 12px; padding: 12px 16px; border-radius: 10px; }
.banner.warn { background: #fdecea; color: var(--warn); font-weight: 600; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; }
.card h2 { margin: 0 0 4px; font-size: 1.15rem; }
.card h3 { margin: 18px 0 8px; font-size: 1rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.row input { flex: 1 1 160px; }
.card input[type=text], .card input:not([type]), .card input[type=number], .card input[type=password], .card select {
  padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; min-height: 44px; background: #fff; min-width: 0;
}
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; }

.cat-bar { display: flex; gap: 8px; align-items: center; }
.cat-bar .cats { flex: 1; min-width: 0; padding: 0; border: 0; }
.tab, .card, .cat-head > *, .item-row > *, .opt-row > * { min-width: 0; }
.cat-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cat-head input { flex: 1 1 180px; font-size: 1.1rem; font-weight: 700; }

/* 加價選項 */
.opt-row { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; margin-bottom: 6px; }

/* 品項表 */
.item-head, .item-row {
  display: grid; gap: 6px; align-items: center;
  grid-template-columns: minmax(140px, 1fr) 76px 76px 76px 64px 104px 50px 50px 132px;
}
.item-head { font-size: .8rem; color: var(--muted); padding: 0 8px 4px; }
.item-row { padding: 8px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: #fff; }
.item-row.sold { background: #fbf3f2; }
.item-row input, .item-row select { width: 100%; }
.item-row .acts { display: flex; gap: 4px; justify-content: flex-end; }
.item-row .acts button { min-width: 40px; min-height: 40px; padding: 4px 8px; }
.item-row label.check { justify-content: center; }
.item-row .lbl { display: none; }

@media (max-width: 860px) {
  .item-head { display: none; }
  .item-row { grid-template-columns: repeat(3, 1fr); }
  .item-row .f-name { grid-column: 1 / -1; }
  .item-row .lbl { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 2px; }
  .item-row .f-temp { grid-column: span 2; }
  .item-row .acts { grid-column: 1 / -1; justify-content: space-between; }
  .item-row label.check { flex-direction: column; gap: 2px; }
  .item-row label.check .lbl { order: -1; }
  .save-bar #dirty-msg { flex-basis: 100%; }
  .save-bar .spacer { display: none; }
  .save-bar .btn { flex: 1; }
}

.save-bar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0,0,0,.05); z-index: 10;
}
.save-bar .spacer { flex: 1; }
.save-bar.dirty { background: #fff8e6; }
.save-bar.dirty #dirty-msg { color: var(--accent); font-weight: 700; }

/* 報表 */
.quick .btn { flex: 0 0 auto; }
#rp-form input[type=date] { padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; min-height: 44px; flex: 1 1 140px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 12px 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat span { display: block; font-size: .85rem; color: var(--muted); }
.stat b { display: block; font-size: 1.4rem; color: var(--brand); font-variant-numeric: tabular-nums; }
.stat small { display: block; font-size: .85rem; color: var(--muted); line-height: 1.5; }
#rp-days td, #rp-days th, #rp-items td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs button { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 600px) {
  .tabs button { padding: 12px 10px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat b { font-size: 1.2rem; }
}
/* 回收銀:頂列固定在畫面上方,按鈕醒目(後台頁面會變長,body 不能鎖一個螢幕高,否則 sticky 捲超過就失效) */
html, body { height: auto; min-height: 100%; }
.admin .topbar { position: sticky; top: 0; z-index: 20; }
.topbar .btn.back-pos { background: var(--accent); color: #fff; font-weight: 700; }
.login-box .back-pos { display: flex; align-items: center; justify-content: center; margin-top: 12px; width: 100%; text-decoration: none; }
.cu-filter { margin: 10px 0 4px; }
.cu-filter button { min-height: 40px; padding: 6px 12px; }
.cu-tip { min-height: 1.2em; }
#st-table tr.st-off td { color: var(--muted); }
/* 工作日誌 */
.wl-log { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; background: #fff; }
.wl-log.has-alert { border-color: #e0b77a; background: #fffaf2; }
.wl-head { font-weight: 700; margin-bottom: 6px; }
.wl-row { display: flex; gap: 10px; justify-content: space-between; padding: 4px 0; border-top: 1px dashed var(--line); font-size: .95rem; }
.wl-row span { color: var(--muted); }
.wl-row b { font-weight: 600; text-align: right; }
.wl-row.alert span, .wl-row.alert b { color: #b3261e; }
.wl-edit { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 10px 0; background: #fff; }
.wl-edit .row { margin-top: 6px; }
.wl-edit input[data-k="label"] { flex: 1 1 200px; font-weight: 600; }
.wl-edit input[data-k="hint"] { flex: 1 1 100%; }
/* 叫貨/烘豆 */
.pu-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; background: #fff; line-height: 1.6; }
.pu-card.closed { opacity: .7; }
.pu-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pu-src { padding: 0 8px; border-radius: 8px; background: #efe5da; font-size: .85rem; }
.pu-msg { white-space: pre-wrap; font-family: inherit; background: #fff8ec; padding: 8px; border-radius: 8px; }
#pu-form { border: 2px solid var(--accent); border-radius: 12px; padding: 10px 12px; margin: 10px 0; background: #fffaf2; }
#pu-form h3 { margin: 0 0 8px; }
#pu-form textarea, #tab-purchase textarea { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.pu-beans input { width: 80px; }
.pu-sup { border: 1px dashed var(--line); border-radius: 12px; padding: 8px 10px; margin: 8px 0; }
.pu-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-top: 10px; }
.lbl { display: block; font-weight: 700; margin: 6px 0 4px; }
@media (max-width: 700px) { .pu-grid { grid-template-columns: 1fr; } }
/* 排班 */
.sf-grid th, .sf-grid td { text-align: center; white-space: nowrap; }
.sf-grid tr > th:first-child { text-align: left; }
.sf-grid th.sf-closed { background: #eceef1; color: var(--muted); }
.sf-cell { min-width: 58px; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); cursor: pointer; font: inherit; }
.sf-cell.on { background: #2f7d4f; border-color: #2f7d4f; color: #fff; font-weight: 700; }
.sf-cell.closed:not(.on) { background: #eceef1; }
#sf-store { display: inline-flex; }
/* 排班整月 */
.sf-grid .sf-cell { min-width: 34px; min-height: 36px; padding: 0; }
.sf-grid th small { font-weight: 400; color: var(--muted); }
.sf-grid .sf-mon { border-left: 2px solid #c9ccd1; }
.sf-grid td, .sf-grid th { padding: 3px 2px; }
.sf-grid tr > th:first-child { position: sticky; left: 0; background: #fff; z-index: 1; padding-right: 8px; }
#sk-list td.neg b { color:#b3261e; }
#ta-list tr.ta-old td { background:#fff5f5; } #ta-list tr.ta-old b { color:#c62828; } #ta-list tr.ta-done td { color:#999; }
#ta-add select, #ta-add input { padding:8px; font-size:1rem; }
/* 食安紀錄 */
.fsp-grid td, .fsp-grid th { text-align: center; white-space: nowrap; padding: 4px 6px; }
.fsp-miss { color: #c0392b; background: #fff4f2; }
.fsp-badc { color: #fff; background: #c0392b; font-weight: 700; }
.fsp-ok { color: #2f7d4f; font-weight: 700; }
.fsp-hr { display: inline-block; padding: 2px 8px; border-radius: 99px; margin: 2px; }
.fsp-hr.ok { background: #e6f4ea; }
.fsp-hr.low { background: #fdecea; }
.fsp-people { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; align-items: center; }
.card-inner { border-top: 1px dashed var(--line, #ddd); margin-top: 12px; padding-top: 10px; }
.pc-now { background: #eef6f0; border-radius: 8px; padding: 8px 10px; }
.geo-box { border: 1px dashed var(--line, #ddd); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.geo-box a { margin-left: 8px; }
