/* Plyndi CMS admin. Plain CSS, no build step. Colours are tokens so light and dark mode share every rule. */

:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --side: #ffffff;
  --text: #18201d;
  --muted: #66706b;
  --line: #e3e8e5;
  --soft: #eef3f1;
  --input: #ffffff;
  --primary: #1f6f5c;
  --primary-2: #2a9478;
  --primary-soft: #e3f1ec;
  --primary-ink: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --amber: #8a5a07;
  --amber-soft: #fdf3e1;
  --amber-line: #efd29b;
  --blue: #1d4ed8;
  --blue-soft: #e8effd;
  --blue-line: #b9cdf5;
  --green: #13684d;
  --green-soft: #e3f4ec;
  --green-line: #a7d7c1;
  --teal: #0f766e;
  --teal-soft: #ddf3f0;
  --ok-bg: var(--green-soft);
  --error-bg: var(--danger-soft);
  --shadow: 0 1px 2px rgba(16, 24, 20, .04), 0 4px 14px rgba(16, 24, 20, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 20, .14);
  --radius: 14px;
  --side-w: 248px;
  color-scheme: light;
}

/* Dark: an explicit choice wins; otherwise follow the device */
:root[data-theme='dark'] {
  --bg: #0f1513; --card: #161e1b; --side: #131a17; --text: #e7ecea; --muted: #95a19c; --line: #26312d; --soft: #1c2622; --input: #111916;
  --primary: #3fb592; --primary-2: #5fd0ad; --primary-soft: #173329; --primary-ink: #06231a;
  --danger: #ff8a80; --danger-soft: #3a1714;
  --amber: #f2c26b; --amber-soft: #3a2a0e; --amber-line: #6b5020;
  --blue: #9bb8ff; --blue-soft: #16264a; --blue-line: #2c4580;
  --green: #7fdcb5; --green-soft: #123527; --green-line: #245c45;
  --teal: #6fd6cb; --teal-soft: #0f302d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f1513; --card: #161e1b; --side: #131a17; --text: #e7ecea; --muted: #95a19c; --line: #26312d; --soft: #1c2622; --input: #111916;
    --primary: #3fb592; --primary-2: #5fd0ad; --primary-soft: #173329; --primary-ink: #06231a;
    --danger: #ff8a80; --danger-soft: #3a1714;
    --amber: #f2c26b; --amber-soft: #3a2a0e; --amber-line: #6b5020;
    --blue: #9bb8ff; --blue-soft: #16264a; --blue-line: #2c4580;
    --green: #7fdcb5; --green-soft: #123527; --green-line: #245c45;
    --teal: #6fd6cb; --teal-soft: #0f302d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14.5px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang TC", "Noto Sans TC", "Hiragino Sans", "Apple SD Gothic Neo", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 16px; letter-spacing: -.01em; margin: 0 0 16px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------------------
   App shell: sidebar + top bar */

.app { display: flex; min-height: 100vh; }

.side {
  width: var(--side-w); flex: none; background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 30;
}
.side-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 64px; padding: 0 16px 0 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.logo { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 4px 12px rgba(31, 111, 92, .25); }
.logo .icon { width: 19px; height: 19px; }
.brand-text { min-width: 0; }
.brand-text b { display: block; font-size: 15px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { display: block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }

.nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.nav-group { margin: 16px 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 1px; border-radius: 9px;
  color: var(--muted); font-weight: 500; text-decoration: none; cursor: pointer; user-select: none;
}
.nav-link:hover { background: var(--soft); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-label { flex: 1; min-width: 0; }
.count { font-size: 11px; font-weight: 700; line-height: 18px; min-width: 22px; text-align: center; padding: 0 7px; border-radius: 99px; background: var(--primary); color: var(--primary-ink); }
.nav-link[href='/admin/payments'] .count { background: var(--amber-soft); color: var(--amber); }

.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu .chev { width: 15px; height: 15px; transition: transform .15s; }
.menu[open] .chev { transform: rotate(90deg); }
.menu.active > summary { color: var(--text); font-weight: 600; }
.menu-list { display: flex; flex-direction: column; padding: 2px 0 6px 38px; }
.menu-list a { position: relative; padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: 13.5px; text-decoration: none; }
.menu-list a:hover { background: var(--soft); color: var(--text); }
.menu-list a.active { color: var(--primary); font-weight: 600; background: var(--primary-soft); }

.side-foot { margin: 0; padding: 14px 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.side-foot a { color: var(--text); font-weight: 600; text-decoration: none; }
.side-foot a:hover { color: var(--primary); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 28px;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.top-search { position: relative; flex: 1; max-width: 440px; margin: 0; }
.top-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.top-search input[type=search] { height: 38px; padding: 0 12px 0 36px; border-radius: 10px; border-color: transparent; background: var(--soft); }
.top-search input[type=search]:focus { background: var(--input); }
.top-title { display: none; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.icon-btn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer; font: inherit;
}
.icon-btn:hover { background: var(--soft); color: var(--text); }
.icon-btn.side-close, .icon-btn.menu-btn { display: none; }
.theme-btn .i-sun { display: none; }
:root[data-theme='dark'] .theme-btn .i-sun { display: block; }
:root[data-theme='dark'] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-btn .i-sun { display: block; }
  :root:not([data-theme='light']) .theme-btn .i-moon { display: none; }
}
.top-lang { margin: 0; }
.lang-select { display: flex; align-items: center; gap: 6px; padding: 0 4px 0 10px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--muted); }
.lang-select .icon { width: 16px; height: 16px; }
.lang-select select { width: auto; border: 0; padding: 6px 4px; background: transparent; color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; }
.lang-select select:focus { outline: none; }
.vr { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.signout { display: flex; align-items: center; gap: 4px; margin: 0; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 12px; text-decoration: none; color: var(--text); }
a.me:hover, .me.active { background: var(--soft); }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; background: var(--primary-soft); color: var(--primary); }
.me-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.me-text b { font-size: 13.5px; font-weight: 600; }
.me-text .role { margin: 2px 0 0; }

.wrap { width: 100%; max-width: 1360px; padding: 28px 28px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }

/* Login and setup pages (no sidebar) */
body.auth { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(1200px 600px at 50% -10%, var(--primary-soft), transparent 70%), var(--bg); }
.auth-head { display: flex; justify-content: center; padding: 48px 16px 8px; }
body.auth .wrap { max-width: 460px; margin: 0 auto; padding: 16px 16px 32px; flex: 1; }
.login { max-width: 400px; margin: 16px auto; display: flex; flex-direction: column; gap: 14px; padding: 28px; box-shadow: var(--shadow-lg); }
.login .field { margin-bottom: 0; }
.lang-switch { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; font-size: 13px; margin: 0; }
.lang-switch a { color: var(--muted); text-decoration: none; }
.lang-switch a.active, .lang-switch a[aria-current] { color: var(--primary); font-weight: 600; }

/* ---------------------------------------------------------------------------
   Building blocks */

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 600; line-height: 1.3;
  cursor: pointer; text-decoration: none; box-shadow: var(--shadow); transition: background-color .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--soft); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn-small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); box-shadow: none; }
.btn-danger:hover { background: var(--danger-soft); }
.link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline; }

.alert { padding: 11px 14px; border-radius: 10px; margin: 0 0 16px; border: 1px solid transparent; }
.alert-ok { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-info { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
.empty { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.intro { color: var(--muted); max-width: 680px; }

/* Summary cards on the Inbox */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s;
}
a.stat:hover { border-color: var(--primary); transform: translateY(-1px); }
.stat small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat b { font-size: 24px; letter-spacing: -.02em; line-height: 1.2; }
.stat em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.stat-icon { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; }
.tone-green { background: var(--primary-soft); color: var(--primary); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-teal { background: var(--teal-soft); color: var(--teal); }

/* Empty state */
.empty-state { text-align: center; padding: 44px 20px; }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty-icon .icon { width: 24px; height: 24px; }
.empty-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.empty-state .empty { margin: 0 auto 14px; max-width: 420px; }
.empty-state .empty:last-child { margin-bottom: 0; }

/* Tables */
.group { margin-bottom: 28px; }
.list {
  width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.list th, .list td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.list th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--soft); padding-top: 11px; padding-bottom: 11px; }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr { transition: background-color .12s; }
.list tbody tr:hover td { background: color-mix(in srgb, var(--soft) 70%, transparent); }
.list tr[data-href] { cursor: pointer; }
.list th:nth-child(1) { width: 40%; }
.list th:nth-child(2) { width: 15%; }
.list th:nth-child(3) { width: 25%; }
.list th:nth-child(4) { width: 12%; }
.list .title { font-weight: 600; color: var(--text); text-decoration: none; }
.list a.title:hover { color: var(--primary); }
.list .zh, .list .missing { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.list .missing { font-style: italic; }

/* Badges */
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; line-height: 1.6;
  padding: 1px 9px; border-radius: 99px; background: var(--soft); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge-draft, .p-contacted, .b-pending_payment { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.badge-published, .p-done, .b-paid, .b-confirmed, .d-open { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.badge-changed, .p-new, .badge-lang { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.badge-featured { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.p-new, .p-contacted, .p-done, .b-paid, .b-confirmed, .b-pending_payment, .b-failed { padding-left: 8px; }
.p-new::before, .p-contacted::before, .p-done::before, .b-paid::before, .b-confirmed::before, .b-pending_payment::before, .b-failed::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85;
}
.p-new { font-weight: 700; }
.p-spam { color: var(--muted); }
.b-expired, .b-cancelled { color: var(--muted); text-decoration: line-through; }
.b-failed { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.badge-lang { font-weight: 700; font-size: 11px; border-radius: 6px; padding: 0 6px; vertical-align: 1px; }
.role { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 1px 7px; border-radius: 6px; margin-left: 6px; vertical-align: 1px; }
.role-manager { background: var(--amber-soft); color: var(--amber); }
.role-staff { background: var(--blue-soft); color: var(--blue); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; min-width: 0; }
.field > span, .field .label { font-weight: 600; font-size: 13.5px; }
.field small { color: var(--muted); font-size: 12px; }
.lang { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-left: 4px; }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=email], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--input); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
textarea { resize: vertical; }
.field-error { color: var(--danger); font-size: 13px; margin: 0; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lang-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-bottom: 18px; padding: 4px; background: var(--soft); border-radius: 12px; }
.lang-tab { font: inherit; font-size: 13.5px; font-weight: 600; padding: 6px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.lang-tab:hover { color: var(--text); }
.lang-tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.lang-tab .empty-dot { font-size: 11px; margin-left: 5px; opacity: .75; }
.lang-panel[hidden] { display: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; align-items: start; }
.grid .check { margin-bottom: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.checks.stacked { flex-direction: column; gap: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check input { margin-top: 4px; accent-color: var(--primary); }
.check small { display: block; color: var(--muted); font-size: 12px; }
.card > .check { margin-bottom: 14px; }

.image-field { display: flex; flex-direction: column; gap: 8px; }
.image-field .preview { max-width: 320px; max-height: 200px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.image-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status { font-size: 13px; color: var(--muted); }

.rep-rows { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.rep-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.rep-fields { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; align-items: start; min-width: 0; }
.rep-row .preview { max-width: 160px; max-height: 120px; }
.rep-row .image-field { margin-bottom: 14px; }

.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.secondary-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.secondary-actions form { margin: 0; }
.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.plain li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; display: flex; justify-content: space-between; gap: 12px; }
.single { display: block; }
.counter { display: block; color: var(--muted); font-size: 12px; }
.counter-high { color: var(--danger); }
.foot { text-align: center; padding: 24px; font-size: 12.5px; color: var(--muted); }
.foot a { color: var(--muted); font-weight: 600; }
.foot a:hover { color: var(--primary); }
.top-gap { margin-top: 18px; }
.no-margin { margin: 0; }
.indent { padding-left: 28px; }
button:disabled { cursor: default; opacity: .6; }

/* Activity log */
.activity { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 8px; }
.activity li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 15px; overflow-wrap: anywhere; box-shadow: var(--shadow); }
.activity details { margin-top: 6px; }
.activity summary { cursor: pointer; color: var(--primary); font-size: 13px; }
.changes { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; table-layout: fixed; }
.changes th { text-align: left; width: 22%; font-weight: 600; padding: 4px 8px 4px 0; vertical-align: top; }
.changes td { padding: 4px 8px; vertical-align: top; white-space: pre-wrap; }
.changes .before { background: var(--danger-soft); text-decoration: line-through; color: var(--danger); }
.changes .after { background: var(--green-soft); }

/* Team */
.signout a.muted { text-decoration: none; }
.list tr.inactive td { opacity: .55; }
.list.team th:nth-child(1) { width: 34%; }
.list.team th:nth-child(2) { width: 18%; }
.list.team th:nth-child(3) { width: 30%; }
.list.team th:nth-child(4) { width: 18%; }

/* Inbox */
.filters { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.1fr 1.5fr auto; gap: 0 12px; align-items: end; }
.filters .field { margin-bottom: 0; }
.filter-actions { display: flex; gap: 12px; align-items: center; padding-bottom: 6px; }
.list.inbox th:nth-child(1) { width: 26%; }
.list.inbox th:nth-child(2) { width: 26%; }
.list.inbox th:nth-child(3) { width: 16%; }
.list.inbox th:nth-child(4) { width: 18%; }
.list.inbox th:nth-child(5) { width: 14%; }
.list tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.list tr.unread .title { font-weight: 800; }
.detail { display: grid; grid-template-columns: 200px 1fr; gap: 10px 16px; margin: 16px 0; }
.detail dt { color: var(--muted); font-size: 13.5px; }
.detail dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.contact-links { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-whatsapp { background: #25d366; border-color: #25d366; color: #fff; }
.btn-whatsapp:hover { background: #1fb457; }
.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.inline-form .label { font-weight: 600; font-size: 14px; margin-right: 4px; }
.inline-form select { width: auto; min-width: 200px; }
.notes { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px; }
.notes li { border-left: 3px solid var(--primary-soft); padding: 4px 12px; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Dates & seats */
.list.dates th:nth-child(1) { width: 30%; }
.list.dates th:nth-child(2) { width: 20%; }
.list.dates th:nth-child(3) { width: 18%; }
.list.dates th:nth-child(4) { width: 12%; }
.row-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-actions form { margin: 0; }
.link.danger { color: var(--danger); }

/* Alerts */
.channel-status { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.channel-status p { margin: 6px 0 0; }
.chan { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 5px; }
.chan-email { background: var(--blue-soft); color: var(--blue); }
.chan-whatsapp { background: var(--green-soft); color: var(--green); }
.list.alerts th:nth-child(1) { width: 32%; }
.list.alerts th:nth-child(2) { width: 22%; }
.list.alerts th:nth-child(3) { width: 22%; }
pre.message { white-space: pre-wrap; font: 13px/1.5 ui-monospace, Menlo, monospace; background: var(--soft); padding: 12px; border-radius: 10px; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------------------
   Smaller screens */

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .filter-actions { padding-bottom: 6px; }
}

@media (max-width: 900px) {
  .side { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .side { transform: none; }
  body.nav-open { overflow: hidden; }
  .icon-btn.side-close, .icon-btn.menu-btn { display: grid; }
  .scrim { position: fixed; inset: 0; background: rgba(8, 12, 10, .45); z-index: 25; }
  .top { padding: 0 12px 0 8px; gap: 6px; }
  .top-title { display: block; }
  .top-search { max-width: none; }
  .top-search input[type=search] { height: 36px; }
  .me-text, .vr { display: none; }
  .wrap { padding: 20px 16px 48px; }
}

@media (max-width: 760px) {
  .top-search { display: none; }
  .top-title { display: block; flex: 1; }
  .lang-select .icon { display: none; }
  .lang-select { padding-left: 4px; }
  .lang-select select { max-width: 92px; }
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; gap: 10px; }
  .stat-icon { display: none; }
  .stat b { font-size: 20px; }
  .pair, .grid { grid-template-columns: 1fr; }
  .rep-row { flex-direction: column; }
  .rep-fields { width: 100%; }
  .list th, .list td { padding: 11px 12px; }
  .list th:nth-child(2), .list td:nth-child(2) { display: none; }
  .list th:nth-child(4), .list td:nth-child(4) { display: none; }
  .list th:nth-child(1) { width: 50%; }
  .filters { grid-template-columns: 1fr; gap: 0; }
  .filters .field { margin-bottom: 12px; }
  .detail { grid-template-columns: 1fr; gap: 2px; }
  .detail dd { margin-bottom: 8px; }
  .list.inbox th:nth-child(3), .list.inbox td:nth-child(3), .list.inbox th:nth-child(5), .list.inbox td:nth-child(5) { display: none; }
  .list.dates th:nth-child(3), .list.dates td:nth-child(3) { display: none; }
  /* The general list rule hides columns 2 and 4; on these lists they matter */
  .list.inbox th:nth-child(2), .list.inbox td:nth-child(2), .list.inbox th:nth-child(4), .list.inbox td:nth-child(4),
  .list.dates th:nth-child(2), .list.dates td:nth-child(2), .list.dates th:nth-child(4), .list.dates td:nth-child(4),
  .list.team th:nth-child(2), .list.team td:nth-child(2) { display: table-cell; }
  .channel-status { grid-template-columns: 1fr; }
  .list.alerts th:nth-child(3), .list.alerts td:nth-child(3) { display: none; }
  .list.alerts th:nth-child(2), .list.alerts td:nth-child(2) { display: table-cell; }
}

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

/* Bulk actions on Dates & seats */
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.bulk-bar .muted { margin-right: auto; }
.list th.pick, .list td.pick { width: 40px; text-align: center; }
.list .pick input { width: 18px; height: 18px; cursor: pointer; }
/* With the tick-box column first, the other columns move one place right */
.list.dates.with-pick th:nth-child(1) { width: 40px; }
.list.dates.with-pick th:nth-child(2) { width: 28%; }
.list.dates.with-pick th:nth-child(3) { width: 18%; }
.list.dates.with-pick th:nth-child(4) { width: 16%; }
.list.dates.with-pick th:nth-child(5) { width: 12%; }
@media (max-width: 760px) {
  .list.dates.with-pick th:nth-child(3), .list.dates.with-pick td:nth-child(3) { display: table-cell; }
  .list.dates.with-pick th:nth-child(4), .list.dates.with-pick td:nth-child(4) { display: none; }
  .bulk-bar .muted { width: 100%; }
  .list.dates.with-pick th:nth-child(1) { width: 40px; }
}

/* Currency next to price labels, e.g. Price NT$ */
.currency-tag { font-style: normal; font-size: 11px; font-weight: 800; color: var(--primary); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }

/* "Translate from English" (DeepL) and the "Auto-translated – please check" notes */
.translate-box h2 { margin-bottom: 10px; }
.translate-langs { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 10px; }
.check-inline { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.check-inline input { width: 16px; height: 16px; accent-color: var(--primary); }
.translate-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 6px; }
.translate-actions [data-translate-status] { color: var(--text); }
.lang-tab.needs-check::after { content: '!'; display: inline-block; margin-left: 6px; width: 16px; height: 16px; line-height: 16px; border-radius: 50%; background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-line); font-size: 11px; text-align: center; }
.check-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; }
.check-note[hidden] { display: none; }
.list .needs-check { color: var(--amber); }

/* Name of a list of rows (price options, add-ons, itineraries, ...) */
.repeater-label { display: block; font-weight: 700; margin: 18px 0 4px; }

/* Today (home page) */
.today-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.today-actions .btn .icon { width: 16px; height: 16px; vertical-align: -3px; }
.all-clear { display: flex; align-items: center; gap: 8px; color: var(--green); font-weight: 600; margin: 0; }
.all-clear .icon { width: 20px; height: 20px; }
.attention { list-style: none; margin: 0; padding: 0; }
.att { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.att:first-child { border-top: 0; padding-top: 4px; }
.att-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
.att-red .att-dot { background: var(--danger); }
.att-amber .att-dot { background: #d18b06; }
.att-blue .att-dot { background: var(--blue); }
.att-body { flex: 1; min-width: 0; }
.att-body p { margin: 0; }
.att-body .small { margin-top: 3px; }
.att .btn { flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px !important; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); font-size: 13px; color: var(--text); text-decoration: none; }
.chip:hover { border-color: var(--primary); }
.list.week th:nth-child(1) { width: 18%; }
.list.week th:nth-child(2) { width: 42%; }
.list.week th:nth-child(3) { width: 18%; }
.list.week th:nth-child(4) { width: 8%; }
.list.week tr.is-today td { background: var(--primary-soft); }
.list.week .badges { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: 1px; }
.bar { display: block; height: 5px; border-radius: 3px; background: var(--soft); margin-top: 6px; overflow: hidden; max-width: 120px; }
.bar span { display: block; height: 100%; background: var(--primary); }
.section-title { font-size: 17px; margin: 8px 0 12px; }
.money-line { display: block; }
.top-tours { margin: 2px 0 0; padding-left: 18px; font-size: 13.5px; font-weight: 600; }
.top-tours em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.table-wrap { overflow-x: auto; }
@media (max-width: 640px) {
  .att { flex-wrap: wrap; }
  .att .btn { margin-left: 22px; }
  /* Next 7 days: one small card per tour instead of a squeezed table */
  .list.week thead { display: none; }
  .list.week, .list.week tbody { display: block; }
  .list.week tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .list.week tr:last-child { border-bottom: 0; }
  .list.week tr.is-today { background: var(--primary-soft); }
  .list.week td, .list.week tr.is-today td { display: block !important; padding: 0; border: 0; background: none; }
  .list.week td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .list.week td:nth-child(1) .zh { display: inline; margin-left: 6px; }
  .list.week td:nth-child(5) { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
  .list.week td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .list.week td:nth-child(2) .badges { display: flex; margin: 4px 0 0; }
  .list.week td:nth-child(3) { grid-column: 1; grid-row: 3; }
  .list.week td:nth-child(4) { grid-column: 2; grid-row: 3; align-self: end; color: var(--muted); font-size: 13px; }
  .list.week td:nth-child(4)::before { content: attr(data-label) ' '; }
}
.role-developer { background: var(--accent-soft, #e3eefb); color: var(--accent, #1d4f91); }

/* ---------------------------------------------------------------------------
   Payhip-style product edit page (module.layout = 'product'), e.g. Brightloom Templates */
.product-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1100px) {
  .product-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .product-side { position: sticky; top: 16px; }
}
.product-side .card h2 { font-size: 15px; }
.publish-box { border-color: var(--primary); }
.publish-box h2 { margin-bottom: 12px; }
.form-actions.stacked { flex-direction: column; align-items: stretch; }
.form-actions.stacked .btn { justify-content: center; width: 100%; }
.form-actions.stacked a { text-align: center; }
@media (max-width: 1099px) { .product-side .publish-box { order: 99; } .product-side { display: flex; flex-direction: column; } }

.product-form .card > h2 { margin-bottom: 14px; }
.product-form input[name="title"] { font-size: 18px; font-weight: 600; padding-top: 12px; padding-bottom: 12px; }

/* Cover image: a big, friendly drop area instead of a small button */
.product-form .product-main .image-field:not(.rep-row .image-field) {
  border: 2px dashed var(--line); border-radius: 14px; padding: 18px; align-items: center; text-align: center; background: var(--soft);
}
.product-form .product-main .image-field .preview { max-width: 100%; max-height: 320px; object-fit: contain; }
.product-form .product-main .image-field .btn { padding: 10px 18px; }

.advanced { padding: 0; }
.advanced > summary { cursor: pointer; padding: 16px 20px; list-style: none; }
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: '▸'; display: inline-block; margin-right: 8px; transition: transform .15s; }
.advanced[open] > summary::before { transform: rotate(90deg); }
.advanced[open] > summary { border-bottom: 1px solid var(--line); }
.advanced > :not(summary) { margin: 16px 20px; }
