/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */
.app-header {
  background: var(--header-bg);
  color: var(--header-fg);
  height: 52px;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}

.hub-link {
  color: rgba(245, 237, 224, 0.55);
  text-decoration: none;
  font-size: .8rem;
  flex-shrink: 0;
  transition: color .15s;
  white-space: nowrap;
}
.hub-link:hover { color: var(--header-fg); }

.h-sep {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,.13);
  flex-shrink: 0;
}

.app-title {
  font-size: .9375rem;
  font-weight: 600;
  letter-spacing: -.015em;
  white-space: nowrap;
}

.fixture-select {
  background: rgba(255,255,255,.09);
  color: var(--header-fg);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--radius-sm);
  padding: .25rem .6rem;
  font-family: var(--font-sans);
  font-size: .8rem;
  cursor: pointer;
  max-width: 220px;
}
.fixture-select option { background: var(--header-bg); color: var(--header-fg); }

.spacer { flex: 1; }

/* Conflict pill in header */
.conflict-pill {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .22rem .6rem;
  border-radius: 99px;
  background: var(--rust);
  color: #fff;
  transition: background .2s;
  white-space: nowrap;
}
.conflict-pill.pill-clear {
  background: rgba(255,255,255,.14);
  color: rgba(245,237,224,.7);
}

/* Header buttons */
.btn {
  font-family: var(--font-sans);
  font-size: .8rem;
  font-weight: 500;
  padding: .3rem .8rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(.9); }

.btn-ghost {
  background: rgba(255,255,255,.11);
  color: var(--header-fg);
  border: 1px solid rgba(255,255,255,.17);
}
.btn-primary {
  background: var(--rust);
  color: #fff;
}

/* ── Main layout ────────────────────────────────────────── */
.app-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.375rem 1.25rem 3rem;
}

/* ── Section labels ─────────────────────────────────────── */
.section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-muted);
  margin-bottom: .5rem;
  margin-top: 1.375rem;
}
.section-label:first-child { margin-top: 0; }

/* ── Three-pane row ─────────────────────────────────────── */
.pane-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .625rem;
}

.pane-card {
  background: var(--paper-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.pane-hdr {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .42rem .875rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--border);
}

.pane-hdr-base   { background: rgba(42,37,31,.05);    color: var(--text-muted); }
.pane-hdr-ours   { background: var(--green-bg);        color: var(--green);
                   border-bottom-color: var(--green-border); }
.pane-hdr-theirs { background: var(--blue-bg);         color: var(--blue);
                   border-bottom-color: var(--blue-border); }
.pane-hdr-result { background: var(--rust-bg);         color: var(--rust);
                   border-bottom-color: var(--rust-border); }

.pane-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pane-dot-base   { background: var(--text-muted); }
.pane-dot-ours   { background: var(--green); }
.pane-dot-theirs { background: var(--blue); }
.pane-dot-result { background: var(--rust); }

.pane-body {
  padding: .75rem .875rem;
  max-height: 270px;
  overflow-y: auto;
}

pre.code-block {
  font-family: var(--font-mono);
  font-size: .7375rem;
  line-height: 1.65;
  white-space: pre;
  color: var(--text);
}

/* ── Changes row (auto + conflicts side-by-side) ─────────── */
.changes-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .625rem;
}

.changes-card {
  background: var(--paper-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.changes-hdr {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .875rem;
  font-size: .8rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.badge {
  font-size: .65rem;
  font-weight: 700;
  min-width: 1.4em;
  text-align: center;
  padding: .12rem .42rem;
  border-radius: 99px;
}
.badge-auto     { background: var(--green-bg);  color: var(--green); }
.badge-conflict { background: var(--rust);       color: #fff; }

.changes-body {
  padding: .375rem .875rem;
  max-height: 260px;
  overflow-y: auto;
}

/* ── Auto hunks ─────────────────────────────────────────── */
.auto-hunk {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--border);
}
.auto-hunk:last-child { border-bottom: none; }

.hunk-path {
  font-family: var(--font-mono);
  font-size: .72rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hunk-kind, .hunk-side {
  font-size: .6rem;
  font-weight: 700;
  padding: .1rem .35rem;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
}
.kind-add    { background: var(--green-bg);            color: var(--green); }
.kind-remove { background: var(--rust-bg);             color: var(--rust); }
.kind-change { background: rgba(42,37,31,.07);         color: var(--text-muted); }
/* Move hunks — amber to stand apart from add/remove/change */
.kind-move   { background: rgba(138,98,0,.10);         color: #7a5800; }

/* Move path label is wider (shows "a.b → c.d") — allow a bit more room */
.hunk-path-move {
  min-width: 0;
  flex: 1;
  font-size: .70rem;
}

.side-ours   { background: var(--green-bg);  color: var(--green); }
.side-theirs { background: var(--blue-bg);   color: var(--blue); }

.hunk-val {
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--text-muted);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Conflict cards ─────────────────────────────────────── */
.conflict-card {
  background: var(--paper-light);
  border: 1px solid var(--rust-border);
  border-radius: var(--radius);
  padding: .7rem .875rem;
  margin-bottom: .5rem;
  transition: opacity .3s, transform .3s;
}
.conflict-card:last-child { margin-bottom: 0; }
.conflict-card.resolving  { opacity: 0; transform: translateX(8px); }

/* Conflict card header */
.cc-header {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .5rem;
}

.cc-path {
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 500;
  flex: 1;
  color: var(--text);
}

.cc-badge {
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--rust);
  color: #fff;
  padding: .13rem .42rem;
  border-radius: 99px;
  flex-shrink: 0;
}

/* Conflict values grid */
.cc-values {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .45rem;
  margin-bottom: .6rem;
}

.cv-col {
  padding: .35rem .5rem;
  border-radius: var(--radius-sm);
}
.cv-base   { background: rgba(42,37,31,.06); border: 1px solid rgba(42,37,31,.1); }
.cv-ours   { background: var(--green-bg);    border: 1px solid var(--green-border); }
.cv-theirs { background: var(--blue-bg);     border: 1px solid var(--blue-border); }

.cv-lbl {
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .2rem;
}
.cv-ours   .cv-lbl { color: var(--green); }
.cv-theirs .cv-lbl { color: var(--blue); }

.cv-col code {
  font-family: var(--font-mono);
  font-size: .72rem;
  word-break: break-all;
  line-height: 1.5;
}

/* Accept buttons */
.cc-actions {
  display: flex;
  gap: .45rem;
}

.btn-accept {
  font-family: var(--font-sans);
  font-size: .75rem;
  font-weight: 600;
  padding: .28rem .7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter .15s;
  flex-shrink: 0;
}
.btn-accept:hover { filter: brightness(.88); }

.btn-accept-ours {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.btn-accept-theirs {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue-border);
}

/* ── Empty/resolved notes ───────────────────────────────── */
.empty-note {
  padding: .65rem 0;
  font-size: .8rem;
  color: var(--text-muted);
  font-style: italic;
}
.resolved-note {
  color: var(--green);
  font-style: normal;
  font-weight: 500;
}

/* ── Result pane ────────────────────────────────────────── */
.result-card {
  background: var(--paper-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.result-hdr {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .875rem;
  font-size: .8rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--rust-bg);
}
.result-hdr-sub {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: .1rem;
}

.result-body {
  padding: .75rem .875rem;
  max-height: 340px;
  overflow-y: auto;
}

/* ── Scrollbars ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(42,37,31,.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(42,37,31,.38); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 960px) {
  .pane-row    { grid-template-columns: 1fr; }
  .changes-row { grid-template-columns: 1fr; }
  .cc-values   { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .app-header { gap: .5rem; padding: 0 .875rem; }
  .app-title  { font-size: .85rem; }
}
