/* ==========================================================================
   Ctrl Alt Home — styles
   ========================================================================== */

:root {
  --accent: #7c9cff;
  --bg: #0b0d12;
  --surface: rgba(22, 25, 33, 0.72);
  --surface-solid: #161921;
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #e7e9ee;
  --text-dim: #b3b9c6;
  --text-faint: #828a9b;
  --danger: #ff6b7a;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --widget-opacity: 0.9;
  --card-rgb: 17, 20, 27;
  --tile-bg: rgba(255, 255, 255, 0.055);
  --tile-border: rgba(255, 255, 255, 0.09);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }

/* Background layer: gradient by default, user image when set */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 10% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(160, 90, 255, 0.10), transparent 60%),
    var(--bg);
  background-size: cover;
  background-position: center;
  transition: filter .4s var(--ease);
}
.backdrop.has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, var(--bg-dim, 0.45));
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Grid ---------- */
.grid-stack {
  margin: 24px auto 72px;
  max-width: 2000px;
  width: calc(100% - 32px);
  min-height: 60vh;
}
.grid-stack.gs-1 > .grid-stack-item { width: 100%; left: 0; }

.grid-stack > .grid-stack-item > .grid-stack-item-content { overflow: visible; }
.grid-stack-item { transition: opacity .2s var(--ease); }
.grid-stack-animate .grid-stack-item { transition: left .25s var(--ease), top .25s var(--ease), width .25s var(--ease), height .25s var(--ease); }

/* Drop placeholder */
.grid-stack > .grid-stack-placeholder > .placeholder-content {
  background: color-mix(in srgb, var(--accent) 10%, transparent) !important;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: var(--radius);
  inset: 0;
}

/* Being dragged */
.grid-stack-item.ui-draggable-dragging > .grid-stack-item-content,
.grid-stack-item.ui-resizable-resizing > .grid-stack-item-content {
  box-shadow: 0 24px 50px -16px rgba(0,0,0,.75), 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}
.grid-stack-item.ui-draggable-dragging > .grid-stack-item-content { transform: scale(1.01); }
body.gs-busy iframe { pointer-events: none; }
body.gs-busy { user-select: none; }

/* Resize handle: subtle corner */
.grid-stack-item > .ui-resizable-se {
  background: none !important;
  width: 18px; height: 18px;
  right: 4px !important; bottom: 4px !important;
  transform: none !important;
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.grid-stack-item > .ui-resizable-se::after {
  content: "";
  position: absolute;
  right: 4px; bottom: 4px;
  width: 8px; height: 8px;
  border-right: 2px solid var(--text-faint);
  border-bottom: 2px solid var(--text-faint);
  border-bottom-right-radius: 3px;
}
.grid-stack-item:hover > .ui-resizable-se { opacity: 1; }

/* ---------- Widget card ---------- */
.widget {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: rgba(var(--card-rgb), var(--widget-opacity));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  animation: pop-in .35s var(--ease) both;
}
.widget:hover { border-color: var(--border-strong); }
.widget.transparent { background: transparent; border-color: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.widget.transparent:hover { border-color: var(--border); }
.widget.transparent { text-shadow: 0 1px 3px rgba(0, 0, 0, .75), 0 0 12px rgba(0, 0, 0, .4); }
.widget.transparent .link { background: rgba(10, 12, 16, .55); }

@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.w-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 8px 0 14px;
  cursor: grab;
  user-select: none;
}
.w-head:active { cursor: grabbing; }
.w-title {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.w-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.widget:hover .w-actions, .widget:focus-within .w-actions { opacity: 1; transform: none; }

/* Widgets without a title: header floats over content, revealed on hover */
.widget.no-title .w-head {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 3;
  height: 28px;
  opacity: 0;
  background: linear-gradient(to bottom, rgba(10,12,16,.55), transparent);
  transition: opacity .18s var(--ease);
}
.widget.no-title:hover .w-head { opacity: 1; }
.widget.no-title .w-head::before {
  content: "";
  position: absolute;
  left: 50%; top: 7px;
  width: 28px; height: 4px;
  margin-left: -14px;
  border-radius: 4px;
  background: rgba(255,255,255,.18);
}

body.locked .w-head { cursor: default; }
body.locked .w-actions, body.locked .widget.no-title .w-head { display: none; }
body.locked .ui-resizable-handle { display: none !important; }

.w-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  container-type: size;
}
.widget:not(.no-title) .w-body { padding-top: 0; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Dock ---------- */
.dock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(18, 20, 27, .7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  opacity: .35;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.dock:hover, .dock:focus-within { opacity: 1; }
.dock-btn {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.dock-btn:hover { background: var(--surface-3); color: var(--text); }
.dock-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dock-btn .ic-locked { display: none; }
body.locked .dock-btn .ic-locked { display: block; color: var(--accent); }
body.locked .dock-btn .ic-unlocked { display: none; }
body.locked #btn-add { display: none; }

/* ---------- Empty state ---------- */
.empty-state {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--text-dim);
  pointer-events: none;
}
.empty-state[hidden] { display: none; }
.empty-state button { pointer-events: auto; }

/* ---------- Buttons & inputs ---------- */
.btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: 500 13px var(--font);
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: transparent; color: #0b0d12; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(255, 107, 122, .1); }

input[type="text"], input[type="url"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,.25);
  color: var(--text);
  font: 13.5px var(--font);
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
select option { background: var(--surface-solid); }
textarea { resize: vertical; min-height: 90px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
input[type="color"] { width: 44px; height: 34px; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: transparent; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; cursor: pointer; }
kbd { padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; font: 11px var(--font); color: var(--text-dim); }

/* ---------- Modals ---------- */
.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: rgba(20, 23, 30, .92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: var(--text);
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.8);
}
.modal[open] { animation: modal-in .25s var(--ease); }
.modal::backdrop { background: rgba(5, 6, 9, .55); backdrop-filter: blur(3px); animation: fade-in .25s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-inner { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.modal-head { display: flex; align-items: center; padding: 18px 18px 6px 22px; }
.modal-head h2 { flex: 1; margin: 0; font-size: 16px; font-weight: 600; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 18px 18px 22px; border-top: 1px solid var(--border); }
.modal-foot .hint { color: var(--text-faint); font-size: 12px; }
.spacer { flex: 1; }

.fields { display: grid; gap: 14px; padding: 12px 22px 18px; overflow: auto; }
.field { display: grid; gap: 6px; }
.field > label { font-size: 12px; font-weight: 500; color: var(--text-dim); }
.field .help { font-size: 11.5px; color: var(--text-faint); }
.field.check { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.field.check > label { color: var(--text); font-size: 13px; cursor: pointer; }
.field.inline { grid-template-columns: 1fr auto; align-items: center; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.settings-io { padding: 4px 22px 18px; }
.settings-io h3 { margin: 0 0 10px; font-size: 12px; font-weight: 500; color: var(--text-dim); }
.settings-io .row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Widget picker */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 12px 22px 22px; }
.pick {
  display: grid;
  gap: 6px;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease), transform .15s var(--ease);
}
.pick:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--surface-3); transform: translateY(-2px); }
.pick-icon { font-size: 22px; line-height: 1; }
.pick-name { font-weight: 600; font-size: 13.5px; }
.pick-desc { font-size: 12px; color: var(--text-dim); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 22px; z-index: 100; display: grid; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast {
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(22, 25, 33, .95);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in .3s var(--ease);
}
.toast { display: flex; align-items: center; gap: 14px; }
.toast-action { pointer-events: auto; padding: 3px 10px; border: 0; border-radius: 7px; background: var(--surface-3); color: var(--accent); font: 600 12.5px var(--font); cursor: pointer; }
.toast-action:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.toast.error { border-color: rgba(255,107,122,.4); color: #ffc2c8; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .3s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Widget-specific styles
   ========================================================================== */

.placeholder { display: grid; place-content: center; height: 100%; padding: 16px; text-align: center; color: var(--text-faint); font-size: 13px; }
.placeholder button { margin-top: 10px; justify-self: center; }

/* Clock */
.clock { display: flex; flex-direction: column; justify-content: center; height: 100%; padding: 4cqh 7cqw; }
.clock.center { align-items: center; text-align: center; }
.clock-greet { font-size: clamp(12px, min(6.5cqw, 13cqh), 30px); font-weight: 400; color: var(--text-dim); }
.clock-greet b { color: var(--text); font-weight: 600; }
.clock-time { font-size: clamp(22px, min(19cqw, 42cqh), 140px); font-weight: 300; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.clock-time .sec { font-size: .42em; color: var(--text-faint); margin-left: .12em; letter-spacing: 0; }
.clock-time .ampm { font-size: .3em; color: var(--text-dim); margin-left: .25em; font-weight: 500; letter-spacing: .04em; }
.clock-date { font-size: clamp(11px, min(4.8cqw, 10cqh), 22px); color: var(--text-dim); }
.clock-tz { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .1em; margin-top: 2px; }

/* Search */
.search { display: flex; align-items: center; height: 100%; padding: 10px; }
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: min(100%, 52px);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(0,0,0,.25);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.search-box:focus-within { border-color: color-mix(in srgb, var(--accent) 70%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.search-box input { height: 100%; border: 0; background: transparent; box-shadow: none !important; font-size: 15px; padding: 0 12px 0 4px; }
.search-engine {
  flex: 0 0 auto;
  height: 70%;
  margin-left: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-dim);
  font: 600 11px var(--font);
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}
.search-engine:hover { background: var(--surface-3); color: var(--text); }

/* Links */
.links { display: grid; gap: 8px; padding: 4px 12px 12px; }
.links.tiles { --tile: 92px; --ico: 40px; grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); }
.links.tiles.size-sm { --tile: 74px; --ico: 30px; gap: 6px; }
.links.tiles.size-lg { --tile: 118px; --ico: 52px; gap: 10px; }
.links.list { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.links-empty { grid-column: 1 / -1; padding: 6px 2px; font-size: 12.5px; color: var(--text-faint); }

.link-item { position: relative; min-width: 0; border-radius: 12px; transition: opacity .15s var(--ease), transform .15s var(--ease); }
.link-item.dragging { opacity: .35; }
.link-item.drop-target { outline: 2px dashed color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }

.link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 8px 10px;
  border: 1px solid var(--tile-border);
  border-radius: 12px;
  background: var(--tile-bg);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.link:hover, .link:focus-visible {
  background: color-mix(in srgb, var(--accent) 14%, var(--tile-bg));
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 6px 18px -10px color-mix(in srgb, var(--accent) 60%, transparent);
  outline: none;
}
.links.tiles .link { flex-direction: column; justify-content: center; gap: 7px; padding: 12px 6px 10px; text-align: center; }
.links.tiles .link:hover { transform: translateY(-2px); }

.link-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 7px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: #1a1d24;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
/* White icon plates keep dark favicons (GitHub, X, Notion…) readable on dark cards. */
.links.tiles .link-icon { width: var(--ico); height: var(--ico); border-radius: calc(var(--ico) * .3); font-size: calc(var(--ico) * .42); }
.link-icon img { width: 62%; height: 62%; object-fit: contain; }
.links.list .link-icon img { width: 16px; height: 16px; }
.link-label { min-width: 0; max-width: 100%; font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.links.tiles.size-sm .link-label { font-size: 11.5px; }
.links.tiles.size-lg .link-label { font-size: 13.5px; }

.link-add { border-style: dashed; background: transparent; color: var(--text-dim); }
.link-add .link-icon { background: var(--surface-3); color: var(--text-dim); box-shadow: none; font-weight: 400; }
.link-add .link-label { color: var(--text-dim); }
.link-add:hover .link-icon { background: var(--accent); color: #0b0d12; }

.link-rm {
  position: absolute;
  top: -6px; right: -6px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: #2a2e38;
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: scale(.8);
  transition: opacity .15s var(--ease), transform .15s var(--ease), background .15s var(--ease);
}
.link-item:hover .link-rm, .link-rm:focus-visible { opacity: 1; transform: none; }
.link-rm:hover { background: var(--danger); color: #fff; border-color: transparent; }

.link-form { display: grid; gap: 10px; margin: 0 12px 12px; padding: 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: rgba(0, 0, 0, .25); }
.link-form-row { display: grid; grid-template-columns: 2fr 1.3fr auto auto; gap: 8px; }
.link-form input { height: 34px; }
.link-form input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 107, 122, .2); }
.link-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-height: 92px; overflow: auto; }
.link-suggest-label { font-size: 11.5px; color: var(--text-faint); margin-right: 2px; }
.chip { height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text-dim); font: 500 12px var(--font); cursor: pointer; }
.chip:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--text); background: color-mix(in srgb, var(--accent) 14%, transparent); }
@container (max-width: 420px) { .link-form-row { grid-template-columns: 1fr 1fr; } }

body.locked .link-rm, body.locked .link-add, body.locked .link-form { display: none; }

/* Embed */
.embed { position: absolute; inset: 0; overflow: hidden; border-radius: 0 0 var(--radius) var(--radius); }
.widget.no-title .embed { border-radius: var(--radius); }
.embed iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: #fff; }
.embed iframe.dark-bg { background: transparent; }

/* RSS */
.rss { display: flex; flex-direction: column; height: 100%; }
.rss-status { padding: 6px 14px; font-size: 11.5px; color: var(--text-faint); display: flex; align-items: center; gap: 8px; }
.rss-status .icon-btn { width: 22px; height: 22px; }
.rss-status .spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.rss-list { flex: 1; min-height: 0; overflow: auto; list-style: none; margin: 0; padding: 0 6px 8px; }
.rss-error:empty { display: none; }
.rss-status { flex: 0 0 auto; border-top: 1px solid var(--border); }
.rss-item a {
  display: block;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  transition: background .15s var(--ease);
}
.rss-item a:hover { background: var(--surface-2); }
.rss-item a:visited .rss-title { color: var(--text-dim); }
.rss-title { font-size: 13.5px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rss-meta { margin-top: 3px; font-size: 11.5px; color: var(--text-faint); display: flex; gap: 6px; }
.rss-meta .src { color: color-mix(in srgb, var(--accent) 75%, var(--text-dim)); max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rss-desc { margin-top: 4px; font-size: 12.5px; color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rss-error { padding: 4px 16px 12px; color: #ffb3bb; font-size: 12px; }

/* Notes */
.notes { position: absolute; inset: 0; padding: 0 6px 6px; }
.notes textarea {
  width: 100%; height: 100%;
  min-height: 0;
  resize: none;
  padding: 6px 10px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none !important;
  color: var(--text);
  font: 14px/1.6 var(--font);
}
.notes textarea.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
.notes textarea::placeholder { color: var(--text-faint); }

/* To-do */
.todo { display: flex; flex-direction: column; height: 100%; }
.todo-add { flex: 0 0 auto; display: flex; gap: 6px; padding: 2px 12px 8px; }
.todo-add input { height: 34px; }
.todo-list { flex: 1; overflow: auto; list-style: none; margin: 0; padding: 0 6px; }
.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  transition: background .15s var(--ease), opacity .2s var(--ease);
}
.todo-item:hover { background: var(--surface-2); }
.todo-item .txt { flex: 1; min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; outline: none; border-radius: 4px; }
.todo-item .txt:focus { background: rgba(0,0,0,.25); padding: 0 4px; }
.todo-item.done .txt { color: var(--text-faint); text-decoration: line-through; }
.todo-item .icon-btn { opacity: 0; width: 22px; height: 22px; font-size: 16px; }
.todo-item:hover .icon-btn { opacity: 1; }
.todo-foot { flex: 0 0 auto; display: flex; align-items: center; padding: 6px 14px 10px; font-size: 11.5px; color: var(--text-faint); }
.todo-foot button { border: 0; background: none; color: var(--text-faint); font: inherit; cursor: pointer; padding: 0; }
.todo-foot button:hover { color: var(--text); }

/* Dashboard width */
body[data-width="normal"] .grid-stack { max-width: 1440px; }
body[data-width="full"] .grid-stack { max-width: none; }

/* High-contrast cards */
body.hc {
  --card-rgb: 8, 10, 14;
  --border: rgba(255, 255, 255, 0.2);
  --border-strong: rgba(255, 255, 255, 0.32);
  --text: #ffffff;
  --text-dim: #d0d5df;
  --text-faint: #a4abba;
  --tile-bg: rgba(255, 255, 255, 0.09);
  --tile-border: rgba(255, 255, 255, 0.18);
}
body.hc .widget { backdrop-filter: blur(24px) saturate(110%); -webkit-backdrop-filter: blur(24px) saturate(110%); }

/* Weather */
.wx { display: flex; flex-direction: column; justify-content: center; gap: 10px; height: 100%; padding: 12px 16px; }
.wx-now { display: flex; align-items: center; gap: 14px; }
.wx-icon { font-size: clamp(34px, min(16cqw, 30cqh), 72px); line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35)); }
.wx-main { min-width: 0; }
.wx-temp { font-size: clamp(28px, min(15cqw, 26cqh), 64px); font-weight: 300; line-height: 1; letter-spacing: -.03em; }
.wx-label { font-size: 13.5px; color: var(--text); margin-top: 4px; }
.wx-place { font-size: 11.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-dim); }
.wx-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding-top: 10px; border-top: 1px solid var(--border); }
.wx-day { display: grid; justify-items: center; gap: 2px; font-size: 11.5px; color: var(--text-dim); }
.wx-dicon { font-size: 22px; line-height: 1.2; }
.wx-drange b { color: var(--text); font-weight: 600; }
.wx-err { font-size: 11.5px; color: #ffb3bb; }
@container (max-height: 230px) { .wx-days { display: none; } }
@container (max-height: 150px) { .wx-stats { display: none; } }

/* Calendar */
.cal { display: flex; flex-direction: column; height: 100%; padding: 6px 12px 12px; }
.cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.cal-title { flex: 1; border: 0; background: none; color: var(--text); font: 600 14px var(--font); cursor: pointer; border-radius: 7px; padding: 4px; }
.cal-title:hover { background: var(--surface-3); }
.cal.not-current .cal-title { color: var(--accent); }
.cal-head .icon-btn { font-size: 20px; }
.cal-grid { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; gap: 2px; min-height: 0; }
.cal.with-wk .cal-grid { grid-template-columns: auto repeat(7, 1fr); }
.cal-dow { display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; }
.cal-day, .cal-wk { display: grid; place-items: center; border-radius: 8px; font-size: clamp(11px, min(4cqw, 5cqh), 15px); font-variant-numeric: tabular-nums; }
.cal-wk { padding: 0 6px; color: var(--text-faint); font-size: 10.5px; }
.cal-day.weekend { color: var(--text-dim); }
.cal-day.other { color: var(--text-faint); opacity: .55; }
.cal-day.today { background: var(--accent); color: #0b0d12; font-weight: 700; opacity: 1; box-shadow: 0 4px 14px -6px var(--accent); }

/* Focus timer */
.tm { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 100%; padding: 6px 12px 12px; --tm: var(--accent); }
.tm.is-break { --tm: #4fd1a5; }
.tm-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.tm-tabs button { padding: 4px 10px; border: 0; border-radius: 7px; background: none; color: var(--text-dim); font: 500 11.5px var(--font); cursor: pointer; white-space: nowrap; }
.tm-tabs button:hover { color: var(--text); }
.tm-tabs button.on { background: var(--surface-3); color: var(--text); }
.tm-face { position: relative; flex: 1; min-height: 0; aspect-ratio: 1; max-width: 100%; display: grid; place-items: center; }
.tm-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.tm-track { fill: none; stroke: var(--surface-3); stroke-width: 5; }
.tm-prog { fill: none; stroke: var(--tm); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .3s linear; }
.tm-center { position: relative; text-align: center; }
.tm-time { font-size: clamp(20px, min(13cqw, 15cqh), 56px); font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; }
.tm-label { margin-top: 4px; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; }
.tm-ctrl { display: flex; gap: 8px; }
.tm .btn.primary { background: var(--tm); min-width: 84px; }
@container (max-height: 200px) { .tm-tabs { display: none; } }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .grid-stack { width: calc(100% - 32px); margin-top: 16px; }
  .dock { opacity: 1; right: 12px; bottom: 12px; }
  .toasts { bottom: 72px; }
  .w-actions { opacity: 1; transform: none; }
  .field-row { grid-template-columns: 1fr; }
  .link-rm { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Sync panel (Settings) */
.sync-panel { align-items: center; min-height: 36px; }
.sync-panel .hint { color: var(--text-dim); font-size: 13px; flex-basis: 100%; }
.sync-avatar { width: 28px; height: 28px; border-radius: 50%; }
.sync-who { font-size: 14px; }
.sync-gbtn { min-height: 32px; }
