/* The apps, drawn where a room's messages would be.
   Everything below reads in this app's own tokens, so a page here sits in the
   same light and the same dark as every room beside it. */

.app {
  display: flex;
  flex-direction: column;
  gap: var(--block-space, 1em);
}

.app__head h2 {
  margin: 0;
}

.app__note {
  color: var(--color-text);
  margin: 0.4em 0 0;
  opacity: 0.7;
}

/* A word meant to be typed back into a room, said in the shape it is typed. */
.app__literal {
  background-color: var(--color-message-bg);
  border-radius: 0.4em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.1em 0.4em;
}

.app__eyebrow {
  border-block-end: 1px solid var(--color-border-dark);
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin: 0.5em 0 0;
  opacity: 0.6;
  padding-block-end: 0.5em;
  text-transform: uppercase;
}

.app__empty {
  margin: 0;
  opacity: 0.6;
}

/* ------------------------------------------------------------- The launcher */

.app__list {
  display: grid;
  gap: 0.75em;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* One app, one card: the name first because that is what is being chosen, the
   sentence under it because that is what settles the choice. */
.app__card {
  border-radius: 0.8em;
  border: 1px solid var(--color-border-darker);
  color: var(--color-text);
  display: grid;
  gap: 0.25em;
  padding: 0.9em 1.1em;
  text-decoration: none;

  @media (any-hover: hover) {
    &:where(:not(:active):hover) {
      background-color: var(--color-message-bg);
    }
  }
}

.app__card-name {
  font-weight: 600;
}

.app__card-blurb {
  font-size: 0.875em;
  opacity: 0.7;
}

/* ------------------------------------------------------------------ Ledgers */

/* A list read as a ledger: what happened on the left, what it amounts to on
   the right, a hairline between the lines and none around them. */
.app__rows {
  display: grid;
  list-style: none;
  margin: 0;
  padding: 0;
}

.app__row {
  align-items: baseline;
  border-block-end: 1px solid var(--color-border-dark);
  display: flex;
  gap: 1em;
  justify-content: space-between;
  padding: 0.6em 0;

  &:last-child {
    border-block-end: 0;
  }
}

.app__row-main {
  min-inline-size: 0;
}

.app__stamps {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
  opacity: 0.7;
  text-align: end;
}

.app__facts {
  display: grid;
  gap: 0.5em 1.2em;
  grid-template-columns: auto 1fr;
  margin: 0;
}

.app__facts dt {
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 0.6;
  padding-block-start: 0.2em;
  text-transform: uppercase;
}

.app__facts dd {
  margin: 0;
}

/* -------------------------------------------------------------------- Leave */

.app__form {
  display: flex;
  flex-direction: column;
  gap: 0.75em;
}

.app__fields {
  display: grid;
  gap: 0.75em;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12em), 1fr));
}

.app__field {
  display: grid;
  gap: 0.3em;
}

.app__label {
  font-size: 0.8em;
  font-weight: 600;
  opacity: 0.7;
}

.app__errors {
  background-color: var(--color-message-bg);
  border-inline-start: 3px solid var(--color-negative);
  border-radius: 0.5em;
  padding: 0.75em 1em;

  & p, & ul {
    margin: 0;
  }

  & ul {
    padding-inline-start: 1.2em;
  }
}

/* A standing is a tint, never a block: a wash of its own hue behind the word
   and no border to make a button of it. */
.leave-status,
.stage-badge {
  border-radius: 0.4em;
  display: inline-block;
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.2em 0.5em;
  text-transform: uppercase;
  white-space: nowrap;
}

.leave-status {
  background-color: var(--color-message-bg);
  opacity: 0.8;
}

.leave-status--approved {
  background-color: oklch(var(--lch-green) / 0.15);
  color: var(--color-positive);
  opacity: 1;
}

.leave-status--rejected {
  background-color: oklch(var(--lch-red) / 0.15);
  color: var(--color-negative);
  opacity: 1;
}

.app__press {
  align-self: start;
}

/* --------------------------------------------------------------- Attendance */

.app__today {
  background-color: var(--color-selected);
  border-radius: 0.5em;
  margin: 0;
  padding: 0.5em 0.8em;
}

.app__months {
  align-items: center;
  display: flex;
  gap: 0.75em;
  justify-content: space-between;
}

.app__month-name {
  font-weight: 600;
}

/* -------------------------------------------------------------------- Cards */

.app__account {
  border-block-end: 2px solid var(--color-text);
  font-size: 1em;
  margin: 0.5em 0 0;
  padding-block-end: 0.4em;
}

.app__board {
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin: 0.25em 0 0;
  opacity: 0.6;
  text-transform: uppercase;
}

/* min() rather than a bare width so a tile can never be wider than the column
   it was given — below that the grid falls to one and the tile shrinks with it
   instead of pushing the page sideways. */
.card-grid {
  display: grid;
  gap: 0.75em;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14em), 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.card-tile {
  background-color: var(--color-bg);
  border-radius: 0.8em;
  border: 1px solid var(--color-border-darker);
  display: grid;
  gap: 0.5em;
  padding: 0.8em 0.9em;
}

.card-tile__title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.card-tile__meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.card-tile__who {
  font-size: 0.8em;
  opacity: 0.7;
  overflow-wrap: anywhere;
}

.card-tile__who--none {
  font-style: italic;
}

.card-tile__when {
  font-size: 0.75em;
  opacity: 0.6;
}

/* Three of the stages are fixed words and wear their own hue; anything else is
   the name of a column somebody made up, and wears the neutral one. */
.stage-badge--inbox {
  background-color: oklch(var(--lch-orange) / 0.18);
  color: var(--color-alert);
}

.stage-badge--column {
  background-color: var(--color-selected);
}

.stage-badge--later {
  background-color: var(--color-message-bg);
  opacity: 0.8;
}

.stage-badge--done {
  background-color: oklch(var(--lch-green) / 0.15);
  color: var(--color-positive);
}

@media (max-width: 60ch) {
  /* One tile to a line on a phone: a second column at this width would give a
     card title four words a line. */
  .card-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
