:root {
  color-scheme: light;
  --ink: #172126;
  --muted: #647178;
  --soft: #f3f6f8;
  --surface: #ffffff;
  --line: #d9e2e7;
  --line-strong: #b9c8d0;
  --red: #d53c3c;
  --teal: #087f78;
  --amber: #b46d1d;
  --green: #2f8f46;
  --blue: #2c6d9f;
  --shadow: 0 18px 45px rgba(23, 33, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.access-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(47, 143, 70, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}

.content-area,
.side-panel {
  min-width: 0;
}

.intro-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 30px 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 680px;
  margin-bottom: 0;
  font-size: 2.35rem;
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 0.95rem;
  line-height: 1.3;
}

.primary-action,
.card-link,
.card-copy,
.ghost-button,
.filter-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.primary-action {
  gap: 8px;
  padding: 0 16px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 750;
}

.primary-action:hover,
.card-link:hover {
  transform: translateY(-1px);
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-box {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 44px;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(8, 127, 120, 0.1);
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.filter-tab {
  min-width: 76px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.filter-tab:hover,
.filter-tab.is-active {
  border-color: var(--line-strong);
  background: var(--ink);
  color: #ffffff;
}

.result-count {
  min-height: 24px;
  margin: 16px 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-card {
  position: relative;
  display: flex;
  min-height: 290px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(23, 33, 38, 0.05);
}

.dashboard-card::before {
  content: "";
  display: block;
  height: 6px;
  background: var(--accent, var(--teal));
}

.card-body {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  padding: 18px;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 118px;
}

.card-icon,
.card-logo {
  display: grid;
  width: min(240px, 100%);
  height: 118px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent, var(--teal)) 11%, #ffffff);
  color: var(--accent, var(--teal));
  font-size: 1.2rem;
  font-weight: 900;
}

.card-icon {
  width: 44px;
  height: 44px;
}

.card-logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100% - 18px);
  max-height: calc(100% - 18px);
  object-fit: contain;
  mix-blend-mode: multiply;
}

.dashboard-card[data-dashboard="webmea"] .card-logo {
  background: #070707;
}

.dashboard-card[data-dashboard="webmea"] .card-logo img {
  mix-blend-mode: normal;
}

.card-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f5f8f9;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.dashboard-card h3 {
  margin: 12px 0 8px;
  font-size: 1.22rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.dashboard-card p {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 100%;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.meta-item span,
.meta-item strong {
  display: block;
}

.meta-item span {
  color: var(--muted);
  font-size: 0.74rem;
}

.meta-item strong {
  margin-top: 3px;
  font-size: 0.86rem;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.card-link {
  gap: 8px;
  padding: 0 12px;
  background: var(--accent, var(--teal));
  color: #ffffff;
  font-weight: 800;
}

.card-copy,
.ghost-button {
  min-width: 44px;
  padding: 0 12px;
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
  font-weight: 750;
}

.card-copy:hover,
.ghost-button:hover {
  border-color: var(--line-strong);
  background: #f7fafb;
}

.side-panel {
  display: grid;
  gap: 14px;
}

.signal-visual {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.signal-visual canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 13 / 9;
}

.quick-section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(23, 33, 38, 0.05);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.section-heading .ghost-button {
  min-height: 34px;
  font-size: 0.8rem;
}

.recent-list {
  display: grid;
  gap: 8px;
}

.recent-link,
.empty-state {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  text-decoration: none;
}

.recent-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent, var(--teal));
}

.recent-link span,
.empty-state span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 750;
}

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

.mini-stats {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.mini-stats div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 38px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.mini-stats div:last-child {
  border-bottom: 0;
}

.mini-stats dt {
  color: var(--muted);
}

.mini-stats dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: min(320px, calc(100vw - 36px));
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

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

  .side-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .signal-visual {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 12px;
  }

  .topbar,
  .intro-row {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 1.8rem;
    line-height: 1.12;
  }

  .primary-action {
    width: 100%;
  }

  .control-panel {
    grid-template-columns: 1fr;
  }

  .filter-tabs {
    justify-content: flex-start;
  }

  .dashboard-grid,
  .side-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .card-top {
    min-height: auto;
  }

  .card-logo {
    width: min(215px, 100%);
    height: 104px;
  }

  .filter-tab {
    flex: 1 1 calc(50% - 8px);
  }

  .card-meta {
    grid-template-columns: 1fr;
  }

  .card-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
