/* Wayfinder CDM dashboard. Wayfinder's own theme, so it reads as one of its apps: in light the web app's palette
   (asgardeo-b2c-sample-app/frontend: white surfaces, ink #111827, blue #2563eb, 8px corners, Inter), in dark the
   in-flight screen's cabin navy (screen/public/styles.css). One data hue (the brand blue: every bar is the same
   step), status colors only for what a CRM answered, each with an icon and a label; the status pairs are chosen
   per theme so that green and red stay apart for color-blind readers. */

:root {
  color-scheme: light;
  --page: #f9fafb;
  --surface: #ffffff;
  --header: rgba(255, 255, 255, 0.94);
  --ink: #111827;
  --ink-2: #4b5563;
  --muted: #6b7280;
  --hairline: #e5e7eb;
  --border: rgba(17, 24, 39, 0.1);
  --control: #f1f5f9;
  --control-edge: #475569;
  --data: #2563eb;
  --data-track: #dbeafe;
  --neutral: #8b95a5;
  --good: #16a34a;
  --good-ink: #166534;
  --critical: #b91c1c;
  --critical-ink: #b91c1c;
  --brand: #2563eb;
  --brand-wash: rgba(37, 99, 235, 0.1);
  --flash: rgba(37, 99, 235, 0.12);
  --tip: #111827;
  --tip-ink: #ffffff;
  font-family:
    Inter, Aptos, "Avenir Next", "SF Pro Text", "Helvetica Neue", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0b1736;
    --surface: #13224a;
    --header: rgba(11, 23, 54, 0.92);
    --ink: #f8fafc;
    --ink-2: #a5b4cf;
    --muted: #8697b6;
    --hairline: rgba(148, 163, 184, 0.18);
    --border: rgba(148, 163, 184, 0.18);
    --control: rgba(148, 163, 184, 0.12);
    --control-edge: rgba(148, 163, 184, 0.4);
    --data: #60a5fa;
    --data-track: #1e3a8a;
    --neutral: #64748b;
    --good: #4ade80;
    --good-ink: #4ade80;
    --critical: #dc2626;
    --critical-ink: #fca5a5;
    --brand: #60a5fa;
    --brand-wash: rgba(96, 165, 250, 0.14);
    --flash: rgba(96, 165, 250, 0.18);
    --tip: #f8fafc;
    --tip-ink: #0b1736;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

h1,
h2,
p,
figure {
  margin: 0;
}

/* The header, as Wayfinder's: sticky, translucent, the logo in its tile */
.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 5vw, 72px);
  background: var(--header);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

h1 {
  font-size: 1.08rem;
  font-weight: 600;
}

.sub,
.hint,
.note {
  color: var(--ink-2);
  font-size: 13px;
}

.live {
  display: flex;
  gap: 12px;
  align-items: center;
}

.state {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neutral);
}

.state.on .dot {
  background: var(--good);
}

.state.off .dot {
  background: var(--critical);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  min-height: 36px;
  padding: 0 14px;
  background: var(--control);
  border: 1px solid var(--control-edge);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--brand-wash);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

main {
  display: grid;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px clamp(16px, 5vw, 72px) 48px;
}

.banner {
  padding: 10px 14px;
  border: 1px solid var(--critical);
  border-radius: 8px;
  background: var(--surface);
}

/* Where customer data goes: the CDM and each CRM, with its state as an icon and a label */
.targets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  color: var(--ink-2);
}

.target strong {
  color: var(--ink);
  font-weight: 600;
}

.attention {
  display: grid;
  gap: 4px;
}

.attention ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-2);
}

.mark {
  display: inline-block;
  width: 1.1em;
  font-weight: 700;
  text-align: center;
}

.mark.good {
  color: var(--good-ink);
}

.mark.critical {
  color: var(--critical-ink);
}

.mark.neutral {
  color: var(--muted);
}

/* Stat tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}

.tile,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tile {
  padding: 14px 16px;
}

.label {
  color: var(--ink-2);
  font-size: 13px;
}

.value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
}

/* Charts */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  padding: 16px;
  min-width: 0;
}

figcaption,
h2 {
  font-size: 14px;
  font-weight: 600;
}

figcaption {
  margin-bottom: 12px;
}

figcaption .hint {
  margin-left: 6px;
  font-weight: 400;
}

/* One column per day on a shared baseline, the count on the column */
.cols {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  align-items: end;
}

.col {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.col-plot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: flex-end;
  height: 120px;
  border-bottom: 1px solid var(--hairline);
}

.col-bar {
  width: min(70%, 28px);
  min-height: 2px;
  background: var(--data);
  border-radius: 4px 4px 0 0;
}

.col-num {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.col-day {
  min-height: 16px;
  overflow: visible;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
}

.bars {
  display: grid;
  gap: 8px;
}

/* One ranked row: name, bar on a shared baseline, value at the tip */
.row {
  display: grid;
  grid-template-columns: minmax(120px, 46%) 1fr;
  gap: 10px;
  align-items: center;
}

.row .name {
  color: var(--ink-2);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.row .plot {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.row .fill {
  flex: 0 0 auto;
  height: 14px;
  min-width: 2px;
  background: var(--data);
  border-radius: 0 4px 4px 0;
}

.row .num {
  font-variant-numeric: tabular-nums;
}

.empty {
  color: var(--muted);
}

/* Tables */
.table-card {
  padding: 0;
}

.table-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.search input {
  width: min(320px, 60vw);
  margin-left: 6px;
  padding: 5px 10px;
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.scroll {
  max-height: 460px;
  overflow: auto;
  border-top: 1px solid var(--hairline);
}

table {
  width: 100%;
  border-collapse: collapse;
}

table.wide {
  min-width: 1180px;
}

table.wide td:first-child {
  min-width: 240px;
}

table.wide td:first-child .second {
  overflow-wrap: normal;
  white-space: nowrap;
}

td.sf {
  min-width: 130px;
  white-space: nowrap;
}

td.sf .chip.second {
  white-space: nowrap;
}

.foot {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--hairline);
  color: var(--ink-2);
  font-size: 13px;
}

td .chip.second {
  white-space: normal;
}

th,
td {
  padding: 8px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--hairline);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td.when,
td.id {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td .second {
  display: block;
  color: var(--ink-2);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.chip {
  white-space: nowrap;
}

a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

tr.new td {
  animation: arrive 2.4s ease-out;
}

@keyframes arrive {
  from {
    background: var(--flash);
  }

  to {
    background: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  tr.new td {
    animation: none;
  }
}

.tip {
  position: fixed;
  z-index: 10;
  max-width: 280px;
  padding: 6px 10px;
  background: var(--tip);
  color: var(--tip-ink);
  border-radius: 8px;
  font-size: 12px;
  pointer-events: none;
}
