/* HumanityZ Telemetry & Analytics Admin Portal
   Follows the print-process broadsheet system: paper ground, sharp hairlines, tabular numerals, zero rounded cards. */

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  padding: 18px 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.window-switch,
.category-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.window-switch button,
.category-switch button {
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-top: 3px solid transparent;
  border-radius: 0;
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
  transition: color 0.25s var(--sh-ease), border-color 0.25s var(--sh-ease), background-color 0.25s var(--sh-ease);
}

.window-switch button:hover,
.category-switch button:hover {
  color: var(--ink);
}

.window-switch button[aria-pressed="true"],
.category-switch button[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 500;
  border-top-color: var(--ink-block);
  background: color-mix(in srgb, var(--surface) 65%, transparent);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.admin-btn {
  font: inherit;
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 9px 15px;
  min-height: 42px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.25s var(--sh-ease), color 0.25s var(--sh-ease);
}

.admin-btn:hover:not(:disabled) {
  background: var(--ink);
  color: var(--page);
}

.admin-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.admin-btn:disabled {
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
}

.admin-btn.primary {
  background: var(--ink);
  color: var(--page);
}

.admin-btn.primary:hover:not(:disabled) {
  background: transparent;
  color: var(--ink);
}

.status-line {
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

/* Section 1: 4-Column Studio Pulse Strip */
.pulse-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 32px;
  border-bottom: 1px solid var(--line);
}

.pulse-cell {
  padding: 22px 24px 26px 0;
  border-top: 4px solid var(--ink);
  min-width: 0;
}

.pulse-cell + .pulse-cell {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.pulse-cell.ink-k { border-top-color: var(--k); }
.pulse-cell.ink-y { border-top-color: var(--y); }
.pulse-cell.ink-c { border-top-color: var(--c); }
.pulse-cell.ink-m { border-top-color: var(--m); }

.pulse-eyebrow {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 6px;
}

.pulse-figure {
  display: block;
  font-size: clamp(42px, 4.8vw, 68px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.96;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 10px;
}

.pulse-sub {
  font-size: 15px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Section 2: Nightporch Asymmetric Split Funnel */
.funnel-section {
  margin-top: clamp(52px, 6vw, 88px);
  padding-top: 24px;
  border-top: 1px solid var(--ink);
}

.funnel-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.45fr;
  gap: clamp(28px, 4.5vw, 64px);
  align-items: start;
}

.funnel-lead h2 {
  font-size: clamp(30px, 3.3vw, 48px);
  letter-spacing: -0.045em;
  line-height: 1.02;
  margin-bottom: 16px;
}

.funnel-lead p {
  color: var(--muted);
  max-width: 44ch;
  margin-bottom: 20px;
}

.funnel-callouts {
  border-top: 1px solid var(--line);
  margin-top: 20px;
}

.funnel-callout-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.funnel-callout-row strong {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.funnel-bars {
  border-top: 2px solid var(--ink);
}

.funnel-stage {
  display: grid;
  grid-template-columns: minmax(170px, 1.2fr) minmax(120px, 2fr) 74px 62px;
  gap: 16px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.funnel-stage-name {
  font-weight: 500;
}

.funnel-stage-key {
  display: block;
  font-size: 13px;
  color: var(--muted);
  font-family: "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

.funnel-track {
  height: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.funnel-fill {
  height: 100%;
  background: var(--y);
  transition: width 0.45s var(--sh-ease);
}

.funnel-count {
  text-align: right;
  font-weight: 500;
}

.funnel-pct {
  text-align: right;
  color: var(--muted);
  font-size: 15px;
}

/* Section 3: 14-Day UTC Activity Matrix */
.timeline-section {
  margin-top: clamp(52px, 6vw, 88px);
  padding-top: 24px;
  border-top: 1px solid var(--ink);
}

.timeline-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
}

.timeline-header h2 {
  font-size: clamp(30px, 3.3vw, 48px);
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.timeline-header p {
  color: var(--muted);
  font-size: 16px;
}

.timeline-strip {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  padding: 24px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.day-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.day-val {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.day-bar-wrap {
  width: 100%;
  height: 110px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-bottom: 1px solid var(--ink);
}

.day-bar {
  width: 100%;
  max-width: 34px;
  background: var(--c);
  min-height: 2px;
  transition: height 0.4s var(--sh-ease);
}

.day-label {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Section 4: Portfolio Ledger Table (Responsive Container Query Table) */
.ledger-section {
  margin-top: clamp(52px, 6vw, 88px);
  padding-top: 24px;
  border-top: 1px solid var(--ink);
}

.ledger-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px 24px;
  margin: 22px 0 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.ledger-search {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 8px 14px;
  min-height: 42px;
  min-width: 260px;
}

.ledger-search:focus-visible {
  outline: 3px solid var(--focus, #b43771);
  outline-offset: 3px;
}

.table-wrapper {
  overflow-x: auto;
  max-inline-size: 100%;
  container-type: inline-size;
}

.analytics-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.analytics-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: var(--page);
}

.analytics-table th,
.analytics-table td {
  padding: 15px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.analytics-table thead th {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.analytics-table th.num,
.analytics-table td.num {
  text-align: right;
}

.analytics-table tbody th {
  font-weight: 500;
  position: sticky;
  inset-inline-start: 0;
  background: var(--page);
  z-index: 1;
}

.app-title-cell {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.ink-mark {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  background: var(--c);
}

.ink-mark.ink-y { background: var(--y); }
.ink-mark.ink-c { background: var(--c); }
.ink-mark.ink-m { background: var(--m); }

.app-slug-sub {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  font-family: "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  margin-top: 2px;
}

.stage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 6px;
}

.stage-item {
  font-size: 14px;
  color: var(--muted);
}

.stage-item strong {
  color: var(--ink);
  font-weight: 500;
}

/* Section 5: Operator Console (Dark Transcript Sheet) */
.operator-section {
  margin-top: clamp(52px, 6vw, 88px);
  margin-bottom: clamp(48px, 6vw, 80px);
}

.operator-sheet {
  background: #1b211e;
  color: #eef0e8;
  padding: clamp(24px, 3.6vw, 44px);
  border-top: 5px solid var(--c);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 4vw, 52px);
}

html[data-theme="dark"] .operator-sheet,
html[data-scheme="dark"] .operator-sheet {
  background: #111613;
}

.operator-sheet h2 {
  font-size: clamp(26px, 2.6vw, 36px);
  color: #eef0e8;
  margin-bottom: 10px;
}

.operator-sheet p {
  font-size: 15px;
  color: #a9b3a6;
  margin-bottom: 18px;
  max-width: 52ch;
}

.operator-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.operator-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 14px;
  color: #a9b3a6;
}

.operator-field.full {
  grid-column: 1 / -1;
}

.operator-field select,
.operator-field input {
  font: inherit;
  font-size: 15px;
  color: #eef0e8;
  background: #283029;
  border: 1px solid #475247;
  border-radius: 0;
  padding: 9px 12px;
  min-height: 42px;
}

.operator-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: #1b211e;
  background: #eef0e8;
  border: 1px solid #eef0e8;
  border-radius: 0;
  padding: 9px 16px;
  min-height: 42px;
  cursor: pointer;
}

.operator-btn:hover {
  background: transparent;
  color: #eef0e8;
}

.operator-btn.danger {
  background: transparent;
  color: #f38ba8;
  border-color: #f38ba8;
}

.operator-btn.danger:hover {
  background: #f38ba8;
  color: #1b211e;
}

.operator-log {
  margin-top: 14px;
  font: 14px/1.6 "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color: #c9d1c5;
  min-height: 1.6em;
}

@container (width < 720px) {
  .analytics-table,
  .analytics-table thead,
  .analytics-table tbody,
  .analytics-table tr,
  .analytics-table th,
  .analytics-table td {
    display: block;
  }

  .analytics-table thead {
    display: none;
  }

  .analytics-table tr {
    margin-block-end: 18px;
    border: 1px solid var(--line);
    border-top: 2px solid var(--ink);
  }

  .analytics-table tbody th {
    position: static;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .analytics-table td.num {
    text-align: left;
  }

  .analytics-table td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-weight: 400;
  }
}

@media (max-width: 960px) {
  .pulse-strip {
    grid-template-columns: 1fr 1fr;
  }
  .pulse-cell:nth-child(3) {
    border-left: 0;
    padding-left: 0;
  }
  .funnel-grid,
  .operator-sheet {
    grid-template-columns: 1fr;
  }
  .timeline-strip {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .pulse-strip {
    grid-template-columns: 1fr;
  }
  .pulse-cell + .pulse-cell {
    border-left: 0;
    padding-left: 0;
  }
  .funnel-stage {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }
  .funnel-track {
    grid-column: 1 / -1;
    order: 3;
  }
  .operator-form {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .window-switch button,
  .category-switch button,
  .admin-btn,
  .funnel-fill,
  .day-bar {
    transition: none;
  }
}
