:root {
  --bg: #f8f3ec;
  --bg-deep: #f0e4d7;
  --panel: rgba(255, 250, 245, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.93);
  --border: rgba(124, 100, 84, 0.16);
  --text: #271d18;
  --muted: #7a675b;
  --primary: #e7a640;
  --primary-deep: #ca7c1f;
  --accent: #6f68f7;
  --danger: #be5547;
  --warning: #d18a34;
  --success: #6d63f4;
  --shadow: 0 22px 60px rgba(63, 39, 24, 0.12);
  --ink-rgb: 39, 29, 24;
  --primary-rgb: 231, 166, 64;
  --accent-rgb: 111, 104, 247;
  color-scheme: light;
  font-family: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at 14% 18%, rgba(var(--primary-rgb), 0.24), transparent 32%),
    radial-gradient(circle at 88% 14%, rgba(var(--accent-rgb), 0.16), transparent 30%),
    linear-gradient(180deg, #fcf8f2 0%, #f3e7db 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

.hidden {
  display: none !important;
}

.page-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(var(--primary-rgb), 0.97),
    rgba(var(--accent-rgb), 0.9)
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  position: relative;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.brand-mark::before {
  width: 22px;
  height: 6px;
  left: 11px;
  top: 19px;
}

.brand-mark::after {
  width: 6px;
  height: 22px;
  left: 19px;
  top: 11px;
}

.brand-title {
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.1rem;
}

.brand-sub,
.generated-badge,
.user-meta,
.eyebrow,
.mini-label,
.metric-sub,
.stack-meta,
.activity-meta,
.breakdown-meta,
.pill,
.sample-badge {
  font-family: "IBM Plex Mono", monospace;
}

.brand-sub,
.generated-badge,
.user-meta,
.stack-meta,
.activity-meta,
.breakdown-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page {
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--muted);
}

.eyebrow.small {
  margin-bottom: 8px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.3rem, 4vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
  max-width: 12ch;
}

.lede {
  margin-top: 18px;
  max-width: 62ch;
  line-height: 1.7;
  color: var(--muted);
  font-size: 1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-aside {
  display: grid;
  gap: 14px;
}

.hero-pulse {
  background: linear-gradient(
    160deg,
    rgba(var(--primary-rgb), 0.18),
    rgba(var(--accent-rgb), 0.08) 52%,
    rgba(255, 255, 255, 0.78)
  );
  border-radius: 24px;
  padding: 22px;
  border: 1px solid rgba(var(--primary-rgb), 0.18);
}

.hero-pulse strong {
  display: block;
  margin: 8px 0 10px;
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.hero-pulse p {
  color: var(--muted);
  line-height: 1.6;
}

.hero-highlights {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.highlight-card {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 248, 241, 0.9));
  border: 1px solid rgba(var(--ink-rgb), 0.08);
}

.highlight-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.highlight-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.6rem;
  letter-spacing: -0.04em;
}

.state-panel {
  padding: 26px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.state-icon {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    rgba(var(--primary-rgb), 0.22),
    rgba(var(--accent-rgb), 0.16)
  );
  position: relative;
  flex: none;
}

.state-icon::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  inset: 15px;
}

.state-panel h2 {
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.state-panel p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.state-actions {
  margin-left: auto;
}

.dashboard {
  display: grid;
  gap: 18px;
}

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

.metric-card {
  padding: 18px 18px 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 247, 239, 0.92));
  border: 1px solid rgba(var(--ink-rgb), 0.08);
}

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-value {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.metric-sub {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.76rem;
}

.dashboard-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.92fr);
}

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

.analytics-panel,
.activity-panel,
.latest-panel,
.actions-panel {
  padding: 26px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  letter-spacing: -0.04em;
  font-size: 1.45rem;
}

.section-subhead h3 {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.section-subhead p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.55;
}

.trend-chart {
  display: grid;
  gap: 12px;
}

.trend-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 12px;
}

.trend-label,
.trend-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.trend-bar-wrap {
  height: 16px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.08);
  overflow: hidden;
}

.trend-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.breakdown-block {
  margin-top: 26px;
}

.breakdown-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.breakdown-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(var(--ink-rgb), 0.07);
}

.breakdown-item strong {
  font-size: 1.05rem;
}

.breakdown-item .count {
  margin-left: auto;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.04em;
}

.activity-feed,
.stack-list,
.action-grid {
  display: grid;
  gap: 12px;
}

.activity-card {
  position: relative;
  padding: 16px 18px 16px 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(var(--ink-rgb), 0.08);
}

.activity-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 5px;
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.25);
}

.activity-card.tone-success::before {
  background: var(--success);
}

.activity-card.tone-warning::before {
  background: var(--warning);
}

.activity-card.tone-danger::before {
  background: var(--danger);
}

.activity-card.tone-info::before {
  background: var(--primary);
}

.activity-summary {
  font-weight: 700;
  line-height: 1.5;
}

.activity-summary .target {
  color: var(--accent);
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 9px;
}

.pill,
.sample-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(var(--ink-rgb), 0.1);
  background: rgba(255, 250, 245, 0.82);
  font-size: 0.75rem;
  color: var(--muted);
}

.stack-item,
.action-card {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(var(--ink-rgb), 0.08);
}

.stack-item strong,
.action-card strong {
  display: block;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.stack-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.action-card p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.action-card[data-enabled="false"] {
  opacity: 0.8;
}

.action-status {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.18);
  color: #9b5f18;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 247, 239, 0.8));
  border: 1px solid rgba(var(--ink-rgb), 0.08);
}

.user-name {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.primary,
.ghost {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 16px;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  box-shadow: 0 16px 28px rgba(var(--primary-rgb), 0.28);
}

.ghost {
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  border: 1px solid rgba(var(--ink-rgb), 0.12);
}

.primary:hover,
.ghost:hover {
  transform: translateY(-1px);
}

.wide {
  width: 100%;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(30, 21, 17, 0.38);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal-card {
  width: min(100%, 460px);
  padding: 28px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(var(--ink-rgb), 0.06);
  color: var(--text);
  font-size: 1.4rem;
}

.modal-copy {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.auth-form label {
  display: grid;
  gap: 7px;
}

.auth-form span {
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-form input {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid rgba(var(--ink-rgb), 0.12);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

.auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(92vw, 420px);
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(var(--ink-rgb), 0.94);
  color: #fff;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
  z-index: 30;
}

.empty {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
  border: 1px dashed rgba(var(--ink-rgb), 0.16);
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 860px) {
  .page-shell {
    padding: 16px;
  }

  .topbar,
  .state-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .hero-highlights,
  .metric-grid,
  .dashboard-grid.secondary {
    grid-template-columns: 1fr;
  }

  .trend-row {
    grid-template-columns: 72px minmax(0, 1fr) 40px;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions > * {
    width: 100%;
  }

  .user-badge {
    justify-content: space-between;
  }
}
