/* Dashboard and Approvals: one head row, one line of counts, then bordered lists.
   Row, item, meter and tab styles come from ui_patterns.css (loaded later); these rules
   only place them, so selectors here carry a page scope to outrank the shared ones. */

/* ---- Dashboard -------------------------------------------------------- */

.operations-home {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.operations-home .home-quick-actions > * {
  min-height: 36px;
}

/* The summary line comes first. "Needs you now" is the first list under it, and while
   it is loading or empty it shrinks to a short note at the start of the summary line. */
.home-overview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  min-width: 0;
}

.home-overview > .home-summary {
  order: 0;
  flex: 0 1 auto;
  min-width: 0;
}

.home-overview > .home-attention {
  order: 1;
  flex: 1 1 100%;
  min-width: 0;
}

.home-overview > .home-attention:is(:has([aria-busy="true"]), :has(.notification-queue-empty--compact)) {
  order: -1;
  flex: 0 1 auto;
  border: 0;
  background: transparent;
}

.home-overview > .home-attention:is(:has([aria-busy="true"]), :has(.notification-queue-empty--compact)) > .sh-box__head {
  display: none;
}

.home-attention-list > .sh-row + .sh-row {
  border-top: 1px solid var(--line);
}

.home-attention-list > .sh-row:last-child {
  border-bottom-right-radius: 7px;
  border-bottom-left-radius: 7px;
}

.home-attention-list[aria-busy="true"] > .sh-box__empty {
  padding: 0;
  font-size: 0.875rem;
}

.operations-home .home-attention-list > .notification-queue-empty--compact {
  gap: 6px;
  margin: 0;
  padding: 0;
  color: var(--success);
  font-size: 0.875rem;
}

.operations-home .home-attention-list > .notification-queue-empty--compact > .material-symbols-outlined {
  color: inherit;
  font-size: 18px;
}

.operations-home .home-attention-list > .notification-queue-empty--compact > strong {
  color: inherit;
  font-size: inherit;
  font-weight: 700;
}

.operations-home .home-attention-dismiss {
  position: relative;
  z-index: 1;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  transform: none !important;
}

.operations-home .home-attention-dismiss:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.operations-home .home-attention-dismiss .material-symbols-outlined {
  font-size: 18px;
}

.operations-home .overview-main.home-lists {
  gap: 16px;
}

.operations-home .content-cols-2.home-cols {
  gap: 16px;
}

/* Rows that carry an approval meter need room; below that the lists stack. */
.operations-home .home-lists {
  container-type: inline-size;
}

@container (max-width: 1080px) {
  .operations-home .content-cols-2.home-cols {
    grid-template-columns: minmax(0, 1fr);
  }
}

.operations-home .home-box {
  container-type: inline-size;
}

/* Open-list links in box heads are buttons (they keep their data-jump-tab hook). */
.operations-home button.sh-box__link,
.operations-home button.sh-box__link:hover {
  min-height: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: none !important;
}

/* Rows that open a dialog use a button as their stretched title link. */
.operations-home button.sh-row__link,
.operations-home button.sh-row__link:hover,
.operations-home button.sh-row__link:active {
  display: flex;
  padding: 0;
  border: 0;
  border-radius: 0 !important;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  letter-spacing: 0;
  text-align: left;
  transform: none !important;
}

.operations-home .home-row-flag {
  color: var(--ink);
  font-weight: 700;
}

/* A box narrower than a row with a meter puts the meter on its own line under the text. */
@container (max-width: 620px) {
  .operations-home .home-box .sh-row:has(> .sh-meter) {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 6px 12px;
  }

  .operations-home .home-box .sh-row:has(> .sh-meter) > .sh-row__icon {
    grid-column: 1;
    grid-row: 1;
  }

  .operations-home .home-box .sh-row:has(> .sh-meter) > :is(.sh-row__text, .sh-row__link) {
    grid-column: 2;
    grid-row: 1;
  }

  .operations-home .home-box .sh-row:has(> .sh-meter) > .sh-row__amount {
    grid-column: 3;
    grid-row: 1;
  }

  .operations-home .home-box .sh-row:has(> .sh-meter) > .sh-row__go {
    grid-column: 4;
    grid-row: 1;
  }

  .operations-home .home-box .sh-row > .sh-meter {
    grid-column: 2 / -1;
    grid-row: 2;
  }
}

/* ---- Approvals -------------------------------------------------------- */

.approval-center {
  display: grid;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.approval-pane {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.approval-pane[hidden] {
  display: none;
}

/* Title, meter and amount share the first line's centre. */
.approval-entry .sh-item__line {
  align-items: flex-start;
}

.approval-entry .sh-item__line > :is(.sh-row__icon, .sh-row__amount) {
  margin-top: 1px;
  line-height: 20px;
}

.approval-entry .sh-item__line > .sh-meter {
  margin-top: 1px;
}

.approval-entry .sh-row__title {
  line-height: 20px;
}

.approval-entry .sh-item__body a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.approval-entry .sh-item__body a:hover {
  color: var(--color-link-hover);
}

/* Off the Approvals page the rows sit directly in the page's own list or the
   emergency disclosure, so they draw their own hairlines there. */
.emergency-approval-menu > .approval-entry + .approval-entry {
  border-top: 1px solid var(--line);
}

.approval-entry[data-row-selected="true"] {
  background: var(--current-wash);
  box-shadow: inset 3px 0 0 var(--color-brand-accent);
}

.approval-entry:focus {
  outline: none;
}

.approval-entry:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

/* The decision: a one-line note that grows, one filled Approve, a quiet Deny. */
.approval-entry .approval-entry__decide > textarea {
  flex: 1 1 240px;
  box-sizing: border-box;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  max-height: 10rem;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 0.875rem;
  line-height: 20px;
  resize: none;
  field-sizing: content;
}

.approval-entry .approval-entry__decide > button {
  min-width: 84px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
}

.approval-entry .approval-entry__decide > .approve-button,
.approval-entry .approval-entry__decide > .approve-button:hover {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-ink);
  filter: none;
}

.approval-entry .approval-entry__decide > .approve-button:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

.approval-entry .approval-entry__decide > .deny-button {
  border: 1px solid var(--control-border);
  background: var(--surface);
  color: var(--ink);
}

.approval-entry .approval-entry__decide > .deny-button:hover {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--control-border));
  background: var(--danger-soft);
  color: var(--danger);
}

.approval-entry .sh-item__line > .approval-entry__decide {
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 0;
}

.approval-entry .form-message:empty {
  display: none;
}

/* Phone widths and any touch screen keep 44px decision targets. */
@media (max-width: 900px), (pointer: coarse) {
  .approval-entry .approval-entry__decide > textarea {
    height: 44px;
    min-height: 44px;
    padding: 11px 12px;
    font-size: 16px;
  }

  .approval-entry .approval-entry__decide > button {
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  .approval-entry .approval-entry__decide > textarea {
    flex-basis: 100%;
  }

  .approval-entry .sh-item__actions.approval-entry__decide > button {
    flex: 1 1 0;
  }

  .approval-entry .sh-item__line > .approval-entry__decide {
    grid-column: 2 / -1;
    grid-row: 2;
    margin-left: 0;
  }
}
