/* Content OS — premium design system. Warm paper + violet, Inter Tight. House brand (site-v2). */

:root {
  --paper:   #FAF9F6;
  --paper-2: #F3F1EB;
  --card:    #FFFFFF;
  --ink:     #16141C;
  --text:    #4A4754;
  --muted:   #8A8794;
  --line:    #ECEAE4;
  --line-2:  #E2DFD7;
  --violet:  #5B46C9;
  --violet-d:#4A38A8;
  --violet-soft: #EEEBFA;
  --reach:   #2F8F6B;   /* track: reach (green) */
  --reach-soft: #E6F3EC;
  --icp:     #5B46C9;   /* track: icp (violet) */
  --icp-soft: #EEEBFA;
  --amber:   #B7791F;
  --amber-soft: #FBF1DD;
  --danger:  #C0392B;
  --ok:      #2F8F6B;
  --shadow:  0 1px 2px rgba(22,20,28,.04), 0 8px 24px rgba(22,20,28,.06);
  --shadow-lg: 0 12px 40px rgba(22,20,28,.14);
  --r-sm: 8px;
  --r:    13px;
  --r-lg: 18px;
  --rail-w: 232px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Inter Tight", var(--sans);
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--display); color: var(--ink); font-weight: 500; margin: 0; letter-spacing: -.01em; }
a { color: var(--violet); text-decoration: none; }
.hidden { display: none !important; }

/* --- buttons ---------------------------------------------------------------------------------- */
.btn {
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  padding: 9px 15px; border-radius: var(--r-sm); cursor: pointer;
  transition: all .16s ease; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn:hover { border-color: var(--violet); color: var(--violet); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--violet); border-color: var(--violet); color: #fff; box-shadow: 0 4px 14px rgba(91,70,201,.28); }
.btn-primary:hover { background: var(--violet-d); border-color: var(--violet-d); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 8px 10px; }
.btn-ghost:hover { color: var(--violet); background: var(--violet-soft); transform: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; font-family: var(--sans); padding: 2px 4px; }
.link-btn:hover { color: var(--violet); }

/* --- login ------------------------------------------------------------------------------------ */
.login { position: fixed; inset: 0; background: var(--paper); display: flex; align-items: center; justify-content: center; z-index: 100; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 40px 36px; width: 340px; box-shadow: var(--shadow-lg); text-align: center; display: flex; flex-direction: column; gap: 14px; }
.login-mark { font-family: var(--display); font-weight: 600; font-size: 26px; color: var(--ink); letter-spacing: -.02em; }
.login-sub { margin: -8px 0 6px; color: var(--muted); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.login-input { padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-size: 15px; font-family: var(--sans); outline: none; transition: border .15s; }
.login-input:focus { border-color: var(--violet); }
.login-btn { justify-content: center; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* --- app shell -------------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; height: 100vh; }

.rail { background: var(--paper-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 16px; gap: 10px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--violet); color: #fff; font-family: var(--display); font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(91,70,201,.3); }
.brand-mark span { font-size: 10px; opacity: .85; margin-left: 1px; }
.brand-text { font-family: var(--display); font-weight: 500; font-size: 17px; color: var(--ink); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: none; background: none; border-radius: var(--r-sm); font-family: var(--sans); font-size: 14.5px; font-weight: 500; color: var(--text); cursor: pointer; text-align: left; transition: all .14s; }
.nav-item:hover { background: rgba(91,70,201,.07); color: var(--violet); }
.nav-item.active { background: var(--violet); color: #fff; box-shadow: 0 4px 14px rgba(91,70,201,.26); }
.nav-item.active .ni-ico { opacity: 1; }
.ni-ico { width: 18px; text-align: center; opacity: .55; font-size: 14px; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.streak-chip { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 14px; box-shadow: var(--shadow); }
.streak-flame { font-size: 17px; filter: grayscale(1) opacity(.5); }
.streak-chip.lit .streak-flame { filter: none; }
.streak-num { font-family: var(--display); font-weight: 600; font-size: 20px; color: var(--ink); }
.streak-label { font-size: 12px; color: var(--muted); }
.rail-meta { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.perm-chip { font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* --- main ------------------------------------------------------------------------------------- */
.main { overflow-y: auto; height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(250,249,246,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 20px 34px; display: flex; align-items: center; justify-content: space-between; }
.page-title { font-size: 24px; font-weight: 500; }
.page-sub { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.week-badge { font-family: var(--mono); font-size: 12px; color: var(--violet); background: var(--violet-soft); padding: 5px 11px; border-radius: 20px; }

.view { padding: 28px 34px 80px; max-width: 1180px; }

/* --- generic cards & layout ------------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.row { display: flex; gap: 14px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-family: var(--sans); font-weight: 600; margin: 26px 0 14px; }
.section-title:first-child { margin-top: 0; }

/* --- skill run cards (the buttons that do the work) ------------------------------------------- */
.skill-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; transition: border .15s, transform .15s; }
.skill-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.skill-card.hero { border-left: 3px solid var(--violet); }
.skill-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.skill-title { font-family: var(--display); font-size: 18px; font-weight: 500; color: var(--ink); }
.skill-eta { font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--paper-2); padding: 3px 8px; border-radius: 12px; white-space: nowrap; }
.skill-blurb { font-size: 13.5px; color: var(--text); line-height: 1.55; }
.skill-writes { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.skill-writes b { color: var(--text); font-weight: 500; }
.skill-arg { width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; font-family: var(--sans); font-size: 13.5px; resize: vertical; min-height: 0; outline: none; transition: border .15s; }
.skill-arg:focus { border-color: var(--violet); }
.skill-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }

/* --- pills / tags ----------------------------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 20px; background: var(--paper-2); color: var(--text); border: 1px solid var(--line); }
.pill.reach { background: var(--reach-soft); color: var(--reach); border-color: transparent; }
.pill.icp { background: var(--icp-soft); color: var(--icp); border-color: transparent; }
.pill.proven { background: var(--reach-soft); color: var(--reach); border-color: transparent; }
.pill.variation { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.pill.new { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.pill.ghost { background: transparent; }

/* --- hook browser ----------------------------------------------------------------------------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filter-search { flex: 1; min-width: 200px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 13px; font-family: var(--sans); font-size: 14px; outline: none; }
.filter-search:focus { border-color: var(--violet); }
.seg { display: inline-flex; background: var(--paper-2); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { border: none; background: none; padding: 6px 12px; border-radius: 6px; font-family: var(--sans); font-size: 13px; color: var(--muted); cursor: pointer; transition: all .14s; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.hook-list { display: flex; flex-direction: column; gap: 10px; }
.hook { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 15px 18px; display: flex; flex-direction: column; gap: 9px; transition: border .15s; }
.hook:hover { border-color: var(--line-2); }
.hook-text { font-size: 14.5px; color: var(--ink); line-height: 1.5; }
.hook-meta { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.hook-src { font-size: 11.5px; color: var(--muted); font-style: italic; }
.count-note { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* --- pipeline / packet stages ----------------------------------------------------------------- */
.stages { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.stage { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.stage .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.stage.done { color: var(--ink); }
.stage.done .dot { background: var(--reach); }
.stage-sep { width: 22px; height: 1px; background: var(--line-2); margin: 0 8px; }

/* --- library board ---------------------------------------------------------------------------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: 220px; gap: 14px; overflow-x: auto; padding-bottom: 16px; }
.col { background: var(--paper-2); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.col-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 2px 4px; }
.col-count { background: var(--card); border-radius: 10px; padding: 1px 7px; font-size: 11px; }
.vcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; cursor: pointer; box-shadow: var(--shadow); transition: transform .14s, border .14s; display: flex; flex-direction: column; gap: 8px; }
.vcard:hover { transform: translateY(-2px); border-color: var(--violet); }
.vcard-title { font-size: 13.5px; color: var(--ink); font-weight: 500; line-height: 1.35; }
.vcard-meta { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- metrics / analytics ---------------------------------------------------------------------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); }
.kpi-num { font-family: var(--display); font-size: 30px; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }
.kpi-label { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.track-panel { border-top: 3px solid var(--line-2); }
.track-panel.reach { border-top-color: var(--reach); }
.track-panel.icp { border-top-color: var(--icp); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 12px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); }

/* --- empty states ----------------------------------------------------------------------------- */
.empty { text-align: center; padding: 46px 24px; color: var(--muted); background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--r); }
.empty-ico { font-size: 30px; opacity: .4; margin-bottom: 10px; }
.empty h3 { color: var(--text); font-weight: 500; margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 420px; margin: 0 auto 14px; }

/* --- markdown render -------------------------------------------------------------------------- */
.md { font-size: 14.5px; line-height: 1.65; color: var(--text); }
.md h1, .md h2, .md h3 { margin: 20px 0 10px; }
.md h1 { font-size: 21px; } .md h2 { font-size: 18px; } .md h3 { font-size: 15.5px; }
.md p { margin: 10px 0; }
.md ul, .md ol { margin: 10px 0; padding-left: 22px; }
.md li { margin: 4px 0; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--paper-2); padding: 2px 5px; border-radius: 4px; }
.md pre { background: var(--paper-2); padding: 14px; border-radius: var(--r-sm); overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.md blockquote { border-left: 3px solid var(--violet); margin: 12px 0; padding: 2px 14px; color: var(--muted); }
.md hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* --- run console ------------------------------------------------------------------------------ */
.console-fab { position: fixed; right: 26px; bottom: 26px; z-index: 40; background: var(--ink); color: #fff; border: none; border-radius: 24px; padding: 12px 20px; font-family: var(--sans); font-weight: 500; font-size: 14px; cursor: pointer; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px; transition: transform .15s; }
.console-fab:hover { transform: translateY(-2px); }
.console-fab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.console-fab-dot.live { background: #4ADE80; box-shadow: 0 0 0 0 rgba(74,222,128,.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,.5);} 70% { box-shadow: 0 0 0 8px rgba(74,222,128,0);} 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0);} }
.console { position: fixed; right: 0; top: 0; bottom: 0; width: 420px; max-width: 92vw; background: var(--card); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 50; transform: translateX(105%); transition: transform .26s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; }
.console.open { transform: translateX(0); }
.console-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.console-body { overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.console-empty { color: var(--muted); font-size: 13.5px; text-align: center; padding: 40px 0; }
.run { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.run-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--paper-2); cursor: pointer; }
.run-name { font-family: var(--display); font-size: 14.5px; color: var(--ink); font-weight: 500; }
.run-status { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 12px; text-transform: uppercase; letter-spacing: .05em; }
.run-status.running { background: var(--violet-soft); color: var(--violet); }
.run-status.done { background: var(--reach-soft); color: var(--reach); }
.run-status.failed { background: #FBE7E4; color: var(--danger); }
.run-log { max-height: 240px; overflow-y: auto; padding: 10px 14px; font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
.ev { display: flex; gap: 8px; align-items: baseline; }
.ev-ico { font-family: var(--mono); color: var(--violet); font-size: 11px; flex-shrink: 0; }
.ev-text { color: var(--text); }
.ev-detail { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.ev.tool .ev-text { color: var(--ink); }
.ev.error .ev-text { color: var(--danger); }
.run-result { padding: 12px 14px; border-top: 1px solid var(--line); background: var(--paper); font-size: 13px; }
.run-result .md { font-size: 13px; }

/* --- modal ------------------------------------------------------------------------------------ */
.modal { position: fixed; inset: 0; background: rgba(22,20,28,.42); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 24px; }
.modal-card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: 540px; max-width: 100%; max-height: 88vh; overflow-y: auto; padding: 26px 28px; }
.modal-card h2 { font-size: 20px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.field input, .field select, .field textarea { border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 9px 12px; font-family: var(--sans); font-size: 14px; outline: none; transition: border .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--violet); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }

/* --- toasts ----------------------------------------------------------------------------------- */
.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--r-sm); font-size: 13.5px; box-shadow: var(--shadow-lg); animation: drop .25s ease; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* --- responsive (narrow GHL iframe panel) ----------------------------------------------------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail { flex-direction: row; align-items: center; height: auto; position: sticky; top: 0; z-index: 20; padding: 10px 14px; gap: 14px; overflow-x: auto; }
  .brand { padding: 0; } .brand-text { display: none; }
  .nav { flex-direction: row; }
  .nav-item span:not(.ni-ico) { display: none; }
  .rail-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; gap: 10px; }
  .streak-label { display: none; }
  .main { height: auto; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .view { padding: 20px 18px 80px; }
  .topbar { padding: 16px 18px; }
}
