/* ============================================================
   Home dashboard — arrangeable widgets (tasks · calendar ·
   recents · favorites) + a Customize control.
   ============================================================ */

/* ----- dashboard shell ----- */
.wg-dash { margin: 4px 0 22px; }
/* the section also carries the legacy .ht-panel class; neutralise its
   old two-column grid so the widget grid below can take over */
.ht-panel.wg-dash { display: block; }

.wg-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.wg-customize {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 8px;
  transition: color .12s var(--ease-out, ease), border-color .12s var(--ease-out, ease), background .12s var(--ease-out, ease);
}
.wg-customize:hover { color: var(--accent); border-color: var(--accent); background: var(--bg-hover); }
.wg-customize svg { width: 14px; height: 14px; }

/* ----- customize panel ----- */
.wg-cfg {
  border: 1px solid var(--border);
  border-radius: var(--radius-card, 12px);
  background: var(--bg-elevated, var(--bg));
  padding: 8px;
  margin-bottom: 14px;
  max-width: 440px;
}
.wg-cfg-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  padding: 4px 6px 8px;
}
.wg-cfg-close {
  background: none; border: 0; color: var(--text-faint);
  cursor: pointer; line-height: 0; padding: 2px; border-radius: 6px;
  transition: color .12s var(--ease-out, ease), background .12s var(--ease-out, ease);
}
.wg-cfg-close:hover { color: var(--text); background: var(--bg-hover); }
.wg-cfg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 8px;
}
.wg-cfg-row:hover { background: var(--bg-hover); }
.wg-cfg-name {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text);
}
.wg-cfg-name svg { color: var(--accent); flex: 0 0 auto; }
.wg-cfg-move { flex: 0 0 auto; display: inline-flex; gap: 4px; }
.wg-cfg-arrow {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: color .12s var(--ease-out, ease), border-color .12s var(--ease-out, ease);
}
.wg-cfg-arrow:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.wg-cfg-arrow:disabled { opacity: .35; cursor: default; }

/* visibility toggle switch */
.wg-cfg-toggle {
  flex: 0 0 auto;
  width: 32px; height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--border-strong, var(--border));
  position: relative;
  cursor: pointer;
  transition: background .14s var(--ease-out, ease);
}
.wg-cfg-toggle.on { background: var(--accent); }
.wg-cfg-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform .14s var(--ease-out, ease);
}
.wg-cfg-toggle.on .wg-cfg-knob { transform: translateX(14px); }

/* ----- widget grid ----- */
.wg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  align-items: start;
}
.wg-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-card, 12px);
  background: var(--bg-elevated, var(--bg));
  padding: 14px 16px;
  min-width: 0;
}
.wg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.wg-head-tt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.wg-head-tt svg { color: var(--accent); }
.wg-head-link {
  background: none;
  border: 0;
  color: var(--text-faint);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color .12s var(--ease-out, ease), background .12s var(--ease-out, ease);
}
.wg-head-link:hover { color: var(--accent); background: var(--bg-hover); }
.wg-body { min-width: 0; }

/* ----- generic list (recents / favorites) ----- */
.wg-list { display: flex; flex-direction: column; gap: 1px; }
.wg-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px;
  border: 0;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: background .12s var(--ease-out, ease);
}
.wg-item:hover { background: var(--bg-hover); }
.wg-item-ic {
  flex: 0 0 auto;
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  color: var(--text-faint);
}
.wg-item-ic svg { color: var(--text-faint); }
.wg-item-tx {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wg-item:hover .wg-item-tx { color: var(--accent); }
.wg-item-time { flex: 0 0 auto; font-size: 11px; color: var(--text-faint); }

/* ----- empty states ----- */
.wg-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  font-size: 13px;
  color: var(--text-faint);
}
.wg-empty svg { color: var(--text-faint); flex: 0 0 auto; }
.wg-dash-empty { grid-column: 1 / -1; }

/* ----- tasks widget (shared markup) ----- */
.ht-tasks { display: flex; flex-direction: column; gap: 2px; }
.ht-task {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 6px;
  border-radius: 8px;
  cursor: default;
  transition: background .12s var(--ease-out, ease);
}
.ht-task:hover { background: var(--bg-hover); }
.ht-check {
  flex: 0 0 auto;
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong, var(--border));
  border-radius: 5px;
  background: var(--bg);
  cursor: pointer;
  position: relative;
  transition: border-color .12s, background .12s;
}
.ht-check:hover { border-color: var(--accent); }
.ht-check-on { background: var(--accent); border-color: var(--accent); }
.ht-check-on::after {
  content: "✓";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; line-height: 1;
}
.ht-task-tx {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ht-task-tx:hover { color: var(--accent); }
.ht-task-ic { flex: 0 0 auto; font-size: 14px; }
.ht-task-overdue .ht-task-tx { color: var(--text); }
.ht-task-badge {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  color: #b4442f;
  background: color-mix(in srgb, #e0533a 15%, transparent);
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.ht-task-db { cursor: pointer; }
.ht-task-tx-db { color: var(--text-muted, var(--text-faint)); }
.ht-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  font-size: 13px;
  color: var(--text-faint);
}
.ht-empty svg { color: #2fae6b; }
.ht-more {
  align-self: flex-start;
  margin-top: 4px;
  background: none;
  border: 0;
  color: var(--text-faint);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color .12s var(--ease-out, ease), background .12s var(--ease-out, ease);
}
.ht-more:hover { color: var(--accent); background: var(--bg-hover); }

/* ----- calendar widget (shared markup) ----- */
.ht-mc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.ht-mc-title { font-size: 13px; font-weight: 600; color: var(--text); }
.ht-mc-nav {
  background: none; border: 0; color: var(--text-faint);
  cursor: pointer; padding: 2px 4px; border-radius: 6px; line-height: 0;
  transition: color .12s var(--ease-out, ease), background .12s var(--ease-out, ease);
}
.ht-mc-nav:hover { color: var(--accent); background: var(--bg-hover); }
.ht-mc-prev svg { transform: rotate(180deg); }
.ht-mc-wd,
.ht-mc-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.ht-mc-wd { margin-bottom: 3px; }
.ht-mc-wd span {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
}
.ht-mc-day {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  border-radius: 7px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: background .1s var(--ease-out, ease);
}
.ht-mc-day:hover { background: var(--bg-hover); }
.ht-mc-out { color: var(--text-faint); opacity: .5; }
.ht-mc-today {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.ht-mc-today:hover { background: var(--accent); }
.ht-mc-dot {
  position: absolute;
  bottom: 3px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: transparent;
}
.ht-mc-has .ht-mc-dot { background: var(--accent); }
.ht-mc-today.ht-mc-has .ht-mc-dot { background: #fff; }
.ht-cal-link {
  margin-top: 8px;
  width: 100%;
  text-align: center;
  background: none;
  border: 0;
  color: var(--text-faint);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color .12s var(--ease-out, ease), background .12s var(--ease-out, ease);
}
.ht-cal-link:hover { color: var(--accent); background: var(--bg-hover); }

/* narrow screens: grid already wraps via minmax(); force one column early */
@media (max-width: 720px) {
  .wg-grid { grid-template-columns: 1fr; }
}
