/* OmniContext UI, 87 Seconds light skin. Plain CSS, no framework: tokens first, then layout, components and pages. */

:root {
  /* 87 Seconds brand: ink and white, with the three colours of the OmniContext mark. */
  --ink: #0b0b0f;
  --magenta: #e01892;
  --indigo: #4a4ca0;
  --sage: #86ad92;
  --brand-rule: linear-gradient(90deg, var(--magenta) 0 33.3%, var(--indigo) 33.3% 66.6%, var(--sage) 66.6% 100%);

  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-muted: #f1f1ee;
  --text: var(--ink);
  --text-muted: #5c5c66;
  --border: #e3e3df;
  --border-strong: #cbcbc5;
  --accent: #4545a0;
  --accent-hover: #34348a;
  --accent-soft: #ececf7;
  --primary: var(--ink);
  --primary-hover: #2a2a33;
  --primary-text: #ffffff;
  --success: #2f6b3c;
  --success-soft: #e6f0e8;
  --warning: #8a5a00;
  --warning-soft: #fdf3dc;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --focus: 0 0 0 3px rgba(74, 76, 160, 0.3);
  --radius: 10px;
  --radius-small: 7px;
  --shadow: 0 1px 2px rgba(11, 11, 15, 0.05), 0 2px 6px rgba(11, 11, 15, 0.05);
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Archivo", "Poppins", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

/* ---- Base ---- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.1rem;
  font-weight: 620;
  margin-top: 2rem;
}

p {
  margin: 0 0 1rem;
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.85em;
}

code {
  background: var(--surface-muted);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
}

pre {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  margin: 0 0 1rem;
}

code.fingerprint {
  word-break: break-all;
}

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

.nowrap {
  white-space: nowrap;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-small);
}

/* ---- Page frame ---- */

.container {
  max-width: 96rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar::after {
  content: "";
  display: block;
  height: 3px;
  background: var(--brand-rule);
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
  flex-wrap: wrap;
}

.topbar nav,
.topbar .account {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.topbar nav a,
.topbar .account a {
  color: var(--text-muted);
  font-weight: 500;
}

.topbar nav a:hover,
.topbar .account a:hover {
  color: var(--text);
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text) !important;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  display: block;
  width: 1.9rem;
  height: 1.9rem;
}

.brand .brand-87s {
  width: 1.75rem;
  height: 1.75rem;
}

.brand-sep {
  width: 1px;
  height: 1.6rem;
  background: var(--border-strong);
}

.wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  line-height: 1;
}

.topbar .client-name {
  color: var(--text) !important;
  font-weight: 600;
}

.account .username {
  color: var(--text-muted);
  font-size: 0.9rem;
}

main.container {
  padding-top: 1.75rem;
  padding-bottom: 3rem;
}

.layout {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

section {
  min-width: 0;
}

@media (max-width: 52rem) {
  .layout {
    grid-template-columns: 1fr;
  }

  /* Wide tables scroll inside their own box instead of widening the page. */
  table {
    display: block;
    overflow-x: auto;
  }
}

/* ---- Sidebar ---- */

.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.sidebar h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius-small);
}

.sidebar li a {
  flex: 1;
  color: var(--text);
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-small);
}

.sidebar li a:hover {
  background: var(--surface-muted);
  text-decoration: none;
}

.sidebar li .muted {
  font-size: 0.85rem;
  padding-right: 0.55rem;
  font-variant-numeric: tabular-nums;
}

.sidebar li.active a {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ---- Buttons and forms ---- */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 560;
  font-size: 0.92rem;
  line-height: 1.2;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-small);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

button:hover,
.button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  text-decoration: none;
}

button.secondary,
.button.secondary,
.topbar button {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

button.secondary:hover,
.button.secondary:hover,
.topbar button:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.topbar button {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

button.danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--border-strong);
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

button.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

form.inline {
  display: inline;
}

input[type="text"],
input[type="search"],
input[type="password"],
input[type="email"],
input[type="date"],
select,
textarea {
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  padding: 0.5rem 0.65rem;
  min-height: 2.35rem;
  width: 100%;
}

input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

input[type="checkbox"] {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
  margin: 0;
}

label {
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--text-muted);
}

/* Filter bars on list pages. */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.6rem 0.75rem;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filters label.check,
.filters label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.35rem;
  color: var(--text);
  font-weight: 500;
}

.filters label:has(input[type="checkbox"]) span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.filters .actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Rarely used filters, folded away until one is set. Open, they take a full row of the filter grid. */
.filters .more-filters[open] {
  grid-column: 1 / -1;
}

.filters .more-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.6rem 0.75rem;
  align-items: end;
}

.filters .more-filters summary {
  min-height: 2.35rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 560;
  color: var(--accent);
}

/* ---- Content blocks ---- */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: none;
}

thead th {
  background: var(--surface-muted);
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-muted) 55%, transparent);
}

/* Item lists: one line per row where possible, so a screen holds more of a long dimension. */
table.list th,
table.list td {
  padding: 0.4rem 0.7rem;
  vertical-align: middle;
}

table.list td {
  line-height: 1.35;
}

.badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

table.kv th {
  width: 12rem;
  background: var(--surface-muted);
  font-weight: 560;
  color: var(--text-muted);
}

td ul {
  margin: 0;
  padding-left: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.85rem;
  margin: 1rem 0 1.75rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  box-shadow: var(--shadow);
}

.stat strong {
  display: block;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 560;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge.value {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.any {
  background: var(--success-soft);
  color: var(--success);
  font-weight: 680;
}

.badge.none {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-muted);
  font-style: italic;
}

table.runs td:not(.label) {
  white-space: nowrap;
}

table.runs td.label {
  min-width: 10rem;
}

.status {
  white-space: nowrap;
  display: inline-block;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}

.status.succeeded {
  color: var(--success);
  background: var(--success-soft);
}

.status.partially_failed {
  color: var(--warning);
  background: var(--warning-soft);
}

.status.failed {
  color: var(--danger);
  background: var(--danger-soft);
}

.status.running {
  color: var(--accent);
  background: var(--accent-soft);
}

.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-small);
  padding: 0.9rem 1rem;
  margin: 0 0 1rem;
}

.notice.error {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.notice pre {
  margin: 0.5rem 0;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.messages li {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-small);
  padding: 0.7rem 1rem;
}

dl.fields {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 1.1rem 1rem;
  margin: 0 0 1rem;
  box-shadow: var(--shadow);
}

dl.fields dt {
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 0.9rem;
}

dl.fields dd {
  margin: 0.2rem 0 0;
}

dl.fields dd ul {
  margin: 0;
  padding-left: 1.1rem;
}

.breadcrumb {
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}

.pagination {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 0.5rem 0;
}

.pagination a {
  font-weight: 560;
}

/* ---- Sign in ---- */

.auth {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 3.5rem - 5rem);
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.auth-brand img {
  width: 2.75rem;
  height: 2.75rem;
}

.auth-brand .wordmark {
  font-size: 1.3rem;
}

.auth-card {
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand-rule);
}

.auth-card h1 {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

.auth-card .lead {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.auth-card form p {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0 0 0.9rem;
}

.auth-card button,
.auth-card .button {
  width: 100%;
  padding: 0.65rem 1rem;
}

.button.microsoft {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.button.microsoft:hover {
  background: var(--surface-muted);
}

.ms-logo {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 1.25rem 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-card .errorlist {
  list-style: none;
  padding: 0.6rem 0.8rem;
  margin: 0 0 1rem;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-small);
  font-size: 0.88rem;
}

/* ---- Client picker ---- */

.client-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.85rem;
}

.client-list a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow);
}

.client-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 0.75rem;
  align-items: baseline;
}

.client-list a .muted {
  grid-column: 1 / -1;
}

.item-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* The dimension and source counts under a client's name, each listing its names on hover. */
.card-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin-top: 0.4rem;
}

.dimension-count,
.source-count {
  position: relative;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px dotted var(--border-strong);
}

.dimension-count.empty,
.source-count.empty {
  border-bottom: none;
}

.hover-list,
.source-names {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 0.35rem);
  z-index: 5;
  min-width: 10rem;
  padding: 0.45rem 0.65rem;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-small);
  box-shadow: var(--shadow);
  font-weight: 500;
  white-space: nowrap;
}

.source-names span {
  display: block;
}

.source-count:hover .source-names,
.dimension-count:hover .hover-list {
  display: block;
}

.hover-list .hover-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.hover-list .hover-n {
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.hover-list .see-more {
  display: block;
  margin-top: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgb(255 255 255 / 0.2);
  text-decoration: underline;
}

.source-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.source-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}

.source-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.source-card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.source-logo {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
  border-radius: 6px;
  flex: none;
}

.field-image {
  display: block;
  max-width: 6rem;
  max-height: 6rem;
  object-fit: contain;
}

.source-card h3 .muted {
  font-size: 0.8rem;
  font-weight: 400;
}

.source-card > p {
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}

.source-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.source-card li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.source-card li .muted {
  font-variant-numeric: tabular-nums;
}

.item-count.empty {
  color: var(--text-muted);
  background: var(--surface-muted);
}

.client-list a .muted {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  margin-top: 0.15rem;
}

.client-search {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  max-width: 34rem;
  margin: 0.5rem 0 0.75rem;
}

.client-search input {
  flex: 1;
}

.client-list a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

/* ---- Empty and error pages ---- */

.empty-page img {
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1rem;
}

.empty-page {
  max-width: 34rem;
  margin: 4rem auto;
  text-align: center;
}

.empty-page .button {
  margin-top: 0.5rem;
}

/* ---- Loading ---- */

.loading-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 20;
  background: var(--brand-rule);
  animation: pulse 1s infinite alternate;
}

body.is-loading .loading-bar {
  display: block;
}

body.is-loading main {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

@keyframes pulse {
  from {
    opacity: 0.3;
  }
  to {
    opacity: 1;
  }
}
