:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e2e5ea;
  --accent: #2f6f6a;
  --accent-soft: #e5f0ef;
  --claim: #2f6f6a;
  --grounds: #3b5ba5;
  --warrant: #8a6d3b;
  --backing: #6b7280;
  --qualifier: #9b4d8c;
  --rebuttal: #a5453b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 24, 33, .08), 0 6px 20px rgba(20, 24, 33, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16191f;
    --panel: #1e222b;
    --ink: #e6e8ec;
    --muted: #9aa1ad;
    --line: #2c313c;
    --accent: #5fb3ac;
    --accent-soft: #22332f;
    --claim: #5fb3ac;
    --grounds: #7d9de0;
    --warrant: #c7a35f;
    --backing: #9aa1ad;
    --qualifier: #c98ab8;
    --rebuttal: #d67a70;
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
  input[type="text"], textarea, .arg-search { background: #171b22; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.site-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark { color: var(--accent); }
.tagline { margin: .25rem 0 0; color: var(--muted); font-size: .9rem; }

.container { max-width: 1080px; margin: 0 auto; padding: 1.5rem; }

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 1.5rem;
}
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.panel h2 { margin-top: 0; font-size: 1.1rem; }
.count { color: var(--muted); font-weight: 400; }

/* Form */
.field { display: block; margin-bottom: .85rem; }
.field-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  margin-bottom: .3rem;
}
.req { color: var(--rebuttal); font-style: normal; margin-left: 2px; }
input[type="text"], textarea {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  background: #fcfcfd;
  resize: vertical;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-claim .field-label { color: var(--claim); }
.field-grounds .field-label { color: var(--grounds); }

.form-actions { display: flex; align-items: center; gap: .75rem; margin-top: .5rem; }
.form-error { color: var(--rebuttal); font-size: .85rem; }

.btn {
  font: inherit;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .5rem .9rem;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #275a56; }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; text-decoration: none; }
.btn-ghost:hover { color: var(--accent); }
.btn-delete:hover { color: var(--rebuttal); }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.panel-narrow { max-width: 640px; margin: 0 auto; }
.head-tools { display: flex; gap: .3rem; flex-shrink: 0; }
.head-tools label { cursor: pointer; }

.arg-search {
  width: 100%;
  margin: .25rem 0 .75rem;
  padding: .5rem .65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fcfcfd;
  color: var(--ink);
}
.arg-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Completeness meter */
.meter {
  display: block;
  height: 5px;
  margin-top: .4rem;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.meter-lg { height: 8px; max-width: 320px; }
.meter-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--grounds), var(--accent));
  transition: width .2s ease;
}
.completeness { display: flex; align-items: center; gap: .75rem; margin: -.5rem 0 1.25rem; }
.completeness-text { color: var(--muted); font-size: .82rem; }

.arg-head { display: flex; align-items: center; justify-content: space-between; }
.arg-actions { display: flex; gap: .4rem; }

/* Argument list */
.arg-list { list-style: none; margin: 0; padding: 0; }
.arg-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--line);
}
.arg-link { flex: 1; text-decoration: none; color: var(--ink); }
.arg-link strong { display: block; }
.arg-claim { display: block; color: var(--muted); font-size: .88rem; }
.btn-delete { font-size: .9rem; line-height: 1; }
.empty { color: var(--muted); }

/* Single argument + diagram */
.breadcrumb a { color: var(--accent); text-decoration: none; }
.arg-title { margin: .3rem 0 1.25rem; }

.diagram { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: 1rem; align-items: stretch; flex-wrap: wrap; }
.row-top { align-items: center; }

.node {
  flex: 1;
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .85rem 1rem;
}
.node p { margin: .25rem 0 0; }
.node-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.node-claim { border-left-color: var(--claim); }
.node-grounds { border-left-color: var(--grounds); }
.node-warrant { border-left-color: var(--warrant); }
.node-backing { border-left-color: var(--backing); }
.node-qualifier { border-left-color: var(--qualifier); flex: 0 1 auto; margin-top: .5rem; }
.node-rebuttal { border-left-color: var(--rebuttal); }

.connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}
.arrow { font-size: 1.6rem; color: var(--muted); }

.meta { color: var(--muted); font-size: .82rem; margin-top: 1.5rem; }

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
  padding: 1.5rem;
}

/* Print: hide chrome, keep the diagram clean on paper. */
@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body { background: #fff; }
  .container { max-width: none; padding: 0; }
  .node { box-shadow: none; break-inside: avoid; }
}
