:root {
  color-scheme: light;
  --surface: oklch(0.985 0.008 230);
  --surface-raised: oklch(1 0 0);
  --surface-muted: oklch(0.95 0.015 230);
  --ink: oklch(0.22 0.035 230);
  --ink-muted: oklch(0.46 0.035 230);
  --line: oklch(0.86 0.025 230);
  --cobalt: oklch(0.45 0.086 230);
  --cobalt-deep: oklch(0.34 0.075 230);
  --amber: oklch(0.72 0.14 75);
  --amber-ink: oklch(0.28 0.07 65);
  --danger: oklch(0.45 0.15 25);
  /* Focus ring contrast is >= 3:1 against white/off-white surfaces. */
  --focus-ring: oklch(0.34 0.075 230);
  --radius: 0.75rem;
  --shadow: 0 0.25rem 0.5rem oklch(0.25 0.03 230 / 0.08);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans TC", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--surface); }
body { margin: 0; color: var(--ink); background: var(--surface); line-height: 1.55; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { min-height: 44px; }
button, select, input, textarea { border: 1px solid var(--line); border-radius: 0.5rem; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
a { color: var(--cobalt-deep); }
.topbar { background: var(--surface-raised); border-bottom: 1px solid var(--line); }
.topbar-inner, .page-shell { width: min(1200px, calc(100% - 2rem)); margin: 0 auto; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.35rem, 3vw, 2rem); margin-bottom: 0; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; margin-bottom: 0; }
.brand-context { color: var(--cobalt); font-size: 0.82rem; font-weight: 750; margin-bottom: 0.2rem; }
.section-context { color: var(--ink-muted); font-size: 0.88rem; margin: 0.25rem 0 0; }
.muted { color: var(--ink-muted); }
.page-shell { padding: 2rem 0 4rem; }
.section-heading, .panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.section-heading { margin-bottom: 1rem; }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.status-card, .panel, .auth-card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.status-card { padding: 1.1rem; }
.status-card-primary { border-color: var(--cobalt); }
.card-label { color: var(--ink-muted); font-size: 0.82rem; margin-bottom: 0.35rem; }
.status-value { font-size: 1.35rem; font-weight: 800; margin-bottom: 0.1rem; overflow-wrap: anywhere; }
.action-bar { display: flex; flex-wrap: wrap; gap: 0.7rem; padding: 1rem 0 2rem; }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 0.55rem 1rem; cursor: pointer; font-weight: 750; border-radius: 0.5rem; }
.button-primary { background: var(--cobalt); color: oklch(1 0 0); border-color: var(--cobalt); }
.button-primary:hover { background: var(--cobalt-deep); }
.button-secondary { background: var(--surface-raised); color: var(--cobalt-deep); border-color: var(--cobalt); }
.button-quiet { background: transparent; color: var(--cobalt-deep); border-color: transparent; }
.button:disabled { cursor: wait; opacity: 0.68; }
.button.is-loading { position: relative; }
.button.is-loading::after { content: ""; width: 0.8rem; height: 0.8rem; margin-left: 0.45rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: button-spin 700ms linear infinite; }
.button-wide { width: 100%; }
.panel { padding: 1.25rem; margin-bottom: 1.25rem; }
.panel-heading { margin-bottom: 1rem; }
.facebook-login-panel { border-color: var(--cobalt); }
.facebook-login-content { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.facebook-login-content > div { max-width: 68ch; }
.connection-status { margin: 0.35rem 0 0; font-size: 1.05rem; font-weight: 800; }
.facebook-privacy-note { margin: 1rem 0 0; color: var(--ink-muted); font-size: 0.88rem; }
.facebook-login-panel .alert { margin: 1rem 0 0; }
.facebook-complete-message { margin-top: 0.75rem; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1rem 0; }
.dialog-close { flex: 0 0 auto; }
dialog { width: min(44rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--surface-raised); box-shadow: var(--shadow); overflow: auto; }
dialog::backdrop { background: oklch(0.16 0.025 230 / 0.58); }
dialog .editor-grid { margin: 0; padding: 1rem; border: 0; background: transparent; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1rem; padding: 1rem; margin-bottom: 1rem; background: var(--surface-muted); border: 1px solid var(--line); border-radius: 0.5rem; }
.editor-grid label, .stack-form label { display: grid; gap: 0.35rem; color: var(--ink-muted); font-size: 0.85rem; font-weight: 700; }
.editor-grid input, .editor-grid select, .editor-grid textarea, .stack-form input { width: 100%; padding: 0.55rem 0.7rem; color: var(--ink); background: var(--surface-raised); }
.full-width { grid-column: 1 / -1; }
.checkbox-label { display: flex !important; align-items: center; grid-template-columns: auto 1fr !important; gap: 0.5rem !important; min-height: 44px; }
.checkbox-label input { width: 1.2rem; height: 1.2rem; min-height: 0; }
.editor-actions { display: flex; gap: 0.6rem; }
.table-wrap { overflow-x: auto; }
.responsive-table { width: 100%; border-collapse: collapse; }
.responsive-table th, .responsive-table td { border-bottom: 1px solid var(--line); padding: 0.8rem 0.6rem; text-align: left; vertical-align: top; }
.responsive-table th { color: var(--ink-muted); font-size: 0.78rem; white-space: nowrap; }
.responsive-table td small { display: block; color: var(--ink-muted); margin-top: 0.15rem; }
.target-price { color: var(--amber-ink); font-weight: 800; }
.link-button { display: inline-flex; align-items: center; min-height: 44px; padding: 0.25rem 0.45rem; margin-right: 0.2rem; border: 0; border-radius: 0.35rem; background: transparent; color: var(--cobalt-deep); text-decoration: underline; cursor: pointer; }
.link-button:disabled { cursor: wait; opacity: 0.68; }
.link-button.is-loading { text-decoration: none; }
.link-button.is-loading::after { content: ""; width: 0.75rem; height: 0.75rem; margin-left: 0.35rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: button-spin 700ms linear infinite; }
.alert { padding: 0.75rem 1rem; border-radius: 0.5rem; border: 1px solid; margin: 0 0 1rem; }
.alert-error { color: var(--danger); background: oklch(0.97 0.025 25); border-color: oklch(0.8 0.1 25); }
.empty-state { color: var(--ink-muted); text-align: center !important; padding: 2rem !important; }
.filter-row select { min-width: 9rem; padding: 0.4rem; background: var(--surface-raised); }
.toast { position: fixed; z-index: 4; inset: auto 1rem 1rem auto; max-width: min(24rem, calc(100% - 2rem)); padding: 0.8rem 1rem; border: 1px solid var(--cobalt); border-radius: 0.5rem; color: var(--surface-raised); background: var(--cobalt-deep); opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(0.5rem); transition: opacity 150ms ease, transform 150ms ease, visibility 0s linear 150ms; }
.toast.visible { opacity: 1; visibility: visible; transform: translateY(0); transition-delay: 0s; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth-shell { width: min(100%, 28rem); }
.auth-card { padding: clamp(1.25rem, 5vw, 2rem); }
.stack-form { display: grid; gap: 0.6rem; margin-top: 1.5rem; }
.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; }
@media (max-width: 800px) {
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .section-heading, .panel-heading { align-items: flex-start; flex-direction: column; }
  .facebook-login-content { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 620px) {
  .topbar-inner, .page-shell { width: min(100% - 1.25rem, 1200px); }
  .page-shell { padding-top: 1.25rem; }
  .status-grid { gap: 0.6rem; }
  .status-card { padding: 0.85rem; }
  .editor-grid { grid-template-columns: 1fr; padding: 0.8rem; }
  dialog { width: 100%; max-width: none; max-height: calc(100dvh - 1rem); margin-block: auto 0.5rem; border-radius: var(--radius) var(--radius) 0 0; }
  .dialog-heading { padding: 0.8rem 0.8rem 0; }
  .editor-actions { flex-wrap: wrap; }
  .editor-actions .button { flex: 1 1 8rem; }
  .full-width { grid-column: auto; }
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table tr { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
  .responsive-table td { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.75rem; border: 0; padding: 0.25rem 0; }
  .responsive-table td::before { content: attr(data-label); color: var(--ink-muted); font-size: 0.78rem; font-weight: 700; }
  .responsive-table td.empty-state { display: block; text-align: center !important; }
  .action-bar .button { flex: 1 1 calc(50% - 0.7rem); }
  .facebook-login-content .button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }
@keyframes button-spin { to { transform: rotate(360deg); } }
