/* Dashboard (dashboard.js). The page header, cards, stats and states come from ui/ui.css; this file lays the
   sections out and styles what only the Dashboard has: attention rows, environment cards, the facts line,
   the activity list and the share row. Cards have a border and no drop shadow. */
.dashboard { padding: 0 0 8px; }
.dash-body { display: flex; flex-direction: column; gap: 24px; }
.dash-body > .ui-state { margin: 0; }

/* ── Needs your attention ── */
.dash-attention.quiet { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); }
.dash-attention .ui-card-head { margin-bottom: 12px; }
.dash-count-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 8px; padding: 0 8px; border-radius: 999px; background: #991B1B; color: #fff; font-size: 12px; font-weight: 600; line-height: 1; vertical-align: 2px; }
.dash-attn-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); overflow: hidden; }
.dash-attn { display: flex; align-items: center; gap: 12px 16px; padding: 16px 16px; border-left: 4px solid var(--tone, var(--border-strong)); }
.dash-attn + .dash-attn { border-top: 1px solid var(--border); }
.dash-attn.tone-bad { --tone: #DC2626; --tone-bg: #FEF2F2; --tone-fg: #B91C1C; }
.dash-attn.tone-warn { --tone: var(--warn-icon, #A16207); --tone-bg: var(--warn-bg, #FFFBEB); --tone-fg: var(--warn-text, #7A5900); }
.dash-attn.tone-approval { --tone: #9333EA; --tone-bg: #F3E8FF; --tone-fg: #6B21A8; }
.dash-attn.tone-info { --tone: #2563EB; --tone-bg: #EFF6FF; --tone-fg: #1D4ED8; }
.dash-attn-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 12px; background: var(--tone-bg); color: var(--tone-fg); }
.dash-attn-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.dash-attn-title { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.dash-attn-detail { font-size: 13px; line-height: 20px; color: var(--secondary); overflow-wrap: anywhere; }
.dash-attn-since { color: var(--muted); white-space: nowrap; }
.dash-attn-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: none; }
.dash-attn-actions button, .dash-env-actions button, .dash-table-actions button { min-height: var(--control-h-compact); height: var(--control-h-compact); padding: 0 12px; font-size: 13px; }

/* ── Environments ── */
.dash-counts { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-count { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--secondary); font-size: 13px; font-weight: 500; }
.dash-count strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-count:hover { border-color: #DD8A4E; background: #FFF8F2; }
#dashboard-environments .ui-card-actions { gap: 8px 16px; }
.dash-env-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 16px; }
.dash-env { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card); }
.dash-env.status-attention { border-color: #FECACA; }
.dash-env-head { display: flex; align-items: flex-start; gap: 12px; }
.dash-env-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; }
.dash-env-tile { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 12px; background: var(--subtle); color: #667085; }
.dash-env.status-running .dash-env-tile { background: #ECFDF3; color: #067647; border-color: #ABEFC6; }
.dash-env.status-progress .dash-env-tile { background: #EFF8FF; color: #175CD3; border-color: #B2DDFF; }
.dash-env.status-approval .dash-env-tile { background: #F4F3FF; color: #6941C6; border-color: #D9D6FE; }
.dash-env.status-attention .dash-env-tile { background: #FEF3F2; color: #B42318; border-color: #FECDCA; }
.dash-env-titles { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 1 1 auto; min-width: 0; }
.dash-env-name { display: inline; min-height: 0; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--text); font-size: 14px; line-height: 20px; font-weight: 600; text-align: left; overflow-wrap: anywhere; }
.dash-env-name:hover { color: var(--active-text); text-decoration: underline; }
.dash-env-workspace { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; line-height: 20px; color: var(--secondary); }
.dash-env-facts { display: flex; flex-wrap: wrap; gap: 2px 0; margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 20px; color: var(--secondary); }
.dash-env-facts li:not(:last-child)::after { content: "·" / ""; margin: 0 8px; color: #A8A29E; }
.dash-env-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.dash-env-actions .dash-action-lifecycle:not(.accent) { margin-left: auto; }
@media (max-width: 480px) {
  .dash-env-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-env-actions > .accent { grid-column: 1 / -1; }
  .dash-env-actions .dash-action-lifecycle:not(.accent) { margin-left: 0; }
}
.dash-progress { display: flex; flex-direction: column; gap: 8px; padding: 12px 12px; border-radius: 8px; background: #EFF6FF; }
.dash-progress.failed { background: var(--warn-bg, #FFFBEB); }
.dash-progress-step { font-size: 13px; line-height: 20px; font-weight: 600; color: #1E3A8A; }
.dash-progress.failed .dash-progress-step { color: var(--warn-text, #7A5900); }
.dash-progress-meter { display: block; height: 6px; border-radius: 3px; background: #BFDBFE; overflow: hidden; }
.dash-progress-meter > span { display: block; height: 100%; border-radius: 3px; background: #1D4ED8; }
.dash-progress.failed .dash-progress-meter { background: #FDE68A; }
.dash-progress.failed .dash-progress-meter > span { background: var(--warn-icon, #A16207); }
.dash-progress-note { font-size: 12px; line-height: 16px; color: #1E40AF; }
.dash-progress.failed .dash-progress-note { color: var(--warn-text, #7A5900); }
.ui-card-body > .dash-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin: 16px 0 0; font-size: 13px; line-height: 20px; color: var(--secondary); }
.dash-facts svg { flex: none; color: var(--muted); }
.dash-fact:not(:last-child)::after { content: "·" / ""; margin-left: 8px; color: #A8A29E; }
.dash-fact-label { color: var(--muted); }
.skeleton-env { gap: 16px; min-height: 150px; pointer-events: none; }
/* Table, used above eight environments on wide screens */
.dash-table-wrap { border: 1px solid var(--border); border-radius: var(--radius-card); overflow: auto; background: var(--card); }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table thead th { height: 44px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--page); color: var(--muted); font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap; }
.dash-table tbody td, .dash-table tbody th { height: 56px; padding: 8px 16px; border-bottom: 1px solid var(--border); color: var(--secondary); font-weight: 400; text-align: left; vertical-align: middle; }
.dash-table tbody tr:last-child > * { border-bottom: 0; }
.dash-table tbody tr:hover { background: var(--page); }
.dash-table-env { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.dash-table-env .dash-env-name { font-size: 13px; }
.dash-table-env .dash-env-workspace { font-size: 12px; }
.dash-table-step { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.dash-table th.tools, .dash-table td.tools { text-align: right; }
.dash-table-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.dash-table-actions .ui-icon-button { width: var(--control-h-compact); padding: 0; border: 1px solid var(--field-border); background: var(--card); color: var(--secondary); }
.dash-table-actions .ui-icon-button:hover { background: var(--subtle); }
.dash-table-actions .ui-icon-button.accent { border-color: var(--action); color: var(--action); }
.dash-table-actions .ui-icon-button.accent:hover, .dash-table-actions .ui-icon-button.accent:focus-visible { border-color: var(--action-hover); background: var(--active); color: var(--action-hover); }
.dash-table-actions .dash-action-lifecycle { min-width: 96px; }
@media (max-width: 1280px) { .dash-table .wider { display: none; } }
@media (max-width: 1000px) { .dash-table .wide { display: none; } }

/* ── Costs this month and recent activity ── */
.dash-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.dash-budget-bar { height: 16px; margin: 24px 0 12px; }
.dash-budget-bar .limit-marker { top: -4px; bottom: -4px; }
.dash-budget-legend { gap: 4px 16px; font-size: 12px; color: var(--secondary); }
.ui-card-body > .dash-cost-note { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0 0; padding: 12px 12px; border: 1px solid var(--warn-border, #FDE68A); border-radius: 8px; background: var(--warn-bg, #FFFBEB); color: var(--warn-text, #7A5900); font-size: 13px; line-height: 20px; }
.dash-cost-note.bad { border-color: #FECACA; background: #FEF2F2; color: #991B1B; }
.dash-cost-note svg { flex: none; margin-top: 2px; }
.ui-card-body > .dash-cost-basis, .ui-card-body > .dash-updated { margin: 16px 0 0; font-size: 12px; line-height: 16px; color: var(--muted); }
.ui-card-body > .dash-cost-basis + .dash-updated { margin-top: 4px; }
.dash-activity { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.dash-activity li { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 0; }
.dash-activity li + li { border-top: 1px solid var(--border); }
.dash-activity-icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--subtle); color: var(--secondary); }
.dash-activity-text { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 20px; color: var(--text); overflow-wrap: anywhere; }
.dash-activity-time { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ── Share this workspace ── */
.ui-card-body > .dash-share-lede { max-width: 760px; margin: 0 0 16px; font-size: 14px; line-height: 20px; color: var(--secondary); }
.dash-share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dash-share-link { display: flex; align-items: center; flex: 1 1 320px; min-width: 0; min-height: var(--control-h); padding: 8px 12px; border: 1px solid var(--field-border); border-radius: var(--radius-control); background: var(--page); font-family: var(--mono); font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
.dash-share-row .secondary { min-height: var(--control-h); height: var(--control-h); padding: 0 16px; border-radius: var(--radius-control); font-size: 14px; text-decoration: none; }
a.dash-share-open:hover { text-decoration: none; }
.ui-card-body > .dash-share-status { margin: 12px 0 0; font-size: 13px; line-height: 20px; color: var(--secondary); }
.dash-share-status > svg { margin-right: 8px; color: var(--muted); vertical-align: -3px; }
.dash-share-status strong { color: var(--text); font-weight: 600; }
.dash-share-status .text-button { min-height: 24px; margin-left: 8px; padding: 0; vertical-align: baseline; }
.dash-share-status .sk-line { display: inline-block; width: 220px; vertical-align: middle; }

/* ── Welcome (no environments yet) ── */
.dash-welcome .ui-state { padding: 48px 24px; }
.dash-welcome-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: 100%; max-width: 880px; margin: 24px 0 0; padding: 24px 0 0; border-top: 1px solid var(--border); list-style: none; text-align: left; }
.dash-welcome-steps li { display: flex; align-items: flex-start; gap: 12px; }
.dash-welcome-icon { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--subtle); color: var(--secondary); }
.dash-welcome-steps strong { display: block; font-size: 14px; line-height: 20px; color: var(--text); }
.dash-welcome-steps span span, .dash-welcome-steps div span { display: block; font-size: 13px; line-height: 20px; color: var(--muted); }

@media (max-width: 1000px) { .dash-columns { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .dash-body { gap: 24px; }
  .dash-attn { flex-wrap: wrap; align-items: flex-start; }
  .dash-attn-text { flex: 1 1 0; }
  .dash-attn-actions { flex: 1 1 100%; justify-content: flex-start; padding-left: 48px; }
  .dash-welcome-steps { grid-template-columns: minmax(0, 1fr); }
  .dash-share-row .secondary { flex: 1 1 auto; }
  .dash-activity li { align-items: flex-start; }
  .dash-activity-time { padding-top: 4px; }
}

/* Team card (workspace administrator) */
.ui-card-body > p.dash-team-line, .dash-team-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; line-height: 20px; color: var(--secondary); }
.dash-team-line svg { color: var(--secondary); }
.dash-team-line strong { color: var(--text); font-weight: 600; }
.dash-team-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-team-actions button { min-height: var(--control-h-compact); height: var(--control-h-compact); padding: 0 12px; font-size: 13px; }

/* Environment card: name and workspace with the status on the right, a row of label and value facts between two
   hairlines, then the way in on the left and what it costs on the right. */
.dash-env { gap: 16px; padding: 20px; }
.dash-env-head { align-items: flex-start; }
.dash-env-head > .badge { flex: none; margin-left: auto; }
.dash-env-titles { gap: 4px; }
.dash-env-name { font-size: 16px; line-height: 24px; }
.dash-env-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin: 0; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.dash-env-facts li:not(:last-child)::after { content: none; }
.dash-env-fact { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dash-env-fact dt { display: flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--secondary); }
.dash-env-fact dt svg { flex: none; color: var(--muted); }
.dash-env-fact dd { margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.dash-env-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; }
.dash-env-foot .dash-env-actions { margin: 0; padding: 0; border: 0; flex-wrap: wrap; }
.dash-env-actions .dash-action-share, .dash-env-actions .dash-action-lifecycle:not(.accent) { margin-left: 0; }
.dash-env-actions .icon-button { display: inline-grid; place-items: center; width: var(--control-h-compact); height: var(--control-h-compact); min-height: var(--control-h-compact); padding: 0; border: 1px solid var(--field-border); border-radius: 8px; background: var(--card); color: var(--text); }
.dash-env-actions .icon-button:hover { background: var(--subtle); }
.dash-env-actions .icon-button svg { width: 16px; height: 16px; }
.dash-env-cost { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.dash-env-cost strong { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.dash-env-cost span { font-size: 12px; line-height: 16px; color: var(--secondary); }
@media (max-width: 720px) {
  .dash-env-foot .dash-env-actions { display: flex; }
  .dash-env-actions > .accent { grid-column: auto; }
}
/* Progress on a card: neutral panel, blue only in the meter */
.dash-progress { background: var(--subtle); }
.dash-progress-step { color: var(--text); }
.dash-progress-note { color: var(--secondary); }
.dash-progress-meter { background: #E7E5E4; }
/* The middle band of every card has the same height, whether it holds the facts or the setup progress */
.dash-env-facts, .dash-env > .dash-progress { min-height: 124px; }
.dash-env > .dash-progress { justify-content: center; gap: 8px; margin: 0; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.dash-env > .dash-progress .dash-progress-step { font-size: 14px; line-height: 20px; }
.dash-env > .dash-progress .dash-progress-note { font-size: 12px; line-height: 16px; }
/* A fact: icon in a soft tile, the value first and strong, the label quiet under it */
.dash-env-facts { gap: 16px 24px; align-content: center; }
.dash-env-fact { display: grid; grid-template-columns: 36px minmax(0, 1fr); grid-template-areas: "icon value" "icon label"; column-gap: 12px; row-gap: 0; align-items: center; }
.dash-env-fact-icon { grid-area: icon; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--subtle); color: var(--secondary); }
.dash-env-fact dd { grid-area: value; align-self: end; font-size: 14px; line-height: 20px; font-weight: 600; }
.dash-env-fact dt { grid-area: label; align-self: start; display: block; font-size: 12px; line-height: 16px; font-weight: 400; color: var(--secondary); }
/* Label on top, value under it */
.dash-env-fact { grid-template-areas: "icon label" "icon value"; }
.dash-env-fact dt { align-self: end; }
.dash-env-fact dd { align-self: start; }
