@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;600;800;900&family=Noto+Sans+TC:wght@300;400;500;700;900&display=swap');

:root{
  /* 方角硬框，跟報告同一套語彙 */
  --r:3px; --r-sm:2px;
  --font:'Archivo','Helvetica Neue',Arial,'PingFang TC','Noto Sans TC',sans-serif;
  --display:'Archivo','Arial Black',var(--font);
  --num:'Archivo',var(--font);
  --ease:cubic-bezier(.33,0,.2,1);
  --tap:46px;
  --pad: clamp(16px, 3.2vw, 34px);
  --side:212px;
}
/* 預設＝報紙白天版，跟前台報告一致 */
:root{
  color-scheme: light;
  --page:#FFFFFF;
  --surface:#FFFFFF; --surface-2:#F7F8FA; --surface-3:#F2F2F2; --surface-4:#E7E9EF;
  --line:rgba(14,28,64,.14); --line-2:rgba(14,28,64,.28);
  --white:#0E1C40; --muted:#4A5573; --dim:rgba(14,28,64,.46);
  --accent:#2A53C1; --accent-dim:rgba(42,83,193,.10); --on-accent:#FFFFFF;
  --ok:#1B6B4A; --warn:#C97A1E; --bad:#C1272D;
  --on-white:#FFFFFF; --topbar:#2A53C1; --savebar:rgba(255,255,255,.96);
  --shadow:none; --toast-bg:#0E1C40; --toast-ink:#FFFFFF;
  --input-bg:#FFFFFF; --input-focus:#FFFFFF;
}
/* 深色版 */
:root[data-theme="dark"]{
  color-scheme: dark;
  --page:#0B1020;
  --surface:#111A32; --surface-2:#0E1628; --surface-3:#16203C; --surface-4:#1D2947;
  --line:rgba(255,255,255,.13); --line-2:rgba(255,255,255,.26);
  --white:#EEF1F8; --muted:#9AA6C4; --dim:rgba(238,241,248,.45);
  --accent:#6C8CF5; --accent-dim:rgba(108,140,245,.16); --on-accent:#0B1020;
  --ok:#4FBF8B; --warn:#E0A94F; --bad:#E4726F;
  --on-white:#0B1020; --topbar:#16203C; --savebar:rgba(11,16,32,.96);
  --shadow:none; --toast-bg:#EEF1F8; --toast-ink:#0B1020;
  --input-bg:#0E1628; --input-focus:#131D36;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme: dark;
    --page:#0B1020;
    --surface:#111A32; --surface-2:#0E1628; --surface-3:#16203C; --surface-4:#1D2947;
    --line:rgba(255,255,255,.13); --line-2:rgba(255,255,255,.26);
    --white:#EEF1F8; --muted:#9AA6C4; --dim:rgba(238,241,248,.45);
    --accent:#6C8CF5; --accent-dim:rgba(108,140,245,.16); --on-accent:#0B1020;
    --ok:#4FBF8B; --warn:#E0A94F; --bad:#E4726F;
    --on-white:#0B1020; --topbar:#16203C; --savebar:rgba(11,16,32,.96);
    --shadow:none; --toast-bg:#EEF1F8; --toast-ink:#0B1020;
    --input-bg:#0E1628; --input-focus:#131D36;
  }
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ margin:0; }
body{
  background:var(--page);
  min-height:100svh; color:var(--white); font-family:var(--font);
  font-size:15px; line-height:1.5; -webkit-font-smoothing:antialiased;
  -webkit-text-size-adjust:100%;
}
h1,h2,h3,h4,p,ul,ol,figure{ margin:0; }
ul,ol{ list-style:none; padding:0; }
a{ color:inherit; text-decoration:none; }
button,input,select,textarea{ font:inherit; color:inherit; }
img,svg{ display:block; }

.wrap{ width:100%; max-width:1180px; margin-inline:auto; padding-inline:var(--pad); }

/* ---------- 頂列 ---------- */
.topbar{
  position:sticky; top:0; z-index:40; backdrop-filter:blur(18px);
  background:var(--topbar); border-bottom:1px solid var(--line);
  /* 頂列在白天版是藍底、深色版是深藍底，兩邊都是深色面。
     頁面的墨水色票是給白紙用的，直接沿用會變成深藍字壓藍底。
     所以頂列自己定一組淺色墨水，裡面的元件照常用變數就會是對的。 */
  --white:#FFFFFF; --muted:rgba(255,255,255,.82); --dim:rgba(255,255,255,.74);
  --line:rgba(255,255,255,.20); --line-2:rgba(255,255,255,.42);
  --accent:#FFFFFF; --accent-dim:rgba(255,255,255,.14);
  color:var(--white);
}
/* 下拉選單展開後是系統畫的白底，選項要用深色字 */
.topbar select option{ color:#0E1C40; background:#FFFFFF; }
.topbar__in{ display:flex; align-items:center; gap:14px; min-height:62px; }
.logo{ display:flex; align-items:center; gap:9px; font-size:17px; letter-spacing:-.03em; }
.logo svg{ width:24px; height:20px; }
.logo small{ font-size:10px; letter-spacing:.09em; text-transform:uppercase; color:var(--dim); }
.topbar__spacer{ flex:1; }

/* ---------- 按鈕 ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:var(--tap); padding:0 18px; border-radius:var(--r-sm);
  border:1px solid transparent; background:var(--surface-3); color:var(--white);
  font-size:15px; letter-spacing:-.02em; cursor:pointer; white-space:nowrap;
  transition:background .18s var(--ease), border-color .18s var(--ease), opacity .18s var(--ease);
}
.btn:hover{ background:var(--surface-4); }
.btn:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.btn--primary{ background:var(--white); color:var(--on-white); font-weight:500; }
.btn--primary:hover{ opacity:.86; }
.btn--accent{ background:var(--accent); color:var(--on-accent); font-weight:500; }
.btn--accent:hover{ opacity:.88; }
.btn--ghost{ background:transparent; border-color:var(--line-2); }
.btn--ghost:hover{ background:var(--accent-dim); }
.btn--sm{ min-height:38px; padding:0 12px; font-size:13px; border-radius:8px; }
.btn--danger{ color:var(--bad); border-color:var(--line-2); background:transparent; }
.btn[disabled]{ opacity:.45; cursor:not-allowed; }

/* ---------- 卡片與區塊 ---------- */
.card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); }
.card__hd{ display:flex; align-items:center; gap:12px; padding:18px var(--pad); border-bottom:1px solid var(--line); flex-wrap:wrap; }
.card__hd h2{ font-size:18px; letter-spacing:-.03em; font-weight:500; }
.card__hd p{ font-size:13px; color:var(--dim); width:100%; }
.card__bd{ padding:var(--pad); }
.card + .card{ margin-top:14px; }

.label{ font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--dim); }
.hint{ font-size:12.5px; line-height:1.55; color:var(--dim); }
.hint b{ color:var(--muted); font-weight:400; }

/* ---------- 表單 ---------- */
.grid{ display:grid; gap:14px; }
.grid--2{ grid-template-columns:repeat(2,1fr); }
.grid--3{ grid-template-columns:repeat(3,1fr); }
.grid--4{ grid-template-columns:repeat(4,1fr); }
@media (max-width:820px){ .grid--2,.grid--3,.grid--4{ grid-template-columns:1fr; } }
.span2{ grid-column:span 2; } @media (max-width:820px){ .span2{ grid-column:auto; } }

.field{ display:flex; flex-direction:column; gap:7px; }
.field > label{ font-size:13px; color:var(--muted); display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.field .req{ color:var(--accent); font-size:11px; }
.field input,.field select,.field textarea{
  width:100%; min-height:var(--tap); padding:11px 13px;
  background:var(--input-bg); border:1px solid var(--line); border-radius:var(--r-sm);
  outline:none; transition:border-color .18s var(--ease), background .18s var(--ease);
}
.field textarea{ min-height:96px; resize:vertical; line-height:1.6; }
.field input:focus,.field select:focus,.field textarea:focus{ border-color:var(--accent); background:var(--input-focus); }
.field input::placeholder,.field textarea::placeholder{ color:var(--dim); opacity:.7; }
.field input[inputmode="numeric"]{ font-family:var(--num); }
/* iOS 的日期欄位預設把值置中，跟旁邊每一個欄位都不一樣。
   -webkit-date-and-time-value 是 Safari 用來排日期文字的內部元件。 */
.field input[type="date"]{ text-align:left; font-family:var(--num); }
.field input[type="date"]::-webkit-date-and-time-value{ text-align:left; }
.field select{ appearance:none; background-image:linear-gradient(45deg,transparent 50%,var(--dim) 50%),linear-gradient(135deg,var(--dim) 50%,transparent 50%);
  background-position:calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size:5px 5px; background-repeat:no-repeat; padding-right:38px; }
.field__tip{ font-size:12px; color:var(--dim); line-height:1.5; }
.field__tip strong{ color:var(--accent); font-weight:400; }

fieldset{ border:0; margin:0; padding:0; }
.fs__t{ display:flex; align-items:center; gap:10px; margin:26px 0 14px; }
.fs__t:first-child{ margin-top:0; }
.fs__t h3{ font-size:14px; font-weight:500; letter-spacing:-.02em; }
.fs__t i{ flex:1; height:1px; background:var(--line); }
.fs__t .tag{ font-size:10.5px; letter-spacing:.08em; text-transform:uppercase; padding:3px 8px; border-radius:5px; }
.tag--req{ background:var(--accent-dim); color:var(--accent); }
.tag--opt{ background:var(--surface-3); color:var(--dim); }

/* ---------- 分頁 ---------- */
.tabs{ display:flex; gap:8px; overflow-x:auto; padding:14px 0 4px; scrollbar-width:none;
  -webkit-overflow-scrolling:touch; }
.tabs::-webkit-scrollbar{ display:none; }
.tab{ flex:none; min-height:40px; padding:0 15px; border-radius:999px; border:1px solid var(--line);
  background:transparent; font-size:14px; cursor:pointer; display:inline-flex; align-items:center; gap:8px;
  transition:background .18s var(--ease), border-color .18s var(--ease); }
.tab:hover{ background:var(--accent-dim); }
.tab.on{ background:var(--white); color:var(--on-white); border-color:var(--white); font-weight:500; }
.tab .n{ font-family:var(--num); font-size:11px; padding:1px 6px; border-radius:99px; background:var(--surface-3); }
.tab.on .n{ background:rgba(127,127,127,.28); }
.tab .warn{ width:6px; height:6px; border-radius:50%; background:var(--warn); }

/* ---------- 貼文卡 ---------- */
.rowcard{ background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r); overflow:hidden; }
.rowcard + .rowcard{ margin-top:12px; }
.rowcard__hd{ display:flex; align-items:center; gap:12px; padding:14px 16px; cursor:pointer; user-select:none; }
.rowcard__hd:hover{ background:var(--accent-dim); }
.rowcard__av{ width:38px; height:38px; border-radius:50%; background:var(--surface-3); flex:none;
  display:grid; place-items:center; font-size:14px; font-family:var(--num); color:var(--muted); }
.rowcard__main{ flex:1; min-width:0; }
.rowcard__t{ font-size:15px; letter-spacing:-.02em; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rowcard__s{ font-size:12px; color:var(--dim); margin-top:3px; display:flex; gap:8px; flex-wrap:wrap; }
.rowcard__bd{ padding:0 16px 18px; border-top:1px solid var(--line); }
.rowcard[data-open="0"] .rowcard__bd{ display:none; }
.chev{ transition:transform .2s var(--ease); color:var(--dim); flex:none; }
.rowcard[data-open="1"] .chev{ transform:rotate(180deg); }

.meter{ width:64px; height:5px; border-radius:3px; background:var(--surface-3); overflow:hidden; flex:none; }
.meter > i{ display:block; height:100%; background:var(--accent); border-radius:3px; transition:width .4s var(--ease); }
.meter--full > i{ background:var(--ok); }
@media (max-width:600px){ .meter{ width:44px; } }

.chip{ font-size:11px; letter-spacing:.05em; padding:3px 8px; border-radius:6px;
  background:var(--surface-3); color:var(--muted); white-space:nowrap; }
.chip--ok{ background:var(--surface-3); color:var(--ok); }
.chip--warn{ background:var(--accent-dim); color:var(--accent); }

/* ---------- 專案列表 ---------- */
.plist{ display:grid; gap:12px; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); }
.pcard{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); padding:20px;
  display:flex; flex-direction:column; gap:14px; transition:border-color .18s var(--ease); }
.pcard:hover{ border-color:var(--line-2); }
.pcard__t{ font-size:19px; letter-spacing:-.03em; }
.pcard__c{ font-size:13px; color:var(--dim); }
.pcard__row{ display:flex; gap:16px; flex-wrap:wrap; }
.pcard__row div span{ display:block; }
.pcard__row .n{ font-family:var(--num); font-size:17px; }
.pcard__row .k{ font-size:10.5px; letter-spacing:.08em; text-transform:uppercase; color:var(--dim); margin-top:3px; }

/* ---------- 儲存列 ---------- */
.savebar{
  position:sticky; bottom:0; z-index:30; margin-top:18px;
  background:var(--savebar); backdrop-filter:blur(18px);
  border-top:1px solid var(--line); padding:12px 0 max(12px, env(safe-area-inset-bottom));
}
.savebar__in{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.savebar .status{ font-size:13px; color:var(--dim); flex:1; min-width:120px; }
.savebar .status.ok{ color:var(--ok); }
@media (max-width:600px){
  .savebar__in{ gap:8px; }
  .savebar .btn{ flex:1; padding-inline:10px; }
  .savebar .status{ order:-1; width:100%; flex:none; }
}

/* ---------- 登入 ---------- */
.auth{ min-height:100svh; display:grid; place-items:center; padding:24px; }
.auth__box{ width:100%; max-width:420px; }
.auth__box .card__bd{ display:flex; flex-direction:column; gap:16px; }
.auth h1{ font-size:26px; letter-spacing:-.04em; font-weight:400; }
/* 「或」分隔線與 Google 登入鈕。伺服器沒設定憑證時這兩塊是 hidden 的。 */
.orline{ display:flex; align-items:center; gap:12px; margin:20px 0 14px;
  font-size:12px; color:var(--dim); letter-spacing:.06em; }
.orline i{ flex:1; height:1px; background:var(--line); }
.gbtn{ width:100%; gap:10px; margin-bottom:18px; text-decoration:none; font-weight:500; }
.gbtn svg{ flex:none; }

.auth .sw{ font-size:13px; color:var(--dim); text-align:center; }
.auth .sw button{ background:none; border:0; color:var(--accent); cursor:pointer; padding:6px; }
.msg{ font-size:13px; padding:11px 13px; border-radius:var(--r-sm); }
.msg--err{ background:var(--surface-3); color:var(--bad); }
.msg--ok{ background:var(--surface-3); color:var(--ok); }

/* ---------- 其他 ---------- */
.empty{ text-align:center; padding:56px 20px; color:var(--dim); }
.empty h3{ font-size:18px; color:var(--white); font-weight:400; margin-bottom:8px; }
.toast{ position:fixed; left:50%; bottom:88px; transform:translateX(-50%) translateY(12px);
  background:var(--toast-bg); color:var(--toast-ink); padding:12px 18px; border-radius:10px; font-size:14px;
  opacity:0; pointer-events:none; transition:opacity .25s var(--ease), transform .25s var(--ease); z-index:80;
  max-width:calc(100vw - 32px); text-align:center; }
.toast.on{ opacity:1; transform:translateX(-50%) translateY(0); }
.spin{ width:16px; height:16px; border:2px solid var(--line-2); border-top-color:var(--white);
  border-radius:50%; animation:spin .7s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }
.sr{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
@media (prefers-reduced-motion:reduce){ *{ transition-duration:.01ms !important; animation-duration:.01ms !important; } }

/* 主題切換鈕 */
.themetoggle{ width:var(--tap); height:var(--tap); border-radius:50%; border:1px solid var(--line);
  background:transparent; color:var(--white); display:grid; place-items:center; cursor:pointer; padding:0;
  transition:background .18s var(--ease), border-color .18s var(--ease); flex:none; }
.themetoggle:hover{ background:var(--accent-dim); border-color:var(--accent); }
.themetoggle svg{ width:19px; height:19px; }
.themetoggle .sun{ display:none; }
:root[data-theme="light"] .themetoggle .sun{ display:block; }
:root[data-theme="light"] .themetoggle .moon{ display:none; }
@media (prefers-color-scheme: light){
  :root:not([data-theme="dark"]):not([data-theme="light"]) .themetoggle .sun{ display:block; }
  :root:not([data-theme="dark"]):not([data-theme="light"]) .themetoggle .moon{ display:none; }
}

/* ---------- 頂列在窄螢幕的收斂 ---------- */
/* 公司名稱不設固定上限：旁邊有空位就完整顯示，真的擠不下才收成刪節號。
   以前寫死 22ch，中文一個字佔兩個 ch，名稱稍長就被切，即使右邊整片空著。 */
.logo{ white-space:nowrap; min-width:0; flex:0 1 auto; }
.logo > span{ flex:none; }
.logo small{ flex:0 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
@media (max-width:720px){
  .topbar__in{ gap:8px; }
  .logo small{ display:none; }
  /* 中文一個字約佔兩個 ch，六個字要留到 12ch 才不會被切掉 */
  .logo > span{ flex:0 1 auto; min-width:0; max-width:12ch; overflow:hidden; text-overflow:ellipsis; }
}
@media (max-width:420px){
  /* 旁邊的標記拿掉之後，文字就是唯一的品牌識別，不能再整個藏起來，
     否則頁首左半邊會是一片空白，看起來像沒載入完。縮小就夠了。 */
  .logo{ font-size:15px; }
  .logo > span{ max-width:none; }
  .topbar .btn{ padding-inline:12px; }
}

/* ---------- 手機上的可點區域 ----------
   指頭的大小不會因為螢幕變小而變小。這些元素在桌機用滑鼠點沒問題，
   在手機上只有二十幾像素高，按三次中一次。 */
@media (max-width:720px){
  .btn--sm{ min-height:40px; }
  .logo{ min-height:40px; }
  .side__back{ display:inline-flex; align-items:center; min-height:40px; }
  .atable select{ min-height:40px; }
  .atable td a{ display:inline-block; padding-block:10px; }
  .auth .sw button{ min-height:40px; padding-inline:10px; }
  /* 連結列裡的網址是文字連結，本身只有一行字高。
     手機上要給它上下空間才按得到，桌機維持原樣。 */
  .lrow__url a{ display:inline-block; padding-block:13px; }
}

/* ---------- 對話框 ---------- */
.modal{
  position:fixed; inset:0; z-index:60; display:grid; place-items:center;
  padding:20px; background:rgba(0,0,0,.55); backdrop-filter:blur(6px);
  animation:modalIn .18s var(--ease);
}
:root[data-theme="light"] .modal{ background:rgba(40,36,26,.34); }
@keyframes modalIn{ from{ opacity:0 } to{ opacity:1 } }
.modal__box{ width:100%; max-width:460px; max-height:calc(100svh - 40px); overflow:auto; }
.modal__foot{ display:flex; gap:10px; margin-top:22px; }
.modal__foot .btn{ flex:1; }
@media (max-width:600px){
  .modal{ place-items:end center; padding:0; }
  .modal__box{ max-width:none; border-radius:var(--r) var(--r) 0 0;
    padding-bottom:max(0px, env(safe-area-inset-bottom)); }
}

/* ---------- 抓取進度 ---------- */
.progress{ height:6px; border-radius:99px; background:var(--surface-3); overflow:hidden; }
.progress__bar{ height:100%; border-radius:99px; background:var(--accent);
  transition:width .4s var(--ease); }
.msg{ line-height:1.6; }

/* ============================================================
   儀表板
   ============================================================ */
.dhead{ display:flex; align-items:flex-end; justify-content:space-between;
  gap:16px; flex-wrap:wrap; margin-bottom:22px; }
.dhead__eyebrow{ font-size:12px; letter-spacing:.08em; text-transform:uppercase;
  opacity:.4; margin-bottom:8px; }
.dhead__t{ font-size:30px; letter-spacing:-.04em; font-weight:400; }

.dtiles{ display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:18px; }
@media (max-width:820px){ .dtiles{ grid-template-columns:repeat(2,1fr); } }
.dtile{ padding:20px; border-radius:var(--r); background:var(--surface-2);
  border:1px solid var(--line); display:flex; flex-direction:column; gap:8px;
  animation:tile-in .5s var(--ease) var(--d,0ms) both; }
@keyframes tile-in{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }
.dtile__k{ font-size:11px; letter-spacing:.08em; text-transform:uppercase; opacity:.4; }
.dtile__n{ font-size:30px; letter-spacing:-.03em; font-variant-numeric:tabular-nums; }
.dtile__s{ font-size:12px; opacity:.45; }

.dtodo{ margin-bottom:4px; }
.todos{ display:flex; flex-direction:column; }
.todo{ display:grid; grid-template-columns:42px 1fr auto auto; align-items:center;
  gap:14px; padding:14px 4px; border-bottom:1px solid var(--line); cursor:pointer;
  transition:background .18s var(--ease); }
.todo:last-child{ border-bottom:0; }
.todo:hover{ background:var(--surface-3); }
.todo__n{ display:grid; place-items:center; inline-size:32px; block-size:32px;
  border-radius:9px; background:var(--accent-dim); color:var(--accent);
  font-size:14px; font-variant-numeric:tabular-nums; }
.todo__l{ font-size:14px; }
.todo__p{ font-size:12px; opacity:.45; text-align:right; }
.todo__go{ font-size:12px; letter-spacing:.06em; text-transform:uppercase;
  opacity:0; transition:opacity .18s var(--ease); white-space:nowrap; }
.todo:hover .todo__go{ opacity:.7; }
@media (max-width:680px){
  .todo{ grid-template-columns:42px 1fr; }
  .todo__p,.todo__go{ grid-column:2; text-align:left; }
}

/* ---------- 洞察截圖上傳 ---------- */
.drop{ border:1.5px dashed var(--line-2); border-radius:var(--r);
  padding:28px 20px; text-align:center; display:flex; flex-direction:column;
  align-items:center; gap:8px; background:var(--surface-2);
  transition:border-color .2s var(--ease), background .2s var(--ease); }
.drop--over{ border-color:var(--accent); background:var(--accent-dim); }
.drop__t{ font-size:15px; }
.drop__s{ font-size:12.5px; opacity:.5; max-width:46ch; line-height:1.6; }
.drop .btn{ margin-top:6px; }
.pc__upload:empty{ display:none; }
.pc__upload{ margin-top:10px; }
[data-assign-rel]{ inline-size:100%; margin-top:6px; padding:8px 10px;
  border-radius:var(--r-sm); border:1px solid var(--line);
  background:var(--input-bg); color:inherit; font:inherit; }

/* ---------- 創作者 → 平台帳號 → 貼文 ---------- */
.ptree{ border:1px solid var(--line); border-radius:var(--r);
  background:var(--surface-2); margin-bottom:14px; overflow:hidden; }
.ptree__hd{ display:flex; align-items:flex-start; justify-content:space-between;
  gap:14px; padding:16px 18px; border-bottom:1px solid var(--line);
  background:var(--surface-3); flex-wrap:wrap; }
.ptree__name{ font-size:16px; letter-spacing:-.02em; }
.ptree__sub{ margin-top:5px; font-size:12px; opacity:.45; }
.ptree__add{ margin:12px 18px 16px; }
.acct{ padding:0 18px; }
.acct + .acct{ border-top:1px solid var(--line); }
.acct__hd{ display:flex; align-items:center; gap:12px; padding:13px 0;
  flex-wrap:wrap; }
.acct__plat{ font-size:11px; letter-spacing:.08em; text-transform:uppercase;
  padding:4px 8px; border-radius:6px; background:var(--accent-dim);
  color:var(--accent); white-space:nowrap; }
.acct__handle{ font-size:14px; }
.acct__f{ font-size:12px; opacity:.5; font-variant-numeric:tabular-nums;
  display:flex; align-items:center; gap:6px; }
.acct__note{ font-size:10px; padding:2px 5px; border-radius:4px;
  background:var(--surface-4); opacity:.8; }
.acct__act{ margin-left:auto; display:flex; gap:6px; }
.btn--xs{ padding:5px 9px; font-size:11.5px; }
.modal select{ inline-size:100%; padding:10px 12px; border-radius:var(--r-sm);
  border:1px solid var(--line); background:var(--input-bg); color:inherit; font:inherit; }

/* ---------- 連結社群帳號 ---------- */
.loginbar{ display:flex; align-items:center; justify-content:space-between;
  gap:12px; flex-wrap:wrap; margin-top:14px; padding:12px 14px;
  border-radius:var(--r-sm); background:var(--surface-3);
  border:1px solid var(--line); }
.loginbar__s{ font-size:12.5px; opacity:.6; line-height:1.6; }
.loginbar__s b{ opacity:1; color:var(--accent); }

/* ---------- 報告色系 ---------- */
.swatches{ display:flex; flex-wrap:wrap; gap:10px; }
.swatch{ display:flex; flex-direction:column; align-items:center; gap:7px;
  padding:10px 12px; border-radius:var(--r-sm); border:1.5px solid var(--line);
  background:var(--surface-2); cursor:pointer; font:inherit; color:inherit;
  transition:border-color .18s var(--ease), background .18s var(--ease); }
.swatch:hover{ border-color:var(--c); }
.swatch.on{ border-color:var(--c); background:var(--surface-3); }
.swatch__c{ inline-size:34px; block-size:34px; border-radius:6px; background:var(--c);
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.12); }
.swatch__n{ font-size:11.5px; opacity:.65; }
.swatch.on .swatch__n{ opacity:1; font-weight:600; }

/* ---------- Google 登入 ---------- */
.gbtn{ display:flex; align-items:center; justify-content:center; gap:10px;
  inline-size:100%; padding:12px 16px; border-radius:var(--r-sm);
  border:1px solid var(--line-2); background:var(--surface);
  color:inherit; font:inherit; font-weight:500; text-decoration:none;
  transition:background .18s var(--ease), border-color .18s var(--ease); }
.gbtn:hover{ background:var(--surface-3); border-color:var(--line); }
.gbtn svg{ inline-size:18px; block-size:18px; flex:none; }
.auth__or{ display:flex; align-items:center; gap:12px; margin:18px 0 4px;
  font-size:12px; opacity:.45; }
.auth__or::before,.auth__or::after{ content:''; flex:1;
  border-top:1px solid var(--line); }

/* ---------- 平台管理台 ---------- */
.ccols{ display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:14px; }
@media (max-width:900px){ .ccols{ grid-template-columns:1fr; } }
.hrow{ display:flex; align-items:center; justify-content:space-between;
  gap:14px; padding:11px 0; border-bottom:1px solid var(--line);
  font-size:13.5px; }
.hrow:last-child{ border-bottom:0; }
.hrow > span:last-child{ opacity:.6; text-align:right; }
.hdot{ display:inline-block; inline-size:8px; block-size:8px; border-radius:50%;
  margin-right:9px; vertical-align:middle; }
.hdot.on{ background:var(--ok); } .hdot.off{ background:var(--bad); }
/* 這個環境本來就沒有的能力，不是故障，不該用紅點嚇人 */
.hdot.na{ background:var(--dim); }
.cbar{ display:grid; grid-template-columns:96px 1fr 76px; align-items:center;
  gap:10px; padding:8px 0; font-size:12.5px; }
.cbar__k{ opacity:.6; }
.cbar__t{ block-size:8px; border-radius:99px; background:var(--surface-3); overflow:hidden; }
.cbar__t i{ display:block; block-size:100%; background:var(--accent); }
.cbar__t i.ok{ background:var(--ok); } .cbar__t i.bad{ background:var(--bad); }
.cbar__v{ text-align:right; opacity:.5; font-variant-numeric:tabular-nums; }
/* 表格比畫面寬時只讓表格自己橫捲，頁面不要跟著橫捲 */
/* 有些元件用 class 指定了 display，會蓋掉瀏覽器預設的 [hidden]。
   沒有這一行，登入頁那顆「還沒設定就不該出現」的按鈕會一直顯示。 */
[hidden]{ display:none !important; }

.table-wrap{ overflow-x:auto; }
.atable{ inline-size:100%; border-collapse:collapse; font-size:13px; }
.atable th{ text-align:left; padding:10px 12px; font-weight:600; font-size:11.5px;
  letter-spacing:.06em; text-transform:uppercase; opacity:.45;
  border-bottom:1px solid var(--line); white-space:nowrap; }
.atable td{ padding:11px 12px; border-bottom:1px solid var(--line); }
.atable tr:last-child td{ border-bottom:0; }
.arow{ cursor:pointer; transition:background .16s var(--ease); }
/* 次要欄位：時間、位址、細節，讓主要資訊先被看到 */
.atable .adim{ color:var(--dim); font-size:12px; }
.atable a{ color:var(--accent); text-decoration:none; }
.atable a:hover{ text-decoration:underline; }
/* 沒有任何貼文引用的殘檔，要一眼看得出來 */
.aorphan td{ background:color-mix(in srgb, var(--warn) 7%, transparent); }
/* 管理台的分頁列在標題底下，不要跟卡片黏在一起 */
.tabs a.tab{ text-decoration:none; display:inline-flex; align-items:center; }
.card--danger{ border-color:color-mix(in srgb, var(--bad) 34%, var(--line)); }
.card--danger .card__hd h2{ color:var(--bad); }
.arow:hover{ background:var(--surface-3); }
.atable select{ padding:5px 8px; border-radius:var(--r-sm);
  border:1px solid var(--line); background:var(--input-bg); color:inherit;
  font:inherit; font-size:12.5px; }

/* ============================================================
   後台版型：左側目錄 ＋ 右側內容
   ============================================================ */
.shell2{ display:grid; grid-template-columns:var(--side) minmax(0,1fr);
  gap:26px; align-items:start; }
/* 手機版單欄。這裡一定要寫 minmax(0,1fr)：只寫 1fr 等於 minmax(auto,1fr)，
   軌道會為了塞下內容而超出容器，整頁就被撐寬，貼著視窗寬度的頁首
   反而變成只有半截。 */
@media (max-width:860px){ .shell2{ grid-template-columns:minmax(0,1fr); gap:16px; } }

.side{ position:sticky; top:88px; display:flex; flex-direction:column; gap:16px; }
@media (max-width:860px){ .side{ position:static; min-inline-size:0; } }
.side__back{ font-size:12.5px; color:var(--muted); text-decoration:none;
  transition:color .16s var(--ease); }
.side__back:hover{ color:var(--accent); }
.side__proj{ padding-bottom:14px; border-bottom:2px solid var(--line-2); }
.side__name{ font-family:var(--display); font-weight:800; font-size:17px;
  line-height:1.25; letter-spacing:-.02em; }
.side__client{ margin-top:5px; font-size:12px; color:var(--muted); }
.side__bar{ margin-top:12px; block-size:4px; background:var(--surface-3); overflow:hidden; }
.side__bar i{ display:block; block-size:100%; background:var(--accent);
  transition:width .5s var(--ease); }
.side__pct{ margin-top:6px; font-size:11px; letter-spacing:.05em; color:var(--dim); }

.side__nav{ display:flex; flex-direction:column; }
.side__item{ display:grid; grid-template-columns:26px 1fr auto; align-items:center;
  gap:9px; padding:11px 10px 11px 0; border:0; background:none; color:inherit;
  font:inherit; text-align:left; cursor:pointer;
  border-bottom:1px solid var(--line);
  transition:color .16s var(--ease); }
.side__item:last-child{ border-bottom:0; }
.side__n{ font-family:var(--num); font-size:11px; font-weight:800;
  color:var(--dim); letter-spacing:.04em; }
.side__l{ font-size:13.5px; }
.side__c{ font-family:var(--num); font-size:11px; font-weight:700;
  padding:2px 6px; background:var(--surface-3); color:var(--muted); }
.side__item:hover{ color:var(--accent); }
.side__item.on .side__l{ font-weight:700; color:var(--accent); }
.side__item.on .side__n{ color:var(--accent); }
.side__item.on{ box-shadow:inset 2px 0 0 var(--accent); padding-left:10px; }
@media (max-width:860px){
  /* 橫向目錄自己捲，不要把整個頁面推寬 */
  .side__nav{ flex-direction:row; overflow-x:auto; gap:4px;
    min-inline-size:0; scrollbar-width:none; -webkit-overflow-scrolling:touch; }
  .side__nav::-webkit-scrollbar{ display:none; }
  .side__item{ border-bottom:0; border-top:2px solid transparent;
    padding:10px 12px; white-space:nowrap; grid-template-columns:auto auto; }
  .side__item .side__n{ display:none; }
  .side__item.on{ box-shadow:none; border-top-color:var(--accent); }
}
.side__need{ padding:12px; background:var(--surface-3); font-size:12px; }
.side__need p{ font-weight:700; margin-bottom:6px; color:var(--warn); }
.side__need ul{ display:flex; flex-direction:column; gap:4px; }
.side__need li{ color:var(--muted); }
.side__need li::before{ content:'· '; }

.pane2{ min-inline-size:0; }

/* 報紙感的標題與卡片 */
.card{ border-radius:var(--r); border:1px solid var(--line); box-shadow:none;
  background:var(--surface); }
.card__hd h2{ font-family:var(--display); font-weight:800; letter-spacing:-.02em; }
.dhead__t, .ptree__name{ font-family:var(--display); font-weight:900; }
.dtile__n{ font-family:var(--num); font-weight:800; color:var(--accent); }
.btn--primary{ border-radius:var(--r-sm); font-weight:700; }
.btn--accent{ background:var(--accent); color:var(--on-accent); border-color:var(--accent); }
.chip{ border-radius:var(--r-sm); }

/* ---------- 創作者與連結 ---------- */
.ltree{ border-top:2px solid var(--line-2); padding-top:14px; margin-bottom:20px; }
.ltree:last-child{ margin-bottom:0; }
.ltree__hd{ display:flex; align-items:flex-start; justify-content:space-between;
  gap:14px; flex-wrap:wrap; margin-bottom:10px; }
.ltree__name{ font-family:var(--display); font-weight:800; font-size:16px;
  letter-spacing:-.02em; }
.ltree__sub{ margin-top:4px; font-size:12px; color:var(--muted); }

.lrow{ display:grid;
  grid-template-columns:88px 150px 82px minmax(0,1fr) auto auto;
  align-items:center; gap:10px; padding:11px 0;
  border-bottom:1px solid var(--line); font-size:13px; }
.lrow:last-of-type{ border-bottom:0; }
.lrow__plat{ font-size:10.5px; font-weight:700; letter-spacing:.06em;
  text-transform:uppercase; padding:3px 7px; background:var(--accent-dim);
  color:var(--accent); text-align:center; white-space:nowrap; }
.lrow__handle{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lrow__f{ font-family:var(--num); font-size:12px; color:var(--muted);
  font-variant-numeric:tabular-nums; }
.lrow__url{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:12px; }
.lrow__url a{ color:var(--muted); text-decoration:none; }
.lrow__url a:hover{ color:var(--accent); text-decoration:underline; }
.lrow__url .dim{ color:var(--dim); }
.lrow__act{ display:flex; gap:6px; }
.lrow__out{ grid-column:1 / -1; }
.lrow__out:empty{ display:none; }
.chip--warn{ background:rgba(201,122,30,.14); color:var(--warn); }
@media (max-width:1000px){
  .lrow{ grid-template-columns:88px 1fr auto; }
  .lrow__f,.lrow__url{ grid-column:2; }
  .lrow__state{ grid-column:3; }
  .lrow__act{ grid-column:1 / -1; }
}

/* ===== 分享連結 ===== */
.sharehd{ justify-content:space-between; align-items:flex-start; }
.sharehd > div{ min-inline-size:0; flex:1 1 260px; }
.sharelist{ display:flex; flex-direction:column; gap:12px; }
.share{ border:1px solid var(--line); border-radius:var(--r); padding:16px; display:grid; gap:12px; background:var(--surface); }
.share--dead{ background:var(--surface-2); }
.share--dead .share__name, .share--dead .share__url input{ color:var(--dim); }
.share__top{ display:flex; gap:10px 14px; align-items:center; justify-content:space-between; flex-wrap:wrap; }
.share__name{ font-weight:700; font-size:15px; min-inline-size:0; overflow-wrap:anywhere; }
.share__chips{ display:flex; gap:6px; flex-wrap:wrap; }
.share__url{ display:block; }
.share__url input{ inline-size:100%; }
.share__url input{ font-family:var(--num); font-size:13px; }
.share__stats{ font-size:13px; color:var(--muted); display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.share__stats b{ color:var(--white); font-family:var(--num); font-weight:600; }
.share__acts{ display:flex; gap:8px; flex-wrap:wrap; }
.share__del{ color:var(--bad); margin-inline-start:auto; }
.chip--off{ background:var(--surface-3); color:var(--dim); }
.linkbtn{ background:none; border:0; padding:6px 2px; min-height:32px; color:var(--accent); font:inherit; cursor:pointer; text-decoration:underline; text-underline-offset:3px; }
.linkbtn:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.viewlog{ list-style:none; margin:0; padding:0; border-top:1px solid var(--line); max-height:260px; overflow:auto; }
.viewlog li{ display:grid; grid-template-columns:minmax(0,1.6fr) minmax(0,.7fr) minmax(0,.7fr); gap:8px; padding:8px 0; border-bottom:1px solid var(--line); font-size:13px; color:var(--muted); font-family:var(--num); }
@media (max-width:560px){
  .share{ padding:14px; }
  .share__acts .btn{ flex:1 1 auto; }
  .share__del{ margin-inline-start:0; }
  #newShare{ width:100%; }
}

/* ===== 介面語言切換 ===== */
.langpick{ position:relative; display:inline-flex; }
.langpick select{ min-height:38px; padding:0 30px 0 12px; font-size:13px; border-radius:8px; width:auto;
  background-color:transparent; border:1px solid var(--line-2); color:inherit; }
.topbar .langpick select{ color:var(--white); }
.sr{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
/* 手機上頂列放不下「繁體中文」四個字。以前把選單壓到 92px，結果選單和旁邊的
   「結案報告工具」都被切成刪節號。改成一顆地球圖示，真正的選單透明地蓋在上面，
   點下去一樣是系統的選單，但不再跟品牌名稱搶位置。 */
@media (max-width:560px){
  .topbar .langpick{ width:40px; height:40px; flex:none; border:1px solid var(--line-2); border-radius:8px;
    background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18'/%3E%3C/svg%3E") center/19px no-repeat; }
  .topbar .langpick select{ position:absolute; inset:0; width:100%; height:100%; min-height:0; max-width:none;
    padding:0; border:0; opacity:0; cursor:pointer; }
  /* 品牌名稱是頂列唯一的識別，任何寬度都不准切 */
  .topbar .logo, .topbar .logo > span{ flex:none; max-width:none; overflow:visible; }
  .topbar .themetoggle{ width:40px; height:40px; flex:none; }
}
@media (max-width:350px){
  .topbar__in{ gap:6px; }
  .topbar .logo{ font-size:14px; }
  .topbar .btn{ padding-inline:9px; }
}

/* ===== 報告封面挑選 ===== */
.covers{ display:grid; grid-template-columns:repeat(auto-fill, minmax(132px, 1fr)); gap:10px; }
.coverpick{ display:flex; flex-direction:column; gap:6px; padding:0; border:0; background:none;
  color:var(--muted); font:inherit; font-size:12px; text-align:start; cursor:pointer; min-inline-size:0; }
.coverpick img{ display:block; inline-size:100%; aspect-ratio:16 / 9; object-fit:cover;
  border-radius:6px; background:var(--surface-3); outline:2px solid transparent; outline-offset:2px;
  transition:outline-color .15s ease, opacity .15s ease; }
.coverpick:hover img{ opacity:.88; }
.coverpick:focus-visible img{ outline-color:var(--line-2); }
.coverpick.on img{ outline-color:var(--accent); }
.coverpick.on span{ color:var(--white); font-weight:600; }
.coverpick span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.covers__acts{ display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-top:14px; }
@media (max-width:560px){ .covers{ grid-template-columns:repeat(2, minmax(0, 1fr)); } .covers__acts .btn{ inline-size:100%; } }

/* ===== 分享按鈕（圖示來自 Magnific 圖庫） ===== */
.sendrow{ display:flex; gap:clamp(10px, 2vw, 18px); flex-wrap:wrap; padding-block:4px; }
.sendbtn{ display:flex; flex-direction:column; align-items:center; gap:7px; min-inline-size:58px;
  padding:4px 2px; border:0; background:none; color:var(--muted); font:inherit; font-size:12px;
  cursor:pointer; border-radius:10px; }
.sendbtn:hover .sico{ transform:translateY(-2px); box-shadow:0 6px 16px -6px rgba(0,0,0,.35); }
.sendbtn:hover .sendbtn__t{ color:var(--white); }
.sendbtn:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.sico{ inline-size:46px; block-size:46px; border-radius:50%; display:grid; place-items:center;
  background:center / 100% 100% no-repeat; transition:transform .15s ease, box-shadow .15s ease; }
.sico--line{ background-image:url(/img/share/line.svg); }
.sico--whatsapp{ background-image:url(/img/share/whatsapp.svg); }
.sico--mono{ background:var(--surface-3); border:1px solid var(--line); color:var(--white); }
.sico--mono::before{ content:""; inline-size:20px; block-size:20px; background:currentColor;
  -webkit-mask:var(--ico) center / contain no-repeat; mask:var(--ico) center / contain no-repeat; }
.sico--link{ --ico:url(/img/share/link.svg); }
.sico--email{ --ico:url(/img/share/email.svg); }
.sico--share{ --ico:url(/img/share/share.svg); }
.share .share__acts{ border-top:1px solid var(--line); padding-top:12px; }

/* ===== 圖片位置微調 =====
   框的比例跟報告上一模一樣，使用者看到的就是客戶會看到的裁切。 */
.framer{ margin-top:14px; }
.framer__title{ margin-top:22px; font-size:14px; font-weight:600; letter-spacing:-.01em; }
.framer__stages{ display:flex; flex-wrap:wrap; gap:14px; align-items:flex-end; }
.framer__fig{ margin:0; inline-size:min(100%, var(--w)); flex:0 1 auto; min-inline-size:0; }
.framer__fig:first-child:not(:only-child){ flex:1 1 var(--w); inline-size:auto; max-inline-size:620px; }
.framer__stage{ position:relative; aspect-ratio:var(--ratio); overflow:hidden; border-radius:var(--r-sm);
  background:var(--surface-3); border:1px solid var(--line-2); cursor:grab;
  user-select:none; -webkit-user-select:none; }
.framer__stage img{ display:block; inline-size:100%; block-size:100%; object-fit:cover; pointer-events:none; }
.framer__stage.is-dragging{ cursor:grabbing; border-color:var(--accent); }
.framer__stage.is-fixed{ cursor:default; }
.framer__stage:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
/* 拖曳時浮出三分線，方便把主體對到位置上 */
.framer__stage::after{ content:""; position:absolute; inset:0; pointer-events:none; opacity:0;
  transition:opacity .15s var(--ease);
  background:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.7) calc(33.33% - .5px), rgba(255,255,255,.7) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.7) calc(66.66% - .5px), rgba(255,255,255,.7) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.7) calc(33.33% - .5px), rgba(255,255,255,.7) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.7) calc(66.66% - .5px), rgba(255,255,255,.7) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.framer__stage.is-dragging::after{ opacity:1; }
.framer__fig figcaption{ margin-top:6px; font-size:12px; color:var(--muted); }
.framer__bar{ display:flex; flex-wrap:wrap; align-items:center; gap:10px 14px; margin-top:10px; }
.framer__bar .hint{ flex:1 1 240px; min-inline-size:0; }

.framer__zoom{ display:flex; align-items:center; gap:10px; margin-top:12px; font-size:13px; color:var(--muted);
  max-inline-size:420px; }
.framer__zoom input{ flex:1 1 auto; min-inline-size:0; accent-color:var(--accent); min-block-size:32px; padding:0; border:0; background:none; }
.framer__zoom output{ flex:none; inline-size:3.2em; text-align:end; font-family:var(--num); color:var(--white); }
