/* Welldone CARE — Customer Assurance Review & Evaluation */

:root {
  --green: #78bf26;        /* brand accent: use with black ink only (8.7:1) */
  --green-ink: #3f7a10;    /* links & accents on white (5.25:1) */
  --green-bar: #5a9c1f;    /* chart fills on white (3.38:1) */
  --green-wash: #f1f8e7;
  --ink: #141414;
  --ink-2: #4f4e4b;
  --muted: #85837d;
  --surface: #ffffff;
  --page: #f4f5f0;
  --line: #e2e3db;
  --line-strong: #cfd1c6;

  --urgent-ink: #c02f2f;      --urgent-fill: #d03b3b;      --urgent-wash: #fbecec;
  --progress-ink: #8f6000;    --progress-fill: #fab219;    --progress-wash: #fdf3d8;
  --notstarted-ink: #5f51bd;  --notstarted-fill: #7c6fd0;  --notstarted-wash: #efedfa;
  --pending-ink: #1d62b8;     --pending-fill: #2a78d6;     --pending-wash: #e8f1fc;
  --done-ink: #1c691c;        --done-fill: #0ca30c;        --done-wash: #e9f6e9;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 20, 0.05), 0 4px 14px rgba(20, 20, 20, 0.05);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
}
a { color: var(--green-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

/* ---------- header ---------- */
.topbar {
  background: #0d0d0d;
  color: #fff;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  min-height: 58px;
}
.topbar .logo img { height: 34px; display: block; }
.topbar .app-name {
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
  border-left: 1px solid #333;
  padding-left: 14px;
  white-space: nowrap;
}
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.topbar nav a {
  color: #e8e8e4;
  padding: 8px 11px;
  border-radius: 7px;
  font-size: 0.92rem;
  white-space: nowrap;
}
.topbar nav a:hover { background: #222; text-decoration: none; }
.topbar nav a.active { color: var(--green); font-weight: 600; background: #1c1c1c; }
.topbar .nav-count {
  background: var(--green);
  color: #0d0d0d;
  font-weight: 700;
  border-radius: 99px;
  font-size: 0.72rem;
  padding: 1px 7px;
  margin-left: 5px;
  vertical-align: 1px;
}
.topbar .right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar .search input {
  background: #1d1d1d;
  border: 1px solid #333;
  color: #fff;
  border-radius: 7px;
  padding: 6px 10px;
  width: 170px;
  font-size: 0.9rem;
}
.topbar .search input::placeholder { color: #999; }
.topbar .whoami { color: #c9c9c3; font-size: 0.9rem; white-space: nowrap; }
.topbar .whoami a { color: #fff; font-weight: 600; }
.topbar .logout-btn {
  background: none;
  border: 1px solid #3a3a3a;
  color: #ddd;
  border-radius: 7px;
  padding: 5px 11px;
  cursor: pointer;
  font-size: 0.85rem;
}
.topbar .logout-btn:hover { border-color: var(--green); color: var(--green); }

.container { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }

/* ---------- flash messages ---------- */
.flash { border-radius: var(--radius); padding: 11px 16px; margin-bottom: 16px; font-weight: 500; }
.flash.success { background: var(--done-wash); color: var(--done-ink); border: 1px solid #bfe5bf; }
.flash.error { background: var(--urgent-wash); color: var(--urgent-ink); border: 1px solid #f0c4c4; }
.flash.info { background: var(--pending-wash); color: var(--pending-ink); border: 1px solid #c3dcf6; }

/* ---------- cards & layout ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.card > h2:first-child, .card > .card-head h2 { margin-bottom: 4px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head .sub, .sub { color: var(--ink-2); font-size: 0.9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { margin-top: 2px; }

/* ---------- KPI tiles ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.stat-tile .value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat-tile .label { color: var(--ink-2); font-size: 0.83rem; margin-top: 2px; }
.stat-tile.tone-urgent .value { color: var(--urgent-ink); }
.stat-tile.tone-progress .value { color: var(--progress-ink); }
.stat-tile.tone-pending .value { color: var(--pending-ink); }
.stat-tile.tone-done .value { color: var(--done-ink); }
.stat-tile a { color: inherit; }

/* ---------- status badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 10px;
  white-space: nowrap;
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.badge.s-urgent { background: var(--urgent-wash); color: var(--urgent-ink); }
.badge.s-urgent .dot { background: var(--urgent-fill); }
.badge.s-in_progress { background: var(--progress-wash); color: var(--progress-ink); }
.badge.s-in_progress .dot { background: var(--progress-fill); }
.badge.s-not_started { background: var(--notstarted-wash); color: var(--notstarted-ink); }
.badge.s-not_started .dot { background: var(--notstarted-fill); }
.badge.s-pending_approval { background: var(--pending-wash); color: var(--pending-ink); }
.badge.s-pending_approval .dot { background: var(--pending-fill); }
.badge.s-completed { background: var(--done-wash); color: var(--done-ink); }
.badge.s-completed .dot { background: var(--done-fill); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(0.96); }
.btn-primary { background: var(--green); color: #0d0d0d; }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-danger { background: var(--surface); color: var(--urgent-ink); border-color: #e6b8b8; }
.btn-sm { padding: 5px 11px; font-size: 0.84rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data th {
  text-align: left;
  color: var(--ink-2);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 2px solid var(--line-strong);
  white-space: nowrap;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data tr.rowlink:hover { background: var(--green-wash); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.item-title { font-weight: 550; }
.item-title a { color: var(--ink); }
.item-title a:hover { color: var(--green-ink); }
.item-no { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-sub { color: var(--ink-2); font-size: 0.85rem; margin-top: 1px; }

/* ---------- bars (magnitude, single hue) ---------- */
.bar-row { display: grid; grid-template-columns: 150px 1fr 44px; align-items: center; gap: 10px; margin: 7px 0; }
.bar-row .bar-label { font-size: 0.9rem; text-align: right; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { background: var(--page); border-radius: 4px; height: 22px; position: relative; }
.bar-row .fill { background: var(--green-bar); border-radius: 4px 4px 4px 4px; height: 100%; min-width: 2px; }
.bar-row .fill.zero { background: transparent; }
.bar-row .bar-value { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.9rem; }

/* stacked status bar: 2px gaps between segments, legend carries identity */
.stack-bar { display: flex; height: 22px; border-radius: 5px; overflow: hidden; background: var(--page); }
.stack-bar .seg { height: 100%; margin-right: 2px; }
.stack-bar .seg:last-child { margin-right: 0; }
.seg.s-urgent { background: var(--urgent-fill); }
.seg.s-in_progress { background: var(--progress-fill); }
.seg.s-not_started { background: var(--notstarted-fill); }
.seg.s-pending_approval { background: var(--pending-fill); }
.seg.s-completed { background: var(--done-fill); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.83rem; color: var(--ink-2); margin: 10px 0 4px; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ---------- forms ---------- */
form.stack label, .field label { display: block; font-weight: 600; font-size: 0.87rem; margin: 14px 0 4px; }
input[type="text"], input[type="password"], input[type="date"], input[type="email"], select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 0.95rem;
  font-family: var(--sans);
  background: var(--surface);
  color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .field-row { grid-template-columns: 1fr; } }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.checkbox-grid label { display: flex; align-items: center; gap: 7px; font-weight: 500; margin: 0; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.checkbox-grid label:has(input:checked) { background: var(--green-wash); border-color: var(--green-bar); }
.form-actions { margin-top: 20px; display: flex; gap: 10px; align-items: center; }
.hint { color: var(--muted); font-size: 0.82rem; margin-top: 3px; }

/* ---------- item detail ---------- */
.detail-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 22px; margin: 14px 0 4px; }
.meta-grid .meta-label { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.meta-grid .meta-value { font-size: 0.94rem; }
.prose { white-space: pre-wrap; }
.note {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 10px;
  background: var(--surface);
}
.note.kind-manager { background: var(--green-wash); border-color: #cbe3ad; }
.note.kind-imported { background: var(--page); }
.note .note-head { display: flex; gap: 10px; font-size: 0.82rem; color: var(--ink-2); margin-bottom: 3px; flex-wrap: wrap; }
.note .note-head .author { font-weight: 600; color: var(--ink); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--green-bar);
  border-radius: 50%;
  position: absolute;
  left: -5px; top: 15px;
}
.timeline .when { color: var(--muted); font-size: 0.8rem; }
.approval-banner {
  background: var(--pending-wash);
  border: 1px solid #c3dcf6;
  border-radius: var(--radius);
  padding: 13px 16px;
  margin-bottom: 16px;
}
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-actions form { display: inline; }

/* ---------- team cards ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.team-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.team-card .name { font-weight: 700; font-size: 1rem; }
.team-card .name a { color: var(--ink); }
.team-card .role-tag { color: var(--green-ink); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.team-card .counts { display: flex; gap: 12px; margin-top: 8px; font-size: 0.85rem; color: var(--ink-2); flex-wrap: wrap; }
.team-card .counts b { font-size: 1.05rem; color: var(--ink); }
.team-card .mini-badges { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--page); padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); width: 400px; max-width: 100%; padding: 34px 34px 28px; }
.login-card .logo { text-align: center; margin-bottom: 8px; }
.login-card .logo img { max-width: 220px; }
.login-card h1 { text-align: center; font-size: 1.15rem; }
.login-card .care-sub { text-align: center; color: var(--ink-2); font-size: 0.86rem; margin-bottom: 12px; }
.login-card .care-sub b { color: var(--green-ink); }

/* ---------- misc ---------- */
.empty { color: var(--muted); font-style: italic; padding: 8px 0; }
.section-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); font-weight: 700; margin: 18px 0 8px; }
details.archive summary { cursor: pointer; font-weight: 600; color: var(--ink-2); padding: 6px 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 150px; flex: 1; }
.filters .field label { margin-top: 0; }
.report-links { color: var(--ink-2); font-size: 0.88rem; }
.pill-count { font-variant-numeric: tabular-nums; }

@media print {
  .topbar, .filters, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .container { max-width: none; padding: 0; }
}
