/* Alt8Mail Admin Portal — dashboard visual layer.
   Scoped to .dash-page so the rest of the console keeps its existing rhythm. */

.dash-page { display: flex; flex-direction: column; }
.dash-page .page-head { align-items: flex-start; padding-bottom: 4px; }
.dash-page .page-title { font-size: 27px; letter-spacing: -.035em; }
.dash-page .page-sub { font-size: 11px; color: var(--muted); }
.dash-page .page-purpose {
  margin: 10px 0 0;
  padding: 9px 12px;
  border: 1px solid var(--line, var(--rule));
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: linear-gradient(90deg, var(--accent-soft), var(--surface));
  max-width: 760px;
}

/* ---------- tier switcher ---------- */

.dash-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 15px;
  padding: 5px;
  border: 1px solid var(--rule);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.dash-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface-2);
}
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tab {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-height: 33px;
  min-width: 0;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  flex: none;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease;
}
.dash-tab:hover { background: color-mix(in srgb, var(--surface) 75%, transparent); border-color: var(--rule); color: var(--ink); }
.dash-tab[aria-selected="true"] {
  background: var(--surface);
  border-color: var(--rule);
  box-shadow: inset 0 -2px 0 var(--accent), 0 1px 3px rgba(16, 24, 40, .07);
  color: var(--ink);
}
.dash-tab-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}
.dash-tab[aria-selected="true"] .dash-tab-icon { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.dash-tab-copy { display: flex; flex-direction: row; align-items: baseline; gap: 5px; min-width: 0; }
.dash-tier {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 600 7.5px/1.25 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.dash-tab[aria-selected="true"] .dash-tier { border-color: color-mix(in srgb, var(--accent) 30%, var(--rule)); background: var(--accent-soft); color: var(--accent-text); }
.dash-name { color: inherit; font-size: 11.5px; font-weight: 650; white-space: nowrap; letter-spacing: -.01em; }
.dash-tab-badge {
  margin-left: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font: 600 8px/1 var(--font-mono);
}
.dash-tab-badge.is-warn { background: var(--warn-soft); color: var(--warn); }
.dash-tab-badge.is-danger { background: var(--danger-soft); color: var(--danger); }
.dash-tab-badge.is-good { background: var(--good-soft); color: var(--good); }
.dash-tab-badge .icon-sm { width: 9px; height: 9px; }
.dash-switcher-hint {
  flex: 1;
  min-width: 80px;
  padding: 0 14px;
  color: var(--muted);
  font: 400 9.5px/1.35 var(--font-mono);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-default {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 4px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font: 500 8.5px/1.2 var(--font-mono);
  white-space: nowrap;
}
.dash-default .icon-sm { width: 10px; height: 10px; color: var(--accent-text); }

/* ---------- widget frame ---------- */

.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; align-items: start; }
.dash-widget {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--rule);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .035);
}
.dash-widget.is-bare { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.dash-page .widget-head { align-items: flex-start; gap: 8px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.dash-page .widget-title { align-items: baseline; gap: 8px; }
.dash-page .widget-title h2 { font-size: 13.5px; font-weight: 650; letter-spacing: -.015em; }
.dash-page .widget-note { font-size: 9.5px; color: var(--muted); }
.dash-page .widget-head .section-actions { margin-left: auto; }
.widget-host-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.widget-host-head h2 { margin: 0; font-size: 13.5px; font-weight: 650; letter-spacing: -.015em; }

/* ---------- signals ---------- */

.signal { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.signal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 14px 13px;
  border: 1px solid var(--rule);
  border-radius: 13px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .035);
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.signal-cell::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--rule-strong); }
.signal-cell[data-state="good"]::before { background: var(--good); }
.signal-cell[data-state="warn"]::before { background: var(--warn); }
.signal-cell[data-state="danger"]::before { background: var(--danger); }
.signal-cell:hover { border-color: var(--rule-strong); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 24, 40, .07); }
.signal-top { display: flex; align-items: center; gap: 7px; padding-right: 18px; }
.signal-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 7px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--muted);
}
.signal-label { color: var(--muted); font: 600 9.5px/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .07em; }
.signal-top .dot { width: 6px; height: 6px; margin-left: auto; }
.signal-arrow { position: absolute; top: 15px; right: 13px; color: var(--muted); opacity: 0; transition: opacity 140ms ease; }
.signal-cell:hover .signal-arrow { opacity: 1; }
.signal-value { margin-top: 2px; color: var(--ink); font-size: 27px; font-weight: 700; letter-spacing: -.04em; line-height: 1.05; }
.signal-value .unit { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 1px; }
.signal-detail { color: var(--muted); font-size: 10.5px; line-height: 1.35; }
.signal-track { height: 4px; margin-top: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.signal-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.signal-cell[data-state="good"] .signal-fill { background: var(--good); }
.signal-cell[data-state="warn"] .signal-fill { background: var(--warn); }
.signal-cell[data-state="danger"] .signal-fill { background: var(--danger); }

/* ---------- health band ---------- */

.health-band {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(380px, 1.75fr);
  gap: 22px;
  align-items: center;
  padding: 17px 18px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 65%, var(--accent-soft) 160%);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .035);
}
.health-lead h2 { margin: 4px 0 0; font-size: 21px; letter-spacing: -.03em; }
.health-lead p { margin: 4px 0 8px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.health-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.health-metric { padding: 3px 14px; border-left: 1px solid var(--rule); }
.health-metric strong { display: block; margin-top: 3px; font-size: 22px; font-weight: 650; letter-spacing: -.03em; }
.health-metric .metric-foot { color: var(--muted); font-size: 10px; }

/* ---------- setup checklist ---------- */

.setup-shell { position: relative; }
.setup-progress-head { display: flex; align-items: center; gap: 13px; margin-bottom: 11px; }
.setup-ring {
  --setup-value: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--setup-value) * 1%), var(--surface-3) 0);
}
.setup-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.setup-ring span { position: relative; z-index: 1; color: var(--ink); font: 700 12px/1 var(--font-sans); letter-spacing: -.02em; }
.setup-progress-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.setup-progress-copy b { color: var(--ink); font-size: 13px; font-weight: 650; letter-spacing: -.01em; }
.setup-progress-copy small { color: var(--muted); font-size: 10.5px; line-height: 1.45; max-width: 46ch; }
.setup-track { height: 4px; margin-bottom: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.setup-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 62%, var(--good))); transition: width 220ms ease; }
.checklist { list-style: none; margin: 0; padding: 0; }
.check-item { display: block; padding: 0; border-bottom: 1px solid var(--rule); }
.check-item:last-child { border-bottom: 0; }
.check-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 7px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: background 140ms ease;
}
.check-link:hover { background: var(--surface-2); }
.check-item.is-next .check-link { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.check-mark {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  flex: none;
  margin-top: 1px;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
}
.check-item.is-done .check-mark { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, var(--rule)); color: var(--good); }
.check-item.is-next .check-mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.check-copy b { color: var(--ink); font-size: 11.5px; font-weight: 600; }
.check-copy small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.check-meta { color: var(--muted); font: 400 9px/1.3 var(--font-mono); margin-top: 2px; }
.check-state { flex: none; margin-top: 2px; color: var(--muted); font: 600 8.5px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; }
.check-item.is-done .check-state { color: var(--good); }
.check-item.is-next .check-state { color: var(--accent-text); }
.check-go { flex: none; margin-top: 2px; color: var(--muted); opacity: .7; }
.check-item.is-done .check-go { display: none; }
.setup-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 10px; }
.setup-foot > span { display: inline-flex; align-items: center; gap: 5px; }
.setup-foot .icon-sm { color: var(--accent-text); }

/* floating coach mark */
.setup-coach {
  position: absolute;
  z-index: 40;
  width: 320px;
  padding: 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(10, 21, 31, .24), 0 2px 6px rgba(10, 21, 31, .08);
  animation: setupCoachIn 220ms cubic-bezier(.2, .8, .2, 1);
}
.setup-coach::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 30px;
  width: 14px;
  height: 14px;
  background: var(--surface);
  border-left: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  transform: rotate(45deg);
}
.setup-coach[data-placement="bottom"]::before { left: 34px; top: -8px; border-left: 1px solid var(--rule-strong); border-top: 1px solid var(--rule-strong); border-bottom: 0; }
.setup-coach.is-fixed::before { display: none; }
.setup-coach.is-fixed { max-height: calc(100vh - 32px); overflow-y: auto; }
.setup-coach-close {
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.setup-coach-close:hover { background: var(--surface-2); border-color: var(--rule); color: var(--ink); }
.setup-coach-eyebrow { display: inline-flex; align-items: center; gap: 5px; color: var(--accent-text); font: 600 9px/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .09em; }
.setup-coach-eyebrow .icon-sm { width: 12px; height: 12px; }
.setup-coach h3 { margin: 6px 0 0; font-size: 18px; font-weight: 650; letter-spacing: -.025em; }
.setup-coach p { margin: 4px 0 11px; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.setup-coach-next { padding: 9px 10px; border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--rule)); border-radius: 8px; background: var(--accent-soft); display: flex; flex-direction: column; gap: 2px; }
.setup-coach-next span { color: var(--accent-text); font: 600 8.5px/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.setup-coach-next b { color: var(--ink); font-size: 11.5px; font-weight: 650; }
.setup-coach-next small { color: var(--ink-2); font-size: 9.5px; line-height: 1.4; }
.setup-coach-progress { height: 4px; margin: 10px 0 11px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.setup-coach-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.setup-coach-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.setup-coach-actions .btn { min-height: 27px; }
.setup-coach-actions .btn.ghost { margin-left: auto; }
@keyframes setupCoachIn { from { transform: translateY(5px) scale(.985); } to { transform: none; } }

/* ---------- work + coverage ---------- */

.work-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.work-table th { padding: 7px 9px; border-bottom: 1px solid var(--rule); background: var(--surface-2); color: var(--muted); font: 600 9.5px/1.2 var(--font-mono); letter-spacing: .05em; text-transform: uppercase; text-align: left; }
.work-table th:first-child { border-radius: 7px 0 0 7px; }
.work-table th:last-child { border-radius: 0 7px 7px 0; }
.work-table td { padding: 11px 9px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.work-table tbody tr:last-child td { border-bottom: 0; }
.work-table tbody tr { transition: background 120ms ease; }
.work-table tbody tr:hover { background: var(--surface-2); }
.work-table .work-main { min-width: 220px; }
.work-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.severity { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 3px 7px; border-radius: 999px; color: var(--muted); background: var(--surface-2); font: 600 9px/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; }
.severity .dot { width: 5px; height: 5px; }
.severity.high { color: var(--danger); background: var(--danger-soft); }
.severity.medium { color: var(--warn); background: var(--warn-soft); }
.severity.low { color: var(--muted); }
.work-title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-scope { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.work-owner, .work-age { color: var(--muted); font-size: 11px; white-space: nowrap; }
.work-age { font-family: var(--font-mono); font-size: 10px; }
.work-action { text-align: right; }
.work-action .link-action { font-weight: 600; }

.coverage-list { list-style: none; margin: 0; padding: 0; }
.coverage-item { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 11px 2px; border-bottom: 1px solid var(--rule); font-size: 11.5px; color: var(--ink-2); }
.coverage-item:last-child { border-bottom: 0; }
.coverage-dot { display: grid; place-items: center; }
.coverage-dot .dot { width: 7px; height: 7px; }
.coverage-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coverage-state { color: var(--muted); font: 600 10.5px/1 var(--font-mono); text-align: right; white-space: nowrap; }
.coverage-item.good .coverage-state { color: var(--good); }
.coverage-item.warn .coverage-state { color: var(--warn); }

/* ---------- tables, charts, activity ---------- */

.dash-page .mini-table { font-size: 11px; }
.dash-page .mini-table th { background: var(--surface-2); padding: 7px 8px; border-bottom: 1px solid var(--rule); }
.dash-page .mini-table td { padding: 9px 8px; }
.dash-page .mini-table tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.dash-page .mini-identity .avatar { width: 25px; height: 25px; }
.dash-page .chart-summary { gap: 10px 20px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.dash-page .chart-plot { background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--surface-2) 55%, transparent)); }
.dash-page .chart-bars { gap: 4px; }
.dash-page .bar { border-radius: 2px 2px 0 0; }
.dash-page .chart-data summary { color: var(--accent-text); }
.dash-page .activity-list { border-top: 1px solid var(--rule); }
.dash-page .activity-item { grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 10px 1px; position: relative; }
.dash-page .activity-item::before { content: ""; position: absolute; left: 43px; top: 16px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dash-page .activity-time { padding-right: 12px; }
.dash-page .activity-text { padding-left: 10px; }
.dash-page .activity-target { margin-top: 1px; }
.dash-page .quarantine-band { border: 0; gap: 9px; margin-bottom: 10px; }
.dash-page .quarantine-band > div { padding: 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface-2); }
.dash-page .quarantine-band > div:last-child { border-right: 1px solid var(--rule); }
.dash-page .quarantine-band strong { font-size: 22px; letter-spacing: -.03em; }
.dash-page .bar-list { gap: 11px; }
.dash-page .bar-track { height: 7px; border-radius: 999px; }
.dash-page .bar-fill { border-radius: inherit; }
.dash-page .empty { min-height: 150px; border: 1px dashed var(--rule); border-radius: 10px; background: var(--surface-2); }
.dash-page .empty > .icon { width: 28px; height: 28px; color: var(--muted); }
.dash-page .widget-note { line-height: 1.5; }

/* ---------- builder defaults ---------- */

.builder-defaults { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.builder-default { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 72px; padding: 8px 9px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); text-align: left; transition: border-color 120ms ease, background 120ms ease; }
.builder-default:hover { background: var(--surface-2); border-color: var(--rule-strong); }
.builder-default[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.builder-default b { color: var(--ink); font-size: 11.5px; font-weight: 650; }
.builder-default small { color: var(--muted); font-size: 9.5px; line-height: 1.35; }
.builder-default[aria-pressed="true"] .dash-tier { color: var(--accent-text); }
.builder-hint { margin: 7px 0 0; color: var(--muted); font-size: 9.5px; line-height: 1.4; }

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .signal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-band { grid-template-columns: 1fr; gap: 14px; }
  .dash-switcher-hint { display: none; }
}
@media (max-width: 900px) {
  .dash-switcher { align-items: center; }
  .dash-default { display: none; }
  .dash-tab { min-width: 0; }
  .health-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 0; }
  .health-metric:nth-child(3) { border-left: 0; }
}
@media (max-width: 720px) {
  .dashboard-grid { gap: 13px; }
  .dash-tab { flex: 0 0 auto; }
  .dash-tab-icon { display: none; }
  .dash-tab-badge { margin-left: 0; }
  .dash-page .widget-head { align-items: flex-start; }
  .dash-page .widget-head .section-actions { margin-left: 0; }
  .signal { grid-template-columns: 1fr; }
  .health-band { padding: 14px; }
  .builder-defaults { grid-template-columns: 1fr; }
  .setup-coach { border-radius: 12px; }
}
@media (max-width: 560px) {
  .dash-page .page-title { font-size: 23px; }
  .dash-tabs { gap: 2px; }
  .dash-tab { flex-basis: auto; min-height: 31px; padding: 4px 7px; }
  .dash-name { font-size: 11px; }
  .dash-tier { font-size: 7px; }
  .dash-switcher { padding: 4px; }
  .dash-widget { padding: 13px; }
  .check-copy small { display: none; }
  .check-state { display: none; }
  .setup-ring { width: 54px; height: 54px; }
  .setup-coach { padding: 13px; }
  .setup-coach h3 { font-size: 16px; }
  .setup-coach p { display: none; }
  .setup-coach-progress { margin: 8px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .setup-coach { animation: none; }
  .dash-tab, .signal-cell, .work-table tbody tr, .setup-track span { transition: none; }
}
@media (forced-colors: active) {
  .dash-tab[aria-selected="true"], .check-item.is-next .check-link, .setup-coach { outline: 2px solid Highlight; }
  .signal-cell::before, .setup-ring { forced-color-adjust: none; }
}
