:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef4f1;
  --text: #172026;
  --muted: #5f6f79;
  --line: #d8e0e4;
  --primary: #116466;
  --primary-dark: #0b4547;
  --danger: #a23a3a;
  --success: #216e4e;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 24px;
}

.brand {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.brand span {
  font-weight: 500;
}

.nav {
  align-items: center;
  display: flex;
  gap: 18px;
}

.shell {
  margin: 0 auto;
  max-width: 1920px;
  padding: 32px 24px 56px;
}

.hero,
.page-heading {
  margin-bottom: 28px;
}

.hero {
  align-items: center;
  display: grid;
  min-height: 58vh;
}

.hero h1,
.page-heading h1 {
  font-size: 40px;
  line-height: 1.1;
  margin: 0 0 12px;
}

.hero p,
.page-heading p {
  color: var(--muted);
  margin: 0 0 22px;
  max-width: 680px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.button,
button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  min-height: 40px;
  padding: 8px 14px;
}

.button.primary,
button[type="submit"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

button:hover,
.button:hover {
  border-color: var(--primary-dark);
}

button:disabled {
  background: #e8edf0;
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.link-button {
  background: transparent;
  border: 0;
  color: var(--primary);
  min-height: auto;
  padding: 0;
}

.logout-button {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
  min-height: 42px;
  padding: 8px 16px;
}

.logout-button:hover {
  background: #222222;
  border-color: #222222;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.provider-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.login-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 18px;
  max-width: 460px;
  padding: 18px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel,
.metrics article,
.notice,
.flash {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel {
  margin-bottom: 18px;
  padding: 22px;
}

.panel h2 {
  font-size: 20px;
  margin: 0 0 18px;
}

.definition-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.definition-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.definition-list dd {
  margin: 0 0 8px;
}

.inline-notice {
  margin: 0;
  padding: 12px;
}

.password-reset {
  min-width: 220px;
}

.password-reset summary {
  color: var(--primary);
  cursor: pointer;
  font-weight: 800;
}

.password-reset form {
  gap: 8px;
  margin-top: 10px;
}

.password-reset input {
  min-height: 36px;
}

.password-reset button {
  min-height: 36px;
  justify-self: start;
}

.customer-admin-list {
  display: grid;
  gap: 12px;
}

.customer-admin-row {
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 0.9fr) minmax(160px, 0.9fr) minmax(130px, 0.6fr) auto;
  padding: 14px;
}

.customer-admin-actions {
  align-items: start;
  display: grid;
  gap: 8px;
}

.config-state {
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: center;
  padding: 6px 10px;
  white-space: nowrap;
}

.config-state.ready {
  background: #e4f8ed;
  color: #174f2e;
}

.config-state.missing {
  background: #fff4dc;
  color: #5d4610;
}

.metrics {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 180px));
  margin-bottom: 18px;
}

.metrics article {
  padding: 18px;
}

.metrics strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.metrics span {
  color: var(--muted);
  display: block;
  margin-top: 6px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 14px;
  font-weight: 700;
  gap: 6px;
}

input,
select {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 8px 10px;
  width: 100%;
}

input:focus,
select:focus,
button:focus,
a:focus {
  outline: 3px solid rgba(17, 100, 102, 0.22);
  outline-offset: 2px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 780px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pill {
  background: var(--surface-soft);
  border-radius: 999px;
  color: var(--primary-dark);
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  padding: 3px 9px;
}

.details {
  display: grid;
  gap: 14px;
  margin: 0;
}

.details div {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
}

.details dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.details dd {
  margin: 0;
}

.notice,
.flash {
  padding: 14px 16px;
}

.flash {
  margin-bottom: 16px;
}

.flash-success {
  border-color: rgba(33, 110, 78, 0.35);
  color: var(--success);
}

.flash-error {
  border-color: rgba(162, 58, 58, 0.35);
  color: var(--danger);
}

.impersonation-banner {
  align-items: center;
  background: #fff4dc;
  border-bottom: 1px solid #e2c378;
  color: #5d4610;
  display: flex;
  gap: 14px;
  justify-content: center;
  padding: 10px 16px;
}

.impersonation-banner form {
  display: inline-flex;
}

code {
  background: #eef1f3;
  border-radius: 5px;
  padding: 2px 5px;
}

.customer-panel {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(360px, 1.2fr) minmax(360px, 0.95fr) minmax(400px, 1.25fr);
}

.customer-card,
.customer-empty {
  background: var(--surface);
  border: 1px solid rgba(23, 32, 38, 0.06);
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(23, 32, 38, 0.05);
  padding: 24px;
}

.customer-card h1,
.customer-empty h1 {
  font-size: 28px;
  line-height: 1.12;
  margin: 0 0 20px;
}

.media-heading {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.media-summary {
  background: #eef4f1;
  border-radius: 999px;
  color: #315b50;
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  padding: 7px 11px;
  white-space: nowrap;
}

.assets-card {
  min-height: 720px;
}

.info-note {
  background: #dff0fb;
  border-radius: 7px;
  color: #111111;
  margin: 0 0 10px;
  padding: 8px 10px;
}

.source-note {
  border-radius: 7px;
  font-size: 15px;
  margin: 0 0 18px;
  padding: 7px 10px;
}

.source-note.live {
  background: #e4f8ed;
  color: #174f2e;
}

.source-note.fallback {
  background: #fff4dc;
  color: #5d4610;
}

.asset-list {
  display: grid;
  gap: 8px;
}

.asset-item {
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  padding-left: 16px;
}

.asset-period-full {
  background: #edf8ef;
  border-left-color: #8bcf9c;
}

.asset-period-ending {
  background: #fbeeee;
  border-left-color: #e89a9a;
}

.asset-period-starting {
  background: #edf5ff;
  border-left-color: #8fbdec;
}

.asset-period-contained {
  background: #fff8df;
  border-left-color: #e5ca65;
}

.asset-row {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #111111;
  display: grid;
  font-weight: 400;
  gap: 18px;
  grid-template-columns: 86px minmax(0, 1fr);
  justify-items: start;
  min-height: 106px;
  padding: 12px 0;
  text-align: left;
  width: 100%;
}

.asset-trigger:hover {
  background: rgba(255, 255, 255, 0.46);
  border-color: transparent;
}

.asset-trigger:focus-visible {
  border-radius: 8px;
}

.asset-thumb {
  border: 1px solid #c8c8c8;
  border-radius: 8px;
  display: block;
  height: 78px;
  object-fit: cover;
  position: relative;
  width: 78px;
}

.asset-thumb.placeholder {
  background:
    linear-gradient(135deg, transparent 0 55%, #6fb757 56% 68%, transparent 69%),
    linear-gradient(155deg, transparent 0 62%, #2f9e44 63% 72%, transparent 73%),
    #d8d8d8;
}

.asset-thumb.placeholder::before {
  border-bottom: 16px solid transparent;
  border-left: 16px solid #f2f8ff;
  border-top: 1px solid #b5c4d2;
  content: "";
  height: 16px;
  left: 4px;
  position: absolute;
  top: 4px;
  width: 16px;
}

.asset-title {
  display: block;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.18;
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.asset-period {
  color: #666666;
  display: block;
  font-size: 16px;
  margin: 0;
}

.asset-modal {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(23, 32, 38, 0.26);
  height: min(900px, calc(100vh - 24px));
  max-height: min(900px, calc(100vh - 24px));
  max-width: min(1360px, calc(100vw - 32px));
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.asset-modal::backdrop {
  background: rgba(17, 24, 29, 0.52);
}

.asset-modal-inner {
  display: grid;
  gap: 0;
  grid-template-columns: minmax(520px, 1fr) minmax(480px, 0.72fr);
  height: 100%;
  max-height: min(900px, calc(100vh - 24px));
  overflow: hidden;
  position: relative;
}

.asset-modal-close-form {
  display: block;
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 2;
}

.asset-modal-close {
  align-items: center;
  background: #111111;
  border-color: #111111;
  border-radius: 999px;
  color: #ffffff;
  display: inline-flex;
  font-size: 28px;
  height: 42px;
  justify-content: center;
  line-height: 1;
  min-height: 42px;
  padding: 0;
  width: 42px;
}

.asset-preview-frame {
  align-items: center;
  background: #101315;
  display: flex;
  justify-content: center;
  min-height: 520px;
  overflow: auto;
  padding: 24px;
}

.asset-preview-image {
  display: block;
  height: auto;
  max-height: calc(100vh - 96px);
  max-width: 100%;
  object-fit: contain;
}

.asset-preview-empty {
  color: #ffffff;
  font-weight: 800;
  text-align: center;
}

.asset-modal-details {
  background: #ffffff;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 32px 36px 32px 28px;
}

.asset-modal-details h2 {
  font-size: 22px;
  line-height: 1.2;
  margin: 0 46px 20px 0;
  overflow-wrap: anywhere;
}

.asset-modal-details dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.asset-modal-details dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-top: 10px;
  text-transform: uppercase;
}

.asset-modal-details dd {
  margin: 0;
}

.playlist-list {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.playlist-list li {
  background: #eef4f1;
  border-radius: 999px;
  display: inline-flex;
  padding: 7px 10px;
}

.asset-replication {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
}

.asset-replication summary {
  color: var(--primary);
  cursor: pointer;
  font-weight: 800;
}

.replication-form {
  gap: 12px;
  margin-top: 14px;
}

.replication-form input {
  min-width: 0;
}

.replication-form fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
}

.replication-form legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 0 5px;
}

.replication-period-fields {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(190px, 1fr));
}

.playlist-checkboxes {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
}

.checkbox-label {
  align-items: center;
  color: var(--text);
  display: flex;
  font-size: 14px;
  font-weight: 700;
  gap: 8px;
}

.checkbox-label input {
  min-height: auto;
  width: auto;
}

@media (max-width: 1100px) {
  .asset-modal {
    height: auto;
    overflow: auto;
  }

  .asset-modal-inner {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .asset-preview-frame {
    min-height: 420px;
  }
}

.period-tabs {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 16px;
}

.period-tabs button {
  align-items: center;
  background: #111111;
  border-color: #111111;
  border: 1px solid #111111;
  border-radius: var(--radius);
  color: #ffffff;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
}

.period-tabs button:not(.active) {
  background: #ffffff;
  border-color: var(--line);
  color: #111111;
}

.period-form {
  align-items: start;
  display: grid;
  gap: 10px 14px;
  grid-template-columns: 1fr 1fr;
}

.period-fields {
  display: contents;
}

.period-fields[hidden] {
  display: none;
}

.period-form label {
  color: #111111;
  font-size: 18px;
  font-weight: 500;
}

.period-form input {
  font-size: 17px;
  min-height: 34px;
  padding: 2px 6px;
}

.period-form p {
  color: #555555;
  grid-column: 1 / -1;
  margin: 0;
}

.period-form button {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
  grid-column: 1;
  justify-self: start;
}

.playlist-placement {
  border-top: 1px solid var(--line);
  margin-top: 60px;
  padding-top: 18px;
}

.playlist-placement h2 {
  font-size: 18px;
  line-height: 1.2;
  margin: 0 0 12px;
}

.playlist-placement-table {
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.playlist-placement-table th,
.playlist-placement-table td {
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  padding: 10px 0;
  text-align: left;
  vertical-align: top;
}

.playlist-placement-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.playlist-placement-table th:first-child,
.playlist-placement-table td:first-child {
  padding-right: 12px;
  width: 48%;
}

.playlist-placement-table tr:last-child td {
  border-bottom: 0;
}

.playlist-placement-name {
  color: var(--text);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.playlist-pylon-list {
  color: #315b50;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.pylon-heading {
  margin-bottom: 28px;
}

.pylon-heading h1 {
  margin: 0;
}

.pylon-list {
  display: grid;
  gap: 16px;
}

.pylon-row {
  align-items: center;
  background: #c8e4fa;
  border: 2px solid transparent;
  border-radius: 15px;
  color: #000000;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(130px, 1fr) auto 24px 24px;
  min-height: 78px;
  padding: 14px 12px;
}

.pylon-row.selected {
  background: #eefbff;
  border-color: #10a9d3;
}

.pylon-title {
  font-size: 18px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.count-pill {
  background: #ffffff;
  border-radius: 999px;
  color: #111111;
  display: inline-flex;
  font-size: 15px;
  justify-content: center;
  line-height: 1.2;
  padding: 8px 10px;
  white-space: nowrap;
}

.status-dot {
  border-radius: 999px;
  display: block;
  height: 14px;
  justify-self: center;
  position: relative;
  width: 14px;
}

.status-dot::after {
  background: #111111;
  border-radius: 8px;
  bottom: calc(100% + 10px);
  box-shadow: 0 10px 26px rgba(17, 24, 29, 0.22);
  color: #ffffff;
  content: attr(data-tooltip);
  display: none;
  font-size: 12px;
  font-weight: 800;
  left: 50%;
  line-height: 1.25;
  max-width: 220px;
  opacity: 0;
  padding: 8px 10px;
  pointer-events: none;
  position: absolute;
  text-align: left;
  transform: translate(-50%, 4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: pre-line;
  width: max-content;
  z-index: 5;
}

.status-dot:hover::after {
  display: block;
  opacity: 1;
  transform: translate(-50%, 0);
}

.pylon-row .status-dot:last-child::after {
  left: auto;
  right: 0;
  transform: translateY(4px);
}

.pylon-row .status-dot:last-child:hover::after {
  transform: translateY(0);
}

.status-dot.online {
  background: #2ec978;
}

.status-dot.offline {
  background: #ef4e43;
}

.empty-state,
.customer-empty p {
  color: var(--muted);
  margin: 0;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px 18px;
  }

  .nav {
    flex-wrap: wrap;
  }

  .shell {
    padding: 24px 18px 44px;
  }

  .hero h1,
  .page-heading h1 {
    font-size: 32px;
  }

  .grid.two,
  .metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1240px) {
  .customer-panel {
    grid-template-columns: 1fr;
  }

  .assets-card {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .customer-card,
  .customer-empty {
    border-radius: 12px;
    padding: 18px;
  }

  .customer-card h1,
  .customer-empty h1 {
    font-size: 24px;
  }

  .asset-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .asset-thumb {
    height: 64px;
    width: 64px;
  }

  .period-form,
  .customer-admin-row,
  .pylon-heading,
  .pylon-row {
    grid-template-columns: 1fr;
  }

  .asset-modal-inner {
    grid-template-columns: 1fr;
  }

  .asset-preview-frame {
    min-height: 320px;
    padding: 18px;
  }

  .asset-modal-details {
    padding: 22px;
  }

  .replication-period-fields {
    grid-template-columns: 1fr;
  }

  .count-pill,
  .status-dot {
    justify-self: start;
  }
}
