:root {
  --bg: #f3f7f4;
  --panel: rgba(255,255,255,.92);
  --ink: #17231e;
  --muted: #68766f;
  --line: #dce7e1;
  --accent: #167c5a;
  --accent-2: #0f5d7a;
  --soft: #eaf5ef;
  --warning: #a85b18;
  --danger: #a63f3f;
  --shadow: 0 18px 50px rgba(31, 58, 45, .10);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 7% 7%, rgba(22,124,90,.13), transparent 28%),
    radial-gradient(circle at 92% 92%, rgba(15,93,122,.10), transparent 26%),
    var(--bg);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 1600px; margin: 0 auto; padding: 28px; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 20px; }
.brand { display: flex; gap: 16px; align-items: center; }
.brand-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(145deg, var(--accent), var(--accent-2)); color: white; font-size: 30px; box-shadow: var(--shadow); }
.eyebrow, .section-kicker { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 4px 0 5px; font-size: clamp(28px, 3vw, 42px); line-height: 1.08; }
.hero p { margin: 0; color: var(--muted); }
.status-pill { white-space: nowrap; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.7); color: var(--muted); font-size: 13px; }
.status-pill span { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #c59b31; }
.status-pill.ok span { background: #2a9b65; }
.status-pill.error span { background: #c64d4d; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stats article { padding: 18px 20px; border: 1px solid rgba(220,231,225,.9); border-radius: 18px; background: rgba(255,255,255,.76); box-shadow: 0 8px 28px rgba(31,58,45,.05); }
.stats strong { display: block; font-size: 30px; line-height: 1; }
.stats span { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }
.workspace { display: grid; grid-template-columns: minmax(330px, 430px) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { border: 1px solid rgba(220,231,225,.95); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.input-panel { position: sticky; top: 18px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 22px 16px; border-bottom: 1px solid var(--line); }
h2 { margin: 4px 0 0; font-size: 21px; }
.privacy-note { color: var(--muted); font-size: 12px; text-align: right; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 20px 22px 0; }
label span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 650; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); outline: none; transition: .2s ease; }
input, select { height: 44px; padding: 0 13px; }
textarea { min-height: 310px; padding: 15px; resize: vertical; line-height: 1.65; }
input:focus, textarea:focus, select:focus { border-color: rgba(22,124,90,.65); box-shadow: 0 0 0 4px rgba(22,124,90,.09); }
.textarea-label { display: block; padding: 16px 22px 0; position: relative; }
.textarea-label small { display: block; margin-top: 6px; color: var(--muted); text-align: right; }
.input-actions { display: grid; grid-template-columns: .8fr 1.2fr; gap: 10px; padding: 18px 22px 0; }
button { min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; background: #f6faf8; color: var(--ink); font-weight: 750; }
button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { cursor: not-allowed; opacity: .48; }
button.primary { border-color: transparent; background: linear-gradient(135deg, var(--accent), #168367); color: white; }
button.secondary { background: var(--soft); color: var(--accent); }
.helper { margin: 14px 22px 22px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.spinner { display: none; width: 16px; height: 16px; margin-left: 8px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-heading { align-items: center; }
.toolbar { display: flex; gap: 8px; }
.filters { display: grid; grid-template-columns: 1fr 170px; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.search-box { position: relative; }
.search-box span { position: absolute; left: 13px; top: 11px; margin: 0; font-size: 19px; }
.search-box input { padding-left: 38px; }
.empty-state { min-height: 590px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-icon { width: 72px; height: 72px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 22px; background: linear-gradient(145deg, var(--soft), #edf3fa); color: var(--accent); font-size: 22px; font-weight: 900; border: 1px solid var(--line); }
.empty-state h3 { margin: 0 0 8px; color: var(--ink); }
.empty-state p { margin: 0; }
.result-content { padding: 18px; }
.insight-card { padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.summary-card { margin-bottom: 12px; background: linear-gradient(145deg, #fff, #f3faf6); }
.insight-title { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--ink); font-weight: 800; }
.insight-title small { color: var(--accent); font-weight: 700; }
.insight-card p { margin: 0; line-height: 1.65; color: #33413a; }
.insight-card ul { margin: 0; padding-left: 18px; color: #47564f; line-height: 1.65; }
.insight-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.warning-card { background: #fffaf4; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; min-width: 850px; border-collapse: collapse; background: #fff; }
th, td { padding: 13px 14px; border-bottom: 1px solid #edf2ef; text-align: left; vertical-align: top; font-size: 13px; }
th { background: #f7faf8; color: var(--muted); font-size: 12px; letter-spacing: .02em; }
tr:last-child td { border-bottom: 0; }
.task-title { font-weight: 750; color: var(--ink); }
.evidence { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.badge { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge.high { background: #ffebeb; color: #a63f3f; }
.badge.medium { background: #fff3dc; color: #986019; }
.badge.low { background: #e9f5ee; color: #277252; }
.status-select { min-width: 92px; height: 34px; padding: 0 8px; font-size: 12px; }
.risk-text { color: var(--danger); line-height: 1.45; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); z-index: 50; padding: 12px 16px; border-radius: 12px; background: #17231e; color: #fff; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; }
  .input-panel { position: static; }
  .insight-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .app-shell { padding: 16px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .filters { grid-template-columns: 1fr; }
  .panel-heading { flex-direction: column; }
  .toolbar { width: 100%; }
  .toolbar button { flex: 1; }
  .privacy-note { text-align: left; }
}
