:root {
  --ink: #1f2428;
  --muted: #6b7378;
  --line: #e3e6e8;
  --accent: #1a56db;
  --ok: #157347;
  --warn: #b54708;
  --bg: #f6f7f8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px;
  width: 100%;
  max-width: 560px;
}
.brand {
  font-size: 14px;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin-bottom: 24px;
}
h1 { font-size: 22px; margin: 0 0 20px; font-weight: 700; }
h2 { font-size: 16px; margin: 28px 0 12px; font-weight: 700; }
.detail { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.detail th, .detail td { text-align: left; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.detail th { color: var(--muted); font-weight: 400; width: 7em; }
.amount { font-weight: 700; font-size: 18px; }
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
}
.btn:hover { opacity: 0.92; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.muted { color: var(--muted); font-size: 13px; }
.state { padding: 12px 16px; border-radius: 6px; font-weight: 700; margin-bottom: 16px; }
.state.ok { background: #e8f3ed; color: var(--ok); }
.state.warn { background: #fdf0e4; color: var(--warn); }

/* 後台 */
.admin { max-width: 860px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 2fr 140px auto; gap: 12px; align-items: end; }
.msg { font-size: 14px; margin: 10px 0; min-height: 1.4em; }
.msg.err { color: #b42318; }
.msg.ok { color: var(--ok); }
table.orders { width: 100%; border-collapse: collapse; font-size: 14px; }
table.orders th, table.orders td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
table.orders th { color: var(--muted); font-weight: 400; font-size: 13px; }
.status-pending { color: var(--warn); }
.status-paid { color: var(--ok); font-weight: 700; }
.copybtn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.copybtn:hover { border-color: var(--accent); color: var(--accent); }
/* 後台分頁與案例管理 */
.tabs { display: flex; gap: 8px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.tab {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 15px; color: var(--muted);
  padding: 10px 18px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.row-between h1 { margin: 0; }
.row-gap { display: flex; gap: 12px; margin-top: 8px; }
.case-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.case-form .field.wide { grid-column: 1 / -1; }
.case-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 15px; font-family: inherit; resize: vertical;
}
.case-form select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 15px; font-family: inherit; background: #fff;
}
.field.checks { display: flex; gap: 24px; align-items: center; padding-top: 22px; }
.field.checks label { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); }
.btn.danger { background: #b42318; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 12px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-top: 16px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.thumb .copybtn { position: absolute; bottom: 6px; font-size: 12px; }
.thumb .delimg { right: 6px; }
.thumb .setcover { left: 6px; }
.thumb.is-cover { outline: 2px solid var(--gold, #f0c95a); }
.cover-badge {
  position: absolute; top: 6px; left: 6px; background: rgba(23,35,56,.85); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
}
#imgInput { margin: 6px 0; font-family: inherit; }
.confirm-mask {
  position: fixed; inset: 0; background: rgba(10, 18, 30, .5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.confirm-mask[hidden] { display: none; }
.confirm-box { background: #fff; border-radius: 10px; padding: 28px; max-width: 360px; }
.confirm-box p { margin-bottom: 20px; font-size: 15px; line-height: 1.7; }

@media (max-width: 720px) {
  .form-row { grid-template-columns: 1fr; }
  .case-form { grid-template-columns: 1fr; }
}


/* ── 網站內容管理 ── */
#sitePageSel { padding: 8px 12px; font-family: inherit; font-size: 14px; }
.slot { border: 1px solid #e3ded2; border-radius: 10px; padding: 14px 16px; margin: 12px 0; background: #fdfcf9; }
.slot-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.slot-label { font-weight: 600; font-size: 14px; }
.ov-badge { font-size: 11px; color: #8a6d2f; border: 1px solid #c9ae7b; border-radius: 999px; padding: 1px 8px; }
.slot .s-text, .slot .s-href { width: 100%; box-sizing: border-box; font-family: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid #d7d2c4; border-radius: 6px; margin-bottom: 8px; }
.slot-link { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.slot-imgrow { display: flex; gap: 18px; align-items: flex-start; }
.s-preview { width: 180px; max-height: 140px; object-fit: cover; border-radius: 8px; background: #eee; }
.slot-imgops { flex: 1; }
.slot-imgops .hint { margin: 0 0 8px; }
.pos-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 13px; }
.pos-row select { padding: 5px 8px; font-family: inherit; }
.s-pick { display: inline-block; margin-bottom: 6px; cursor: pointer; }
@media (max-width: 700px) {
  .slot-imgrow { flex-direction: column; }
  .slot-link { grid-template-columns: 1fr; }
}


/* ── 裁切焦點拖曳 ── */
.crop-wrap { margin-top: 4px; max-width: 320px; }
.crop-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.c-tab { border: 1px solid #d7d2c4; background: #fff; border-radius: 999px; padding: 4px 14px; font-size: 12.5px; font-family: inherit; cursor: pointer; }
.c-tab.on { background: #172338; color: #fff; border-color: #172338; }
.crop-box { position: relative; width: 100%; background: #111; border-radius: 8px; overflow: hidden; touch-action: none; cursor: crosshair; }
.crop-box img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; user-select: none; }
.crop-dot { position: absolute; width: 16px; height: 16px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(0,0,0,.55), inset 0 0 0 1.5px rgba(0,0,0,.35); transform: translate(-50%, -50%); pointer-events: none; }
.crop-wrap .hint { margin: 8px 0; }


/* ── 網站內容：分區收合 ── */
details.sec { border: 1px solid #d7d2c4; border-radius: 10px; margin: 12px 0; background: #fff; }
details.sec > summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 10px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::before { content: "▸"; color: #c9ae7b; transition: transform .2s ease; }
details.sec[open] > summary::before { transform: rotate(90deg); }
.sec-n { margin-left: auto; font-weight: 400; font-size: 12px; color: #8a8577; }
.sec-body { padding: 0 14px 14px; }

/* ── FAQ 題組編輯器 ── */
.faq-row { border: 1px solid #e3ded2; border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #fff; }
.faq-row .fq, .faq-row .fa { width: 100%; box-sizing: border-box; font-family: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid #d7d2c4; border-radius: 6px; margin-bottom: 8px; }
.faq-row-ops { display: flex; gap: 8px; }

/* ── 案例列表操作鈕 ── */
.case-ops { white-space: nowrap; }
.case-ops .copybtn { margin-right: 4px; }
.case-ops .copybtn:disabled { opacity: .3; cursor: default; }


/* ── 集合管理器 ── */
.coll-table { margin: 4px 0 12px; }
.coll-thumb { height: 40px; width: 64px; object-fit: cover; border-radius: 6px; vertical-align: middle; margin-right: 10px; background: #eee; }
.coll-title { font-size: 14px; }
.coll-editrow > td { background: #faf8f3; padding: 14px 16px; }
.coll-form .cf-label { display: block; font-size: 12.5px; color: #6f6a5d; margin: 10px 0 4px; }
.coll-form input, .coll-form textarea { width: 100%; box-sizing: border-box; font-family: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid #d7d2c4; border-radius: 6px; }
.coll-form .crop-wrap { margin-top: 12px; }
.dirty-badge { font-size: 11px; color: #a33; border: 1px solid #d99; border-radius: 999px; padding: 1px 8px; }
.btn.small { padding: 8px 18px; font-size: 13px; }
