/* ═══════════════════════════════════════════════════════════════════
   SUB-PAGES — Custom Editor · Creative Prompts · Calendar
   ═══════════════════════════════════════════════════════════════════
   Loaded after each view's own stylesheet, before light-theme.css.

   These three screens are rebuilt rather than tinted. Where an old rule sets
   the layout — #prompts-grid was a 190px-column grid, .ce-tile carried a
   150px min-height — it is reset here explicitly, because inheriting a
   container's display mode is exactly what broke the last pass.

   Tokens only. Accent appears on these screens in three places and nowhere
   else: today on the calendar, the overdue count, and focus rings.
   ------------------------------------------------------------------- */

/* ══ Shared page frame ══════════════════════════════════════════════ */
.sp-title {
  font-size: var(--fs-28); font-weight: 700; letter-spacing: -.025em; color: var(--tx);
  line-height: var(--lh-tight);
}
.sp-sub { font-size: var(--fs-14); color: var(--t3); margin-top: 5px; }

/* ══ Custom Editor ══════════════════════════════════════════════════ */
/* :not(--page) matters — the builder sets padding:0 on .ce-wrap--page, and
   this file loads later, so an unscoped rule would win and break it. */
.ce-wrap:not(.ce-wrap--page) {
  padding: var(--s-8) max(var(--s-6), calc((100% - 1080px) / 2)) var(--s-9);
  max-width: none;
}
.ce-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--s-7); }
.ce-header-title {
  font-size: var(--fs-28); font-weight: 700; letter-spacing: -.025em;
  color: var(--tx); line-height: var(--lh-tight);
}
.ce-header-sub { font-size: var(--fs-14); color: var(--t3); margin-top: 5px; }

.ce-grid { grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: var(--s-4); margin-top: 0; }

/* No min-height: a tile is as tall as what it holds. The old 150px floor is
   what left that band of dead space under every card. */
.ce-tile {
  min-height: 0;
  padding: var(--s-5);
  gap: 0;
  background: var(--bg2);
  border: 1px solid var(--b1);
  border-radius: var(--r-5);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.ce-tile:hover {
  background: var(--bg2); border-color: var(--b3);
  box-shadow: var(--shadow-md); transform: none;
}
.ce-tile-icon {
  width: 34px; height: 34px; border-radius: var(--r-3);
  background: var(--bg3); color: var(--t2);
  display: grid; place-items: center; margin-bottom: var(--s-4);
}
.ce-tile-name { font-size: var(--fs-15); font-weight: 600; color: var(--tx); letter-spacing: -.01em; }
.ce-tile-system-badge {
  align-self: flex-start; margin-top: 6px;
  font-size: var(--fs-10); font-weight: 500; letter-spacing: .04em; text-transform: none;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--bg3); color: var(--t3);
}
.ce-tile-meta {
  font-size: var(--fs-12); color: var(--t3);
  margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--b1);
}
/* Usage is what decides whether a template can be deleted. */
.ce-tile-use {
  font-family: var(--ff-mono); font-size: var(--fs-11); color: var(--t4);
  margin-top: 3px; font-variant-numeric: tabular-nums;
}
.ce-tile-create {
  background: none; border: 1px dashed var(--b2); box-shadow: none;
  align-items: center; justify-content: center; text-align: center;
}
.ce-tile-create:hover { background: var(--bg3); border-color: var(--b3); box-shadow: none; }
.ce-tile-create-icon {
  width: 34px; height: 34px; border-radius: var(--r-pill);
  background: var(--bg3); color: var(--t3); display: grid; place-items: center; margin-bottom: var(--s-3);
}
.ce-tile-create-label { font-size: var(--fs-13); font-weight: 500; color: var(--t2); }
.ce-tile-create-sub   { font-size: var(--fs-11); color: var(--t4); margin-top: 2px; }

/* ══ Creative Prompts ═══════════════════════════════════════════════ */
.prompts-wrap { padding: var(--s-8) max(var(--s-6), calc((100% - 1080px) / 2)) var(--s-9); }
.prompts-header { margin-bottom: var(--s-6); align-items: flex-start; }
.prompts-header > div:first-child {
  font-size: var(--fs-28) !important; font-weight: 700 !important;
  letter-spacing: -.025em; color: var(--tx); line-height: var(--lh-tight);
}
/* Ink, not accent — uploading a file is not the hero action on the page. */
.prompts-header .btn-inline.amber {
  background: var(--fill, var(--tx)); border: 1px solid var(--fill, var(--tx)); color: var(--fill-ink);
  font-weight: 500; border-radius: var(--r-2); height: 36px; padding: 0 var(--s-4);
}
.prompts-header .btn-inline.amber:hover { background: var(--t2); border-color: var(--t2); }

/* The container was a 190px-column grid; the list owns its own layout. */
#prompts-grid, .prompts-grid { display: block; grid-template-columns: none; gap: 0; }

.pq-bar { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.pq-find {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-2);
  height: 38px; padding: 0 var(--s-3);
  border: 1px solid var(--b2); border-radius: var(--r-3); background: var(--bg2);
  transition: border-color var(--t-base) var(--ease);
}
.pq-find:focus-within { border-color: var(--accent); }
.pq-find svg { width: 15px; height: 15px; color: var(--t4); flex: 0 0 auto; }
.pq-find input {
  flex: 1; min-width: 0; border: none; background: none; outline: none;
  color: var(--tx); font-family: inherit; font-size: var(--fs-14);
}
.pq-find input::placeholder { color: var(--t4); }

.pq-seg { display: flex; gap: 2px; padding: 2px; background: var(--bg3); border-radius: var(--r-2); flex: 0 0 auto; }
.pq-seg-b {
  padding: 6px 12px; border: none; border-radius: var(--r-1); background: none;
  font-family: inherit; font-size: var(--fs-12); font-weight: 500; color: var(--t3);
}
.pq-seg-b:hover { color: var(--tx); }
.pq-seg-b.on { background: var(--bg2); color: var(--tx); box-shadow: var(--shadow-sm); }
.pq-count { font-family: var(--ff-mono); font-size: var(--fs-12); color: var(--t4); flex: 0 0 auto; }

.pq-note {
  font-size: var(--fs-12); color: var(--t3); line-height: var(--lh-normal);
  padding: 9px var(--s-3); margin-bottom: var(--s-4);
  background: var(--warning-bg); border-radius: var(--r-2);
}

/* One row per prompt: the name gets the width, everything else is a column. */
.pq-list { border-top: 1px solid var(--b1); }
.pq-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 11px var(--s-3); border-bottom: 1px solid var(--b1);
  cursor: pointer;
  transition: background var(--t-base) var(--ease);
}
.pq-row:hover { background: var(--bg3); }
.pq-ic { color: var(--t4); display: flex; flex: 0 0 auto; }
.pq-ic svg { width: 16px; height: 16px; }
.pq-name {
  flex: 1; min-width: 0; font-size: var(--fs-14); font-weight: 500; color: var(--tx);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pq-ext {
  flex: 0 0 auto; font-family: var(--ff-mono); font-size: var(--fs-10); color: var(--t4);
  padding: 1px 6px; border: 1px solid var(--b1); border-radius: var(--r-1);
}
.pq-dupe {
  flex: 0 0 auto; font-size: var(--fs-10); color: var(--warning);
  background: var(--warning-bg); padding: 2px 8px; border-radius: var(--r-pill);
}
.pq-size {
  flex: 0 0 68px; text-align: right;
  font-family: var(--ff-mono); font-size: var(--fs-11); color: var(--t4);
  font-variant-numeric: tabular-nums;
}
.pq-acts { display: flex; gap: 2px; flex: 0 0 auto; }
.pq-btn {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: var(--r-2); background: none; color: var(--t3);
  opacity: 0;
  transition: opacity var(--t-base) var(--ease), background var(--t-base) var(--ease), color var(--t-base) var(--ease);
}
.pq-row:hover .pq-btn, .pq-btn:focus-visible { opacity: 1; }
.pq-btn svg { width: 14px; height: 14px; }
.pq-btn:hover { background: var(--bg4); color: var(--tx); }
/* Delete only reddens when pointed at, and sits after a gap. */
.pq-del { margin-left: var(--s-3); }
.pq-del:hover { background: var(--danger-bg); color: var(--danger); }




.pq-cta {
  height: 36px; padding: 0 var(--s-4); border: none; border-radius: var(--r-2);
  background: var(--fill, var(--tx)); color: var(--fill-ink);
  font-family: inherit; font-size: var(--fs-13); font-weight: 500;
}
.pq-cta:hover { background: var(--t2); }

/* ══ Calendar ═══════════════════════════════════════════════════════ */
.cal-day { min-height: 72px; }
.cal-day-header {
  font-size: var(--fs-10); font-weight: 600; color: var(--t4);
  letter-spacing: .08em; text-transform: uppercase;
}
.cal-day-num { font-size: var(--fs-12); font-weight: 500; color: var(--t2); }
.cal-day.other-month .cal-day-num { opacity: .4; }

/* Today is a genuine you-are-here marker: one of the sanctioned accents. */
.cal-day.today { background: var(--accent-bg); border-color: var(--accent-line) !important; }
.cal-day.today .cal-day-num {
  background: var(--accent); color: var(--accent-ink);
  width: 20px; height: 20px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center;
}

.cal-overdue {
  display: flex; align-items: center; gap: var(--s-2); width: 100%;
  margin-top: var(--s-5); padding: 11px var(--s-4);
  background: var(--danger-bg); border: 1px solid transparent; border-radius: var(--r-3);
  color: var(--t2); font-family: inherit; font-size: var(--fs-13); text-align: left;
  transition: border-color var(--t-base) var(--ease);
}
.cal-overdue:hover { border-color: var(--danger); }
.cal-overdue-n {
  font-family: var(--ff-mono); font-weight: 600; color: var(--danger);
  font-variant-numeric: tabular-nums;
}
.cal-overdue-go { margin-left: auto; font-size: var(--fs-12); font-weight: 500; color: var(--t3); }
.cal-overdue:hover .cal-overdue-go { color: var(--tx); }

/* Filters were accent pills — accent is not a selection colour. Ink chip in a
   neutral track, the same segmented control used everywhere else. */
.cal-filter-bar { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; margin: var(--s-4) 0; }
.cal-filter-bar > div { margin-top: 0 !important; gap: 2px !important; }
.cal-filter-bar > div > span:first-child {
  font-size: var(--fs-10) !important; font-weight: 600 !important; color: var(--t4) !important;
  letter-spacing: .08em !important; margin-right: 6px;
}
.cal-filter-chip {
  padding: 6px 12px; border: 1px solid transparent !important; border-radius: var(--r-2) !important;
  background: none !important;
  font-family: inherit; font-size: var(--fs-12); font-weight: 500; color: var(--t3) !important;
  transition: background var(--t-base) var(--ease), color var(--t-base) var(--ease);
}
.cal-filter-chip:hover { background: var(--bg3) !important; color: var(--tx) !important; }
.cal-filter-chip.active {
  background: var(--fill, var(--tx)) !important; border-color: var(--fill, var(--tx)) !important;
  color: var(--fill-ink) !important;
}

/* A raw timestamp told you nothing; these say what it means. */
.todo-due {
  font-family: var(--ff-mono); font-size: var(--fs-11); color: var(--t4);
  flex-shrink: 0; font-variant-numeric: tabular-nums;
}
.todo-due.over  { color: var(--danger); font-weight: 500; }
.todo-due.today { color: var(--accent); font-weight: 500; }
.todo-due.soon  { color: var(--t2); }

@media (max-width: 620px) {
  .ce-wrap, .prompts-wrap { padding: var(--s-5) var(--s-4) var(--s-7); }
  .ce-header-title, .prompts-header > div:first-child { font-size: var(--fs-24) !important; }
  .pq-bar { flex-wrap: wrap; }
  .pq-size, .pq-ext { display: none; }
  .cal-day { min-height: 54px; }
}

/* ══ Page header, shared ════════════════════════════════════════════ */
/* The topbar no longer repeats these names (see js/router.js), so the page
   header is the only place the view is titled. */
.sp-head { margin-bottom: var(--s-6); }

/* ══ Prompts — refinements ══════════════════════════════════════════ */
.pq-note {
  display: flex; align-items: center; gap: var(--s-3);
  font-size: var(--fs-12); color: var(--t2); line-height: var(--lh-normal);
  padding: 9px 10px 9px var(--s-3); margin-bottom: var(--s-4);
  background: var(--warning-bg); border-radius: var(--r-2);
}
.pq-note > span { flex: 1; min-width: 0; }
.pq-note-btn {
  flex: 0 0 auto; height: 28px; padding: 0 12px;
  border: 1px solid var(--b2); border-radius: var(--r-2); background: var(--bg2);
  font-family: inherit; font-size: var(--fs-12); font-weight: 500; color: var(--tx);
  transition: background var(--t-base) var(--ease);
}
.pq-note-btn:hover { background: var(--bg3); }

/* The name column was so wide the chips floated in the middle of nowhere.
   Cap it so name, format and size read as one group. */
.pq-name { flex: 0 1 auto; max-width: 52ch; }
.pq-row  { gap: var(--s-2); padding: 9px var(--s-3); }
.pq-row::after { content: ''; flex: 1; }   /* pushes the meta group right */

/* ══ Calendar — one grid, not 42 cards ══════════════════════════════ */
/* Each day was a rounded bordered card with its own hover lift. Forty-two of
   them is a page of boxes; a month is one table with hairlines between days. */
/* The seven day-of-week labels are children of .cal-grid too, so a border on
   the container would box them in with the dates. The frame is drawn by the
   cells instead: every day gets a right and bottom hairline, the first row
   adds a top, the first column adds a left. */
.cal-grid { gap: 0; background: none; }
.cal-day {
  background: var(--bg2) !important;
  border: none !important;
  border-right:  1px solid var(--b1) !important;
  border-bottom: 1px solid var(--b1) !important;
  border-radius: 0 !important;
  min-height: 72px;
  padding: 7px 8px;
  transition: background var(--t-base) var(--ease);
}
/* Children 1–7 are the labels, so the first date cell is child 8. */
.cal-day:nth-child(n+8):nth-child(-n+14) { border-top:  1px solid var(--b1) !important; }
.cal-day:nth-child(7n+1)                 { border-left: 1px solid var(--b1) !important; }
.cal-day:hover  { background: var(--bg3) !important; transform: none; }
.cal-day.other-month { background: var(--bg) !important; }
.cal-day.selected {
  background: var(--bg4) !important; box-shadow: none !important;
}
.cal-day.today { background: var(--accent-bg) !important; }
.cal-day.today .cal-day-num {
  background: var(--accent); color: var(--accent-ink);
  width: 20px; height: 20px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center;
}
/* Day-of-week labels sit outside the frame, so they keep no borders. */
.cal-grid .cal-day-header { border: none !important; background: none !important; padding: 0 0 8px; }
