/* SEC 10-K Item Extractor: minimal styling, no framework.
   Colour palette mirrors Task 1 (claude-skills-cicd) so the three submission
   demos feel like one product family. */

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  margin: 0;
  font-size: 14px;
  color: #222;
  background: #fff;
  line-height: 1.5;
}

header {
  background: #0d1117;
  color: #f0f6fc;
  padding: 14px 24px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
header h1 { margin: 0; font-size: 1.1rem; font-weight: 600; }
header small { opacity: 0.7; font-size: 0.78rem; }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
}

main section {
  margin-bottom: 28px;
}
main h2 {
  font-size: 0.95rem;
  margin: 0 0 12px;
  color: #24292f;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
main h2 small { font-weight: 400; color: #57606a; font-size: 0.78rem; }
main h3 {
  font-size: 0.82rem;
  margin: 14px 0 8px;
  color: #57606a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
main h3 small { font-weight: 400; text-transform: none; letter-spacing: 0; color: #6e7781; }

.lead {
  font-size: 0.92rem;
  color: #24292f;
  margin: 0;
  background: #f6f8fa;
  border-left: 3px solid #0969da;
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
}
.lead code {
  background: rgba(175, 184, 193, 0.2);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Monaco, monospace;
  font-size: 0.85rem;
}

.hint {
  color: #57606a;
  font-size: 0.78rem;
  margin: 8px 0 0;
}
.hint code {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  background: #f6f8fa;
  padding: 1px 4px;
  border-radius: 3px;
}

/* Demo button rows */
.demo-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}
button.demo {
  text-align: left;
  background: white;
  color: #0969da;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, border-color 0.1s;
}
button.demo:hover { background: #ddf4ff; border-color: #0969da; }
button.demo:disabled { opacity: 0.5; cursor: wait; }
button.demo .label { display: block; }
button.demo .meta {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: #6e7781;
  font-weight: 400;
  margin-top: 2px;
}
button.demo .characteristic {
  display: block;
  margin-top: 6px;
  color: #57606a;
  font-weight: 400;
  font-size: 0.78rem;
  line-height: 1.4;
}

/* Live extract form */
#extract-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
#extract-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: #57606a;
  font-weight: 500;
}
#extract-form input {
  font-family: ui-monospace, "SF Mono", Monaco, monospace;
  font-size: 0.88rem;
  padding: 8px 10px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  width: 240px;
}
#extract-form input:focus {
  outline: 2px solid #0969da;
  outline-offset: -1px;
}
#extract-form button {
  padding: 9px 24px;
  background: #1f883d;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  font-family: inherit;
}
#extract-form button:hover { background: #1a7f37; }
#extract-form button:disabled { background: #94d3a2; cursor: wait; }

/* Result */
#result {
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 16px;
  background: #f6f8fa;
}
#status {
  font-size: 0.85rem;
  color: #57606a;
  margin-bottom: 12px;
}
#status.error {
  color: #82071e;
  background: #ffebe9;
  border: 1px solid #ffcecb;
  padding: 10px 14px;
  border-radius: 6px;
}

#filing-meta {
  background: white;
  padding: 12px 16px;
  border-radius: 6px;
  border: 1px solid #d0d7de;
  margin-bottom: 12px;
  font-size: 0.85rem;
}
#filing-meta .filing-title {
  font-size: 1rem;
  font-weight: 600;
  color: #24292f;
  margin: 0 0 4px;
}
#filing-meta .filing-meta-row {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: #57606a;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
#filing-meta .filing-meta-row span b { color: #24292f; font-weight: 500; }
#filing-meta .ibr-note {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #6e7781;
  background: #fff8c5;
  border-left: 3px solid #d4a72c;
  padding: 6px 10px;
  border-radius: 0 4px 4px 0;
}

/* Items list */
.part-group { margin-bottom: 14px; }
.part-group h4 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  color: #57606a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.item-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #d0d7de;
  background: white;
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.08s;
}
.item-row:hover { background: #f6f8fa; }
.item-row.expanded { background: #f6f8fa; }
.item-row .item-num {
  font-family: ui-monospace, monospace;
  font-weight: 600;
  color: #24292f;
}
.item-row .item-title { color: #24292f; }
.item-row .item-title.dim { color: #8b949e; font-style: italic; }

/* Status badges. Class names mirror the Status enum in
   src/workers/extractor/schema.py — keep in sync if that enum changes. */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: ui-monospace, monospace;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.status-extracted                { background: #dafbe1; color: #1a7f37; }
.status-incorporated_by_reference { background: #fff8c5; color: #9a6700; }
.status-not_applicable           { background: #eaeef2; color: #57606a; }
.status-reserved                 { background: #eaeef2; color: #6e7781; }
.status-partial                  { background: #ffe2c0; color: #b25303; }
.status-non_standard             { background: #ddf4ff; color: #0969da; }

/* Expanded item details */
.item-detail {
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-top: none;
  border-radius: 0 0 4px 4px;
  margin-top: -4px;
  margin-bottom: 4px;
  padding: 12px 16px;
  font-size: 0.82rem;
}
.item-detail .detail-row {
  margin-bottom: 8px;
}
.item-detail .detail-row b {
  color: #57606a;
  font-weight: 500;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 2px;
}
.item-detail .content-excerpt {
  background: white;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 320px;
  overflow-y: auto;
  font-family: ui-monospace, "SF Mono", Monaco, monospace;
}
.item-detail .char-range {
  font-family: ui-monospace, monospace;
  font-size: 0.74rem;
  color: #6e7781;
}
.item-detail .reference {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: #6e7781;
}

/* Footer meta (extraction time, XBRL, warnings) */
#footer-meta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d0d7de;
  font-size: 0.78rem;
  color: #57606a;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
#footer-meta .check { font-weight: 500; }
#footer-meta .check.ok { color: #1a7f37; }
#footer-meta .check.warn { color: #9a6700; }
#footer-meta .warnings {
  flex-basis: 100%;
  margin-top: 6px;
}
#footer-meta .warnings ul {
  margin: 4px 0 0; padding: 0; list-style: none;
}
#footer-meta .warnings li {
  font-family: ui-monospace, monospace;
  font-size: 0.74rem;
  color: #6e7781;
  margin-bottom: 2px;
}

/* Responsive */
@media (max-width: 640px) {
  main { padding: 16px 12px; }
  .demo-buttons { grid-template-columns: 1fr; }
  #extract-form input { width: 100%; flex: 1 1 100%; }
  .item-row {
    grid-template-columns: 56px 1fr;
    grid-template-rows: auto auto;
  }
  .item-row .status-badge {
    grid-column: 1 / 3;
    justify-self: start;
  }
}
