/* Cron Expression Explainer — expression, explanation, field table, next runs and a library.
   Colours come from the shared tokens, so the panel follows the light and dark themes. */
.cxe {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
  padding: clamp(16px, 2.4vw, 32px);
  text-align: left;
  color: var(--ink);
  background: var(--bg-2);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--shade);
}
.cxe *, .cxe *::before, .cxe *::after { box-sizing: border-box; }
.cxe [hidden] { display: none !important; }
.cxe h2 { margin: 0 0 .35rem; font-size: 1.45rem; letter-spacing: -.02em; }
.cxe h3 { margin: 0; font-size: 1.1rem; }
.cxe p { margin: 0; color: var(--ink-soft); }
.cxe code, .cxe pre { font-family: var(--font-mono); }
/* Long tokens echoed in messages wrap instead of widening the page. */
.cxe :is(p, li, dd) { overflow-wrap: anywhere; }
.cxe-head p { max-width: 76ch; }
.cxe-small { font-size: .88rem; }
.cxe label { display: grid; gap: .3rem; min-width: 0; font-size: .85rem; font-weight: 650; }
.cxe select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: .45rem .6rem;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--field);
  border: 1.5px solid var(--border-soft);
  border-radius: 6px;
}
.cxe select:disabled { opacity: .6; }
.cxe :is(input, select, button, summary):focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.cxe button {
  min-height: 42px;
  padding: .5rem .95rem;
  font: inherit;
  font-weight: 650;
  color: var(--ink);
  background: var(--bg-2);
  border: 2px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.cxe button:disabled { opacity: .5; cursor: default; }
.cxe .cxe-primary { color: var(--on-action); background: var(--action); box-shadow: 3px 3px 0 var(--shade); }
.cxe .cxe-primary:hover:not(:disabled) { background: var(--primary-dark); }

/* Expression */
.cxe-entry { display: grid; gap: .55rem; padding: 1rem; background: var(--blue-tint); border: 2px solid var(--line); border-radius: 10px; }
.cxe .cxe-label { font-size: 1rem; font-weight: 700; }
.cxe-input-row { display: flex; gap: .6rem; min-width: 0; }
.cxe-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: .55rem .75rem;
  font: 600 1.15rem var(--font-mono);
  letter-spacing: .02em;
  color: var(--ink);
  background: var(--field);
  border: 2px solid var(--line);
  border-radius: 8px;
}
.cxe-input[aria-invalid="true"] { border-color: var(--error); }
.cxe-guide { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.cxe-guide li { display: grid; gap: .1rem; min-width: 0; max-width: 100%; padding: .3rem .55rem; background: var(--bg-2); border: 1.5px solid var(--border-soft); border-radius: 6px; }
.cxe-guide li[data-state="error"] { border: 2px solid var(--error); background: var(--error-soft); }
.cxe-guide li[data-state="command"] { border-style: dashed; }
.cxe-guide-label { font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.cxe-guide code { font-size: .92rem; font-weight: 600; overflow-wrap: anywhere; }
.cxe-problem { display: grid; gap: .45rem; padding: .65rem .8rem; color: var(--ink); background: var(--error-soft); border-left: 4px solid var(--error); border-radius: 6px; }
.cxe-problem .cxe-problem-title { font-weight: 700; color: var(--ink); }
.cxe-caret { margin: 0; padding: .4rem .55rem; overflow-x: auto; font-size: .95rem; white-space: pre; background: var(--field); border-radius: 4px; }
.cxe-caret mark { padding: 0 .05em; color: var(--ink); background: var(--error-wash); border-bottom: 3px solid var(--error); }
.cxe-problem-list { display: grid; gap: .3rem; margin: 0; padding-left: 1.1rem; font-size: .9rem; }

/* Settings */
.cxe-settings { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem 1.25rem; }
.cxe-dialect { flex: 1 1 18rem; }
.cxe-detected { flex: 1 1 100%; font-size: .9rem; }
.cxe-pills { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; border: 0; }
.cxe-pills legend { width: 100%; margin-bottom: .3rem; padding: 0; font-size: .85rem; font-weight: 650; }
.cxe .cxe-pills label { position: relative; display: inline-flex; align-items: center; min-height: 42px; padding: .4rem .9rem; font-size: .92rem; background: var(--bg-2); border: 2px solid var(--line); border-radius: 999px; cursor: pointer; }
.cxe-pills input { position: absolute; opacity: 0; pointer-events: none; }
.cxe .cxe-pills label:has(input:checked) { color: var(--on-action); background: var(--action); box-shadow: 2px 2px 0 var(--shade); }
.cxe .cxe-pills label:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Explanation */
.cxe-result { display: grid; gap: .65rem; padding: 1rem 1.1rem; background: var(--paper-3); border: 2px solid var(--line); border-radius: 10px; }
.cxe .cxe-sentence { font-size: clamp(1.1rem, 2.2vw, 1.35rem); font-weight: 700; line-height: 1.4; color: var(--ink); }
.cxe[data-state="error"] .cxe-sentence, .cxe[data-state="empty"] .cxe-sentence { font-size: 1rem; font-weight: 600; color: var(--ink-soft); }
.cxe .cxe-never { padding: .45rem .7rem; font-weight: 650; color: var(--ink); background: var(--warning-soft); border-left: 4px solid var(--warning); border-radius: 6px; }
.cxe-extras { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .25rem .8rem; margin: 0; font-size: .9rem; }
.cxe-extras dt { font-weight: 700; }
.cxe-extras dd { margin: 0; font-family: var(--font-mono); overflow-wrap: anywhere; }
.cxe-notes, .cxe-warnings { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; font-size: .9rem; }
.cxe-notes:empty, .cxe-warnings:empty { display: none; }
.cxe-notes li { padding-left: .8rem; border-left: 3px solid var(--primary); color: var(--ink); }
.cxe-warnings li { padding: .4rem .65rem; color: var(--ink); background: var(--warning-soft); border-left: 4px solid var(--warning); border-radius: 6px; }
.cxe-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

/* Field table */
.cxe-fields { min-width: 0; padding: .8rem 1rem; border: 1.5px solid var(--border-soft); border-radius: 10px; }
.cxe-fields summary { min-height: 32px; font-weight: 700; cursor: pointer; }
.cxe-table-wrap { max-width: 100%; margin-top: .6rem; overflow-x: auto; }
.cxe table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: .88rem; }
.cxe th, .cxe td { padding: .45rem .7rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-faint); }
.cxe thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); background: var(--paper-3); }
.cxe tbody th { font-weight: 700; white-space: nowrap; }
.cxe td code { font-size: .92rem; font-weight: 650; white-space: nowrap; }
.cxe tr[data-state="error"] { background: var(--error-soft); }
.cxe .cxe-allowed { font-size: .8rem; color: var(--ink-soft); }
.cxe .cxe-empty { color: var(--ink-soft); }

/* Next runs */
.cxe-runs { display: grid; gap: .6rem; }
.cxe-runs-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem 1.25rem; }
.cxe-run-controls { display: flex; flex: 1 1 26rem; flex-wrap: wrap; align-items: end; justify-content: flex-end; gap: .75rem 1rem; }
.cxe-zone { flex: 1 1 15rem; max-width: 24rem; }
.cxe-zone-note, .cxe-runs-status { font-size: .9rem; }
.cxe-run-list { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; counter-reset: run; }
.cxe-run { display: grid; gap: .3rem; padding: .55rem .75rem; background: var(--field); border: 1.5px solid var(--border-soft); border-radius: 8px; }
.cxe-run[data-kind="run"], .cxe-run[data-kind="moved"], .cxe-run[data-kind="repeat"] { counter-increment: run; }
.cxe-run-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .9rem; color: var(--ink); }
.cxe-run-line::before { content: counter(run) "."; min-width: 1.6rem; font-weight: 700; color: var(--ink-soft); }
.cxe-run time { display: inline-flex; flex-wrap: wrap; gap: .2rem .6rem; }
.cxe-run-date { font-weight: 650; }
.cxe-run-time { font: 700 1rem var(--font-mono); }
.cxe-run-offset, .cxe-run-rel { font-size: .85rem; color: var(--ink-soft); }
.cxe-run-rel { margin-left: auto; }
.cxe .cxe-run-note { font-size: .86rem; color: var(--ink); }
.cxe-run[data-kind="moved"], .cxe-run[data-kind="repeat"] { border: 2px solid var(--warning); background: var(--warning-soft); }
.cxe-run:is([data-kind="skipped"], [data-kind="more"]) { border-style: dashed; background: var(--bg-2); }
.cxe-rule { font-size: .85rem; }

/* Library and platforms */
.cxe-library { display: grid; gap: .5rem; }
.cxe-library ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .5rem; margin: 0; padding: 0; list-style: none; }
.cxe-library button { display: grid; gap: .25rem; width: 100%; height: 100%; padding: .55rem .75rem; text-align: left; font-weight: 500; border-width: 1.5px; border-color: var(--border-soft); }
.cxe-library button:hover { border-color: var(--line); }
.cxe-library strong { font-size: .92rem; }
.cxe-library code { font-size: .85rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.cxe-platforms { display: grid; gap: .45rem; }
.cxe-platforms ul { display: grid; gap: .35rem; margin: 0; padding-left: 1.1rem; font-size: .9rem; color: var(--ink-soft); }
.cxe-status { min-height: 1.4em; font-weight: 600; color: var(--ink) !important; }
.cxe-foot { font-size: .85rem; }

@media (max-width: 560px) {
  .cxe-input { font-size: 1rem; }
  .cxe-run-rel { margin-left: 0; }
  .cxe-run-controls { justify-content: flex-start; }
  .cxe-zone { max-width: none; }
}

/* Space the page holds for this view until it mounts (see .tool-view-placeholder in _workspace.css).
   Each height is a little under the space the view takes at that width, measured as how far the
   content below moves when the view replaces the placeholder, so nothing below it moves. Re-measure
   after changing the view's layout: node scripts/measure-tool-views.js --apply cron-expression-explainer. */
.tool-view-placeholder[data-tool="cron-expression-explainer"] { min-height: 2080px; }
@media (max-width: 896px) { .tool-view-placeholder[data-tool="cron-expression-explainer"] { min-height: 2364px; } }
@media (max-width: 560px) { .tool-view-placeholder[data-tool="cron-expression-explainer"] { min-height: 3498px; } }
@media (max-width: 520px) { .tool-view-placeholder[data-tool="cron-expression-explainer"] { min-height: 3750px; } }
