/* ---------- Subscriptions tracker ----------
   Lives at the BOTTOM of the right-pane To-do panel (Bookmarks tab only).
   Bottom-pinned block, capped at 1/3 of the pane; its list scrolls internally.
   Pure Marker tokens (emerald accent, OKLCH) so it matches the whole app. */

.subscriptions-block {
  flex: 0 0 auto;            /* sits below the flex:1 todo-list → pinned to the bottom */
  max-height: 33.333%;       /* never taller than 1/3 of the To-do pane */
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--border);
  background: var(--surface-2);

  /* urgency ramp — emerald (ok) → amber (soon) → red (expired) */
  --sub-ok: var(--accent);
  --sub-soon: oklch(0.64 0.15 64);
  --sub-expired: var(--danger);
}

[data-theme="dark"] .subscriptions-block {
  --sub-soon: oklch(0.78 0.15 72);
}

.subscriptions-block[hidden] {
  display: none;
}

/* head: title + count + add */
.subs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 6px;
  flex-shrink: 0;
}

.subs-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.subs-title svg {
  width: 14px;
  height: 14px;
}

.subs-count {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0 7px;
  border-radius: var(--r-pill);
  min-width: 20px;
  text-align: center;
}

.subs-count:empty {
  display: none;
}

.subs-add {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.subs-add svg {
  width: 15px;
  height: 15px;
}

.subs-add:hover {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* scrolling list */
.subs-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* each subscription = a soft card, same language as .todo-item */
.sub-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.sub-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.sub-fav {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--surface-2);
}

/* letter-tile fallback (markerIconError appends .fav-letter) */
.sub-fav.fav-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent-soft);
}

.sub-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sub-row1 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.sub-name {
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-left {
  flex-shrink: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--sub-ok);
}

/* progress bar */
.sub-bar {
  height: 4px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: color-mix(in oklch, var(--ink), transparent 88%);
}

.sub-bar > span {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--sub-ok);
  transition: width 0.35s var(--ease);
}

.sub-sub {
  font-size: var(--fs-xs);
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* urgency states */
.sub-card.is-soon .sub-left { color: var(--sub-soon); }
.sub-card.is-soon .sub-bar > span { background: var(--sub-soon); }

.sub-card.is-expired {
  background: var(--danger-soft);
  border-color: color-mix(in oklch, var(--danger), transparent 55%);
}
.sub-card.is-expired .sub-left { color: var(--sub-expired); }
.sub-card.is-expired .sub-bar > span { background: var(--sub-expired); }

/* delete (x) — appears on hover, like .todo-del */
.sub-del {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  color: var(--faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.sub-del svg { width: 14px; height: 14px; }

.sub-card:hover .sub-del { opacity: 1; }

.sub-del:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* empty state */
.subs-empty {
  padding: 12px 10px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

.subs-empty button {
  margin-top: 6px;
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: underline;
}

/* ---------- Add / edit dialog extras ---------- */
.sub-dur-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sub-end-preview {
  font-size: var(--fs-sm);
  color: var(--muted);
  padding: 2px 2px 0;
}

.sub-end-preview strong {
  color: var(--accent-text);
  font-weight: 600;
}

.sub-end-preview.is-expired strong {
  color: var(--danger);
}
