/* 共用桌面卡片（待辦區域、時鐘與天氣）外觀：LF、DX 同一套。顏色由各站在桌面根元素設定 CSS 變數：
   --dkc-bg 卡片底色、--dkc-border 外框、--dkc-text 文字、--dkc-muted 次要文字、--dkc-accent 主色（LF 跟背景主題、DX 企業色）。
   載入：/shared/desktop/desk-cards.v1.css（配 desk-cards.v1.js） */
.dk-root { --dkc-bg:#fff; --dkc-border:#e2e8f0; --dkc-text:#0f172a; --dkc-muted:#64748b; --dkc-accent:#007E8A; }
.dark .dk-root { --dkc-bg:#161924; --dkc-border:rgba(255,255,255,.1); --dkc-text:#fff; --dkc-muted:#94a3b8; --dkc-accent:#00A3B4; }
.dkc { position:relative; height:100%; box-sizing:border-box; display:flex; flex-direction:column; gap:12px; padding:18px 18px 14px; border-radius:18px;
  background:var(--dkc-bg); border:1px solid var(--dkc-border); color:var(--dkc-text); overflow:hidden; margin:0; }
.dkc .todo-scroll { flex:1 1 0; min-height:0; }
.dkc > :not(.todo-scroll) { flex-shrink:0; }
.dkc h2 { -webkit-touch-callout:none; }
/* 頂端小橫條：按住可移動（電腦拖、手機長按＝選單／拖曳） */
/* 小橫條看起來小，但感應範圍放大（寬約卡片 4 成、高 20px）；只在卡片最上緣空白，不蓋標題、輸入框 */
.dkc-grip { position:absolute; top:0; left:50%; width:clamp(72px,40%,180px); height:20px; transform:translateX(-50%); cursor:grab; z-index:2; touch-action:none; }
.dkc-grip::after { content:""; position:absolute; top:6px; left:50%; width:32px; margin-left:-16px; height:4px; border-radius:4px; background:rgba(148,163,184,.45); }
.dkc-grip:hover::after { background:rgba(148,163,184,.8); }
.dkc .clock-main.dk-handle { cursor:grab; }
/* 存檔失敗提示條（桌面上方固定） */
.dkc-notice { position:sticky; top:8px; z-index:30; margin:0 0 10px; padding:10px 14px; border-radius:12px; font-size:14px; line-height:1.5;
  background:#fef3c7; color:#92400e; border:1px solid #fcd34d; }
.dark .dkc-notice { background:rgba(245,158,11,.15); color:#fcd34d; border-color:rgba(245,158,11,.4); }
.dkc-notice[hidden] { display:none; }
/* 時鐘基本字型（原本 Tailwind） */
.dkc-clock .clock-main > p:first-child { display:flex; align-items:baseline; gap:4px; margin:0; font-weight:800; letter-spacing:-.025em; font-variant-numeric:tabular-nums; color:var(--dkc-text); }
.dkc-clock [data-widget-field="clockSec"] { color:var(--dkc-muted); }
.dkc-clock [data-widget-field="clockDate"] { margin:4px 0 0; color:var(--dkc-muted); }
.dkc-clock .clock-weather { display:flex; align-items:center; gap:16px; }
.dkc-clock [data-widget-field="wxIcon"] { width:56px; height:56px; flex-shrink:0; color:var(--dkc-accent); }
.dkc-clock .clock-weather > div:last-child { min-width:0; flex:1; }
.dkc-clock .clock-weather > div:last-child > p { margin:0; }
.dkc-clock .clock-weather > div:last-child > p:first-child { display:flex; align-items:baseline; gap:8px; }
.dkc-clock [data-widget-field="wxTemp"] { font-weight:800; font-variant-numeric:tabular-nums; color:var(--dkc-text); }
.dkc-clock [data-widget-field="wxDesc"] { opacity:.85; }
.dkc-clock [data-widget-field="wxMeta"] { margin-top:4px; color:var(--dkc-muted); }
.dkc-clock [data-widget-field="wxRefresh"] { margin-top:8px; padding:8px 12px; border-radius:8px; border:1px solid var(--dkc-border); background:transparent; font:inherit; font-size:14px; font-weight:700; color:var(--dkc-accent); cursor:pointer; }
.dkc-clock [data-widget-field="wxRefresh"][hidden] { display:none; }
/* 時鐘卡片寬 3～5 格、高 1～2 格，字和圖示跟著卡片大小縮放。3×2、4×2 上下排列，1 格高和 5×2 左右排列。 */
.dkc-clock { overflow:hidden; container-type:size; }
.dk-root .dkc-clock-inner { flex:1 1 auto; min-height:0; display:grid; grid-template-columns:minmax(0,1fr); align-content:center; justify-items:center; text-align:center; gap:min(4cqh,14px); }
.dk-root .dkc-clock .clock-main { min-width:0; }
.dk-root .dkc-clock .clock-main > p:first-child { justify-content:center; }
.dk-root .dkc-clock [data-widget-field="clockTime"] { font-size:clamp(28px, min(22cqw, 34cqh), 110px); line-height:1; }
.dk-root .dkc-clock [data-widget-field="clockSec"] { font-size:clamp(12px, min(6.5cqw, 10cqh), 36px); }
.dk-root .dkc-clock [data-widget-field="clockDate"] { font-size:clamp(11px, min(4.5cqw, 7cqh), 20px); line-height:1.4; margin-top:.3em; }
.dk-root .dkc-clock .clock-weather { min-width:0; border:0; padding:0; justify-content:center; gap:min(3cqw,12px); }
.dk-root .dkc-clock .clock-weather > div:last-child { flex:0 1 auto; text-align:left; }
.dk-root .dkc-clock .clock-weather > div:last-child > p:first-child { flex-wrap:nowrap; white-space:nowrap; gap:.3em; }
.dk-root .dkc-clock [data-widget-field="wxIcon"] { width:clamp(24px, min(14cqw, 20cqh), 80px); height:clamp(24px, min(14cqw, 20cqh), 80px); }
.dk-root .dkc-clock [data-widget-field="wxTemp"] { font-size:clamp(20px, min(11cqw, 17cqh), 56px); line-height:1.05; }
.dk-root .dkc-clock [data-widget-field="wxDesc"] { font-size:clamp(12px, min(5cqw, 8cqh), 22px); }
.dk-root .dkc-clock [data-widget-field="wxMeta"] { display:block; font-size:clamp(11px, min(3.4cqw, 5.5cqh), 15px); }
@container (max-height:150px) {
  .dk-root .dkc-clock-inner { grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:center; gap:0; }
  .dk-root .dkc-clock .clock-weather { justify-self:stretch; align-self:stretch; border-left:1px solid rgba(148,163,184,.25); }
  .dk-root .dkc-clock :is([data-widget-field="clockDate"], [data-widget-field="wxMeta"], [data-widget-field="wxDesc"]) { display:none; }
  .dk-root .dkc-clock [data-widget-field="clockTime"] { font-size:clamp(24px, min(calc(11cqw + 14px), 56cqh), 80px); } 
  .dk-root .dkc-clock [data-widget-field="clockSec"] { font-size:clamp(11px, min(4.5cqw, 17cqh), 28px); }
  .dk-root .dkc-clock [data-widget-field="wxIcon"] { width:clamp(22px, min(11cqw, 44cqh), 64px); height:clamp(22px, min(11cqw, 44cqh), 64px); }
  .dk-root .dkc-clock [data-widget-field="wxTemp"] { font-size:clamp(20px, min(11cqw, 44cqh), 60px); }
}
@container (max-height:150px) {
  .dk-root .grid-stack-item[gs-w="3"] .dkc-clock [data-widget-field="clockTime"] { font-size:clamp(22px, min(14cqw, 48cqh), 52px); }
}
/* 5×1：多放日期和「陰」，天氣放大（4 格寬內容約 360～400px、5 格約 460～520px，用 430px 分開） */
@container (max-height:150px) and (min-width:430px) {
  .dk-root .dkc-clock [data-widget-field="clockDate"] { display:block; font-size:clamp(11px, 10cqh, 15px); }
  .dk-root .dkc-clock [data-widget-field="wxDesc"] { display:inline; font-size:clamp(12px, 12cqh, 18px); }
  .dk-root .dkc-clock [data-widget-field="clockTime"] { font-size:clamp(24px, 40cqh, 60px); }
  .dk-root .dkc-clock [data-widget-field="wxIcon"] { width:clamp(26px, 42cqh, 60px); height:clamp(26px, 42cqh, 60px); }
  .dk-root .dkc-clock [data-widget-field="wxTemp"] { font-size:clamp(22px, 40cqh, 56px); }
}
/* 5×2：左右兩半、中間一條直線；左邊時間＋日期，右邊完整天氣。字和圖示盡量放大，填滿版面 */
@container (min-height:151px) and (min-width:430px) {
  .dk-root .dkc-clock-inner { grid-template-columns:minmax(0,1.12fr) minmax(0,.88fr); align-items:center; gap:0; }
  .dk-root .dkc-clock .clock-main { padding-right:3%; }
  .dk-root .dkc-clock .clock-main > p:first-child { gap:.06em; }
  .dk-root .dkc-clock .clock-weather { justify-self:stretch; align-self:stretch; flex-direction:column; align-items:flex-start; justify-content:center; gap:min(2cqh,8px); border-left:1px solid rgba(148,163,184,.25); padding-left:6%; }
  .dk-root .dkc-clock .clock-weather > div:last-child > p:first-child { flex-wrap:wrap; }
  .dk-root .dkc-clock [data-widget-field="clockTime"] { font-size:clamp(32px, min(17.5cqw, 50cqh), 140px); }
  .dk-root .dkc-clock [data-widget-field="clockSec"] { font-size:clamp(12px, min(5cqw, 14cqh), 40px); }
  .dk-root .dkc-clock [data-widget-field="clockDate"] { font-size:clamp(12px, min(3.6cqw, 10cqh), 26px); margin-top:.5em; }
  .dk-root .dkc-clock [data-widget-field="wxIcon"] { width:clamp(28px, min(11cqw, 26cqh), 96px); height:clamp(28px, min(11cqw, 26cqh), 96px); margin-left:-.15em; }
  .dk-root .dkc-clock [data-widget-field="wxTemp"] { font-size:clamp(22px, min(11cqw, 30cqh), 84px); }
  .dk-root .dkc-clock [data-widget-field="wxDesc"] { font-size:clamp(12px, min(4.2cqw, 12cqh), 30px); }
  .dk-root .dkc-clock [data-widget-field="wxMeta"] { font-size:clamp(11px, min(2.8cqw, 8cqh), 20px); white-space:normal; margin-top:.4em; }
}
/* 最大時鐘卡片專用：SVG 弧形機殼、斜側邊、內凹面板及半透明深淺色。 */
.dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock { isolation:isolate; padding:26px 22px 53px; background:transparent; border-color:transparent; box-shadow:none; border-radius:0; --clock-shell:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20500%20244%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22body%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20stop-color%3D%22%23f5f7fa%22%20stop-opacity%3D%22.94%22%2F%3E%3Cstop%20offset%3D%22.12%22%20stop-color%3D%22%23f1f5f9%22%20stop-opacity%3D%22.94%22%2F%3E%3Cstop%20offset%3D%22.72%22%20stop-color%3D%22%23f1f5f9%22%20stop-opacity%3D%22.94%22%2F%3E%3Cstop%20offset%3D%22.83%22%20stop-color%3D%22%23eef2f6%22%20stop-opacity%3D%22.94%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23e9edf2%22%20stop-opacity%3D%22.94%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22rim%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20stop-color%3D%22%23ffffff%22%20stop-opacity%3D%22.38%22%2F%3E%3Cstop%20offset%3D%22.22%22%20stop-color%3D%22%23c2c9d3%22%20stop-opacity%3D%22.34%22%2F%3E%3Cstop%20offset%3D%22.85%22%20stop-color%3D%22%23ffffff%22%20stop-opacity%3D%22.20%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23c2c9d3%22%20stop-opacity%3D%22.4%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cpath%20d%3D%22M42%203%20H458%20Q498%203%20498%2036%20L498%20161%20C500%20193%20488%20217%20472%20233%20Q465%20241%20447%20241%20H53%20Q35%20241%2028%20233%20C12%20217%200%20193%202%20161%20L2%2036%20Q2%203%2042%203Z%22%20fill%3D%22url(%23body)%22%20stroke%3D%22url(%23rim)%22%20stroke-width%3D%221.2%22%2F%3E%3Cpath%20d%3D%22M43%2012%20H457%20Q488%2012%20488%2037%20L488%20160%20Q490%20194%20461%20201%20H39%20Q10%20194%2012%20160%20L12%2037%20Q12%2012%2043%2012Z%22%20fill%3D%22%23bfc6d0%22%20fill-opacity%3D%22.56%22%20stroke%3D%22url(%23rim)%22%20stroke-width%3D%221.3%22%2F%3E%3Cpath%20d%3D%22M45%2018%20H455%20Q481%2018%20481%2039%20L481%20160%20Q483%20190%20458%20193%20H42%20Q17%20190%2019%20160%20L19%2039%20Q19%2018%2045%2018Z%22%20fill%3D%22%23ffffff%22%20stroke%3D%22%23ffffff%22%20stroke-opacity%3D%22.15%22%20stroke-width%3D%22.8%22%2F%3E%3Cpath%20d%3D%22M39%20202%20H461%20Q477%20201%20486%20187%22%20fill%3D%22none%22%20stroke%3D%22%23ffffff%22%20stroke-opacity%3D%22.12%22%20stroke-width%3D%221.4%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E"); }
.dark .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock { background:transparent; border-color:transparent; --clock-shell:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20500%20244%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22body%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20stop-color%3D%22%23272a35%22%20stop-opacity%3D%22.94%22%2F%3E%3Cstop%20offset%3D%22.12%22%20stop-color%3D%22%23222530%22%20stop-opacity%3D%22.94%22%2F%3E%3Cstop%20offset%3D%22.72%22%20stop-color%3D%22%23222530%22%20stop-opacity%3D%22.94%22%2F%3E%3Cstop%20offset%3D%22.83%22%20stop-color%3D%22%2321242f%22%20stop-opacity%3D%22.94%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%231d202b%22%20stop-opacity%3D%22.94%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22rim%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20stop-color%3D%22%23a6aebe%22%20stop-opacity%3D%22.38%22%2F%3E%3Cstop%20offset%3D%22.22%22%20stop-color%3D%22%23252d3a%22%20stop-opacity%3D%22.34%22%2F%3E%3Cstop%20offset%3D%22.85%22%20stop-color%3D%22%23a6aebe%22%20stop-opacity%3D%22.20%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23252d3a%22%20stop-opacity%3D%22.4%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cpath%20d%3D%22M42%203%20H458%20Q498%203%20498%2036%20L498%20161%20C500%20193%20488%20217%20472%20233%20Q465%20241%20447%20241%20H53%20Q35%20241%2028%20233%20C12%20217%200%20193%202%20161%20L2%2036%20Q2%203%2042%203Z%22%20fill%3D%22url(%23body)%22%20stroke%3D%22url(%23rim)%22%20stroke-width%3D%221.2%22%2F%3E%3Cpath%20d%3D%22M43%2012%20H457%20Q488%2012%20488%2037%20L488%20160%20Q490%20194%20461%20201%20H39%20Q10%20194%2012%20160%20L12%2037%20Q12%2012%2043%2012Z%22%20fill%3D%22%2310151f%22%20fill-opacity%3D%22.56%22%20stroke%3D%22url(%23rim)%22%20stroke-width%3D%221.3%22%2F%3E%3Cpath%20d%3D%22M45%2018%20H455%20Q481%2018%20481%2039%20L481%20160%20Q483%20190%20458%20193%20H42%20Q17%20190%2019%20160%20L19%2039%20Q19%2018%2045%2018Z%22%20fill%3D%22%23161924%22%20stroke%3D%22%23a6aebe%22%20stroke-opacity%3D%22.15%22%20stroke-width%3D%22.8%22%2F%3E%3Cpath%20d%3D%22M39%20202%20H461%20Q477%20201%20486%20187%22%20fill%3D%22none%22%20stroke%3D%22%23a6aebe%22%20stroke-opacity%3D%22.12%22%20stroke-width%3D%221.4%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E"); }
.dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock::before { content:""; position:absolute; inset:0; background:var(--clock-shell) center / 100% 100% no-repeat; pointer-events:none; z-index:-1; }
.dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock .dkc-grip { top:18px; }
/* 最大時鐘卡片：圖示、溫度與天氣同列，詳細資料固定分兩行。 */
@container (min-height:151px) and (min-width:430px) {
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock .dkc-clock-inner { grid-template-columns:minmax(0,1.14fr) minmax(0,.86fr); align-items:end; transform:translateY(-7px); }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock .clock-main { align-self:end; }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock [data-widget-field="clockDate"] { margin-bottom:0; line-height:1.4; }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock .clock-weather:has([data-widget-field="wxRefresh"]:not([hidden])) { align-content:center; }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock .clock-weather { display:grid; grid-template-columns:auto auto; align-content:end; align-self:stretch; align-items:center; justify-content:center; column-gap:min(1.5cqw,7px); row-gap:min(1.5cqh,5px); padding-left:8%; padding-bottom:0; }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock .clock-weather > div:last-child { display:contents; }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock .clock-weather > div:last-child > p:first-child { flex-wrap:nowrap; gap:.2em; min-width:0; }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock [data-widget-field="wxIcon"] { width:clamp(30px, 10.5cqw, 80px); height:clamp(30px, 10.5cqw, 80px); margin-left:0; }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock [data-widget-field="wxTemp"] { font-size:clamp(22px, 9.5cqw, 76px); }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock [data-widget-field="wxDesc"] { font-size:clamp(11px, 3.6cqw, 26px); white-space:normal; overflow-wrap:anywhere; }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock [data-widget-field="wxMeta"] { grid-column:1 / -1; font-size:clamp(11px, 3.05cqw, 20px); line-height:1.4; margin-top:0; margin-bottom:0; text-align:center; justify-self:stretch; }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock .clock-weather-detail:last-child:not(:first-child):nth-child(5) { display:block; }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock .clock-weather-separator:nth-child(4) { display:none; }
  .dk-root .grid-stack-item[gs-w="5"][gs-h="2"] .dkc-clock [data-widget-field="wxRefresh"] { grid-column:1 / -1; justify-self:start; }
}
