/* Compliance Document Filler — built on the Micronotes.ai design system.
   Tokens come from tokens.css; this file only composes layout + components. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-app);
  color: var(--fg-default);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--fg-muted); }

/* ── App bar ─────────────────────────────────────────────── */
.appbar {
  background: var(--bg-surface);
  border-bottom: 1.5px solid var(--border-default);
  position: sticky; top: 0; z-index: 10;
}
.appbar-inner {
  max-width: 1280px; margin: 0 auto;
  height: 64px; display: flex; align-items: center; gap: 16px;
  padding: 0 40px;
}
.appbar .logo { height: 26px; }
.appbar-title {
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  color: var(--fg-muted); padding-left: 16px;
  border-left: 1.5px solid var(--border-default); line-height: 1;
}

/* ── Page shell ──────────────────────────────────────────── */
.wrap { max-width: 1280px; margin: 0 auto; padding: 40px 40px 80px; }

.page-head { margin-bottom: 32px; }
.eyebrow { color: var(--brand-primary); margin: 0 0 6px; }
.page-head h1 { margin: 0 0 10px; }
.lede {
  font-size: var(--text-md); color: var(--fg-muted);
  line-height: 1.55; max-width: 72ch; margin: 0;
}

.sub { color: var(--fg-muted); font-size: var(--text-sm); margin: 4px 0 16px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 24px;
}
.card-foot { margin-top: 18px; }
.card-foot .btn { margin-bottom: 0; }

/* Two-column input area — uses the full width on desktop */
.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}
.input-grid .card {
  margin-bottom: 0;
  display: flex; flex-direction: column;
}
.input-grid .drop, .input-grid textarea { flex: 1; }
.input-grid .card-foot {
  display: flex; align-items: center; gap: 16px;
}
.input-grid .card-foot .hint { margin: 0; flex: 1; }

@media (max-width: 860px) {
  .input-grid { grid-template-columns: 1fr; }
  .wrap, .appbar-inner { padding-left: 20px; padding-right: 20px; }
}

/* ── Dropzone ────────────────────────────────────────────── */
.drop {
  display: flex; align-items: center; justify-content: center; min-height: 140px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--fg-muted); cursor: pointer; text-align: center; padding: 16px;
  background: var(--bg-app);
  transition: border-color .15s, color .15s, background .15s;
}
.drop:hover { border-color: var(--brand-primary-30); }
.drop.hot {
  border-color: var(--brand-primary); color: var(--fg-strong);
  background: var(--brand-primary-10);
}

/* ── Buttons (design-system spec) ────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  font-family: inherit; font-size: var(--text-sm); font-weight: var(--weight-semibold);
  border-radius: var(--radius); border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; transition: all .15s;
}
.btn.primary { background: var(--brand-primary); color: #fff; box-shadow: var(--shadow-brand); }
.btn.primary:hover { background: var(--brand-primary-dark); }
.btn.ghost { background: var(--bg-surface); color: var(--fg-default); border-color: var(--border-default); }
.btn.ghost:hover { background: var(--bg-app); }
.btn:disabled, .btn[disabled] { opacity: .5; pointer-events: none; }

/* ── Inputs ──────────────────────────────────────────────── */
textarea {
  width: 100%; background: var(--bg-surface); color: var(--fg-default);
  border: 1.5px solid var(--border-default); border-radius: var(--radius);
  padding: 12px; font: inherit; resize: vertical; min-height: 110px;
}
textarea:focus {
  outline: none; border-color: var(--brand-primary);
  box-shadow: var(--ring-brand);
}

.hint { color: var(--fg-muted); font-size: var(--text-xs); margin: 12px 0 0; }

/* ── Progress ────────────────────────────────────────────── */
.bar {
  height: 8px; background: var(--bg-muted); border-radius: var(--radius-full);
  overflow: hidden; margin: 14px 0 10px;
}
.bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
  transition: width .4s;
}
.state-line { font-size: var(--text-sm); color: var(--fg-default); margin: 0; }
#log {
  list-style: none; padding: 0; margin: 14px 0 0; max-height: 260px; overflow: auto;
  font-size: var(--text-sm); color: var(--fg-muted);
}
#log li { padding: 5px 0; border-bottom: 1px solid var(--border-subtle); }

/* ── Result ──────────────────────────────────────────────── */
.result-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.result-head .card-title { margin: 0; }
.downloads { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }

.answer-box {
  background: var(--bg-app); border: 1.5px solid var(--border-default);
  border-radius: var(--radius); padding: 16px;
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 4px;
  color: var(--fg-default); font-size: var(--text-base); line-height: 1.6;
}

/* ── Table ───────────────────────────────────────────────── */
.tbl-wrap {
  border: 1.5px solid var(--border-default); border-radius: var(--radius-lg);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
thead { background: var(--bg-app); }
th {
  text-align: left; padding: 11px 14px;
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--fg-subtle); border-bottom: 1.5px solid var(--border-default);
}
td {
  text-align: left; padding: 12px 14px; vertical-align: top;
  border-bottom: 1px solid var(--border-subtle); color: var(--fg-default);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(var(--brand-primary-rgb), .03); }
td.answer { max-width: 380px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg-strong); }
td.comment { max-width: 240px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg-muted); }

/* ── Confidence pills (design-system status mapping) ─────── */
.tag {
  display: inline-flex; align-items: center; white-space: nowrap;
  height: 22px; padding: 0 9px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  letter-spacing: .04em; text-transform: uppercase;
}
.tag.High { background: var(--success-bg); color: var(--success-fg); }
.tag.Medium { background: var(--warning-bg); color: var(--warning-fg); }
.tag.Low, .tag.review { background: var(--danger-bg); color: var(--danger-fg); }
