/* CLC 共用桌面 v1：格子、抖動、長按選單、刪除確認。顏色跟著各站 CSS 變數（--text --bg --btn --border --pine），沒有就用預設值。 */
.dk-root { min-height:calc(100dvh - var(--dk-top, 240px)); -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }
.dk-root .grid-stack-item-content { overflow:visible; }
/* gridstack 自己的 CSS 會把格子內容切掉（overflow hidden），App 圖示放大時邊緣被裁；App 格子改成超出也顯示 */
.dk-root.grid-stack > .grid-stack-item.dk-app > .grid-stack-item-content { overflow:visible; }
/* App 圖示固定＝格子寬：只有一欄且不能被內容撐大（不然大尺寸圖片會把圖示撐得比格子大） */
.dk-root .dk-app > .grid-stack-item-content { grid-template-columns:minmax(0,1fr); }
.dk-root .dk-app img { max-width:100%; }
.dk-root .dk-card > .grid-stack-item-content { overflow:auto; border-radius:18px; }
.dk-root .dk-app > .grid-stack-item-content { display:grid; place-items:start center; cursor:grab; touch-action:pan-y; }
.dk-root .dk-app a, .dk-root .dk-app img { -webkit-user-drag:none; -webkit-touch-callout:none; }
.dk-root .dk-card textarea, .dk-root .dk-card input, .dk-root .dk-card [contenteditable] { -webkit-user-select:text; user-select:text; }
.dk-root .grid-stack-item.ui-draggable-dragging > .grid-stack-item-content { cursor:grabbing; opacity:.9; }
#lfApps .dk-app.ui-draggable-dragging > .grid-stack-item-content { background:transparent; box-shadow:none; opacity:1; }
.dk-root > .grid-stack-placeholder > .placeholder-content { border:2px dashed var(--border, rgba(127,127,127,.4)); border-radius:18px; background:transparent; }
/* 搜尋：不符合的變淡 */
.dk-searching .dk-dim { opacity:.15; pointer-events:none; transition:opacity .15s; }
/* 選單 */
.dk-menu { position:fixed; z-index:1000; min-width:168px; padding:6px; border-radius:14px; background:var(--bg, #fff); color:var(--text, #222);
  border:1px solid var(--border, rgba(0,0,0,.12)); box-shadow:0 12px 32px rgba(0,0,0,.22); display:flex; flex-direction:column; }
.dk-menu { animation:dk-menu-in .16s cubic-bezier(.2,.8,.2,1); transform-origin:top left; }
.dk-menu.dk-menu-out { opacity:0; transform:scale(.92); transition:opacity .15s ease, transform .15s ease; pointer-events:none; }
@keyframes dk-menu-in { from { opacity:0; transform:scale(.92); } }
.dk-menu button { text-align:left; border:0; background:none; color:inherit; font:inherit; font-size:14px; font-weight:600; padding:10px 12px; border-radius:10px; cursor:pointer; }
.dk-menu button:hover, .dk-menu button:focus-visible { background:var(--btn, rgba(0,0,0,.06)); outline:none; }
.dk-app-menu { width:218px; min-width:0; max-width:calc(100vw - 16px); max-height:calc(100dvh - 16px); overflow:auto; box-sizing:border-box; }
.dk-app-menu-header { margin:-6px -6px 4px; padding:13px 16px 11px; text-align:left; background:var(--btn, rgba(127,127,127,.14)); }
.dk-app-menu-header strong { font-size:15px; line-height:1.35; overflow-wrap:anywhere; }
@media (prefers-reduced-motion: reduce) {
  .dk-app-menu, .dk-app-menu.dk-menu-out { animation:none; transition:none; }
}
.dk-danger { color:#B5483D !important; }
/* 首頁 App 對話框：沿用「修改 App」的尺寸與操作列，各站以主題變數提供顏色。 */
dialog.dk-confirm {
  --dk-dialog-surface:var(--surface, #fff);
  --dk-dialog-text:var(--text, #0f172a);
  --dk-dialog-muted:var(--muted, #64748b);
  --dk-dialog-field:var(--btn, #f1f5f9);
  --dk-dialog-border:var(--border, #e2e8f0);
  --dk-dialog-primary:var(--pine, #007e8a);
  --dk-dialog-danger:var(--danger, #b5483d);
  box-sizing:border-box; width:min(92vw, 400px); max-height:calc(100dvh - 24px);
  overflow:auto; overscroll-behavior:contain; margin:auto; padding:0; border:0; border-radius:20px;
  background:var(--dk-dialog-surface); color:var(--dk-dialog-text); text-align:left;
}
.dark dialog.dk-confirm {
  --dk-dialog-surface:var(--surface, #161924);
  --dk-dialog-text:var(--text, #f1f5f9);
  --dk-dialog-muted:var(--muted, #8a92a6);
  --dk-dialog-field:var(--btn, rgba(255,255,255,.04));
  --dk-dialog-border:var(--border, rgba(255,255,255,.1));
}
.dk-confirm::backdrop { background:rgba(0,0,0,.6); }
.dk-confirm form { padding:22px; display:flex; flex-direction:column; gap:12px; }
.dk-confirm h2 { margin:0; font-size:18px; font-weight:800; line-height:1.35; }
.dk-confirm p { margin:0; font-size:15px; line-height:1.5; overflow-wrap:anywhere; }
.dk-confirm .dk-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:4px; }
.dk-confirm button { min-height:42px; padding:0 18px; border-radius:12px; background:transparent; color:inherit; border:0; font:inherit; font-weight:700; font-size:15px; cursor:pointer; }
.dk-confirm button[data-primary] { background:var(--dk-dialog-primary); color:#fff; }
.dk-confirm button.dk-danger { background:var(--dk-dialog-danger); color:#fff !important; }
.dk-confirm button:focus-visible { outline:2px solid var(--dk-dialog-primary); outline-offset:2px; }
.dk-confirm button:disabled { opacity:.55; cursor:default; }
/* 調整大小：電腦四邊四角都能直接拉（像 Windows 視窗），不顯示箭頭圖示 */
.dk-root .grid-stack-item:not(.dk-app) > .ui-resizable-handle { display:block !important; background:none !important; transform:none !important; touch-action:none; }
.dk-root .grid-stack-item > .ui-resizable-n, .dk-root .grid-stack-item > .ui-resizable-s { left:24px; right:24px; width:auto; height:10px; }
.dk-root .grid-stack-item > .ui-resizable-e, .dk-root .grid-stack-item > .ui-resizable-w { top:24px; bottom:24px; height:auto; width:10px; }
/* 電腦：四個角 24×24 比邊大、角優先（像 Windows），斜拉比較好抓 */
.dk-root .grid-stack-item > .ui-resizable-ne, .dk-root .grid-stack-item > .ui-resizable-se,
.dk-root .grid-stack-item > .ui-resizable-sw, .dk-root .grid-stack-item > .ui-resizable-nw { width:24px; height:24px; z-index:3; }
.dk-root .grid-stack-item > .ui-resizable-n { top:0; bottom:auto; cursor:ns-resize; }
.dk-root .grid-stack-item > .ui-resizable-s { bottom:0; top:auto; cursor:ns-resize; }
.dk-root .grid-stack-item > .ui-resizable-e { right:0; left:auto; cursor:ew-resize; }
.dk-root .grid-stack-item > .ui-resizable-w { left:0; right:auto; cursor:ew-resize; }
.dk-root .grid-stack-item > .ui-resizable-ne { top:0; right:0; bottom:auto; left:auto; cursor:nesw-resize; }
.dk-root .grid-stack-item > .ui-resizable-sw { bottom:0; left:0; top:auto; right:auto; cursor:nesw-resize; }
.dk-root .grid-stack-item > .ui-resizable-nw { top:0; left:0; bottom:auto; right:auto; cursor:nwse-resize; }
.dk-root .grid-stack-item > .ui-resizable-se { bottom:0; right:0; top:auto; left:auto; cursor:nwse-resize; }
/* 手指操作（.dk-touch，由 JS 依「實際是手指還是滑鼠」切換，不只看裝置類型；有些 Android 手機會回報成滑鼠）：
   像 Android 小工具，長按選取卡片後出現外框和四邊圓點，拖圓點調整大小；平常不顯示 */

.dk-root.dk-touch .grid-stack-item > .ui-resizable-handle { display:none !important; }
  /* 手機長按選取：圓點的中心正好落在卡片外框線上（卡片內容比格子內縮 --dk-m），圓點小一點、框線淡一點 */
.dk-root.dk-touch .grid-stack-item.dk-sel > .ui-resizable-handle { display:block !important; z-index:20; width:32px; height:32px; }
.dk-root.dk-touch .grid-stack-item.dk-sel > .ui-resizable-n, .dk-root.dk-touch .grid-stack-item.dk-sel > .ui-resizable-s { left:calc(50% - 16px); right:auto; }
.dk-root.dk-touch .grid-stack-item.dk-sel > .ui-resizable-e, .dk-root.dk-touch .grid-stack-item.dk-sel > .ui-resizable-w { top:calc(50% - 16px); bottom:auto; }
.dk-root.dk-touch .grid-stack-item.dk-sel > :is(.ui-resizable-n, .ui-resizable-ne, .ui-resizable-nw) { top:calc(var(--dk-m, 8px) - 16px); bottom:auto; }
.dk-root.dk-touch .grid-stack-item.dk-sel > :is(.ui-resizable-s, .ui-resizable-se, .ui-resizable-sw) { bottom:calc(var(--dk-m, 8px) - 16px); top:auto; }
.dk-root.dk-touch .grid-stack-item.dk-sel > :is(.ui-resizable-e, .ui-resizable-ne, .ui-resizable-se) { right:calc(var(--dk-m, 8px) - 16px); left:auto; }
.dk-root.dk-touch .grid-stack-item.dk-sel > :is(.ui-resizable-w, .ui-resizable-nw, .ui-resizable-sw) { left:calc(var(--dk-m, 8px) - 16px); right:auto; }
.dk-root.dk-touch .grid-stack-item.dk-sel > :is(.ui-resizable-ne, .ui-resizable-nw, .ui-resizable-se, .ui-resizable-sw) { display:none !important; } /* 卡片是圓角，四個角不放圓點，只留四邊 */
.dk-root.dk-touch .grid-stack-item.dk-sel > .ui-resizable-handle::after { content:""; position:absolute; left:50%; top:50%; width:10px; height:10px; margin:-5px 0 0 -5px;
    border-radius:50%; background:#fff; border:1.5px solid var(--pine, #007E8A); box-shadow:0 1px 3px rgba(0,0,0,.3); }
.dk-root.dk-touch .grid-stack-item.dk-sel > .grid-stack-item-content { outline:2px solid rgba(255,255,255,.45); outline-offset:0; }

.dk-root .dk-app > .ui-resizable-handle { display:none !important; pointer-events:none !important; } /* App 圖示不能調大小（只有卡片可以） */

.dk-entry-trigger { appearance:none; border:0; padding:0; background:none; cursor:pointer; font:inherit; }
.dk-entry-icon { position:relative; }
.dk-entry-face { position:absolute; inset:0; display:grid; place-items:center; overflow:hidden; -webkit-mask:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20preserveAspectRatio='none'%3E%3Cpath%20d='M100.0%2050.0L99.9%2060.5L99.8%2065.6L99.4%2069.7L99.0%2073.1L98.5%2076.1L97.8%2078.9L97.0%2081.4L96.1%2083.6L95.0%2085.7L93.8%2087.7L92.5%2089.4L91.0%2091.0L89.4%2092.5L87.7%2093.8L85.7%2095.0L83.6%2096.1L81.4%2097.0L78.9%2097.8L76.1%2098.5L73.1%2099.0L69.7%2099.4L65.6%2099.8L60.5%2099.9L50.0%20100.0L39.5%2099.9L34.4%2099.8L30.3%2099.4L26.9%2099.0L23.9%2098.5L21.1%2097.8L18.6%2097.0L16.4%2096.1L14.3%2095.0L12.3%2093.8L10.6%2092.5L9.0%2091.0L7.5%2089.4L6.2%2087.7L5.0%2085.7L3.9%2083.6L3.0%2081.4L2.2%2078.9L1.5%2076.1L1.0%2073.1L0.6%2069.7L0.2%2065.6L0.1%2060.5L0.0%2050.0L0.1%2039.5L0.2%2034.4L0.6%2030.3L1.0%2026.9L1.5%2023.9L2.2%2021.1L3.0%2018.6L3.9%2016.4L5.0%2014.3L6.2%2012.3L7.5%2010.6L9.0%209.0L10.6%207.5L12.3%206.2L14.3%205.0L16.4%203.9L18.6%203.0L21.1%202.2L23.9%201.5L26.9%201.0L30.3%200.6L34.4%200.2L39.5%200.1L50.0%200.0L60.5%200.1L65.6%200.2L69.7%200.6L73.1%201.0L76.1%201.5L78.9%202.2L81.4%203.0L83.6%203.9L85.7%205.0L87.7%206.2L89.4%207.5L91.0%209.0L92.5%2010.6L93.8%2012.3L95.0%2014.3L96.1%2016.4L97.0%2018.6L97.8%2021.1L98.5%2023.9L99.0%2026.9L99.4%2030.3L99.8%2034.4L99.9%2039.5Z'/%3E%3C/svg%3E") center/100% 100% no-repeat; mask:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20100%20100'%20preserveAspectRatio='none'%3E%3Cpath%20d='M100.0%2050.0L99.9%2060.5L99.8%2065.6L99.4%2069.7L99.0%2073.1L98.5%2076.1L97.8%2078.9L97.0%2081.4L96.1%2083.6L95.0%2085.7L93.8%2087.7L92.5%2089.4L91.0%2091.0L89.4%2092.5L87.7%2093.8L85.7%2095.0L83.6%2096.1L81.4%2097.0L78.9%2097.8L76.1%2098.5L73.1%2099.0L69.7%2099.4L65.6%2099.8L60.5%2099.9L50.0%20100.0L39.5%2099.9L34.4%2099.8L30.3%2099.4L26.9%2099.0L23.9%2098.5L21.1%2097.8L18.6%2097.0L16.4%2096.1L14.3%2095.0L12.3%2093.8L10.6%2092.5L9.0%2091.0L7.5%2089.4L6.2%2087.7L5.0%2085.7L3.9%2083.6L3.0%2081.4L2.2%2078.9L1.5%2076.1L1.0%2073.1L0.6%2069.7L0.2%2065.6L0.1%2060.5L0.0%2050.0L0.1%2039.5L0.2%2034.4L0.6%2030.3L1.0%2026.9L1.5%2023.9L2.2%2021.1L3.0%2018.6L3.9%2016.4L5.0%2014.3L6.2%2012.3L7.5%2010.6L9.0%209.0L10.6%207.5L12.3%206.2L14.3%205.0L16.4%203.9L18.6%203.0L21.1%202.2L23.9%201.5L26.9%201.0L30.3%200.6L34.4%200.2L39.5%200.1L50.0%200.0L60.5%200.1L65.6%200.2L69.7%200.6L73.1%201.0L76.1%201.5L78.9%202.2L81.4%203.0L83.6%203.9L85.7%205.0L87.7%206.2L89.4%207.5L91.0%209.0L92.5%2010.6L93.8%2012.3L95.0%2014.3L96.1%2016.4L97.0%2018.6L97.8%2021.1L98.5%2023.9L99.0%2026.9L99.4%2030.3L99.8%2034.4L99.9%2039.5Z'/%3E%3C/svg%3E") center/100% 100% no-repeat; }
.dk-entry-badge { position:absolute; z-index:1; right:-5px; bottom:-5px; box-shadow:0 1px 3px rgba(0,0,0,.35); display:grid; place-items:center; width:21px; height:21px; border-radius:50%; background:#172026e6; color:white; pointer-events:none; animation:dk-badge-nudge 8.7s infinite; }
.dk-entry-badge::after { content:''; width:6px; height:6px; border:solid currentColor; border-width:0 2px 2px 0; transform:translateY(-2px) rotate(45deg); }
@keyframes dk-badge-nudge { 0%,91%,100% { translate:0 0; } 94% { translate:0 -3px; } 97% { translate:0 1px; } }
@media (prefers-reduced-motion:reduce) { .dk-entry-badge { animation:none; } }
.dk-entry-menu { border-inline-start:3px solid var(--pine, var(--teal, #007e8a)); animation:none; overflow:auto; max-height:calc(100dvh - 16px); max-width:calc(100vw - 16px); box-sizing:border-box; }
.dk-entry-menu a { padding:10px 12px; border-radius:10px; color:inherit; text-decoration:none; font-size:14px; font-weight:600; overflow-wrap:anywhere; }
.dk-entry-menu a:is(:hover,:focus-visible) { background:var(--btn, rgba(127,127,127,.15)); }
.dk-entry-dialog fieldset { min-width:0; border:0; padding:0; margin:0; }
.dk-entry-dialog fieldset + fieldset { margin-top:12px; }
.dk-entry-dialog legend { margin-bottom:5px; font-size:13px; font-weight:700; color:var(--dk-dialog-text); }
.dk-entry-dialog .dk-entry-fields { display:grid; grid-template-columns:minmax(0, 3fr) minmax(0, 2fr); gap:8px; }
.dk-entry-fields label { min-width:0; display:flex; flex-direction:column; gap:6px; color:var(--dk-dialog-muted); font-size:13px; font-weight:700; }
.dk-entry-fields input { box-sizing:border-box; width:100%; min-width:0; height:44px; border:1px solid var(--dk-dialog-border); border-radius:12px; padding:0 12px; background:var(--dk-dialog-field); color:var(--dk-dialog-text); font:inherit; font-size:15px; outline:none; }
.dk-entry-fields input:focus { border-color:var(--dk-dialog-primary); }
.dk-entry-dialog [role=alert] { color:var(--dk-dialog-danger); font-size:13px; }
.dk-entry-dialog [role=alert]:empty { display:none; }
