/* COBLID design system — shared by the Platform, Business and Customer frontends.
   Style: "framed sheet". The chrome is one tinted L-frame (sidebar + 48px top bar, no rule
   between them); the work sits on a white sheet inset 8px from the right and bottom edges,
   1px edge, 16px corners, no shadow. Brand hue (COBLID teal) only on the logo, the active
   tab underline, focus and the main data element. Fonts are self-hosted (CSP: self only). */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("./fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("./fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("./fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("./fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }

:root {
  /* frame tinted toward brushed-aluminium blue-grey (the face of COBLID) */
  --ground: #f3f6f8;
  --surface: #ffffff;
  --raised: #f4f6f8;
  --active: #e6eaed;
  --border: #e5e8eb;
  --rule: #eff1f3;
  --control: #cdd1d5;
  --text: #131416;
  --muted: #5b5f63;
  --accent: #1b6c80;           /* COBLID teal */
  --accent-ink: #ffffff;
  --primary: #17191b;          /* primary button: near-black */
  --primary-ink: #ffffff;
  --positive: #1e7b4f; --negative: #c4242a; --warning: #92400e;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e;
  --pill-neutral-bg: #ebedee; --pill-neutral-ink: #353736;
  --pill-accent-bg: #e1f0f3; --pill-accent-ink: #0f4552;

  --font: "IBM Plex Sans", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --fs-title: 22px; --fs-section: 16px; --fs-kpi: 28px; --fs-body: 14px; --fs-small: 12px;

  --radius-card: 8px; --radius-control: 6px; --radius-sheet: 16px;
  --sheet-inset: 8px; --sidebar-width: 228px; --topbar: 48px;
  --gap: 24px; --pad: 24px; --control-height: 32px; --row-height: 48px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground); color: var(--text); font: 400 var(--fs-body)/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--fs-title); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-section); font-weight: 600; line-height: 1.35; }
h3 { font-size: var(--fs-body); font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- shell: L-frame + sheet ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-width) 1fr; grid-template-rows: var(--topbar) 1fr; min-height: 100vh; min-height: 100dvh; }
.brand { grid-row: 1; grid-column: 1; display: flex; align-items: center; gap: 10px; padding: 0 16px; font-weight: 600; letter-spacing: 0.02em; }
.brand img { width: 24px; height: 24px; }
.brand .scope { font-weight: 400; color: var(--muted); letter-spacing: 0; }
.topbar { grid-row: 1; grid-column: 2; display: flex; align-items: center; gap: 12px; padding: 0 calc(var(--sheet-inset) + 8px) 0 var(--pad); }
.topbar .spacer { flex: 1; }
.sidebar { grid-row: 2; grid-column: 1; padding: 8px 8px 16px; display: flex; flex-direction: column; gap: 2px; }
.sidebar .group { margin-top: 16px; padding: 0 10px 4px; font-size: var(--fs-small); color: var(--muted); }
.nav-link { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: var(--radius-control); color: var(--text); }
.nav-link:hover { background: var(--active); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--active); font-weight: 600; }
.nav-link.locked { color: var(--muted); }
.nav-link.locked > svg:first-child { opacity: .5; }
.nav-link .nav-count { margin-left: auto; }
.nav-link .nav-lock { margin-left: auto; width: 14px; height: 14px; opacity: .7; }
/* Grouped menu (business back office): on a desktop the group wrappers vanish and a heading looks like .group;
   on a phone (see the 760px block) it is a drawer with collapsible groups. */
.sidebar.grouped .nav-group, .sidebar.grouped .nav-items { display: contents; }
.sidebar .nav-group-toggle { display: block; width: 100%; border: 0; background: none; font: inherit; font-size: var(--fs-small); line-height: inherit; text-align: left; color: var(--muted); pointer-events: none; }
.nav-group-toggle svg, .sidebar .nav-head, .nav-backdrop { display: none; }
/* Current version at the bottom of the menu; links to 更新日誌. */
.nav-version { margin-top: auto; padding: 16px 10px 0; font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-version:hover { color: var(--accent); }
/* Features the plan does not include: frosted and inert, with an upgrade note on top. */
.feature-locked { position: relative; border-radius: var(--radius-card); overflow: hidden; }
.feature-locked > .locked-content { filter: blur(2px) grayscale(1); opacity: .5; pointer-events: none; user-select: none; min-height: 180px; }
.feature-locked > .locked-note {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 6px; padding: 72px 24px 24px; text-align: center; background: color-mix(in srgb, var(--surface) 55%, transparent);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.feature-locked .locked-note p { max-width: 380px; margin: 0 0 6px; }
.feature-locked .locked-icon { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); }
.feature-locked .locked-icon svg { width: 18px; height: 18px; }
.feature-locked .locked-icon svg, .nav-link .nav-lock { fill: none; stroke: currentColor; stroke-width: 1.75; }
.nav-link svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 1.6; flex: none; }
.sheet {
  grid-row: 2; grid-column: 2; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sheet); margin: 0 var(--sheet-inset) var(--sheet-inset) 0;
  min-width: 0; padding: var(--pad); overflow: auto;
}
.btn.menu-btn { display: none; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head .sub { margin-top: 4px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-height);
  padding: 0 12px; border-radius: var(--radius-control); border: 1px solid var(--control); background: var(--surface);
  color: var(--text); font: 500 var(--fs-body)/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background 150ms var(--ease-out), transform 120ms var(--ease-out);
}
.btn:hover { background: var(--raised); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #2c2f32; }
.btn-danger { color: var(--negative); }
.btn-danger.solid { background: var(--negative); border-color: var(--negative); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-lg { height: 40px; padding: 0 16px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- cards & grid ---------- */
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-card); }
.kpi { padding: 16px 20px; }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi .label { font-size: var(--fs-small); color: var(--muted); font-weight: 500; }
.kpi .value { font-size: var(--fs-kpi); font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 4px; }
.kpi .value.zero { color: var(--muted); }
.kpi .note { font-size: var(--fs-small); color: var(--muted); margin-top: 2px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; }
.tab { padding: 8px 0 10px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: 0; border-left: 0; border-right: 0; font: 500 var(--fs-body) var(--font); cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- table ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .count { margin-left: auto; color: var(--muted); font-size: var(--fs-small); }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
table.data th { text-align: left; font-size: var(--fs-small); font-weight: 500; color: var(--muted); padding: 8px 12px; white-space: nowrap; }
table.data th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.data th button:focus-visible { outline: 2px solid var(--accent); }
table.data td { padding: 0 12px; height: var(--row-height); border-top: 1px solid var(--rule); vertical-align: middle; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:hover td { background: #fafbfc; }
table.data td.actions-cell { text-align: right; white-space: nowrap; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500; white-space: nowrap; }
.pill.positive { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.negative { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warning { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.pill.neutral { background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.pill.accent { background: var(--pill-accent-bg); color: var(--pill-accent-ink); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .field .label { font-weight: 500; }
.field .hint { font-size: var(--fs-small); color: var(--muted); }
.field .error { font-size: var(--fs-small); color: var(--negative); }
input.input, select.input, textarea.input {
  height: 36px; padding: 0 10px; border: 1px solid var(--control); border-radius: var(--radius-control);
  background: var(--surface); color: var(--text); font: 400 var(--fs-body) var(--font); width: 100%;
}
textarea.input { height: auto; min-height: 88px; padding: 8px 10px; resize: vertical; }
input.input:focus, select.input:focus, textarea.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.input[aria-invalid="true"] { border-color: var(--negative); }
input.search { width: 280px; max-width: 100%; height: var(--control-height); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-error { background: var(--pill-negative-bg); color: var(--pill-negative-ink); padding: 10px 12px; border-radius: var(--radius-control); margin-bottom: 16px; }
.form-note { background: var(--pill-warning-bg); color: var(--pill-warning-ink); padding: 10px 12px; border-radius: var(--radius-control); margin-bottom: 16px; }

/* settings: label column + panel */
.settings-section { display: grid; grid-template-columns: minmax(200px, 360px) minmax(0, 700px); gap: 32px; padding: 32px 0; border-top: 1px solid var(--border); }
.settings-section:first-of-type { border-top: 0; padding-top: 8px; }
.settings-section .desc { color: var(--muted); margin-top: 4px; }
.panel { background: #fafbfb; border-radius: var(--radius-sheet); padding: 16px; }

/* role matrix */
.matrix { border-collapse: collapse; }
.matrix th, .matrix td { padding: 6px 10px; border-top: 1px solid var(--rule); text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix thead th { font-size: var(--fs-small); color: var(--muted); font-weight: 500; border-top: 0; }
.matrix .module td { font-weight: 600; background: var(--raised); text-align: left; }

/* ---------- states ---------- */
.state { padding: 40px 16px; text-align: center; color: var(--muted); }
.state h2 { color: var(--text); margin-bottom: 4px; }
.state .btn { margin-top: 12px; }
.state.error h2 { color: var(--negative); }
.skeleton { background: var(--raised); border-radius: 4px; height: 14px; margin: 10px 0; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- dialog & toast ---------- */
dialog.dialog { border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0,0,0,.14); color: var(--text); }
dialog.dialog::backdrop { background: rgba(19,20,22,.35); }
.dialog-body { padding: 20px; }
.dialog-body p { margin-top: 8px; color: var(--muted); }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--rule); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--primary); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: 360px; animation: rise 200ms var(--ease-out); }
.toast.error { background: var(--negative); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); }
.auth-aside { background: var(--accent); color: #e8f3f5; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside .wordmark { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 18px; letter-spacing: 0.04em; }
.auth-aside .wordmark img { width: 32px; height: 32px; }
.auth-aside .statement { font-size: 32px; line-height: 1.2; color: #fff; font-weight: 500; max-width: 520px; letter-spacing: -0.01em; }
.auth-aside .flow { display: flex; flex-wrap: wrap; gap: 6px 16px; color: #cfe5ea; font-size: 15px; margin-top: 20px; }
.auth-main { background: var(--surface); padding: 48px; display: flex; flex-direction: column; justify-content: center; }
.auth-main form { width: 100%; max-width: 380px; }
.auth-main h1 { margin-bottom: 4px; }
.auth-main .sub { color: var(--muted); margin-bottom: 24px; }
.auth-main .alt { margin-top: 16px; color: var(--muted); }
/* sign-up: 「請至信箱完成驗證」 (check mail, resend) */
.auth-main .check-mail { margin-top: 20px; }
.auth-main .body-p { margin-bottom: 8px; }
.auth-main .resend-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 20px; color: var(--muted); }
.auth-main .ok-note { background: var(--pill-positive-bg); color: var(--pill-positive-ink); padding: 10px 12px; border-radius: var(--radius-control); margin-top: 16px; }
.auth-main .check-mail .form-error { margin: 16px 0 0; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .span-4, .span-6, .span-8 { grid-column: span 12; }
  .settings-section { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 760px) {
  :root { --pad: 16px; }
  .shell { grid-template-columns: 1fr; grid-template-rows: var(--topbar) 1fr; }
  .brand { grid-column: 1; }
  .topbar { grid-column: 1; grid-row: 1; justify-content: flex-end; padding-right: 12px; background: transparent; pointer-events: none; }
  .topbar > * { pointer-events: auto; }
  .topbar .hide-sm { display: none; }
  .btn.menu-btn { display: inline-flex; }
  .sidebar { position: fixed; inset: var(--topbar) 0 0 0; background: var(--ground); z-index: 50; padding: 12px; display: none; overflow: auto; }
  .sidebar.open { display: flex; }
  /* Phone drawer (change menu-order-mobile): rows ≥ 48px that never shrink, 16px text, the list scrolls inside
     the panel, the page behind stays put, room for the iPhone home bar at the end. */
  html.nav-open, html.nav-open body { overflow: hidden; }
  .sidebar.grouped {
    inset: 0 0 0 auto; width: min(340px, 88vw); z-index: 60; gap: 0; padding: 0 12px calc(24px + env(safe-area-inset-bottom));
    overflow-y: auto; overscroll-behavior: contain; box-shadow: -8px 0 24px rgb(0 0 0 / .12);
  }
  .sidebar.grouped > * { flex: none; }
  .sidebar.grouped .nav-head {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1;
    height: 56px; margin: 0 -12px; padding: 0 6px 0 22px; background: var(--ground); font-weight: 600; font-size: var(--fs-section);
  }
  .sidebar.grouped .nav-close { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .sidebar.grouped .nav-close svg { width: 22px; height: 22px; }
  .sidebar.grouped .nav-group { display: flex; flex-direction: column; gap: 2px; }
  .sidebar.grouped .nav-group + .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
  .sidebar.grouped .nav-items { display: flex; flex-direction: column; gap: 2px; }
  .sidebar.grouped .nav-group:not(.open) .nav-items { display: none; }
  .sidebar.grouped .nav-link { height: auto; min-height: 48px; padding: 0 12px; gap: 14px; font-size: 16px; }
  .sidebar.grouped .nav-link svg { width: 20px; height: 20px; }
  .sidebar.grouped .nav-link .nav-lock { width: 16px; height: 16px; }
  .sidebar .nav-group-toggle {
    display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin: 0; padding: 0 12px;
    border-radius: var(--radius-control); font-size: 13px; font-weight: 600; letter-spacing: .04em; pointer-events: auto; cursor: pointer;
  }
  .sidebar .nav-group-toggle:active { background: var(--active); }
  .nav-group-toggle svg { display: block; width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; transition: transform .2s var(--ease-out); }
  .nav-group.open .nav-group-toggle svg { transform: rotate(180deg); }
  /* A badge inside a closed group (e.g. pending refunds) shows as a dot on its heading. */
  .nav-group:not(.open):has(.nav-count) .nav-group-toggle > span::after {
    content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 8px; border-radius: 50%; background: var(--accent); vertical-align: 2px;
  }
  .sidebar.grouped .nav-version { margin-top: 16px; padding: 12px 12px 0; min-height: 44px; }
  html.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgb(15 23 30 / .4); }
  .sheet { grid-column: 1; margin: 0; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; }
  .page-head { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { padding: 24px 16px; }
  .auth-aside .statement { font-size: 22px; }
  .auth-main { padding: 32px 16px; justify-content: flex-start; }
  input.search { width: 100%; }
  .kpi + .kpi { border-left: 0; border-top: 1px solid var(--border); }
  table.data.stack thead { display: none; }
  table.data.stack tr { display: block; padding: 10px 0; border-top: 1px solid var(--rule); }
  table.data.stack td { display: flex; justify-content: space-between; gap: 12px; height: auto; border: 0; padding: 2px 0; }
  table.data.stack td::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-small); flex-shrink: 0; }
  table.data.stack td.num { text-align: right; }
  /* A value of two lines (e.g. person + time) stays one right-aligned block on a phone. */
  table.data.stack td .cell-stack { text-align: right; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Printable documents (quotes, orders) ---------- */
.print-doc { max-width: 820px; margin: 0 auto; color: var(--text); }
.print-doc .doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; border-bottom: 2px solid var(--text); padding-bottom: 12px; margin-bottom: 16px; }
.print-doc .doc-head h1 { font-size: 22px; }
.print-doc table.data td, .print-doc table.data th { padding: 6px 8px; }
.totals { margin-left: auto; width: min(320px, 100%); }
.totals div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.totals > div > div { padding: 0; }
.totals .grand { border-top: 1px solid var(--text); font-weight: 700; font-size: 18px; padding-top: 8px; }
.totals .tax-none { color: var(--muted); }
.print-doc .option-block { break-inside: avoid; margin-bottom: 28px; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; }
  .topbar, .sidebar, .brand, .no-print, .toast-region, dialog { display: none !important; }
  .shell { display: block !important; }
  .sheet { margin: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; padding: 0 !important; min-height: 0 !important; }
  .print-doc { max-width: none; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Pickers and compatibility list ---------- */
.picker-list { list-style: none; margin: 4px 0 0; padding: 4px; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 6px; max-height: 260px; overflow: auto; }
.picker-list .btn { width: 100%; justify-content: flex-start; height: auto; min-height: 32px; padding: 6px 8px; text-align: left; white-space: normal; }
.compat-list { list-style: none; margin: 0; padding: 0; }
.compat-list li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--rule); font-size: var(--fs-small); }
.compat-list .pill { flex: none; }

/* ---------- Customer site ---------- */
.customer-page { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.customer-page .option-block { margin-bottom: 16px; }
.quote-items { list-style: none; margin: 0 0 12px; padding: 0; }
.quote-items li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
@media print { .customer-page { padding: 0; } .customer-page .card { border: 0; padding: 0; } }
.quote-items-table td { vertical-align: middle; }
.quote-items-table .col-item { min-width: 260px; }

/* ---------- Order stepper, timeline, assembly board, photos ---------- */
.stepper { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0 0 8px; overflow-x: auto; }
.stepper li { flex: 1; min-width: 72px; text-align: center; font-size: var(--fs-small); color: var(--muted); padding: 8px 4px; border-top: 3px solid var(--border); white-space: nowrap; }
.stepper li.done { color: var(--text); border-top-color: var(--accent); }
.stepper li.current { color: var(--text); font-weight: 600; border-top-color: var(--accent); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-top: 1px solid var(--rule); }
.board { display: grid; grid-template-columns: repeat(6, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: var(--ground); border-radius: var(--radius-card); padding: 10px; min-height: 120px; }
.board-col h3 { font-size: var(--fs-small); margin-bottom: 8px; }
.board-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; color: inherit; text-decoration: none; }
.board-card:hover { border-color: var(--accent); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-grid a { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--ground); }
.photo-grid figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.photo-grid .photo-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
@media (max-width: 720px) { .board { grid-template-columns: repeat(6, 78vw); } }

/* ---------- Customer portal (phone first) ---------- */
.portal { --fs-body: 15px; font-size: 15px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--ground); }
.portal .input { font-size: 16px; height: 44px; } /* 16px keeps iOS from zooming into the field */
.portal textarea.input { height: auto; min-height: 120px; padding: 10px; }
.portal .btn { min-height: 44px; font-size: 15px; }
.portal .pill { height: 24px; }
.portal-head { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; min-height: 56px; background: var(--surface); border-bottom: 1px solid var(--border); }
.portal-brand { font-weight: 700; font-size: 16px; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-head .right { display: flex; align-items: center; gap: 4px; }
.portal-head nav { display: none; gap: 4px; }
.portal-head nav a { padding: 8px 12px; border-radius: var(--radius-control); color: var(--muted); font-weight: 500; }
.portal-head nav a[aria-current="page"] { color: var(--text); background: var(--raised); }
.icon-btn { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 50%; color: var(--text); }
.icon-btn:hover { background: var(--raised); }
.portal svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: none; }
.portal > .customer-page { width: 100%; box-sizing: border-box; flex: 1; padding-bottom: 96px; }
.portal-foot { padding: 16px 16px 88px; text-align: center; }
.portal-foot a { color: inherit; text-decoration: underline; }
.portal-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding: 4px 0 calc(6px + env(safe-area-inset-bottom)); }
.portal-tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; justify-content: center; font-size: 12px; color: var(--muted); }
.portal-tabs a[aria-current="page"] { color: var(--accent); font-weight: 600; }
body:has(.portal-tabs) .toasts { bottom: 80px; }
@media (min-width: 721px) {
  .portal-head nav { display: flex; }
  .portal-tabs { display: none; }
  .portal > .customer-page { padding-bottom: 48px; }
  .portal-foot { padding-bottom: 24px; }
  body:has(.portal-tabs) .toasts { bottom: 16px; }
}
.portal-hello { color: var(--muted); margin: 2px 0 20px; }
.portal-sec { margin: 24px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.portal-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: -8px 0 4px -6px; color: var(--text); font-weight: 500; }
.portal-alert { border-radius: 12px; padding: 16px; margin-bottom: 12px; background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.portal-alert.ask { background: var(--pill-warning-bg); color: var(--pill-warning-ink); border: 1px solid #f5e1b0; }
.portal-alert .title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.portal-alert .actions { display: flex; gap: 8px; margin-top: 12px; }
.portal-alert .actions .btn { flex: 1; }
.portal-alert .btn:not(.btn-primary) { background: var(--surface); }
.portal-focus { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; color: inherit; margin-bottom: 12px; }
.portal-focus:hover { border-color: var(--accent); }
.portal-focus .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.portal-focus .title { font-weight: 600; font-size: 16px; }
.portal-focus .now { font-weight: 600; color: var(--accent); }
.portal-focus .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.progress-bar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin: 14px 0 8px; }
.progress-bar i { height: 6px; border-radius: 3px; background: var(--border); }
.progress-bar i.done { background: var(--accent); }
.progress-bar i.now { background: var(--accent); opacity: .45; }
.portal-list { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.portal-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; color: inherit; text-decoration: none; }
.portal-card + .portal-card { border-top: 1px solid var(--rule); }
.portal-card:hover { background: var(--raised); }
.portal-card .main { flex: 1; min-width: 0; }
.portal-card .main > div:first-child { font-weight: 500; }
.portal-card .sub2 { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-card .chev { color: var(--control); }
.portal .card { border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.portal .card > h2 { margin-bottom: 10px; }
.steps { list-style: none; margin: 4px 0 0; padding: 0; }
.steps li { position: relative; padding: 0 0 18px 28px; color: var(--muted); }
.steps li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--control); background: var(--surface); box-sizing: content-box; }
.steps li::after { content: ""; position: absolute; left: 10px; top: 22px; bottom: 2px; width: 2px; background: var(--border); }
.steps li:last-child { padding-bottom: 0; }
.steps li:last-child::after { display: none; }
.steps li.done { color: var(--text); }
.steps li.done::before { background: var(--accent); border-color: var(--accent); }
.steps li.done::after { background: var(--accent); }
.steps li.now { color: var(--text); font-weight: 600; }
.steps li.now::before { border-color: var(--accent); box-shadow: 0 0 0 4px var(--pill-accent-bg); }
.steps .when { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.steps .note { display: block; font-size: 14px; font-weight: 400; color: var(--text); white-space: pre-wrap; }
.portal .photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.portal .photo-grid img { border-radius: 8px; }
.money-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.money-row.big { font-size: 18px; font-weight: 700; border-top: 1px solid var(--rule); margin-top: 6px; padding-top: 10px; }

/* ---------- Global search, meters, announcements ---------- */
.search-box { position: relative; }
.search-pop { position: absolute; top: 38px; left: 0; width: 360px; max-height: 420px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.08); z-index: 60; padding: 6px; }
.search-group { font-size: var(--fs-small); color: var(--muted); padding: 6px 8px 2px; }
.search-item { display: block; padding: 6px 8px; border-radius: 6px; color: inherit; text-decoration: none; }
.search-item:hover { background: var(--ground); }
.meter { height: 8px; background: var(--ground); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.meter-fill { height: 100%; background: var(--accent); }
.meter-fill.warn { background: var(--negative); }
.plan-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.plan-pick { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.plan-pick.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan-pick-price { font-size: 18px; font-weight: 600; }
.plan-pick ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; color: var(--muted); font-size: var(--fs-small, 13px); }
.plan-pick .btn { margin-top: auto; }
.richmenu-preview { width: 100%; max-width: 760px; height: auto; display: block; border-radius: 8px; border: 1px solid var(--border); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg-item { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: var(--fs-small, 13px); }
.seg-item:has(input:checked) { border-color: var(--accent); background: var(--active); font-weight: 600; }
.seg-item input { accent-color: var(--accent); }
.serial-list { display: grid; gap: 10px; }
.serial-line { display: grid; grid-template-columns: minmax(160px, 1fr) 2fr; gap: 12px; align-items: start; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.serial-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
@media (max-width: 720px) { .serial-line { grid-template-columns: 1fr; } }
.line-binding { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-control); margin-bottom: 12px; }
.line-binding img, .line-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.line-avatar { display: inline-flex; align-items: center; justify-content: center; background: #06c755; color: #fff; font-weight: 600; }
.bank-details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; }
.bank-details > div { display: contents; }
.bank-details dt { color: var(--muted); }
.bank-details dd { margin: 0; font-weight: 500; }
/* ---------- online payment (change newebpay-payments) ---------- */
.pay-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.pay-option { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; min-width: 0; }
.pay-option h3 { margin: 0 0 4px; }
.pay-option .sub { color: var(--muted); font-size: var(--fs-small); margin: 0 0 12px; }
.pay-methods { display: flex; flex-direction: column; gap: 8px; }
.btn.pay-method { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; height: auto; min-height: 44px; padding: 8px 12px; text-align: left; white-space: normal; }
.pay-method .t { display: block; font-weight: 500; }
.pay-method .d { display: block; color: var(--muted); font-size: var(--fs-small); font-weight: 400; }
.pay-method .go { color: var(--muted); }
.pay-result { max-width: 560px; }
.pay-result .icon { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; margin-bottom: 12px; }
.pay-result .icon.ok { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pay-result .icon.wait { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.pay-result .icon.bad { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pay-result h2.result-title { font-size: 22px; margin: 0 0 6px; }
.big-code { font-family: var(--mono); font-size: 22px; letter-spacing: .04em; font-weight: 600; overflow-wrap: anywhere; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--rule, var(--border)); }
.toggle-row.first { border-top: 0; }
.switch { position: relative; width: 40px; height: 22px; border-radius: 999px; background: var(--control, #c9cdd0); flex: none; border: 0; padding: 0; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 21px; }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.checks { display: flex; gap: 20px; flex-wrap: wrap; }
.checks label { display: inline-flex; gap: 6px; align-items: center; }
.note-box { background: var(--raised, #f3f4f5); border-radius: var(--radius-control); padding: 10px 12px; }
.warn-box { background: var(--pill-warning-bg); color: var(--pill-warning-ink); border-radius: var(--radius-control); padding: 10px 12px; }
@media (max-width: 760px) { .pay-options { grid-template-columns: 1fr; } .big-code { font-size: 18px; } }
.card.announce { border-left: 3px solid var(--accent); margin-bottom: 8px; }
/* ---------- changelog (更新日誌) ---------- */
.cl-list { display: grid; gap: 16px; max-width: 760px; }
.cl-entry h2 { font-size: var(--fs-section); font-weight: 600; margin: 0; }
.cl-entry .cl-version { margin-left: 8px; font-size: var(--fs-small); font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.cl-entry .cl-title { font-weight: 400; color: var(--muted); margin-left: 8px; }
.cl-entry ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cl-entry li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; line-height: 1.6; }
.cl-entry li .pill { justify-self: start; }
@media (max-width: 760px) { .cl-entry li { grid-template-columns: 1fr; gap: 4px; } }
/* Shop balance (change plan-change-credit): balance card, money breakdown box, signed amounts. */
.balance-card { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.balance-amt { font-size: 28px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.calc { display: grid; grid-template-columns: 1fr max-content; gap: 6px 16px; margin: 12px 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--raised); }
.calc .total { font-weight: 600; border-top: 1px solid var(--border); padding-top: 6px; }
.amt-pos { color: var(--positive); }
.amt-neg { color: var(--negative); }
.notice-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--raised); margin: 12px 0; }
.cell-stack { display: flex; flex-direction: column; gap: 2px; }

/* ---------- Branding on customer-facing pages (change free-plan-branding) ---------- */
/* Free-plan watermark: one small grey centred line at the very bottom; the address is printed next to it on paper. */
.powered { text-align: center; font-size: 12px; color: var(--muted); margin-top: 32px; }
.powered a { color: inherit; text-decoration: none; }
.powered a:hover { text-decoration: underline; }
.powered .powered-url { display: none; }
@media print { .powered { margin-top: 24px; } .powered .powered-url { display: inline; } }
.portal-foot .powered { margin-top: 8px; }
/* Shop logo in customer-facing headers (plans with branding). */
.doc-logo { display: block; max-height: 56px; max-width: 220px; margin-bottom: 6px; }
.portal-brand img { display: block; height: 32px; max-width: 160px; object-fit: contain; }
/* 商家設定 → 店鋪 Logo */
.logo-preview { display: flex; align-items: center; justify-content: center; min-height: 96px; padding: 16px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.logo-preview img { max-height: 64px; max-width: 240px; }
.logo-preview.empty { border-style: dashed; color: var(--muted); font-size: 13px; text-align: center; }

/* Google sign-in (change google-login). Google branding: white fill, #747775 1px stroke, #1F1F1F text, 40px high,
   20px "G", 12px side padding, 10px gap. Roboto is not loaded (CSP: no external fonts); the system font is used. */
.btn-google {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 40px; padding: 0 12px;
  background: #fff; color: #1f1f1f; border: 1px solid #747775; border-radius: 4px; font-size: 14px; font-weight: 500;
  letter-spacing: .25px; cursor: pointer; text-decoration: none;
}
.btn-google:hover { background: #f8fafd; text-decoration: none; }
.btn-google:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-google svg { width: 20px; height: 20px; flex: none; }
.or-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 12px; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.google-email { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--raised); margin-bottom: 16px; }
.google-email svg { width: 18px; height: 18px; flex: none; }
.google-email .who { display: flex; flex-direction: column; min-width: 0; }
.google-email .who b { overflow: hidden; text-overflow: ellipsis; }
.linked-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.linked-row .who { display: flex; align-items: center; gap: 10px; min-width: 0; overflow-wrap: anywhere; }
.linked-row svg { width: 20px; height: 20px; flex: none; }

/* ---------- shop website editor (change shop-site; the site itself is styled by /s/site.css) ---------- */
.site-status { display: grid; grid-template-columns: 1fr auto; gap: 12px 24px; align-items: center; }
.site-url { font-family: "IBM Plex Mono", monospace; font-size: 13px; word-break: break-all; }
.site-meta { color: var(--muted); font-size: 13px; }
.site-alert { border: 1px solid var(--negative); background: var(--pill-negative-bg); color: var(--pill-negative-ink); border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.site-alert.warn { border-color: var(--warning); background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.site-editor-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.site-editor-bar h1 { font-size: 18px; }
.site-editor-bar .spacer { flex: 1; }
.site-saved { color: var(--muted); font-size: 13px; }
.site-saved.error { color: var(--negative); }
.site-editor { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }
.site-editor > * { min-width: 0; }
.site-blocks { display: flex; flex-direction: column; gap: 8px; }
.site-block { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.site-block.selected { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.site-block-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; cursor: pointer; }
.site-block-head .t { flex: 1; min-width: 0; }
.site-block-head .t b { display: block; font-size: 13px; }
.site-block-head .t span { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-block-head > svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.site-tools { display: flex; gap: 2px; }
.site-tool { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; border-radius: 6px; color: var(--muted); font-size: 14px; cursor: pointer; }
.site-tool:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.site-tool:disabled { opacity: .35; cursor: default; }
/* shop-site phase 2: page list actions, 最新消息 list */
.site-row-actions { display: flex; gap: 4px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.site-posts td .muted { display: block; }
.site-post-img { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.site-post-img img { width: 120px; height: 80px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.site-block-form { border-top: 1px solid var(--rule); padding: 14px 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.site-block-form .field { margin: 0; }
.site-block-form .count { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }
.site-block-form .hint { color: var(--muted); font-size: 12px; }
.site-sub { display: flex; flex-direction: column; gap: 8px; }
.site-sub > b { font-size: 13px; }
.site-row { border: 1px solid var(--rule); border-radius: 6px; padding: 8px; display: grid; gap: 6px; }
.site-row-tools { display: flex; justify-content: flex-end; gap: 2px; }
.site-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.site-img-slot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.site-img-slot .thumb { width: 72px; height: 48px; border-radius: 6px; background: linear-gradient(120deg, #182024, #26323a); object-fit: cover; flex: none; }
.site-add { border: 1px dashed var(--control); border-radius: 8px; padding: 10px; text-align: center; color: var(--muted); background: none; cursor: pointer; width: 100%; }
.site-add:hover { color: var(--text); border-color: var(--accent); }
.site-preview { border: 1px solid var(--border); border-radius: 12px; background: var(--ground); padding: 12px; position: sticky; top: 0; }
.site-preview-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.site-frame { background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden auto; margin: 0 auto; max-height: 820px; }
.site-frame.phone { width: 390px; max-width: 100%; border-radius: 22px; border-width: 6px; border-color: #1e2124; }
.site-frame a { pointer-events: none; }
.site-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.site-pick { border: 1px solid var(--border); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; position: relative; }
.site-pick input { position: absolute; opacity: 0; pointer-events: none; }
.site-pick:hover, .site-pick:has(input:checked) { border-color: var(--accent); background: var(--raised); }
.site-pick:has(input:focus-visible) { outline: 2px solid var(--accent); }
.site-pick b { font-size: 13px; }
.site-pick span { color: var(--muted); font-size: 12px; line-height: 1.5; }
dialog.dialog:has(.site-wide) { width: min(720px, calc(100vw - 32px)); }
.site-lib { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-height: 320px; overflow: auto; }
.site-lib label { position: relative; aspect-ratio: 4 / 3; border-radius: 6px; border: 2px solid transparent; overflow: hidden; cursor: pointer; background: var(--raised); }
.site-lib label img { width: 100%; height: 100%; object-fit: cover; display: block; }
.site-lib label input { position: absolute; opacity: 0; pointer-events: none; }
.site-lib label:has(input:checked) { border-color: var(--accent); }
.site-lib label:has(input:focus-visible) { outline: 2px solid var(--accent); }
.site-lib .used { position: absolute; left: 4px; bottom: 3px; font-size: 10px; color: #fff; background: rgba(0,0,0,.55); padding: 0 4px; border-radius: 3px; }
.site-changes { margin: 12px 0 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: 8px; }
.site-changes li { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--rule); font-size: 13px; }
.site-changes li:first-child { border-top: 0; }
.site-serp { border: 1px solid var(--border); border-radius: 8px; padding: 14px; font-family: Arial, sans-serif; }
.site-serp .u { color: #202124; font-size: 12px; }
.site-serp .t { color: #1a0dab; font-size: 18px; margin: 2px 0; }
.site-serp .d { color: #4d5156; font-size: 13px; }
.site-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.site-swatches label { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); cursor: pointer; position: relative; }
.site-swatches input { position: absolute; opacity: 0; pointer-events: none; }
.site-swatches label:has(input:checked) { box-shadow: 0 0 0 2px var(--accent); }
.site-swatches label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 16px; font-size: 13px; margin: 16px 0 0; }
.site-kv dt { color: var(--muted); }
.site-kv dd { margin: 0; word-break: break-all; }
@media (max-width: 960px) {
  .site-editor { grid-template-columns: minmax(0, 1fr); }
  .site-preview { position: static; }
  .site-frame.phone { width: 100%; border-width: 1px; border-radius: 8px; border-color: var(--border); }
  .site-picker { grid-template-columns: repeat(2, 1fr); }
  .site-lib { grid-template-columns: repeat(3, 1fr); }
  .site-status { grid-template-columns: 1fr; }
  .site-two { grid-template-columns: 1fr; }
}
/* 自訂網域 card (shop-site phase 3; back office 網站設定 and the platform list) */
.dom-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.dom-host { font-size: 15px; word-break: break-all; }
.dom-panel > p { margin: 0 0 12px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
table.rec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); margin-bottom: 8px; }
table.rec td { word-break: break-all; }
.dom-kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin-bottom: 12px; }
@media (max-width: 760px) {
  table.rec tr { padding: 8px 12px; }
  .dom-kv { grid-template-columns: 1fr; }
}
