/* 前台＋後台並排外框（5 套 demo 共用）
   桌機：左邊手機尺寸的前台、右邊後台；窄螢幕：上方分段按鈕切換。 */
:root {
  --brand: #1f5136;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --line: #e3e5ea;
  --text: #1c1f24;
  --muted: #646a73;
  --radius: 14px;
  --head-h: 56px;
  --phone-w: 390px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; overflow: hidden; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 頂列 */
.sh-head {
  height: var(--head-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.sh-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sh-logo { width: 28px; height: 28px; border-radius: 8px; flex: none; }
.sh-name { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-spacer { flex: 1; }
.sh-btn {
  height: 34px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); cursor: pointer; text-decoration: none;
  font-size: 13px; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.sh-btn:hover { background: #f7f8fa; border-color: #d3d6dc; }
.sh-btn:active { background: #eff1f4; }
.sh-btn svg { width: 15px; height: 15px; }

/* 窄螢幕用的切換鈕 */
.sh-seg { display: none; }

/* 主區：桌機並排 */
.sh-main {
  height: calc(100% - var(--head-h));
  display: grid;
  grid-template-columns: calc(var(--phone-w) + 2px) minmax(0, 1fr);
  gap: 20px;
  padding: 16px 20px 20px;
}
.sh-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.sh-label { display: flex; align-items: baseline; gap: 8px; height: 28px; padding: 0 2px; }
.sh-label b { font-size: 13px; font-weight: 650; }
.sh-label b::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px;
  border-radius: 50%; background: var(--brand); vertical-align: 1px;
}
.sh-pane--admin .sh-label b::before { background: #9aa1ab; }
.sh-frame {
  flex: 1; min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.sh-pane--front .sh-frame {
  width: calc(var(--phone-w) + 2px);
  max-height: 860px;
  border-radius: 32px;
  border-color: #d9dce2;
  box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 12px 32px -12px rgba(16,24,40,.18);
}
.sh-frame iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--surface); }

/* 窄螢幕：一次看一邊，用分段按鈕切換 */
@media (max-width: 1199px) {
  body { overflow: hidden; }
  .sh-head { padding: 0 12px; gap: 8px; }
  .sh-btn .sh-txt { display: none; }
  .sh-btn { width: 36px; padding: 0; justify-content: center; }
  .sh-seg {
    display: inline-flex; padding: 3px; gap: 2px;
    background: #eceef1; border-radius: 10px;
  }
  .sh-seg button {
    height: 30px; padding: 0 14px; border: 0; border-radius: 8px;
    background: transparent; cursor: pointer; font-size: 13px; color: var(--muted);
    transition: background .15s, color .15s;
  }
  .sh-seg button[aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16,24,40,.08); }
  .sh-main { display: block; padding: 0; }
  .sh-pane { height: 100%; }
  .sh-label { display: none; }
  .sh-frame, .sh-pane--front .sh-frame { width: 100%; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
  body[data-view="front"] .sh-pane--admin, body[data-view="admin"] .sh-pane--front { display: none; }
}
/* 平板以上但仍是單欄時，前台維持手機寬度置中 */
@media (min-width: 600px) and (max-width: 1199px) {
  body[data-view="front"] .sh-main { background: var(--bg); padding: 16px; }
  body[data-view="front"] .sh-pane--front .sh-frame {
    width: calc(var(--phone-w) + 2px); margin: 0 auto; max-height: 860px;
    border: 1px solid #d9dce2; border-radius: 32px;
  }
}
@media (max-width: 420px) { .sh-name { font-size: 14px; } }

/* 重置確認 */
.sh-dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 24px;
  width: min(360px, calc(100% - 32px));
  box-shadow: 0 24px 48px -12px rgba(16,24,40,.25);
}
.sh-dialog::backdrop { background: rgba(16,24,40,.32); }
.sh-dialog h2 { margin: 0 0 8px; font-size: 16px; }
.sh-dialog p { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.sh-dialog .sh-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sh-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.sh-primary:hover { background: var(--brand); border-color: var(--brand); filter: brightness(1.08); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
