/* ═══════════════════════════════════════════════════════════
   CHAD Cornerstone — Your Property Journey™
   kanban.css  |  Pipeline Board + Workspace Stage Banner
   ═══════════════════════════════════════════════════════════ */

/* ─── KANBAN PAGE WRAPPER ────────────────────────────────── */

.kb-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* ─── PAGE HEADER ─────────────────────────────────────────── */

.kb-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.kb-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.3px;
}

.kb-page-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

.kb-view-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-view-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.kb-view-btn:hover {
  background: var(--surface-3);
  color: var(--text-1);
}

.kb-view-btn--active {
  background: #152B52;
  color: #E8C825;
  border-color: #152B52;
}

/* ─── BOARD LAYOUT ────────────────────────────────────────── */

.kb-board {
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 16px 24px 24px;
  overflow-x: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  align-items: flex-start;
}

.kb-board::-webkit-scrollbar {
  height: 6px;
}
.kb-board::-webkit-scrollbar-track {
  background: transparent;
}
.kb-board::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ─── COLUMN ──────────────────────────────────────────────── */

.kb-column {
  display: flex;
  flex-direction: column;
  min-width: 248px;
  max-width: 248px;
  background: var(--surface-1);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.kb-col-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--stage-color, #152B52) 0%, color-mix(in srgb, var(--stage-color, #152B52) 80%, #000) 100%);
  position: relative;
}

.kb-col-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 100%);
  pointer-events: none;
}

.kb-col-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.kb-col-meta {
  flex: 1;
  min-width: 0;
}

.kb-col-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-col-count {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  margin-top: 1px;
}

.kb-col-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  flex: 1;
}

.kb-col-empty {
  padding: 20px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-4);
  font-style: italic;
}

/* ─── CLIENT CARD ─────────────────────────────────────────── */

.kb-card {
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.kb-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  border-color: color-mix(in srgb, var(--border) 70%, #E8C825);
}

.kb-card--open {
  border-color: color-mix(in srgb, var(--border) 50%, #E8C825);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.kb-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px 12px;
  cursor: pointer;
  user-select: none;
}

.kb-card-header:hover .kb-expand-arrow {
  color: #E8C825;
}

.kb-card-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.kb-card-info {
  flex: 1;
  min-width: 0;
}

.kb-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.1px;
}

.kb-card-prop {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

.kb-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.kb-card-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
}

.kb-card-tasks {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}

.kb-card-next {
  font-size: 12px;
  color: var(--text-2);
  padding: 8px 14px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kb-card-next-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kb-card-next-task {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
}

.kb-card-next--done .kb-card-next-task {
  color: #2ecc71;
}

.kb-card-pct--done {
  color: #2ecc71;
}

.kb-expand-arrow {
  font-size: 16px;
  color: var(--text-3);
  transition: transform 0.2s ease, color 0.15s ease;
  line-height: 1;
}

/* ─── PROGRESS BAR ─────────────────────────────────────────── */

.kb-progress-track {
  height: 5px;
  background: var(--surface-3);
  margin: 0 14px 8px;
  border-radius: 3px;
  overflow: hidden;
}

.kb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1F407B 0%, #3d6cb5 100%);
  border-radius: 2px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.kb-progress-fill--done {
  background: linear-gradient(90deg, #1e8449 0%, #2ecc71 100%);
}

/* ─── URGENT DATE PILLS (card preview) ──────────────────────── */

.kb-urgent-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 12px 6px;
}

.kb-date-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ─── CARD BODY (expanded) ────────────────────────────────── */

.kb-card-body {
  border-top: 1px solid var(--border);
  padding: 0 12px 12px;
}

.kb-card-body.hidden {
  display: none;
}

/* ─── CHECKLIST ───────────────────────────────────────────── */

.kb-checklist {
  padding-top: 12px;
}

.kb-checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

.kb-checklist-count {
  font-weight: 600;
  color: var(--text-3);
}

.kb-check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  border-radius: 5px;
  transition: background 0.1s ease;
}

.kb-check-row:hover {
  background: var(--surface-3);
  margin: 0 -4px;
  padding: 5px 4px;
}

.kb-check-row input[type="checkbox"] {
  display: none;
}

.kb-check-mark {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  background: var(--surface-1);
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
  transition: all 0.15s ease;
}

.kb-check-row input[type="checkbox"]:checked + .kb-check-mark {
  background: #1e8449;
  border-color: #1e8449;
}

.kb-check-row input[type="checkbox"]:checked + .kb-check-mark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: #fff;
  font-weight: 700;
  line-height: 1;
}

.kb-check-label {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
  flex: 1;
  transition: color 0.15s ease;
}

.kb-check-row--done .kb-check-label {
  color: var(--text-4);
  text-decoration: line-through;
}

/* ─── KEY DATES SECTION ───────────────────────────────────── */

.kb-dates-section {
  padding-top: 12px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
}

.kb-date-row {
  display: grid;
  grid-template-columns: 18px 1fr auto auto;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  font-size: 12px;
}

.kb-date-icon {
  font-size: 13px;
  text-align: center;
}

.kb-date-label {
  color: var(--text-2);
  white-space: nowrap;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-date-input {
  width: 114px;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-1);
  font-size: 11px;
  font-family: var(--font);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.kb-date-input:focus {
  outline: none;
  border-color: #E8C825;
}

/* Colour-code the date input borders */
.kb-date-input.kb-date--overdue { border-color: #e74c3c; }
.kb-date-input.kb-date--soon    { border-color: #f39c12; }
.kb-date-input.kb-date--ok      { border-color: #27ae60; }

.kb-date-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  min-width: 52px;
  text-align: center;
}

/* Date status colours (shared for pills + tags) */
.kb-date--overdue {
  background: rgba(231, 76, 60, 0.18);
  color: #e74c3c;
}

.kb-date--soon {
  background: rgba(243, 156, 18, 0.18);
  color: #f39c12;
}

.kb-date--ok {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

/* ─── CARD ACTIONS ─────────────────────────────────────────── */

.kb-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.kb-advance-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: 7px;
  border: none;
  background: linear-gradient(135deg, #1e8449, #27ae60);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
  letter-spacing: 0.2px;
}

.kb-advance-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.kb-advance-btn:active {
  transform: translateY(0);
}

.kb-advance-btn--partial {
  background: linear-gradient(135deg, #1F407B, #2d5aa0);
  opacity: 0.85;
}

.kb-open-btn {
  width: 100%;
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.kb-open-btn:hover {
  background: #152B52;
  color: #E8C825;
  border-color: #152B52;
}

/* ─── CLIENT HUB — KANBAN TOGGLE ──────────────────────────── */

.ch-view-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ch-view-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ch-view-btn:hover {
  background: var(--surface-3);
  color: var(--text-1);
}

.ch-view-btn--active {
  background: #152B52;
  color: #E8C825;
  border-color: #152B52;
}

/* ─── WORKSPACE STAGE BANNER ──────────────────────────────── */

.ws-stage-wrap {
  margin-bottom: 16px;
}

.ws-stage-wrap .ws-stage-banner {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  cursor: pointer;
}

.ws-stage-body {
  background: linear-gradient(135deg, rgba(0,48,73,0.55) 0%, rgba(0,26,40,0.55) 100%);
  border: 1px solid rgba(254,127,45,0.25);
  border-top: none;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  padding: 16px 20px 18px;
  overflow: hidden;
}

.ws-stage-body--collapsed {
  display: none;
}

.ws-stage-body .kb-checklist {
  margin: 0;
  background: transparent;
  border: none;
  padding: 0;
}

.ws-stage-body .kb-dates-section {
  margin-top: 14px;
}

.ws-stage-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: rgba(255,255,255,0.7);
  transition: transform 0.2s ease;
}

.ws-stage-chevron--collapsed {
  transform: rotate(180deg);
}

.ws-stage-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #003049 0%, #001a28 100%);
  border: 1px solid rgba(254,127,45,0.25);
  position: relative;
  overflow: hidden;
}

.ws-stage-banner::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 140px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04));
  pointer-events: none;
}

.ws-stage-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: none;
}

.ws-stage-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ws-stage-icon-lg {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.ws-stage-eyebrow {
  font-size: 13px;
  font-weight: 600;
  color: #fe7f2d;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 3px;
}

.ws-stage-name {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
}

.ws-stage-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ws-stage-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.ws-stage-prog-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.ws-stage-prog-bar {
  width: 120px;
  height: 5px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  overflow: hidden;
}

.ws-stage-prog-fill {
  height: 100%;
  background: #E8C825;
  border-radius: 3px;
  transition: width 0.4s ease;
  min-width: 3px;
}

.ws-stage-prog-txt {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
}

.ws-stage-select {
  padding: 6px 28px 6px 10px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='rgba(255,255,255,0.6)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ws-stage-select:hover {
  border-color: rgba(255,255,255,0.45);
  background-color: rgba(0,0,0,0.35);
}

.ws-stage-select:focus {
  outline: none;
  border-color: #E8C825;
}

.ws-stage-select option {
  background: #1a2744;
  color: #fff;
}

/* ─── RESPONSIVE — narrow screens ───────────────────────────── */

@media (max-width: 900px) {
  .kb-board {
    padding: 12px 16px 20px;
  }

  .kb-column {
    min-width: 220px;
    max-width: 220px;
  }

  .ws-stage-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .ws-stage-right {
    width: 100%;
    justify-content: space-between;
  }

  .ws-stage-select {
    flex: 1;
  }
}
