:root {
  --bg: #f4f7f5;
  --card: #ffffff;
  --ink: #1f2a25;
  --muted: #7f8a84;
  --line: #e2ebe6;
  --primary: #00653E;          /* WFM brand green */
  --primary-dark: #004e30;
  --primary-soft: #e9f5f0;     /* WFM light green accent */
  --primary-ink: #fff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 60, 35, .09);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.link-btn { background: none; border: none; padding: 0; font: inherit; cursor: pointer; color: var(--muted); }
.link-btn:hover { text-decoration: underline; }
.small { font-size: 12px; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: 18px;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 0 20px; height: 56px; position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; color: var(--primary); }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.container { max-width: 1280px; margin: 0 auto; padding: 22px 20px; }

/* buttons */
.btn {
  display: inline-block; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; font-size: 14px; font-weight: 500;
}
.btn:hover { text-decoration: none; border-color: #bcd3c8; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-danger { color: #b91c1c; border-color: #f0c9c9; }
.btn-danger:hover { background: #fdecec; border-color: #e6a6a6; }

/* projects */
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; }
.projects-table .inline-name { width: 100%; margin: 0; padding: 6px 8px; }
.projects-table td { vertical-align: middle; }
.proj-actions { white-space: nowrap; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.color-dot { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; margin: 0; }
.inline-select { width: auto; margin: 0; padding: 5px 8px; font-size: 13px; }

/* cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
label { display: block; margin-bottom: 12px; font-weight: 500; }
input, textarea, select {
  width: 100%; margin-top: 5px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit;
  background: #fff;
}
.row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash-error { background: #fdecec; color: #b3261e; }
.flash-ok { background: #e7f6ec; color: #1a7f43; }

/* login */
.login-wrap { display: flex; justify-content: center; padding-top: 8vh; }
.login-card { width: 360px; text-align: center; }
.login-card form { text-align: left; margin-top: 14px; }
.auth-alt { margin-top: 14px; text-align: center; line-height: 1.6; }

/* password show/hide toggle */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 40px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer; font-size: 16px;
  line-height: 1; padding: 4px; opacity: .65;
}
.pw-toggle:hover { opacity: 1; }

/* board */
.board-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.board-header h1 { margin: 0; }
.filters { display: flex; align-items: center; gap: 10px; }
.filters select { width: auto; margin: 0; }

.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start; }
.column { background: #eef1ef; border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; max-height: calc(100vh - 150px); }
.column-head { display: flex; align-items: center; gap: 6px; font-weight: 600; padding: 6px 6px 10px; font-size: 13px; flex: 0 0 auto; }
.count { margin-left: auto; background: #fff; border-radius: 20px; padding: 1px 9px; font-size: 12px; color: var(--muted); }
.column-body { min-height: 40px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-right: 3px; flex: 1 1 auto; }
.column-body::-webkit-scrollbar { width: 6px; }
.column-body::-webkit-scrollbar-thumb { background: #cdd6d1; border-radius: 6px; }
.column-body.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; border-radius: 8px; }

.task-card { background: #fff; border-radius: 8px; padding: 10px 11px; box-shadow: var(--shadow); border-left: 3px solid transparent; cursor: grab; }
.task-card:hover { box-shadow: 0 2px 8px rgba(0,60,35,.12); }
.task-card.locked { cursor: default; }
.task-card.dragging { opacity: .45; }
.task-card.pr-high { border-left-color: #f59e0b; }
.task-card.pr-urgent { border-left-color: #ef4444; }
.task-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-title:hover { text-decoration: none; color: var(--primary); }
.task-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; }
.task-meta:empty { margin: 0; }
.task-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 8px; }

.chip { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: color-mix(in srgb, var(--c) 16%, #fff); color: var(--c); font-weight: 600; }
.prio { font-size: 11px; color: var(--muted); }
.prio-high { color: #b45309; }
.prio-urgent { color: #b91c1c; font-weight: 700; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #c4c9d6; }
.status-requested { background: #94a3b8; }
.status-backlog { background: #64748b; }
.status-in_progress { background: #0d9488; }
.status-review { background: #f59e0b; }
.status-done { background: #10b981; }

.avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }

/* detail */
.back { display: inline-block; margin-bottom: 12px; }
.title-row { display: flex; align-items: flex-start; gap: 12px; }
.title-row h1 { margin: 8px 0; flex: 1 1 auto; }
.title-row .btn { flex: 0 0 auto; margin-top: 12px; }

/* attachments */
.att-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.att-row a { font-weight: 500; }
.att-row .muted { margin-left: auto; }
.att-form { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.att-form input[type="file"] { width: auto; margin: 0; flex: 1 1 auto; }
.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
.detail-main h1 { margin: 8px 0; }
.description { white-space: pre-wrap; margin-top: 12px; line-height: 1.55; }
.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment p { margin: 4px 0 0; }
.comment-form { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.detail-side h3 { margin: 0 0 8px; }
.detail-side h3 + form + h3 { margin-top: 16px; }

/* role tags */
.role-tag { font-size: 10px; padding: 1px 7px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.role-manager { background: #d7ece2; color: var(--primary); }
.role-worker { background: #e0f2fe; color: #0369a1; }
.role-requester { background: #f1f5f9; color: #64748b; }

/* read-only fields (requester / worker view) */
.readonly-field { margin: 4px 0 8px; padding: 8px 10px; background: #f4f5f7; border-radius: 8px; }
.task-card.locked { cursor: default; opacity: .92; }

/* team */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; align-items: start; }
.team-card { padding: 16px; }
.team-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.team-who { min-width: 0; }
.team-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 7px; }
.team-counts { display: flex; gap: 6px; margin-top: 5px; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; }
.pill-todo { background: #eef1f5; color: #64748b; }
.pill-done { background: var(--primary-soft); color: var(--primary); }
.badge { font-size: 10px; background: var(--primary-soft); color: var(--primary); padding: 1px 7px; border-radius: 20px; }

.lane-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lane { background: #f5f7f6; border-radius: 10px; padding: 10px 10px 4px; }
.lane-title { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.lane-title .count { margin-left: auto; background: #fff; border-radius: 20px; padding: 0 8px; font-size: 11px; color: var(--muted); }
.lane-body { display: flex; flex-direction: column; gap: 8px; max-height: 440px; overflow-y: auto; padding-right: 2px; }
.lane-body::-webkit-scrollbar { width: 6px; }
.lane-body::-webkit-scrollbar-thumb { background: #d5ddd8; border-radius: 6px; }
.lane-empty { font-size: 12px; color: #aab4ae; padding: 6px 2px 10px; }

/* mini task card (team lanes) */
.mt { display: block; background: #fff; padding: 9px 11px; border-radius: 8px; border-left: 3px solid #cbd5d0; box-shadow: var(--shadow); color: var(--ink); }
.mt:hover { text-decoration: none; box-shadow: 0 2px 8px rgba(0,60,35,.12); transform: translateY(-1px); transition: all .12s; }
.mt-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.mt .chip.sm { margin-top: 7px; font-size: 10px; padding: 1px 7px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt.st-done { border-left-color: #10b981; }
.mt.st-done .mt-title { color: #55605a; }
.mt.st-in_progress { border-left-color: #0d9488; }
.mt.st-review { border-left-color: #f59e0b; }
.mt.st-backlog { border-left-color: #94a3b8; }
.mt.st-requested { border-left-color: #cbd5d0; }
.chip.sm { display: inline-block; }

/* members table */
table.members { width: 100%; border-collapse: collapse; }
table.members th, table.members td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); }

@media (max-width: 980px) {
  .board { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
}

/* search + sort buttons (board & my requests) */
.filters .search-input { width: 230px; margin: 0; }
.sortbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.sort-label { margin-right: 2px; }
.sort-btn {
  display: inline-block; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.sort-btn:hover { text-decoration: none; border-color: #bcd3c8; background: var(--primary-soft); }
.sort-btn.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

/* task popup (in-page detail) */
body.peek-open { overflow: hidden; }
.peek-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(15, 35, 26, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px;
  overflow-y: auto;
}
.peek-backdrop[hidden] { display: none; }
.peek-dialog {
  position: relative; width: min(940px, 100%); background: var(--card);
  border-radius: var(--radius); box-shadow: 0 18px 48px rgba(0, 40, 25, .28);
  padding: 22px 24px 24px;
}
.peek-close {
  position: absolute; top: 10px; right: 12px; width: 30px; height: 30px; padding: 0;
  border: none; background: transparent; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer; border-radius: 8px;
}
.peek-close:hover { background: #eef1ef; color: var(--ink); }
.peek-body { max-height: 82vh; overflow-y: auto; padding-right: 4px; }
.peek-head h2 { margin: 8px 0 4px; font-size: 20px; line-height: 1.3; padding-right: 28px; }
.peek-grid { display: grid; grid-template-columns: 1fr 260px; gap: 22px; align-items: start; margin-top: 14px; }
.peek-main h3, .peek-side h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.peek-main > h3:first-child { margin-top: 0; }
.peek-side { border-left: 1px solid var(--line); padding-left: 20px; }
.peek-side h3:first-child { margin-top: 0; }
.peek-side select { margin-top: 0; }
.peek-delete { margin-top: 18px; }
@media (max-width: 780px) {
  .peek-grid { grid-template-columns: 1fr; }
  .peek-side { border-left: none; border-top: 1px solid var(--line); padding: 16px 0 0; }
}

/* ---- action log ---------------------------------------------------------- */
.log-filters { padding: 14px 16px; margin-bottom: 14px; }
.log-filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.log-filter-row label { margin-bottom: 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.log-filter-row select, .log-filter-row input { margin-top: 4px; padding: 7px 9px; font-size: 13px; }
.log-filter-row .grow { flex: 1 1 200px; min-width: 180px; }
.log-filter-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }

.log-people { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.log-person {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 12.5px; font-weight: 500;
}
.log-person:hover { text-decoration: none; border-color: #bcd3c8; background: var(--primary-soft); }
.log-person.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.log-person.active .count { background: rgba(255,255,255,.22); color: #fff; }
.log-person .count { margin: 0; background: var(--primary-soft); color: var(--primary); font-size: 11px; }

.log-day { margin-bottom: 18px; }
.log-day-head { display: flex; align-items: baseline; gap: 10px; padding: 0 2px 7px; }
.log-date { font-weight: 700; font-size: 13px; }
.log-day-head .count { margin-left: auto; background: var(--card); border: 1px solid var(--line); }
.log-card { padding: 0; margin-bottom: 0; overflow: hidden; }

.log-row {
  display: grid; align-items: baseline; gap: 12px;
  grid-template-columns: 46px 92px 190px 1fr 108px 56px;
  padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.log-row:last-child { border-bottom: 0; }
.log-row:hover { background: var(--primary-soft); }
.log-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.log-who { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-where { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.log-where span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-stat { display: inline-flex; gap: 6px; justify-content: flex-end; font-variant-numeric: tabular-nums; font-size: 11.5px; }
.log-add { color: #15803d; }
.log-del { color: #b91c1c; }
.log-ref { font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; text-align: right; }
.log-pager { margin-top: 4px; align-items: center; }

@media (max-width: 900px) {
  .log-row { grid-template-columns: 46px 1fr; row-gap: 3px; }
  .log-where, .log-stat, .log-ref { grid-column: 2; justify-content: flex-start; text-align: left; }
  .log-what { grid-column: 2; white-space: normal; }
  .log-filter-actions { margin-left: 0; }
}

/* ---- action log charts --------------------------------------------------- */
.charts { margin: 4px 0 18px; }
.chart-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 13px 15px; min-width: 0; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.chart-head h3 { font-size: 13px; font-weight: 700; }

/* daily sparkline (flex columns, height %) */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 96px; }
.spark-bar { flex: 1 1 0; min-width: 2px; background: var(--primary); border-radius: 2px 2px 0 0; opacity: .82; }
.spark-bar:hover { opacity: 1; }
.spark-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--muted); }
.spark-axis .mono, .mono { font-variant-numeric: tabular-nums; }

/* horizontal bar lists (people, projects) */
.barlist { display: flex; flex-direction: column; gap: 8px; }
.barrow { display: grid; grid-template-columns: 78px 1fr auto; align-items: center; gap: 8px; font-size: 12.5px; }
.barrow.unmapped { opacity: .55; }
.barlabel { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barlabel .swatch { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.bartrack { height: 8px; background: var(--primary-soft); border-radius: 999px; overflow: hidden; }
.barfill { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.barval { min-width: 30px; text-align: right; font-weight: 600; }
.barchurn { display: inline-flex; gap: 6px; white-space: nowrap; }
.barrow:not(:has(.barchurn)) { grid-template-columns: 78px 1fr auto; }
.chart-note { margin: 10px 2px 0; line-height: 1.5; }

@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
  .barrow { grid-template-columns: 72px 1fr auto; }
}

/* ---- H2 goals panel ------------------------------------------------------ */
.h2panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 17px; margin: 4px 0 14px; }
.h2head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.h2head h3 { font-size: 14px; font-weight: 700; }
.h2list { display: flex; flex-direction: column; gap: 12px; }
.h2row { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: center; }
.h2main { min-width: 0; }
.h2top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.h2title { font-weight: 600; font-size: 13.5px; }
.h2pct { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.h2track { display: block; height: 9px; margin: 6px 0 5px; background: var(--primary-soft); border-radius: 999px; overflow: hidden; }
.h2fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.h2meta { line-height: 1.45; }

/* status → color (chip + fill) */
.h2chip { font-weight: 600; }
.h2chip-none { background: #eef1f5; color: #64748b; }
.h2chip-hold { background: #fef3c7; color: #b45309; }
.h2chip-late { background: #fee2e2; color: #b91c1c; }
.h2chip-mid  { background: var(--primary-soft); color: var(--primary); }
.h2chip-on   { background: #dcfce7; color: #15803d; }
.h2chip-done { background: #d1fae5; color: #047857; }
.h2-none .h2fill { background: #94a3b8; }
.h2-hold .h2fill { background: #d97706; }
.h2-late .h2fill { background: #dc2626; }
.h2-on   .h2fill { background: #16a34a; }
.h2-done .h2fill { background: #059669; }

.h2edit { display: flex; align-items: center; gap: 6px; margin: 0; }
.h2edit input[type="number"] { width: 62px; margin: 0; padding: 6px 8px; }
.h2edit select { width: auto; margin: 0; padding: 6px 8px; font-size: 13px; }

@media (max-width: 760px) {
  .h2row { grid-template-columns: 1fr; }
  .h2edit { justify-content: flex-start; }
}

/* action log — plain-English gloss under the raw commit message */
.log-what { display: flex; flex-direction: column; gap: 3px; min-width: 0; white-space: normal; overflow: visible; text-overflow: clip; }
.log-sum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-plain { font-size: 12px; color: var(--muted); line-height: 1.42; white-space: normal; }
