/* Iris shell — shared design tokens + component overrides so the Django
   campaigns app and the FastAPI Iris demo feel like one product.
   Mirrors iris_app/src/iris/web/static/iris.css; load AFTER main.css. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #f1f3f6;
  --border: #e3e6ec;
  --border-strong: #cdd2db;
  --text: #1a1d24;
  --text-soft: #5b6273;
  --text-faint: #8a91a1;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --brand-grad: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 50%, #14b8a6 100%);
  --shadow: 0 1px 2px rgba(20,24,40,.04), 0 4px 14px rgba(20,24,40,.05);
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --risk: #b91c1c;
  --risk-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
}

html, body {
  background: var(--bg) !important;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ---- Top bar ---- */

.navbar {
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 14px 24px !important;
  box-shadow: none !important;
}
.navbar .container-fluid { padding: 0; }

.navbar-brand {
  display: flex !important;
  align-items: center !important;
  gap: 10px;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  color: var(--text) !important;
  font-size: 16px !important;
  padding: 0 !important;
}
.navbar-brand .sep { color: var(--border-strong); font-weight: 300; }
.navbar-brand img { height: 22px !important; width: auto !important; }
.navbar-brand .badge {
  background: var(--surface-alt) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-faint) !important;
  font-size: 11px !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  font-weight: 600 !important;
  padding: 4px 11px !important;
  border-radius: 999px !important;
}

.navbar-nav .nav-link {
  color: var(--text-soft) !important;
  font-size: 13px;
  padding: 6px 12px !important;
  border-radius: 6px;
}
.navbar-nav .nav-link:hover {
  background: var(--surface-alt);
  color: var(--text) !important;
}

/* ---- Cards / surfaces (override Bootstrap bg-body-tertiary) ---- */

.bg-body-tertiary {
  background: var(--surface) !important;
}
.card.bg-body-tertiary, .card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: var(--shadow);
}

/* ---- Headings ---- */

h1, .h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; }
h2, .h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
h3, .h3 { font-size: 16px; font-weight: 600; }
.h5 { font-size: 14px; font-weight: 600; }

.text-muted { color: var(--text-faint) !important; }

/* ---- Buttons ---- */

.btn { font-size: 13px; font-weight: 500; border-radius: 6px; padding: 7px 14px; }
.btn-primary {
  background: var(--brand-grad) !important;
  border: none !important;
  color: #fff !important;
  font-weight: 600 !important;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: 0.45; filter: none; }

.btn-outline-primary {
  border: 1px solid var(--accent) !important;
  color: var(--accent) !important;
  background: var(--surface) !important;
}
.btn-outline-primary:hover {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
}

.btn-sm { font-size: 12px; padding: 5px 10px; }

/* ---- Forms ---- */

.form-control, .form-select {
  background: var(--surface-alt) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-size: 13px !important;
}
.form-control:focus, .form-select:focus {
  background: var(--surface) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-soft) !important;
}
.form-control-sm, .form-select-sm { font-size: 12.5px !important; }
.form-label { font-size: 12px; color: var(--text-soft); font-weight: 500; }
.input-group .form-control { border-right: none; }

/* ---- Lists ---- */

.list-group-item {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text);
}
.list-group-item-action:hover {
  background: var(--accent-soft) !important;
}

/* ---- Alerts mapped to Iris insight severities ---- */

.alert {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
}
.alert-info, .alert-secondary { background: var(--surface-alt); color: var(--text-soft); border-color: var(--border); }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-color: #fde68a; }
.alert-danger { background: var(--risk-bg); color: var(--risk); border-color: #fecaca; }

.badge.text-bg-warning { background: var(--warn) !important; color: #fff; }
.badge.text-bg-danger { background: var(--risk) !important; color: #fff; }
.badge.text-bg-info { background: var(--info) !important; color: #fff; }
.badge.text-bg-secondary { background: var(--text-soft) !important; color: #fff; }

/* ---- Brand bar (anchor date row) ---- */

.anchor-bar {
  background: var(--brand-grad) !important;
  color: #fff !important;
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.anchor-bar input[type=date] {
  background: rgba(255,255,255,0.15) !important;
  border: 1px solid rgba(255,255,255,0.4) !important;
  color: #fff !important;
}
.anchor-bar button {
  background: #fff !important;
  color: var(--accent) !important;
  border: none !important;
  font-weight: 600;
}

/* ---- Workstream + task rows (already custom in detail page) ---- */

.ws-card {
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.ws-card h2 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.ws-card .ws-desc { color: var(--text-faint); font-size: 12.5px; margin-bottom: 12px; }

.task-row {
  display: grid;
  grid-template-columns: 1fr 130px 140px 160px 80px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.task-row-wrap:first-of-type .task-row { border-top: none; }
.task-row .title { font-size: 13.5px; }
.task-row .title.critical::before {
  content: "!";
  color: var(--risk);
  font-weight: 700;
  margin-right: 6px;
}
.task-row .role-hint { color: var(--text-faint); font-size: 11.5px; }
.task-row .task-desc { color: var(--text-soft); font-size: 12.5px; margin-top: 2px; }
.task-row.done .title { color: var(--text-faint); text-decoration: line-through; }
.task-row.na .title { color: var(--text-faint); text-decoration: line-through; opacity: 0.7; }

.task-actions { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
.task-action-btn {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); border-radius: 4px;
  font-size: 12px; padding: 2px 6px; cursor: pointer;
}
.task-action-btn:hover { background: var(--surface-alt); color: var(--text); }
.task-action-btn.iris-jump {
  color: var(--brand);
  border-color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}
.task-action-btn.iris-jump:hover { background: var(--accent-soft); color: var(--brand); }

.task-edit-form { padding: 12px 0; }
.task-comments { padding: 0 0 8px 24px; }

.comment-thread { background: var(--surface-alt); border-radius: 6px; padding: 10px 12px; margin-top: 6px; }
.comment { padding: 6px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment-reply { margin-left: 24px; border-left: 2px solid var(--border); padding-left: 12px; }
.comment-head { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--text-faint); }
.comment-author { font-weight: 600; color: var(--text-soft); }
.comment-del-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 0 6px; font-size: 13px; }
.comment-del-btn:hover { color: var(--risk); }
.comment-body { font-size: 13px; line-height: 1.5; margin-top: 2px; }
.comment-deleted .comment-body { color: var(--text-faint); font-style: italic; }
.comment-form { display: flex; gap: 6px; margin-top: 10px; }
.comment-form input { flex: 1; }

.prospect-table { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); margin-bottom: 24px; }
.prospect-row {
  display: grid;
  grid-template-columns: 60px 2fr 80px 1fr 160px;
  gap: 12px; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.prospect-row:last-child { border-bottom: none; }
.prospect-row.prospect-head {
  background: var(--surface-alt);
  color: var(--text-faint);
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700;
}
.prospect-rank { color: var(--text-faint); font-weight: 600; font-variant-numeric: tabular-nums; }
.prospect-score { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.prospect-name { min-width: 0; }
.prospect-name .fw-semibold { font-size: 13.5px; }

/* Dashboard builder: 12-column grid where each widget sets its own span */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 60px;
  gap: 12px;
}
.dashboard-widget { position: relative; min-width: 0; min-height: 0; }
.dashboard-widget:hover .dashboard-widget-del { opacity: 1; }
.dashboard-widget-del {
  position: absolute; top: 6px; right: 6px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); cursor: pointer;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 14px; line-height: 1; padding: 0;
  opacity: 0; transition: opacity 0.12s;
}
.dashboard-widget-del:hover { color: #b91c1c; border-color: #b91c1c; }
.dashboard-widget .card { border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.dashboard-widget .kpi-value { color: var(--text); }
.widget-error { color: #b91c1c; font-size: 12px; padding: 8px; }

/* Card layout for the dev queue list */
.dev-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px;
  box-shadow: var(--shadow); color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.dev-card:hover { border-color: var(--accent); }
.dev-card-high { border-left: 4px solid #dc2626; }
.dev-card-shipped { opacity: 0.65; }
.dev-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dev-card-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.dev-card-when { font-variant-numeric: tabular-nums; flex: none; white-space: nowrap; }
.dev-card-question { font-size: 14.5px; line-height: 1.5; color: var(--text); font-weight: 500; margin-bottom: 10px; }
.dev-card-foot { display: flex; flex-wrap: wrap; gap: 14px; align-items: baseline; font-size: 12.5px; }
.dev-card-asker-label { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; margin-right: 4px; }
.dev-card-asker-link { color: var(--brand); font-weight: 600; }
.dev-card-asker-link:hover { text-decoration: underline; }
.dev-card-why { color: var(--text-soft); font-style: italic; flex-basis: 100%; margin-top: 4px; }

.dev-pill {
  font-size: 11px; letter-spacing: 0.04em; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  white-space: nowrap;
}
.dev-pill-development { background: #dbeafe; color: #1e40af; }
.dev-pill-consultancy { background: #fed7aa; color: #9a3412; }
.dev-pill-unsure      { background: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }
.dev-pill-general     { background: #ddd6fe; color: #5b21b6; }
.dev-pill-specific    { background: #e5e7eb; color: #374151; }
.dev-pill-status-new          { background: #fef3c7; color: #92400e; }
.dev-pill-status-triaged      { background: #cffafe; color: #155e75; }
.dev-pill-status-in_progress  { background: #dbeafe; color: #1e40af; }
.dev-pill-status-shipped      { background: #d1fae5; color: #065f46; }
.dev-pill-status-wont_do      { background: #fee2e2; color: #991b1b; }
.dev-pill-status-duplicate    { background: #f3f4f6; color: #4b5563; }

/* Thread (conversation between asker and team) */
.thread { display: flex; flex-direction: column; gap: 10px; }
.thread-msg {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px;
}
.thread-msg-team { border-left: 3px solid var(--accent); background: var(--accent-soft); }
.thread-msg-asker { border-left: 3px solid #14b8a6; background: #f0fdfa; }
.thread-msg-system { border-left: 3px dashed var(--border-strong); background: var(--surface-alt); }
.thread-msg-resolution { border-left-color: #16a34a; background: #f0fdf4; }
.thread-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-faint); margin-bottom: 6px; }
.thread-side { font-weight: 600; color: var(--text-soft); }
.thread-body { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.thread-body p:last-child { margin-bottom: 0; }
.thread-form textarea { font-size: 13.5px; }

.dev-queue-table { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.dev-queue-row { display: grid; grid-template-columns: 140px 1fr 160px 200px; gap: 12px; align-items: start; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.dev-queue-row:last-child { border-bottom: none; }
.dev-queue-row.dev-queue-head { background: var(--surface-alt); color: var(--text-faint); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700; }
.dev-queue-q a { color: var(--text); }
.dev-queue-q a:hover { color: var(--brand); }
.dev-queue-when { font-variant-numeric: tabular-nums; }

.todo-tick {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--text-faint); cursor: pointer; flex: none;
  font-weight: 700;
}
.todo-tick:hover { border-color: var(--brand); color: var(--brand); }
.todo-row.todo-done .todo-tick {
  background: var(--brand); color: #fff; border-color: var(--brand);
}

/* ---- Iris brief + Q&A blocks ---- */

.iris-brief, .iris-answer {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
}
.iris-brief strong, .iris-answer strong { color: var(--text); font-weight: 600; }

.question-card {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  border-radius: 8px !important;
}

/* ---- Misc ---- */

a { color: var(--accent); }
a:hover { color: #3730a3; }
hr, .border-top, .border-bottom { border-color: var(--border) !important; }
footer.footer { background: var(--bg) !important; color: var(--text-faint); border-top: 1px solid var(--border) !important; }
