@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Manrope:wght@400;500;600;700;800&family=Bodoni+Moda:opsz,wght@6..96,400;6..96,500&display=swap');

/* InsideOut London — Systems Register
   Brand v2 tokens, identical to the Pipeline app so the two read as one system. */

:root {
  --dark:   #3A3D40;
  --cream:  #EFEAE0;
  --bronze: #B66A3B;
  --mid:    #F5F0E8;
  --ink:    #1A1A1A;
  --muted:  #7A756D;
  --hair:   #D5CCBF;
  --green:  #3F7A4F;

  /* build-status ramp: green = complete, bronze stepped by lightness for the rest */
  --st-live:    #3F7A4F;
  --st-testing: #B66A3B;
  --st-prog:    #C9A176;
  --st-backlog: #DBC6AF;

  --panel:  #E6DED0;
  --spine:  #E2D8C6;

  --sans:  'Manrope', system-ui, sans-serif;
  --serif: 'Bodoni Moda', Georgia, serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--bronze); }
a:hover { color: #8F4F27; }

.tracked-label {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-weight: 500;
  font-size: 10px;
  color: var(--bronze);
  margin: 0;
}

.mono { font-family: var(--mono); }

/* ---------- login ------------------------------------------------------ */

.login-body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--mid);
  box-shadow: inset 0 0 0 1px #E4DCCE;
  padding: 40px 36px 36px;
}
.wordmark { margin-bottom: 28px; display: block; }
.masthead .wordmark img { display: block; height: auto; max-width: 150px; }
.login-mark { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-bottom: 30px; }
.login-mark img { display: block; height: auto; }
.login-mark img:first-child { width: 52px; }
.login-mark img:last-child { width: min(190px, 70%); }
.wordmark-name {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  color: var(--dark);
  line-height: 1;
}
.wordmark-place {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .32em;
  color: var(--bronze);
  margin-top: 3px;
}
.login-heading {
  font-size: 24px;
  font-weight: 800;
  color: var(--dark);
  margin: 10px 0 10px;
  letter-spacing: -.01em;
}
.login-note { font-size: 14px; line-height: 1.55; color: var(--muted); margin: 0 0 26px; }
.login-card label { display: block; margin-bottom: 8px; }
.login-card input {
  width: 100%;
  font-family: var(--sans);
  font-size: 16px;
  padding: 13px 14px;
  border: 1px solid var(--hair);
  background: var(--cream);
  color: var(--ink);
}
.login-card input:focus { outline: 2px solid var(--bronze); outline-offset: -2px; }
.login-card button {
  width: 100%;
  margin-top: 16px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--cream);
  background: var(--dark);
  border: 0;
  padding: 14px;
  cursor: pointer;
}
.login-card button:hover { background: #2C2E30; }
.login-error { margin: 18px 0 0; font-size: 13px; color: #9B3226; }
.login-foot { margin-top: 26px; font-family: var(--mono); font-size: 10px; color: var(--muted); text-align: center; }

/* ---------- masthead --------------------------------------------------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--hair);
  background: var(--cream);
  position: sticky;
  top: 0;
  z-index: 20;
}
.masthead .wordmark { margin: 0; }
.masthead-actions { display: flex; gap: 10px; align-items: center; }
.ghost-button {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  background: transparent;
  border: 1px solid var(--hair);
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.ghost-button:hover { background: var(--mid); color: var(--dark); }

/* ---------- sheet ------------------------------------------------------ */

.sheet { max-width: 1680px; margin: 0 auto; padding: 30px 26px 80px; }
.sheet-head { margin-bottom: 24px; }
.sheet-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  letter-spacing: -.018em;
  color: var(--dark);
  margin: 10px 0 8px;
  line-height: 1.06;
}
.sheet-sub { font-size: 14px; color: var(--muted); margin: 0; }

.totals { display: flex; flex-wrap: wrap; gap: 26px; margin: 22px 0 6px; }
.total { display: flex; flex-direction: column; gap: 4px; }
.total-figure { font-family: var(--mono); font-size: 32px; font-weight: 700; color: var(--dark); line-height: 1; }
.total-figure.live { color: var(--green); }
.total-figure.build { color: var(--bronze); }
.total-figure.backlog { color: #A9A096; }

/* ---------- tab menu --------------------------------------------------- */

.view-switch {
  display: flex;
  gap: 4px;
  margin: 26px 0 22px;
  border-bottom: 2px solid var(--dark);
  overflow-x: auto;
  scrollbar-width: none;
}
.view-switch::-webkit-scrollbar { display: none; }
.switch-button {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 12px 18px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.switch-button:hover { color: var(--dark); }
.switch-button.on { color: var(--dark); background: var(--mid); border-bottom-color: var(--bronze); }

/* ---------- stage columns (process map) -------------------------------- */

.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  align-items: start;
}
.stage-col { display: flex; flex-direction: column; gap: 8px; }
.stage-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.stage-top { display: flex; align-items: baseline; justify-content: space-between; }
.stage-num { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--bronze); line-height: 1; }
.stage-count { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.stage-count.heavy { color: var(--dark); font-weight: 700; }
.stage-name { font-size: 13px; font-weight: 700; color: var(--dark); line-height: 1.25; min-height: 2.5em; }
.stage-rule { height: 1px; background: var(--dark); }

/* ---------- system chip ------------------------------------------------ */

.chip {
  border-left: 3px solid var(--st-backlog);
  background: var(--mid);
  box-shadow: inset 0 0 0 1px #E4DCCE;
  padding: 11px 13px 12px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  display: block;
}
.chip:hover { background: #F0E9DE; }
.chip:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }
.chip.is-container { background: var(--panel); box-shadow: inset 0 0 0 2px var(--dark); }
.chip.is-spine { background: var(--spine); box-shadow: inset 0 0 0 3px var(--dark); }
.chip-name { font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--ink); text-wrap: pretty; }
.chip.is-container .chip-name,
.chip.is-spine .chip-name { font-weight: 800; color: var(--dark); }
.chip-meta {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .13em;
  text-transform: uppercase;
  font-weight: 500;
}
.chip-type { color: var(--muted); }
.chip-nest {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid #E4DCCE;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  font-weight: 700;
}
.nest-spine { color: var(--dark); }
.nest-in { color: var(--bronze); }
.nest-nil { color: #CFC5B6; font-weight: 500; }
.chip-holds {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #C4BBAA;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .13em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--dark);
}

/* ---------- bars (build status) ---------------------------------------- */

.bar-row { display: grid; grid-template-columns: minmax(150px, 230px) 1fr auto; gap: 16px; align-items: center; margin-bottom: 14px; }
.bar-label { display: flex; align-items: baseline; justify-content: flex-end; gap: 9px; text-align: right; }
.bar-stage { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--bronze); }
.bar-name { font-size: 13px; font-weight: 600; color: var(--dark); line-height: 1.2; }
.bar-track { display: flex; gap: 2px; height: 30px; background: var(--mid); box-shadow: inset 0 0 0 1px #E6DECF; }
.bar-seg { display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 12px; font-weight: 700; min-width: 0; }
.bar-total { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--dark); min-width: 26px; text-align: right; }

/* ---------- panels (usecase) ------------------------------------------- */

.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.panel { background: var(--mid); box-shadow: inset 0 0 0 1px #E4DCCE; }
.panel-head { background: var(--panel); box-shadow: inset 0 0 0 2px var(--dark); padding: 15px 16px 14px; }
.panel-head.spine { background: var(--spine); box-shadow: inset 0 0 0 3px var(--dark); }
.panel-title { font-size: 17px; font-weight: 800; color: var(--dark); line-height: 1.15; }
.panel-code { font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: .18em; color: var(--bronze); }
.panel-sub { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 7px; font-family: var(--mono); font-size: 9px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.mod-strip { display: flex; gap: 12px; padding: 12px 16px; background: #EDE6DA; box-shadow: inset 0 0 0 1px #E4DCCE; align-items: baseline; }
.mod-vals { font-size: 13px; font-weight: 600; color: var(--dark); line-height: 1.45; }
.kid { display: flex; align-items: baseline; gap: 10px; padding: 11px 16px; border-top: 1px solid #E4DCCE; border-left: 3px solid var(--st-backlog); cursor: pointer; width: 100%; font: inherit; color: inherit; text-align: left; background: none; }
.kid:hover { background: #F0E9DE; }
.kid-stage { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--bronze); min-width: 20px; }
.kid-name { flex: 1; font-size: 13px; font-weight: 600; line-height: 1.3; }
.kid-tag { font-family: var(--mono); font-size: 9px; letter-spacing: .13em; font-weight: 700; color: var(--bronze); }

/* ---------- chain (price to payment) ----------------------------------- */

.chain { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; align-items: stretch; }
.chain-step { display: flex; flex-direction: column; background: var(--mid); box-shadow: inset 0 0 0 1px #E4DCCE; }
.chain-top { padding: 18px 18px 16px; }
.chain-act { font-size: 19px; font-weight: 800; color: var(--dark); line-height: 1.2; margin-top: 10px; text-wrap: pretty; }
.chain-spine { background: var(--spine); box-shadow: inset 0 0 0 2px var(--dark); padding: 16px 18px; flex: 1; }
.chain-fe { padding: 16px 18px; }
.chain-note { padding: 0 18px 18px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.tok { display: inline-block; font-family: var(--mono); font-size: 10.5px; font-weight: 700; padding: 5px 9px; margin: 0 4px 5px 0; }
.tok-use  { background: #EDE6DA; color: #6E675C; box-shadow: inset 0 0 0 1px #D8CEBE; }
.tok-make { background: var(--dark); color: var(--cream); }
.tok-tool { color: var(--muted); box-shadow: inset 0 0 0 1px #C4BBAA; }
.tok-show { background: #EDE6DA; color: var(--dark); box-shadow: inset 0 0 0 1px #D8CEBE; }
.tok-key { font-family: var(--mono); font-size: 9px; letter-spacing: .15em; text-transform: uppercase; color: #A9A096; margin-bottom: 7px; }

/* ---------- legend, states, detail ------------------------------------- */

.legend { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin: 26px 0 0; padding-top: 18px; border-top: 1px solid var(--hair); }
.legend-item { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; }
.swatch { width: 15px; height: 15px; flex: none; }
.state-message { font-size: 14px; color: var(--muted); padding: 30px 0; }
.hint { font-size: 12px; color: var(--muted); margin: 14px 0 0; }

.drawer-back { position: fixed; inset: 0; background: rgba(26,26,26,.34); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(460px, 100%);
  background: var(--cream);
  box-shadow: -1px 0 0 var(--hair);
  z-index: 41;
  overflow-y: auto;
  padding: 26px 26px 60px;
}
.drawer h2 { font-size: 22px; font-weight: 800; color: var(--dark); margin: 12px 0 6px; line-height: 1.2; }
.drawer-close { position: absolute; top: 18px; right: 20px; }
.drawer-block { margin-top: 22px; }
.drawer-block p { font-size: 14px; line-height: 1.6; color: var(--ink); margin: 8px 0 0; white-space: pre-line; }
.drawer-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

@media (max-width: 640px) {
  .sheet { padding: 22px 16px 70px; }
  .masthead { padding: 14px 16px; }
  .bar-row { grid-template-columns: 1fr; gap: 6px; }
  .bar-label { justify-content: flex-start; text-align: left; }
  .totals { gap: 18px; }
}
