/* ============================================================
   LinkUp — Recently Completed
   Stabilization-ledger layout · commit-log row design
   ============================================================ */

:root {
  --bg-deep: #07090f;
  --bg-elev: #0e1320;
  --bg-card: #131929;
  --bg-card-2: #181f33;

  --accent:        #4f7df5;
  --accent-2:      #22d3a7;  /* shipped / stable */
  --accent-amber:  #f5b14f;
  --accent-violet: #8b6df5;
  --accent-pink:   #f56ab5;
  --accent-glow:   rgba(34,211,167,0.30);

  --text-primary:   #e8ecf4;
  --text-secondary: #8a93ad;
  --text-dim:       #5b6480;
  --text-mono:      #b9c4e0;

  --border:        rgba(140,160,220,0.10);
  --border-strong: rgba(140,160,220,0.20);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --mono: "JetBrains Mono","SF Mono",ui-monospace,Menlo,Consolas,monospace;
  --sans: -apple-system,BlinkMacSystemFont,"Inter","Segoe UI",Roboto,sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }

body {
  font-family: var(--sans);
  background:
    radial-gradient(1100px 600px at 90% -10%, rgba(34,211,167,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(79,125,245,0.06), transparent 60%),
    var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  padding: 56px 24px 80px;
}

.wrap { max-width: 1120px; margin: 0 auto; }

/* ============ HEADER ============ */
.page-head { margin-bottom: 48px; }
.head-meta {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.meta-chip {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: 0.18em; font-weight: 600;
  color: var(--accent-2);
  padding: 7px 12px;
  background: rgba(34,211,167,0.08);
  border: 1px solid rgba(34,211,167,0.25);
  border-radius: 6px;
}
.chip-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(34,211,167,0.6);
  animation: ping 2.2s infinite;
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(34,211,167,0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(34,211,167,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,211,167,0); }
}
.meta-trail {
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
}

.page-head h1 {
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 600; letter-spacing: -0.02em; line-height: 1.05;
  margin-bottom: 16px;
}
.grad {
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede {
  font-size: 16px; color: var(--text-secondary);
  max-width: 740px; margin-bottom: 32px;
}

/* summary */
.summary {
  display: grid;
  grid-template-columns: 1fr 1px 1fr 1px 1fr 1px 1fr;
  align-items: center;
  padding: 22px 8px;
  background: linear-gradient(180deg, var(--bg-elev), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.sum-cell { padding: 0 22px; }
.sum-divider { width: 1px; height: 42px; background: var(--border); }
.sum-label {
  display: block; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 6px;
}
.sum-val {
  display: block; font-family: var(--mono);
  font-size: 26px; font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.sum-sub { display: block; font-size: 11.5px; color: var(--text-dim); margin-top: 4px; }

/* ============ LEDGER ============ */
.ledger { margin-bottom: 56px; }

.ledger-toolbar {
  display: flex; justify-content: space-between; align-items: end;
  gap: 18px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.ledger-toolbar h2 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
}

.tool-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  display: flex; align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 10px;
  width: 260px;
  transition: border-color .2s, box-shadow .2s;
}
.search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,125,245,0.12);
}
.search-icon { color: var(--text-dim); font-size: 14px; margin-right: 8px; }
.search-wrap input {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: var(--text-primary); font: inherit; font-size: 13px;
}
.search-wrap input::placeholder { color: var(--text-dim); }
.search-kbd {
  font-family: var(--mono); font-size: 11px;
  color: var(--text-dim);
  padding: 2px 7px;
  border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--bg-card);
}

.seg {
  display: inline-flex; padding: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.seg-btn {
  background: transparent; border: 0; cursor: pointer;
  color: var(--text-secondary);
  font: inherit; font-size: 12.5px;
  padding: 7px 14px; border-radius: 6px;
  transition: all .2s;
}
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.active {
  background: var(--bg-card-2);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* row head */
.row-head {
  display: grid;
  grid-template-columns: 52px 1fr 110px 110px;
  gap: 16px;
  padding: 10px 18px;
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* items */
.items { list-style: none; }
.item { border-bottom: 1px solid var(--border); }
.item.hide { display: none; }

.row {
  display: grid;
  grid-template-columns: 52px 1fr 110px 110px;
  gap: 16px;
  align-items: center;
  width: 100%; text-align: left;
  background: transparent;
  border: 0; cursor: pointer;
  padding: 18px;
  font: inherit;
  color: var(--text-primary);
  position: relative;
  transition: background .2s;
}
.row::before {
  content: ""; position: absolute; left: 0; top: 18px; bottom: 18px;
  width: 2px; background: var(--accent-2);
  opacity: 0; transition: opacity .2s;
  border-radius: 2px;
  box-shadow: 0 0 12px var(--accent-glow);
}
.row:hover { background: rgba(140,160,220,0.025); }
.row:hover::before,
.row[aria-expanded="true"]::before { opacity: 1; }

.r-num {
  font-family: var(--mono); font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.r-main { min-width: 0; }
.r-title {
  display: block;
  font-size: 14.5px; font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.r-sub {
  display: block;
  font-size: 12.5px; color: var(--text-secondary);
}

.r-area {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.10em; text-align: center;
  padding: 5px 8px; border-radius: 5px;
  border: 1px solid transparent;
  width: fit-content; justify-self: start;
}
.a-backend { color: var(--accent);        background: rgba(79,125,245,0.10);  border-color: rgba(79,125,245,0.25); }
.a-mobile  { color: var(--accent-amber);  background: rgba(245,177,79,0.10);  border-color: rgba(245,177,79,0.25); }
.a-ui      { color: var(--accent-violet); background: rgba(139,109,245,0.10); border-color: rgba(139,109,245,0.25); }
.a-auth    { color: var(--accent-pink);   background: rgba(245,106,181,0.10); border-color: rgba(245,106,181,0.25); }

.r-hash {
  font-family: var(--mono); font-size: 12px;
  color: var(--text-mono);
  padding: 6px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  justify-self: end;
  transition: all .2s;
  cursor: copy;
}
.r-hash:hover { color: var(--accent-2); border-color: rgba(34,211,167,0.4); }
.r-hash.copied { color: var(--accent-2); border-color: var(--accent-2); }

/* expand */
.row-extra {
  max-height: 0; overflow: hidden;
  transition: max-height .35s ease, padding .25s ease;
  background: rgba(10,13,20,0.5);
}
.item.open .row-extra { max-height: 260px; padding: 6px 18px 22px; }
.extra-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
}
.ex-label {
  display: block; font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 6px;
}
.extra-grid p { font-size: 13px; color: var(--text-secondary); }
.state-pill {
  display: inline-block;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.12em;
  padding: 4px 8px; border-radius: 5px;
}
.st-stable {
  color: var(--accent-2);
  background: rgba(34,211,167,0.10);
  border: 1px solid rgba(34,211,167,0.25);
}

.empty {
  text-align: center; padding: 56px 20px;
  color: var(--text-dim);
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  margin-top: 14px;
}
.empty-dash {
  display: block; width: 40px; height: 3px;
  background: var(--text-dim);
  margin: 0 auto 14px; border-radius: 3px;
}

/* ============ TRANSITION FLOW ============ */
.flow-section {
  background: linear-gradient(180deg, var(--bg-elev), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  margin-bottom: 24px;
}
.flow-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.flow-mark {
  width: 6px; height: 22px; border-radius: 3px;
  background: var(--accent-2);
  box-shadow: 0 0 14px var(--accent-glow);
}
.flow-head h2 { font-size: 18px; font-weight: 600; }
.flow-lede { color: var(--text-secondary); font-size: 14px; margin-bottom: 22px; max-width: 720px; }

.flow {
  display: grid; grid-template-columns: 1fr; gap: 0;
}
.stage {
  display: grid;
  grid-template-columns: 52px 1fr auto 1fr;
  align-items: center; gap: 18px;
  padding: 16px 20px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.stage-step {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--accent-2);
  padding: 6px 10px;
  background: rgba(34,211,167,0.08);
  border: 1px solid rgba(34,211,167,0.25);
  border-radius: 5px;
  text-align: center; letter-spacing: 0.08em;
}
.stage-from { color: var(--text-secondary); font-size: 14px; }
.stage-arrow {
  font-family: var(--mono); font-size: 16px; color: var(--text-dim);
}
.stage-to { color: var(--text-primary); font-size: 14px; font-weight: 500; }

.flow-connector {
  width: 1px; height: 22px;
  background: linear-gradient(180deg, var(--accent-2), transparent);
  margin-left: 46px;
  opacity: 0.5;
}
.stage-final .stage-step {
  color: var(--accent);
  background: rgba(79,125,245,0.10);
  border-color: rgba(79,125,245,0.25);
}
.stage-final .stage-to {
  color: var(--accent);
}

/* ============ PURPOSE ============ */
.purpose {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  margin-bottom: 40px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
}
.p-head { grid-column: 1 / -1; }
.p-tag {
  display: inline-block;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 8px;
}
.p-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 14px; }
.purpose > p { color: var(--text-secondary); font-size: 14.5px; max-width: 520px; }

.purpose-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.purpose-list li {
  display: flex; align-items: start; gap: 12px;
  font-size: 13.5px; color: var(--text-primary);
}
.pl-mark {
  flex: none; margin-top: 8px;
  width: 14px; height: 2px; border-radius: 2px;
  background: var(--accent-2);
}

/* footer */
.foot {
  display: flex; justify-content: center; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-dim);
  padding-top: 24px; border-top: 1px solid var(--border);
}
.foot .sep { opacity: 0.5; }
.foot kbd {
  font-family: var(--mono); font-size: 11px;
  padding: 1px 6px; margin: 0 2px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}

/* toast */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 18px;
  background: var(--bg-card-2);
  border: 1px solid var(--accent-2);
  color: var(--accent-2);
  font-family: var(--mono); font-size: 12px;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none;
  transition: all .25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ RESPONSIVE ============ */
@media (max-width: 820px) {
  .summary { grid-template-columns: 1fr 1fr; row-gap: 18px; }
  .sum-divider { display: none; }
  .sum-cell { padding: 0 18px; }
  .row-head, .row { grid-template-columns: 36px 1fr 80px; }
  .row-head span:last-child, .r-hash { display: none; }
  .extra-grid { grid-template-columns: 1fr; }
  .stage { grid-template-columns: 1fr; gap: 8px; }
  .stage-arrow { display: none; }
  .flow-connector { display: none; }
  .purpose { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  body { padding: 32px 14px 60px; }
  .search-wrap { width: 100%; }
  .ledger-toolbar { flex-direction: column; align-items: start; }
}
