/* Platform setup disclosure (renders on each opportunity card) */
.platform-setup {
  margin: 6px 0 10px;
  border: 1px solid #DCE7DF;
  border-radius: 8px;
  background: #F6FBF7;
  overflow: hidden;
}
.platform-setup summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #064425;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.platform-setup summary::-webkit-details-marker { display: none; }
.platform-setup summary::after {
  content: "▾";
  margin-left: auto;
  font-size: 10px;
  color: #178442;
  transition: transform 0.15s;
}
.platform-setup[open] summary::after { transform: rotate(180deg); }
.platform-setup summary:hover { background: #ECF6EF; }
.platform-setup-body {
  padding: 4px 16px 14px;
  border-top: 1px solid #DCE7DF;
  background: white;
}
.platform-setup-blurb {
  font-size: 13px;
  color: #2E3A33;
  line-height: 1.5;
  margin: 10px 0 12px;
}
.platform-setup-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.platform-setup-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: #2E3A33;
  line-height: 1.55;
}
.platform-setup-steps li { margin-bottom: 8px; }
.platform-setup-steps li:last-child { margin-bottom: 0; }

:root {
  --gam-leaf: #1FA851;
  --gam-leaf-deep: #178442;
  --gam-forest: #064425;
  --gam-mint: #E8F5EC;
  --gam-mint-deep: #D4ECDC;
  --ink: #1A1F1B;
  --ink-2: #4A524C;
  --ink-3: #8A938C;
  --bg: #FAFBF9;
  --surface: #FFFFFF;
  --border: #E6E9E6;
  --border-strong: #CDD3CE;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 2px rgba(6, 68, 37, 0.04);
  --shadow-modal: 0 20px 60px rgba(6, 68, 37, 0.18);
  --pill-blue-bg: #E6F1FB;
  --pill-blue-fg: #0C447C;
  --pill-teal-bg: #E1F5EE;
  --pill-teal-fg: #085041;
  --pill-amber-bg: #FAEEDA;
  --pill-amber-fg: #633806;
  --pill-purple-bg: #EEEDFE;
  --pill-purple-fg: #3C3489;
  --pill-coral-bg: #FAECE7;
  --pill-coral-fg: #712B13;
  --pill-pink-bg: #FBEAF0;
  --pill-pink-fg: #72243E;
  --pill-red-bg: #FCEBEB;
  --pill-red-fg: #791F1F;
  --pill-gray-bg: #EFF1EE;
  --pill-gray-fg: #4A524C;
}

* { box-sizing: border-box; }
/* HTML hidden attribute must always win over class display rules.
   Without this, e.g. .tab-panel[hidden] could still render if a class sets display. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 16px; }
.brand-link { display: flex; align-items: center; cursor: default; text-decoration: none; }
.brand-logo { height: 32px; width: auto; display: block; }
.admin-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--gam-forest); color: white;
  font-size: 12px; font-weight: 600; letter-spacing: 0.2px;
  text-decoration: none; cursor: pointer;
  transition: background 0.12s, transform 0.06s;
}
.admin-pill:hover { background: #053219; }
.admin-pill:active { transform: translateY(1px); }
.admin-pill .ti { font-size: 14px; }
.brand-divider { width: 1px; height: 28px; background: var(--border-strong); }
.client-context .client-name { font-size: 15px; font-weight: 600; color: var(--gam-forest); }
.client-context .client-url { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.date { font-size: 13px; color: var(--ink-2); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gam-mint); color: var(--gam-forest);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}

.main { max-width: 1100px; margin: 0 auto; padding: 28px; }

.metrics-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 28px;
}
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}
.metric-label { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.metric-value { font-size: 28px; font-weight: 600; color: var(--gam-forest); margin: 4px 0 2px; line-height: 1.1; }
.metric-sub { font-size: 12px; color: var(--ink-3); }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-header h2 {
  font-size: 18px; font-weight: 600; color: var(--gam-forest); margin: 0;
}
.filter-group { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: var(--radius-md); border: 1px solid var(--border); }
.filter-btn {
  font-size: 12px; padding: 6px 12px;
  background: transparent; border: 0; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.filter-btn:hover { color: var(--ink); }
.filter-btn.is-active { background: var(--gam-forest); color: white; }

.opportunities { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }

.opp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.12s;
}
.opp-card:hover { border-color: var(--border-strong); }
.opp-card.is-approved { opacity: 0.75; background: #F6FAF7; }
.opp-card.is-passed { opacity: 0.5; }

.opp-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pill {
  font-size: 11px; padding: 4px 9px; border-radius: 999px;
  font-weight: 600; letter-spacing: 0.2px;
  display: inline-flex; align-items: center; gap: 4px;
}
.pill-blue { background: var(--pill-blue-bg); color: var(--pill-blue-fg); }
.pill-teal { background: var(--pill-teal-bg); color: var(--pill-teal-fg); }
.pill-amber { background: var(--pill-amber-bg); color: var(--pill-amber-fg); }
.pill-purple { background: var(--pill-purple-bg); color: var(--pill-purple-fg); }
.pill-coral { background: var(--pill-coral-bg); color: var(--pill-coral-fg); }
.pill-pink { background: var(--pill-pink-bg); color: var(--pill-pink-fg); }
.pill-red { background: var(--pill-red-bg); color: var(--pill-red-fg); }
.pill-gray { background: var(--pill-gray-bg); color: var(--pill-gray-fg); font-weight: 500; }
.pill-success { background: var(--gam-mint); color: var(--gam-forest); font-weight: 600; }
.pill-success:hover { background: #d6edd9; }

/* Q&A phase card variants */
.opp-qa-setup {
  border-left: 4px solid #E89E48;
  background: linear-gradient(to right, #FFF8EF 0%, var(--surface) 80%);
}
.opp-qa-warmup {
  border-left: 4px solid #4A6FB5;
  background: linear-gradient(to right, #F4F7FE 0%, var(--surface) 80%);
}

/* Account card - needs-signup variant */
.account-needs-signup {
  background: #FFF8EF;
  border-color: #F2C892;
}
.account-needs-signup .account-platform {
  color: #8C4A00;
}
.pill .ti { font-size: 12px; }
.meta-spacer { flex: 1; }
.meta-right { font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 4px; }
.meta-right.is-success { color: var(--gam-leaf-deep); font-weight: 600; }
.meta-right.is-muted { color: var(--ink-3); }

.opp-title { font-size: 15px; font-weight: 600; color: var(--gam-forest); margin: 0 0 6px; }
.opp-draft { font-size: 13px; color: var(--ink-2); line-height: 1.65; margin: 0 0 14px; }

.opp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  font-size: 12px; padding: 7px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink);
  font-weight: 500; transition: background 0.12s, border-color 0.12s, transform 0.04s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--bg); border-color: var(--ink-3); }
.btn:active { transform: scale(0.98); }
.btn .ti { font-size: 14px; }
.btn-primary { background: var(--gam-leaf); color: white; border-color: var(--gam-leaf); font-weight: 600; }
.btn-primary:hover { background: var(--gam-leaf-deep); border-color: var(--gam-leaf-deep); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: var(--bg); color: var(--ink-2); }

.opp-approved-line, .opp-passed-line { font-size: 13px; color: var(--ink-3); }

.footer-status {
  display: flex; align-items: center; gap: 12px;
  background: var(--gam-mint); border: 1px solid var(--gam-mint-deep);
  border-radius: var(--radius-md); padding: 14px 18px;
  color: var(--gam-forest);
}
.footer-status .ti { font-size: 20px; color: var(--gam-forest); }
.footer-status div { flex: 1; font-size: 13px; }
.ghost-btn { background: transparent; border: 1px solid var(--gam-forest); color: var(--gam-forest); padding: 5px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.ghost-btn:hover { background: var(--gam-forest); color: white; }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6, 68, 37, 0.35);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 64px 20px 20px; z-index: 100;
  overflow-y: auto;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 720px; padding: 32px;
  box-shadow: var(--shadow-modal); position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: transparent; border: 0; padding: 6px; border-radius: var(--radius-sm);
  color: var(--ink-2);
}
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-close .ti { font-size: 22px; }
.modal h3 { font-size: 18px; color: var(--gam-forest); margin: 0 0 8px; font-weight: 600; }
.modal h4 { font-size: 14px; color: var(--gam-forest); margin: 18px 0 8px; font-weight: 600; }
.modal p { font-size: 14px; color: var(--ink-2); line-height: 1.65; margin: 0 0 12px; }
.modal .howto-step {
  display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border);
}
.modal .howto-step:first-of-type { border-top: 0; }
.step-num {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: var(--gam-mint); color: var(--gam-forest);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.step-text { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.step-text strong { color: var(--gam-forest); font-weight: 600; }
.draft-box {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 16px;
  font-size: 13px; color: var(--ink); line-height: 1.7;
  margin: 8px 0 12px; font-family: 'Inter', sans-serif;
  white-space: pre-wrap;
}

/* === Tab nav (Today / Accounts / Library / History) === */
.tab-nav {
  display: flex; gap: 4px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  position: sticky; top: 60px; z-index: 9;
}
.tab-btn {
  font-size: 14px; font-weight: 500;
  padding: 14px 16px;
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 8px;
  transition: color 0.12s, border-color 0.12s;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.is-active { color: var(--gam-forest); border-bottom-color: var(--gam-leaf); }
.tab-btn .ti { font-size: 16px; }

.tab-panel { display: block; }
.tab-panel[hidden] { display: none; }

.panel-intro { margin-bottom: 24px; }
.panel-intro h2 { font-size: 22px; font-weight: 600; color: var(--gam-forest); margin: 0 0 6px; }
.panel-intro p { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin: 0; max-width: 640px; }

/* === Accounts === */
.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-card);
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
}
.account-platform { font-size: 13px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.account-handle { font-size: 16px; font-weight: 600; color: var(--gam-forest); margin: 2px 0 8px; font-family: ui-monospace, monospace; }
.account-next { font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.tier-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px;
  white-space: nowrap;
}
.tier-fresh { background: #FCE4D6; color: #993C1D; }
.tier-established { background: #FFF2CC; color: #854F0B; }
.tier-recognized { background: #E2EFDA; color: #085041; }
.tier-trusted { background: #C6EFCE; color: #173404; }
.account-stats { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* === Library (platform how-tos) === */
.lib-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.lib-card-header { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.lib-platform-name { font-size: 16px; font-weight: 600; color: var(--gam-forest); }
.lib-description { font-size: 13px; color: var(--ink-2); line-height: 1.55; margin: 8px 0 0; }
.lib-body { display: none; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.lib-card.is-open .lib-body { display: block; }
.lib-section { margin-bottom: 16px; }
.lib-section h4 { font-size: 13px; font-weight: 600; color: var(--gam-forest); margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.4px; }
.lib-section ol, .lib-section ul { margin: 0; padding-left: 20px; font-size: 13px; color: var(--ink-2); line-height: 1.65; }
.lib-section li { margin-bottom: 4px; }
.lib-section .lib-text { font-size: 13px; color: var(--ink-2); line-height: 1.65; }
.lib-toggle { font-size: 13px; color: var(--ink-3); padding: 4px; }
.lib-card.is-open .lib-toggle { transform: rotate(180deg); }

/* Q&A opportunity card extras (when track === 'qa') */
.opp-qa .opp-platform-howto {
  background: var(--gam-mint);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 10px 0;
  font-size: 12px;
}
.opp-qa .opp-platform-howto h5 { font-size: 11px; font-weight: 600; color: var(--gam-forest); margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.opp-qa .opp-platform-howto ol { margin: 0; padding-left: 18px; color: var(--ink-2); line-height: 1.55; }
.opp-qa .account-flag { font-size: 11px; color: var(--ink-3); margin-left: 8px; }

@media (max-width: 720px) {
  .top-bar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .main { padding: 18px 14px; }
  .metrics-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .metric { padding: 14px; }
  .metric-value { font-size: 22px; }
  .brand-divider { display: none; }
  .client-context .client-url { display: none; }
  .date { display: none; }
  .top-actions { gap: 8px; }

  /* Tab nav: allow horizontal scroll instead of squishing */
  .tab-nav {
    overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch;
    padding-bottom: 4px; scrollbar-width: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn { flex-shrink: 0; font-size: 13px; padding: 8px 12px; }

  /* Section headers stack the title above the filter buttons */
  .section-header {
    flex-direction: column; align-items: flex-start; gap: 10px;
  }
  .section-header h2 {
    font-size: 16px; line-height: 1.35; flex-wrap: wrap; gap: 6px !important;
  }
  /* The description span next to section titles - full width on mobile */
  .section-header h2 > span:last-child:not(.pill) {
    width: 100%; margin-left: 0 !important; font-size: 11px !important;
  }
  .filter-group { flex-wrap: wrap; gap: 4px; }
  .filter-btn { font-size: 12px; padding: 6px 10px; }

  /* Opportunity cards: smaller padding, stack actions */
  .opp-card { padding: 16px 14px; }
  .opp-meta {
    flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: flex-start;
  }
  .opp-meta .meta-spacer { display: none; }
  .opp-meta .meta-right { width: 100%; margin-top: 2px; }
  .opp-title { font-size: 15px; line-height: 1.4; }
  .opp-draft { font-size: 13px; }
  .opp-actions {
    flex-wrap: wrap; gap: 6px;
  }
  .opp-actions .btn { font-size: 12px; padding: 8px 12px; flex: 1 1 auto; min-width: 0; }
  .opp-actions .btn-ghost { flex: 0 1 auto; }
  .opp-actions span:not(.pill) { width: 100%; margin-bottom: 4px; }

  /* Account cards: stack the right-side tier badge under the content */
  .account-card {
    flex-direction: column; align-items: stretch; gap: 10px; padding: 14px;
  }
  .account-card > div:first-child { flex: 1 1 100%; }
  .account-card > div:last-child { text-align: left; }
  .account-platform { font-size: 14px; }
  .account-handle { font-size: 13px; flex-wrap: wrap; }
  .account-next { font-size: 12px; }
  .account-stats { font-size: 11px; }

  /* Footer status: stack */
  .footer-status {
    flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px;
  }

  /* Panel intro (Accounts tab) with the wizard button */
  .panel-intro {
    flex-direction: column !important; align-items: flex-start !important;
  }
  .panel-intro #open-wizard-btn { width: 100%; justify-content: center; }

  /* Modal (existing one, not the wizard) */
  .modal { padding: 22px 18px; }
}

/* Very narrow phones */
@media (max-width: 400px) {
  .metrics-row { grid-template-columns: 1fr 1fr; }
  .opp-card { padding: 14px 12px; }
  .opp-actions .btn { font-size: 12px; padding: 8px 10px; }
}
