/* GUDO Space 後台管理樣式 — 沿用官網墨綠／米白／金色系統 */
:root {
  --forest: #1f3b2c;
  --forest-deep: #16281d;
  --forest-card: #24422f;
  --cream: #f4ecdc;
  --cream-card: #fbf6ea;
  --cream-line: #e7dcc4;
  --gold: #c6a24e;
  --gold-deep: #b28d3a;
  --ink: #262420;
  --ink-soft: #5c574d;
  --on-dark: #f2ecdb;
  --on-dark-soft: #aeb9ad;
  --sans: "Noto Sans TC", -apple-system, "PingFang TC", sans-serif;
  --display: "Cormorant Garamond", serif;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--cream); line-height: 1.6; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: inherit; }

/* 按鈕 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 14px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid transparent; transition: .15s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn--gold { background: var(--gold); color: var(--forest-deep); }
.btn--gold:hover { background: var(--gold-deep); }
.btn--dark { background: var(--forest); color: var(--on-dark); }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--cream-line); }
.btn--ghost:hover { border-color: var(--gold); }
.btn--danger { background: #fff; color: #b4453a; border-color: #e6c4bf; }
.btn--danger:hover { background: #fbeeec; }
.btn--sm { padding: 7px 13px; font-size: 13px; }
.btn--block { width: 100%; padding: 13px; }

/* 登入 */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background:
  radial-gradient(120% 90% at 50% -10%, #2c4a38, var(--forest-deep)); }
.login__card { background: var(--cream-card); border-radius: 22px; padding: 40px; width: 100%; max-width: 380px; box-shadow: 0 30px 60px rgba(0,0,0,.3); }
.login__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login__brand span { font-family: var(--display); font-size: 24px; font-weight: 600; }
.login__card h1 { font-size: 18px; margin-bottom: 22px; }
.login__card label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 16px; }
.login__card input { width: 100%; margin-top: 7px; padding: 12px 14px; border: 1px solid var(--cream-line); border-radius: 10px; background: #fff; }
.login__card input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(198,162,78,.18); }
.pw-wrap { position: relative; display: block; margin-top: 7px; }
.pw-wrap input { margin-top: 0 !important; padding-right: 60px !important; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: none; background: none; color: var(--gold-deep); font-size: 13px; font-weight: 700; padding: 6px 8px; }
.pw-toggle:hover { color: var(--forest); }
.login__err { color: #b4453a; font-size: 13px; margin-top: 12px; font-weight: 500; }

/* 版面 */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--forest-deep); color: var(--on-dark); display: flex; flex-direction: column; padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
.side__brand { display: flex; align-items: center; gap: 9px; padding: 0 8px 20px; }
.side__brand span { font-family: var(--display); font-size: 21px; font-weight: 600; }
.side__nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.side__nav button { text-align: left; background: none; border: none; color: var(--on-dark-soft); font-size: 14px; font-weight: 500; padding: 11px 12px; border-radius: 10px; transition: .15s; }
.side__nav button:hover { background: rgba(242,236,219,.07); color: var(--on-dark); }
.side__nav button.is-active { background: var(--forest-card); color: var(--on-dark); font-weight: 700; }
.side__foot { border-top: 1px solid rgba(242,236,219,.1); padding-top: 14px; }
.side__view { display: block; font-size: 13px; color: var(--on-dark-soft); padding: 8px 12px; text-decoration: none; }
.side__view:hover { color: var(--gold); }
.side__me { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; font-size: 13px; }
.side__me button { background: none; border: 1px solid rgba(242,236,219,.2); color: var(--on-dark-soft); border-radius: 8px; padding: 4px 10px; font-size: 12px; }
.side__me button:hover { color: var(--on-dark); border-color: var(--on-dark-soft); }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(246,239,225,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--cream-line); padding: 18px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar h2 { font-size: 20px; }
.topbar__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.content { padding: 28px 32px 60px; }

/* 卡片 / 區塊 */
.panel { background: var(--cream-card); border: 1px solid var(--cream-line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel__head h3 { font-size: 16px; }
.muted { color: var(--ink-soft); font-size: 13px; }
.hint { color: var(--ink-soft); font-size: 13px; margin-bottom: 18px; }

/* 表單欄位 */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field input[type=text], .field input[type=password], .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--cream-line); border-radius: 9px; background: #fff; }
.field textarea { min-height: 70px; resize: vertical; line-height: 1.7; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(198,162,78,.16); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* 狀態下拉 / 徽章 */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.badge.open, .badge.new { background: rgba(31,59,44,.1); color: var(--forest); }
.badge.wait, .badge.contacted { background: rgba(198,162,78,.18); color: var(--gold-deep); }
.badge.full, .badge.done { background: rgba(120,110,95,.14); color: var(--ink-soft); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; color: var(--ink-soft); font-weight: 700; padding: 10px 12px; border-bottom: 2px solid var(--cream-line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--cream-line); vertical-align: top; }
.table tr:hover td { background: rgba(198,162,78,.05); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; background: rgba(31,59,44,.07); border-radius: 6px; padding: 2px 7px; color: var(--ink-soft); }

/* 可重複項目編輯 */
.item { border: 1px solid var(--cream-line); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: #fff; position: relative; }
.item__bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.item__bar strong { font-size: 14px; }
.chips-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip-x { display: inline-flex; align-items: center; gap: 6px; background: rgba(31,59,44,.08); border-radius: 999px; padding: 5px 8px 5px 12px; font-size: 13px; }
.chip-x button { border: none; background: none; color: var(--ink-soft); font-size: 15px; line-height: 1; }
.chip-x button:hover { color: #b4453a; }

.stack { display: flex; flex-direction: column; gap: 6px; }
.inline { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }

.empty { text-align: center; color: var(--ink-soft); padding: 60px 20px; }
.thumb { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; border: 1px solid var(--cream-line); background: #efe7d4; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 16px; }
.media-cell__name { font-size: 12px; color: var(--ink-soft); margin-top: 6px; word-break: break-all; }

/* 圖庫挑選 Modal */
.lib-overlay { position: fixed; inset: 0; background: rgba(22,40,29,.55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lib-panel { background: var(--cream); border-radius: 18px; width: min(920px, 96vw); max-height: 86vh; overflow: auto; padding: 20px 22px 26px; box-shadow: 0 30px 70px rgba(0,0,0,.4); }
.lib-head { position: sticky; top: -20px; background: var(--cream); display: flex; align-items: center; justify-content: space-between; padding: 6px 0 14px; margin-bottom: 6px; border-bottom: 1px solid var(--cream-line); }
.lib-pick { cursor: pointer; border-radius: 12px; padding: 6px; transition: .15s; }
.lib-pick:hover { background: rgba(198,162,78,.16); transform: translateY(-2px); }
.lib-pick .media-cell__name { text-align: center; }

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--forest-deep); color: var(--on-dark); padding: 12px 22px; border-radius: 999px; font-size: 14px; font-weight: 500; box-shadow: 0 12px 30px rgba(0,0,0,.25); z-index: 100; }
.toast.err { background: #8f342b; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 8px; align-items: center; }
  .side__brand { padding: 0; }
  .side__nav { flex-direction: row; flex-wrap: wrap; flex-basis: 100%; }
  .side__foot { flex-basis: 100%; display: flex; justify-content: space-between; }
  .row, .row-3 { grid-template-columns: 1fr; }
  .content { padding: 20px; }
  .topbar { padding: 14px 20px; }
}
