/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --ink: #171a1f;
  --muted: #6e7683;
  --line: #dfe4eb;
  --surface: #ffffff;
  --surface-soft: #f4f6f8;
  --blue: #3f8fbf;
  --blue-soft: #dceef7;
  --amber: #e98b2a;
  --danger: #be4b55;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 26, 31, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 26, 31, 0.035) 1px, transparent 1px),
    var(--surface-soft);
  background-size: 42px 42px;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

a {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.theme-hub {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 10px 0 44px;
}

.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-heading p {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hub-header h1 {
  margin: 0;
  font-size: clamp(30px, 3vw, 44px);
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: 0;
}

.period-badge {
  min-width: 252px;
  margin-bottom: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  text-align: right;
}

.period-badge span,
.period-badge strong {
  display: block;
}

.period-badge span {
  color: var(--muted);
  font-size: 12px;
}

.period-badge strong {
  margin-top: 3px;
  font-size: 16px;
}

.filter-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
}

.tag-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.tag-chip.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.hub-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.control-cluster {
  display: grid;
  gap: 7px;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
}

.control-pill,
.report-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.control-pill {
  padding: 0 11px;
  color: var(--muted);
}

.control-pill.active {
  background: var(--ink);
  color: #fff;
}

.report-trigger {
  align-self: end;
  min-height: 42px;
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 6px;
}

.metric-card,
.platform-panel,
.report-panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 46px rgba(28, 35, 46, 0.06);
}

.metric-card {
  min-height: 148px;
  padding: 22px;
}

.metric-card.primary {
  background: var(--ink);
  color: #fff;
}

.metric-label,
.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric-card.primary .metric-label,
.metric-card.primary small {
  color: rgba(255, 255, 255, 0.72);
}

.metric-card strong {
  display: block;
  margin: 20px 0 8px;
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 850;
  line-height: 0.95;
  letter-spacing: 0;
}

.hub-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.95fr);
  gap: 18px;
  margin-top: 18px;
}

.platform-panel,
.report-panel {
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 850;
  letter-spacing: 0;
}

.panel-heading span {
  min-width: max-content;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.platform-list {
  display: grid;
}

.platform-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.78fr) minmax(150px, 1.1fr) minmax(270px, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 102px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.platform-row:last-child {
  border-bottom: 0;
}

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

.platform-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--platform-color);
}

.platform-identity strong,
.platform-identity small {
  display: block;
}

.platform-identity strong {
  font-size: 17px;
}

.platform-identity small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.reach-track {
  height: 10px;
  border-radius: 999px;
  background: #edf1f4;
  overflow: hidden;
}

.reach-track span {
  display: block;
  width: var(--reach-share);
  height: 100%;
  border-radius: inherit;
  background: var(--platform-color);
}

.platform-row dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.platform-row dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.platform-row dd {
  margin: 5px 0 0;
  font-size: 16px;
  font-weight: 850;
}

.platform-empty {
  position: absolute;
  right: 0;
  bottom: 10px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.report-summary {
  margin: 22px 0;
  color: #303640;
  font-size: 17px;
  line-height: 1.7;
}

.report-panel section + section {
  margin-top: 24px;
}

.report-panel h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 850;
}

.report-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-list li {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 10px;
  color: #454d59;
  font-size: 14px;
  line-height: 1.55;
}

.report-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 2px;
  background: var(--blue);
}

.report-list.action li::before {
  background: var(--amber);
}

.empty-state {
  margin-top: 32px;
  padding: 48px;
}

.empty-state h1 {
  margin: 0 0 10px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1040px) {
  .metric-grid,
  .hub-workspace {
    grid-template-columns: 1fr 1fr;
  }

  .report-panel {
    grid-column: 1 / -1;
  }

  .platform-row {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 0;
  }

  .platform-empty {
    position: static;
  }
}

@media (max-width: 720px) {
  .theme-hub {
    width: min(100% - 24px, 1440px);
    padding-top: 18px;
  }

  .hub-header,
  .filter-band {
    align-items: stretch;
    flex-direction: column;
  }

  .period-badge {
    min-width: 0;
    margin-bottom: 18px;
    text-align: left;
  }

  .metric-grid,
  .hub-workspace {
    grid-template-columns: 1fr;
  }

  .hub-controls {
    justify-content: stretch;
  }

  .control-cluster,
  .report-trigger {
    flex: 1 1 160px;
  }

  .segmented-control {
    width: 100%;
  }

  .platform-row dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-page {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 10px 0 48px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-header h1 {
  margin: 0;
  font-size: clamp(30px, 3vw, 44px);
  font-weight: 850;
  line-height: 1.05;
}

.admin-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.admin-link,
.admin-action,
.admin-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.admin-link {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 16px;
}

.admin-flash {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.admin-flash.alert {
  border-color: rgba(190, 75, 85, 0.35);
  color: var(--danger);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.admin-stats article,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 46px rgba(28, 35, 46, 0.06);
}

.admin-stats article {
  min-height: 96px;
  padding: 18px;
}

.admin-stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-stats strong {
  display: block;
  margin-top: 12px;
  font-size: 34px;
  line-height: 1;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
}

.admin-forms {
  display: grid;
  gap: 18px;
}

.admin-panel {
  padding: 20px;
}

.admin-panel-heading {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.admin-panel-heading p {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.admin-panel-heading h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 850;
}

.admin-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.admin-field,
.admin-field-grid {
  display: grid;
  gap: 8px;
}

.admin-field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-input,
.admin-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
}

.admin-input {
  height: 42px;
  padding: 0 12px;
}

.admin-textarea {
  min-height: 94px;
  padding: 11px 12px;
  resize: vertical;
}

.admin-input:focus,
.admin-textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(63, 143, 191, 0.12);
}

.admin-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.admin-radio:checked + .admin-pill {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.admin-radio:focus-visible + .admin-pill {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.admin-action {
  width: max-content;
  border: 0;
  background: var(--blue);
  color: #fff;
  padding: 0 18px;
  cursor: pointer;
}

.admin-records {
  display: grid;
}

.admin-record {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 96px;
  border-bottom: 1px solid var(--line);
}

.admin-record:last-child {
  border-bottom: 0;
}

.admin-record strong,
.admin-record small {
  display: block;
}

.admin-record small {
  margin-top: 5px;
  color: var(--muted);
}

.admin-record dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.admin-record dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.admin-record dd {
  margin: 4px 0 0;
  font-weight: 850;
}

.admin-delete {
  border: 1px solid rgba(190, 75, 85, 0.35);
  background: rgba(190, 75, 85, 0.08);
  color: var(--danger);
  padding: 0 12px;
  cursor: pointer;
}

@media (max-width: 960px) {
  .admin-grid,
  .admin-field-grid,
  .admin-field-grid.three {
    grid-template-columns: 1fr;
  }

  .admin-record {
    grid-template-columns: 1fr;
    padding: 18px 0;
  }
}

@media (max-width: 720px) {
  .admin-page {
    width: min(100% - 24px, 1440px);
  }

  .admin-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .admin-record dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
