/* What is Orkestrator's own. The look of the page comes from `ekkel/ekkel.css`, loaded before this. */

/* ---- page ------------------------------------------------------------------------------- */

h2.day { position: sticky; top: var(--top-height, 3rem); background: var(--bg); padding: .5rem 0; z-index: 1; color: var(--fg); text-transform: none; letter-spacing: 0; font-size: 1rem; }
h2.day .muted { font-weight: 400; margin-left: .5rem; }
/* Date inputs, each with its own remove button tight against it. */
.dates { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.dates > .date { display: inline-flex; align-items: center; }
.dates > .date > button { padding-inline: .25rem; }

/* ---- names: tags in front, since labels are not unique ------------------------------------ */

.name { display: inline-flex; align-items: baseline; gap: .35rem; flex-wrap: wrap; }
.name .label { font-weight: 500; }
/* A state's name is one token in code; its scope is a tag that the dot and the local part run
   on from without a gap, so the eye reads a scoped name and a selection picks up the whole. */
code.state { font-weight: 500; white-space: nowrap; }
code.state .tag.scope { font-family: inherit; font-size: inherit; line-height: 1.3; margin-right: 1px; }
/* A tag is the one thing on the page with a thick coloured left edge, wherever it appears: in
   front of a name, in a filter, on the tags page. The colour is the tag's own, set inline; badges,
   segmented pickers and weekday chips look like themselves and never like this. */
.tag {
  /* Dark turns the lightness over, so a deep tag in light is a bright one in dark and they still
     differ by as much. The fill is the ink, faint, over the panel. */
  --tag-ink: light-dark(oklch(var(--tag-l) var(--tag-c) var(--tag-h)), oklch(calc(1.2 - var(--tag-l)) var(--tag-c) var(--tag-h)));
  --tag-fill: color-mix(in oklch, var(--tag-ink) 14%, var(--panel));
  display: inline-block; border-radius: 4px; padding: .05rem .5rem .05rem .4rem; font-size: .85rem;
  background: var(--tag-fill); color: var(--tag-ink); font-weight: 500;
  white-space: nowrap; line-height: 1.45;
  border: 1px solid var(--line); border-left: 4px solid var(--tag-ink);
}
/* In a picker a tag that is not picked is the pale one; a picked tag looks like a tag does
   everywhere else, so what the row of chips shows is the tags in force. */
.chip.tag { border-color: var(--line); border-left-color: var(--tag-ink); }
.chip.tag { cursor: pointer; padding-right: .55rem; }
.chip.tag:not(.on) { background: transparent; color: var(--muted); border-left-color: color-mix(in srgb, var(--tag-ink) 35%, transparent); }
.chip.tag:not(.on):hover { background: color-mix(in srgb, var(--tag-fill) 45%, transparent); }
.chip.tag.on { background: var(--tag-fill); color: var(--tag-ink); }
.chip.tag.on:hover { filter: brightness(.96); }
.chip.tag:focus-visible { outline-offset: 0; }
.chip.tag:disabled { cursor: default; opacity: 1; }
.tag.filter { cursor: pointer; }
.tag.filter:hover { filter: brightness(.94); }
.tags { display: inline-flex; gap: .3rem; }
/* The filter's own button: what is in force, and a caret saying it opens. */
/* One control to the eye: the opener, wide enough for "No filter" and a typical tag alike so it
   does not resize with each pick, and the clear drawn over its end before the chevron. */
.tagfilter { position: relative; display: inline-flex; }
.tagfilter button.open { display: inline-flex; align-items: center; justify-content: space-between; gap: .5rem; min-width: 13rem; padding-right: .5rem; }
.tagfilter button.open .icon { color: var(--muted); }
.tagfilter button.clear { position: absolute; right: 1.6rem; top: 0; bottom: 0; min-height: 0; padding: 0 .3rem; display: inline-flex; align-items: center; }
.tagfilter button.clear:hover { color: var(--fg); }
/* Room for the clear, so the summary never runs under it. */
.tagfilter:has(.clear) button.open { padding-right: 2.9rem; }
.tagfilter:has(.clear) button.open .icon { margin-right: -2.4rem; }
.popup.tagfilter-popup { padding: .7rem .8rem; gap: .6rem; max-width: min(36rem, calc(100vw - 1rem)); }
.popup.tagfilter-popup .chips { gap: .3rem; }
.popup.tagfilter-popup .row { justify-content: space-between; }

/* A user is not a tag: no chip, the name in plain text, which reads as somebody rather than as
   something a thing is filed under. */
.user { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.user + .badge { margin-left: .5rem; }
.user .name { font-weight: 500; }

/* ---- tables ----------------------------------------------------------------------------- */

tr.dim .label { font-weight: 400; }
/* The wide text columns share what is left over; the rest are as wide as what is in them. */
table.list.occurrences, .sections.occurrences { --columns: max-content 2fr max-content 1fr max-content; }
table.list.series { --columns: 2fr max-content 2fr max-content max-content; }
table.list.states { --columns: 2fr max-content max-content 1fr 1fr max-content; }
table.list.plan, .sections.plan { --columns: max-content 1fr 2fr max-content max-content; }
table.list.tags { --columns: max-content 1fr max-content max-content; }
table.list.users { --columns: max-content 1fr 1fr max-content; }
table.list.clients { --columns: max-content max-content 1fr 1fr max-content; }
td.col-name { min-width: 18rem; }
td.col-tag, td.col-tags, td.col-runs { white-space: nowrap; }
td.time .end { color: var(--muted); }
td.time .rel { display: block; color: var(--muted); font-size: .8rem; }

/* Done is fine like running is, but over: the same kind, faded. */
.badge.done { opacity: .75; }
.nag { font-size: .78rem; font-weight: 500; margin-left: .4rem; }

/* ---- definition forms --------------------------------------------------------------------- */

textarea.json { width: 100%; min-height: 12rem; white-space: pre; tab-size: 2; line-height: 1.45; }
textarea.json.tall { min-height: 30rem; }
/* Sized by its rows and cols, which follow the content. */
textarea.json.short { min-height: 0; width: auto; }
.modes { display: flex; }
.result { font-size: .85rem; font-weight: 600; }
.result:not(.error) { color: var(--fg); }
.result.error { font-weight: 400; }
/* A target is chips beside a captioned field: both sit on the field's control line. */
/* The kind on one line, whatever that kind needs indented under it. */
.target { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.target > .settings { display: flex; flex-direction: column; gap: .5rem; margin-left: 1.5rem; }
.target > .settings:empty { display: none; }

p.audit { margin: -.5rem 0 1rem; font-size: .85rem; }

.help .modal-body h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1.1rem 0 .3rem; }
.help .modal-body table { width: 100%; }
.help .modal-body td { padding: .15rem .6rem .15rem 0; vertical-align: baseline; }
/* One column width across the tables, so they read as one document rather than several. */
.help .modal-body table { table-layout: fixed; }
.help .modal-body td:first-child { width: 13rem; }
.help .modal-body code { color: var(--fg); }

/* ---- narrower windows ------------------------------------------------------------------- */

@media (min-width: 761px) and (min-height: 600px) {
  .pane h2.day { top: 0; }
}

/* An occurrence row holds a time, a name, a status and five buttons; below this the four columns
   stop fitting, and a row that scrolls sideways hides the buttons the view exists for. Each row
   becomes a block instead — when and what, then how it stands, then the actions. The width is
   where the status column starts wrapping to three lines, not where the buttons finally fall off
   the card: between those two the rows are already ragged. */
@media (max-width: 1400px) {
  .sections.occurrences, .sections.occurrences > section, .sections.occurrences > section > .card,
  .sections table.occurrences, table.occurrences, table.occurrences > tbody, table.occurrences > * > tr, table.occurrences td { display: block; }
  table.occurrences > * > tr { padding: .6rem .9rem; border-top: 1px solid var(--line); }
  table.occurrences > * > tr:first-child { border-top: none; }
  table.occurrences td { padding: .15rem 0; border: none; width: auto; }
  /* And they have to be allowed to wrap here, which is what the margin below them is for. */
  table.occurrences td.actions { white-space: normal; }
  table.occurrences td.time { white-space: normal; }
  table.occurrences td.time .rel { display: inline; margin-left: .5rem; }
  table.occurrences td.col-tags:has(.tags:empty) { display: none; }
  table.occurrences td.actions { text-align: left; margin-top: .35rem; }
  table.occurrences td.actions button { margin: 0 .35rem .35rem 0; }
}

@media (max-width: 760px) {
  td.col-name { min-width: 12rem; }
}
