/* Card 761 + 762, reworked in card 835: the Valley screen (web/src/valley.ts). The Console's own tokens and type ("Trace"): the valley is a
   quiet backdrop (the sky follows the time of day in Luxembourg); the zones, the list and the panel carry the facts. State is always an
   icon plus a word: ember for working, amber for waiting on a person, red for trouble (console.css's rule). */
.cx-valley { padding: 20px 24px 40px; max-width: none; }
.vl { font-family: var(--cx-font); color: var(--cx-text); overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.vl h1 { margin: 0; font: 600 20px/1.3 var(--cx-font); }
.vl h2 { margin: 0; font: 600 14px/1.3 var(--cx-font); }
.vl-h3 { margin: 18px 0 8px; font: 600 13px/1.3 var(--cx-font); }
.vl-muted { color: var(--cx-text-muted); }
.vl a { color: var(--cx-text); text-underline-offset: 3px; text-decoration-color: var(--cx-line-strong); }
.vl a:hover { text-decoration-color: currentColor; }
.vl ::selection { background: var(--cx-sel); color: var(--cx-white); }
.vl .sr, .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.vl :focus-visible { outline: 2px solid var(--cx-focus); outline-offset: 2px; }
.vl-ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* the head: title and live line, the View button */
.vl-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.vl-sub { margin: 4px 0 0; color: var(--cx-text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.vl .vl-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--cx-line-btn);
  background: transparent; color: var(--cx-text); font: 500 13px/1 var(--cx-font); cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s; }
.vl .vl-btn:hover { background: var(--cx-raised); border-color: var(--cx-line-strong); }
.vl .vl-btn[aria-expanded="true"] { background: var(--cx-raised); border-color: var(--cx-line-strong); }
.vl .vl-btn:disabled { opacity: .55; cursor: default; }
.vl .vl-btn[aria-busy="true"] { cursor: progress; }
.vl .vl-pri { background: var(--cx-accent); border-color: var(--cx-accent); color: var(--cx-accent-ink); }
.vl .vl-pri:hover { background: var(--cx-accent-hi); border-color: var(--cx-accent-hi); }
.vl .vl-quiet { color: var(--cx-text-2); }
.vl .vl-danger { border-color: var(--cx-danger-line); color: var(--cx-danger); }
.vl .vl-danger:hover { background: var(--cx-danger-line); border-color: var(--cx-danger); color: var(--cx-white); }
.vl .vl-link { background: none; border: 0; padding: 0; color: var(--cx-text); font: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--cx-line-strong); cursor: pointer; }

/* the View panel: plain segmented choices, kept per person */
.vl-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 20px; padding: 16px; margin: 0 0 12px;
  border: 1px solid var(--cx-line-2); border-radius: 12px; background: var(--cx-panel); }
.vl-view[hidden] { display: none; }
.vl-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.vl-fs legend { padding: 0; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--cx-text-2); }
.vl-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.vl-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.vl-seg label, .vl .vl-segb { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; font: 500 13px/1 var(--cx-font); color: var(--cx-text-2);
  background: transparent; border: 1px solid var(--cx-line-btn); border-radius: 9px; cursor: pointer; transition: background-color .15s, color .15s; }
.vl-seg input:checked + label, .vl .vl-segb[aria-pressed="true"] { background: var(--cx-active-bg); border-color: var(--cx-line-strong); color: var(--cx-active-fg); }
.vl-seg input:checked + label::before, .vl .vl-segb[aria-pressed="true"]::before { content: ""; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: currentColor; }
.vl-seg input:focus-visible + label { outline: 2px solid var(--cx-focus); outline-offset: 2px; }
.vl-seg label:hover, .vl .vl-segb:hover { color: var(--cx-text); border-color: var(--cx-line-strong); }
.vl-chk { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0; font-size: 13px; }
.vl-chk input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--cx-accent); }
.vl-saved { grid-column: 1 / -1; margin: 0; font-size: 12px; }

/* the team chips */
.vl-teams { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.vl-teams[hidden] { display: none; }
.vl-teamsl { font-size: 12px; margin-right: 4px; }
.vl .vl-chip { min-height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--cx-line-btn); background: transparent; color: var(--cx-text-muted);
  font: 500 13px/1 var(--cx-font); cursor: pointer; }
.vl .vl-chip[aria-pressed="true"] { background: var(--cx-raised); border-color: var(--cx-line-strong); color: var(--cx-text); }
.vl .vl-chip[aria-pressed="false"] { text-decoration: line-through; text-decoration-color: var(--cx-text-faint); }

/* the body: the valley and the list on the left, the panel on the right */
.vl-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 16px; align-items: start; }
.vl-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }

/* the valley: a quiet sky (the time of day in Luxembourg) and two hills behind the zones */
.vl-land { position: relative; border: 1px solid var(--cx-line-2); border-radius: 14px; overflow: hidden; isolation: isolate;
  --vl-sky1: #0a0b0d; --vl-sky2: #12141b; background: linear-gradient(180deg, var(--vl-sky1), var(--vl-sky2)); }
.vl-land[data-sky="dawn"] { --vl-sky1: #0f0f16; --vl-sky2: #1c1716; }
.vl-land[data-sky="day"] { --vl-sky1: #0d1016; --vl-sky2: #141a20; }
.vl-land[data-sky="dusk"] { --vl-sky1: #0e0d14; --vl-sky2: #1d1514; }
[data-theme=light] .vl-land { --vl-sky1: #f3f4f7; --vl-sky2: #eceef2; }
[data-theme=light] .vl-land[data-sky="day"] { --vl-sky1: #eef3f8; --vl-sky2: #f6f6f7; }
[data-theme=light] .vl-land[data-sky="dusk"], [data-theme=light] .vl-land[data-sky="dawn"] { --vl-sky1: #f6f1ee; --vl-sky2: #f6f6f7; }
.vl-hills { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 38%; z-index: -1; }
.vl-hill1 { fill: var(--cx-line-soft); }
.vl-hill2 { fill: var(--cx-line); }
.vl-zones { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; padding: 12px; }
.vl-zone { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--cx-line-2); border-radius: 12px; padding: 10px 10px 8px;
  background: color-mix(in srgb, var(--cx-panel) 90%, transparent); }
.vl-noempty .vl-zone.vl-empty { display: none; }
.vl-zone.vl-empty { opacity: .72; }
.vl-zh { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 6px; }
.vl-n { font: 600 13px/1 var(--cx-font); color: var(--cx-text-2); font-variant-numeric: tabular-nums; }
.vl-zempty { margin: 2px 4px 4px; font-size: 13px; }
.vl-zone:not(.vl-empty) .vl-zempty { display: none; }
.vl-folk { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px; }
.vl-tok { min-width: 0; }
.vl .vl-ag { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 8px;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--cx-text); text-align: left; font: inherit; cursor: pointer;
  transition: background-color .15s, border-color .15s; }
.vl .vl-ag:hover { background: var(--cx-raised); }
.vl .vl-ag[aria-pressed="true"] { background: var(--cx-active-bg); border-color: var(--cx-line-strong); }
.vl-av { position: relative; display: inline-flex; }
.vl-tk { display: grid; min-width: 0; }
.vl-tn { font-weight: 600; font-size: 13px; line-height: 1.3; }
.vl-td { color: var(--cx-text-muted); font-size: 12px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vl[data-labels="names"] .vl-td { display: none; }
.vl[data-labels="none"] .vl-tk { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.vl[data-labels="none"] .vl-folk { grid-template-columns: repeat(auto-fill, 60px); }
.vl[data-labels="none"] .vl-ag { grid-template-columns: auto; justify-items: center; }
/* working: a soft ring breathes round the character (motion says "in progress"; still when motion is off) */
.vl-z-working .vl-av::after { content: ""; position: absolute; inset: -3px; border-radius: 13px; border: 1.5px solid var(--cx-ember); opacity: .55; }
@keyframes vl-breathe { 0%, 100% { opacity: .2; transform: scale(.96); } 50% { opacity: .7; transform: scale(1.04); } }
.vl-z-working .vl-av::after { animation: vl-breathe 2.4s ease-in-out infinite; }
.vl-still .vl-z-working .vl-av::after { animation: none; opacity: .55; }
.vl-still .cr, .vl-still .cr * { animation: none !important; transition: none !important; }

/* state words: an icon and a word, coloured by meaning */
.vl-st { display: inline-flex; align-items: center; gap: 5px; font: 600 12px/1.2 var(--cx-font); color: var(--cx-text-2); white-space: nowrap; }
.vl-st-working { color: var(--cx-ember-text); }
.vl-st-needs, .vl-st-desktop { color: var(--cx-warn-text); }
.vl-st-trouble { color: var(--cx-danger); }
.vl-st-ready { color: var(--cx-text-2); }
.vl-st-resting { color: var(--cx-text-muted); }
.vl-st-off { color: var(--cx-text-faint); }
.vl-tag { display: inline-block; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--cx-line-btn); font-size: 11px; font-weight: 500; color: var(--cx-text-muted); }

/* the list */
.vl-list h2 { margin-bottom: 8px; }
.vl-scroll { overflow-x: auto; border: 1px solid var(--cx-line-2); border-radius: 12px; }
.vl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.vl-table thead th { position: sticky; top: 0; background: var(--cx-panel); text-align: left; font-weight: 600; font-size: 12px; color: var(--cx-text-muted);
  padding: 8px 10px; border-bottom: 1px solid var(--cx-line-2); white-space: nowrap; }
.vl-table td, .vl-table tbody th { padding: 8px 10px; border-bottom: 1px solid var(--cx-line); vertical-align: top; text-align: left; font-weight: 400; }
.vl-table tr:last-child td, .vl-table tr:last-child th { border-bottom: 0; }
.vl-grp th { padding: 14px 10px 6px !important; font-weight: 600 !important; font-size: 12px; color: var(--cx-text-2); background: transparent; }
.vl-grp th .vl-ic { vertical-align: -3px; margin-right: 4px; }
.vl-table tr[data-vl-row] { cursor: pointer; }
.vl-table tr[data-vl-row]:hover { background: var(--cx-card-bg); }
.vl-table tr.vl-sel { background: var(--cx-active-bg); }
.vl .vl-rowb { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0; border: 0; background: none; color: var(--cx-text); font: 600 13px/1.3 var(--cx-font);
  text-align: left; cursor: pointer; }
.vl .vl-rowb .cx-avatar { flex: none; }
.vl .vl-rowb > span:last-child { white-space: nowrap; }
.vl-table tbody th { min-width: 180px; }
.vl-table td:first-of-type { white-space: nowrap; }
.vl-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vl-doing { min-width: 180px; max-width: 320px; }
.vl-res { min-width: 160px; max-width: 300px; }
.vl-res .vl-muted, .vl-doing .vl-muted { overflow-wrap: anywhere; }
.vl[data-density="compact"] .vl-table td, .vl[data-density="compact"] .vl-table tbody th { padding: 4px 10px; }
.vl[data-density="compact"] .vl-rowb .cx-avatar { width: 24px; height: 24px; border-radius: 7px; font-size: 10px; }
.vl[data-density="compact"] .vl-res .vl-muted { display: none; }
.vl[data-density="compact"] .vl-ag { min-height: 40px; padding: 4px 6px; }
.vl[data-density="compact"] .vl-av .cx-avatar { width: 32px; height: 32px; border-radius: 9px; }
.vl[data-density="compact"] .vl-z-working .vl-av::after { border-radius: 11px; }
.vl[data-density="compact"] .vl-folk { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.vl[data-layout="map"] .vl-list, .vl[data-layout="list"] .vl-land { display: none; }

/* the panel: the selected agent, or what the zones mean */
.vl-panel { position: sticky; top: 0; max-height: calc(100vh - 32px); overflow-y: auto; border: 1px solid var(--cx-line-2); border-radius: 14px; padding: 16px;
  background: var(--cx-panel); font-size: 13px; }
.vl-panel h2 { font-size: 16px; margin-bottom: 4px; }
.vl-panel p { margin: 0 0 8px; }
.vl-ph { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; margin-bottom: 12px; }
.vl-why { margin: 6px 0 4px !important; }
.vl .vl-x { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: none;
  color: var(--cx-text-muted); cursor: pointer; }
.vl .vl-x:hover { background: var(--cx-raised); color: var(--cx-text); }
.vl-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 12px; margin: 0; }
.vl-dl dt { color: var(--cx-text-muted); }
.vl-dl dd { margin: 0; min-width: 0; }
.vl-quote { color: var(--cx-text-2); }
.vl-cards, .vl-runs { margin: 4px 0 0; padding-left: 18px; }
.vl-cards li, .vl-runs li { margin-bottom: 6px; }
.vl-rst { font-weight: 600; }
.vl-rst-failed, .vl-rst-timeout, .vl-rst-lost, .vl-rst-quota { color: var(--cx-danger); }
.vl-rst-running { color: var(--cx-ember-text); }
.vl-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
[data-vl-card] { margin-top: 16px; }
[data-vl-head]:empty + [data-vl-acts]:empty ~ [data-vl-card] { margin-top: 0; }
.vl-confirm { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--cx-danger-line); border-radius: 10px; }
.vl-qw { margin-top: 14px; }
.vl-qw .vl-link { display: inline-block; margin-top: 6px; font-size: 12px; }
.vl-more { margin-top: 14px; }
.vl-more summary { cursor: pointer; color: var(--cx-text-2); margin-bottom: 8px; }
.vl-legend { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 10px; }
.vl-legend b { font-variant-numeric: tabular-nums; }
.vl-decs { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.vl-dec { border: 1px solid var(--cx-warn-line); border-radius: 10px; padding: 8px 10px; background: var(--cx-warn-card); }
.vl-dec p { margin: 0 0 6px; }
.vl-decrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.vl-decrow[hidden] { display: none; }
.vl-decrow input { flex: 1 1 160px; min-height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--cx-line-btn); background: var(--cx-field); color: var(--cx-text); font: inherit; }
.vl-msg { margin: 8px 0 0 !important; }
.vl-msg:empty { display: none; }

/* what happened, and a new work item */
.vl-chron { border: 1px solid var(--cx-line-2); border-radius: 12px; padding: 0 14px; }
.vl-chron summary { display: flex; align-items: baseline; gap: 10px; padding: 12px 0; cursor: pointer; list-style-position: inside; }
.vl-chron summary h2 { display: inline; }
.vl-chron summary .vl-muted { font-size: 12px; }
.vl-events { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.vl-ev { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; }
.vl-ev time { color: var(--cx-text-muted); font-variant-numeric: tabular-nums; }
.vl-ev-run-ended a, .vl-ev-run-started a { color: var(--cx-text-2); }
.vl-quest { margin: 8px 0 14px; display: grid; gap: 6px; font-size: 13px; }
.vl-quest[hidden] { display: none; }
.vl-quest-row { display: flex; flex-wrap: wrap; gap: 6px; }
.vl-quest input, .vl-quest select { min-height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--cx-line-btn); background: var(--cx-field); color: var(--cx-text); font: inherit; }
.vl-quest input { flex: 1 1 220px; }

/* narrower: one column; the panel comes right after the valley when an agent is selected */
@media (max-width: 1100px) {
  .vl-body { display: flex; flex-direction: column; }
  .vl-main { display: contents; }
  .vl-land { order: 1; } .vl-panel { order: 2; position: static; max-height: none; } .vl-list { order: 3; } .vl-chron { order: 4; }
  .vl-body > *, .vl-main > * { width: 100%; min-width: 0; box-sizing: border-box; }
  .vl:not(.vl-has-sel) .vl-panel { display: none; }
}
@media (max-width: 640px) {
  .cx-valley { padding: 14px 16px 32px; }
  .vl-zones { padding: 8px; }
  .vl-zone { flex: 1 1 100% !important; }
  .vl-folk { grid-template-columns: minmax(0, 1fr); }
  .vl-ag { min-height: 48px; }
  .vl-ev { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .vl-dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .vl-dl dd { margin-bottom: 8px; }
  /* the agent list: each row becomes a small card (name and state, then what it is doing and its result, then today and the last run);
     no sideways scrolling inside a box on a phone */
  .vl-scroll { overflow: visible; border: 0; border-radius: 0; }
  .vl-table, .vl-table tbody { display: block; }
  .vl-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .vl-table tr.vl-grp { display: block; }
  .vl-table tr.vl-grp th { display: block; padding: 14px 2px 6px; border: 0; background: transparent; }
  .vl-table tr[data-vl-row] { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 4px 12px; padding: 10px 12px; margin-bottom: 8px;
    border: 1px solid var(--cx-line-2); border-radius: 12px; }
  .vl-table tr[data-vl-row] > th, .vl-table tr[data-vl-row] > td { display: block; min-width: 0; padding: 0; border: 0; }
  .vl-table tr[data-vl-row] > td:nth-of-type(1) { text-align: right; white-space: nowrap; padding-top: 6px; }
  .vl-table tr[data-vl-row] > td:nth-of-type(2), .vl-table tr[data-vl-row] > td:nth-of-type(3) { grid-column: 1 / -1; }
  .vl-table tr[data-vl-row] > td:nth-of-type(4) { display: none; }
  .vl-table tr[data-vl-row] > td:nth-of-type(5) { text-align: left; font-size: 12px; color: var(--cx-text-muted); }
  .vl-table tr[data-vl-row] > td:nth-of-type(6) { text-align: right; font-size: 12px; color: var(--cx-text-muted); }
  .vl-table tr[data-vl-row] > td:nth-of-type(5)::before { content: "Today "; }
  .vl-table tr[data-vl-row] > td:nth-of-type(6)::before { content: "Last run "; }
}
@media (prefers-reduced-motion: reduce) { .vl-ag, .vl-btn { transition: none; } }
