/* Style 4 — Kanban Tiến Độ | NQ57 */
/* Flat Design Bold — NO shadows anywhere */

:root {
  --font-main: 'DM Sans', system-ui, -apple-system, sans-serif;
  --bg-page: #F3F4F6;
  --col-gray: #6B7280;
  --col-red: #EF4444;
  --col-amber: #F59E0B;
  --col-green: #22C55E;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  background: var(--bg-page);
  color: #111827;
}

/* ── HEADER ─────────────────────────────────────────── */
.k-header {
  background: #FFFFFF;
  border-bottom: 3px solid #E5E7EB;
  box-shadow: none;
  padding: 0 20px;
  flex-shrink: 0;
}

.k-header-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0 8px;
}

.k-header-top .btn-back {
  color: #6B7280;
  border-color: #D1D5DB;
  flex-shrink: 0;
  font-family: var(--font-main);
}

.k-title {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
  flex: 1;
}

.k-header-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 10px;
  gap: 16px;
  flex-wrap: wrap;
}

/* Stats bar */
.k-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.k-stat-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.k-stat-label {
  font-size: 11px;
  color: #9CA3AF;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.k-stat-val {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.k-stat-pct {
  color: #2563EB;
}

.k-stat-sep {
  color: #E5E7EB;
  font-size: 16px;
  line-height: 1;
}

/* Filter */
.k-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.k-select {
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  background: #F9FAFB;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  appearance: auto;
}

.k-select:focus {
  outline: 2px solid #2563EB;
  outline-offset: 1px;
}

.k-filter-tabs {
  display: flex;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  overflow: hidden;
}

.k-tab {
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border: none;
  background: #F9FAFB;
  color: #6B7280;
  cursor: pointer;
  border-right: 1px solid #D1D5DB;
  transition: background 150ms ease, color 150ms ease;
}

.k-tab:last-child {
  border-right: none;
}

.k-tab:hover {
  background: #F3F4F6;
  color: #374151;
}

.k-tab.active {
  background: #111827;
  color: #FFFFFF;
}

/* ── KANBAN COLUMNS ──────────────────────────────────── */
.k-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  height: calc(100vh - 130px);
  background: var(--bg-page);
}

.k-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #E5E7EB;
  min-height: 0;
}

.k-col:last-child {
  border-right: none;
}

.k-col-header {
  padding: 14px 16px 10px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.k-col-sub {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.8;
  text-transform: none;
  letter-spacing: 0;
}

.k-count {
  display: inline-block;
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.k-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

/* ── CARD ────────────────────────────────────────────── */
.k-card {
  background: #FFFFFF;
  border-left: 4px solid;
  border-radius: 4px;
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: none;
  transition: transform 150ms ease;
  flex-shrink: 0;
}

.k-card:hover {
  transform: translateY(-2px);
}

.k-card-name {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
  margin-bottom: 6px;
}

.k-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Badges */
.k-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.k-badge-bn {
  background: #DBEAFE;
  color: #1D4ED8;
}

.k-badge-dp {
  background: #D1FAE5;
  color: #065F46;
}

.k-nv {
  font-size: 11px;
  color: #9CA3AF;
  font-weight: 500;
}

/* Card stats grid */
.k-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px 8px;
  margin-top: 8px;
}

.k-card-stats > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.k-label {
  font-size: 10px;
  color: #9CA3AF;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.k-val {
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

/* Rate display */
.k-card-rate {
  margin-top: 8px;
  font-weight: 700;
  font-size: 18px;
  color: #111827;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.k-card-rate.rate-gray  { color: #9CA3AF; }
.k-card-rate.rate-red   { color: #EF4444; }
.k-card-rate.rate-amber { color: #D97706; }
.k-card-rate.rate-green { color: #16A34A; }

/* Empty state */
.k-col-empty {
  text-align: center;
  padding: 32px 16px;
  color: #D1D5DB;
  font-size: 13px;
  font-weight: 500;
}

/* ── MODAL ───────────────────────────────────────────── */
.modal-overlay {
  align-items: flex-end;
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
  }
}

.modal-box {
  background: #FFFFFF;
  border-radius: 4px 4px 0 0;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
  box-shadow: none;
  transform: translateY(20px);
  transition: transform 200ms ease;
  position: relative;
}

@media (min-width: 768px) {
  .modal-box {
    border-radius: 4px;
    width: 90vw;
    max-height: 85vh;
    transform: scale(0.97) translateY(0);
  }
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

@media (min-width: 768px) {
  .modal-overlay.active .modal-box {
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 2px solid #F3F4F6;
  position: sticky;
  top: 0;
  background: #FFFFFF;
  z-index: 1;
}

.modal-dv-name {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.modal-dv-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.modal-close {
  position: static;
  background: #F3F4F6;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 6px 10px;
  color: #374151;
  opacity: 1;
  flex-shrink: 0;
  font-family: var(--font-main);
  font-weight: 500;
  transition: background 150ms ease;
}

.modal-close:hover {
  background: #E5E7EB;
}

.modal-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 2px solid #F3F4F6;
}

.modal-summary-item {
  padding: 14px 20px;
  border-right: 1px solid #F3F4F6;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-summary-item:last-child {
  border-right: none;
}

.ms-label {
  font-size: 10px;
  color: #9CA3AF;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ms-val {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.ms-val.pct-gray  { color: #9CA3AF; }
.ms-val.pct-red   { color: #EF4444; }
.ms-val.pct-amber { color: #D97706; }
.ms-val.pct-green { color: #16A34A; }

.modal-table-wrap {
  padding: 16px 24px 24px;
  overflow-x: auto;
}

/* Table adjustments in modal */
.modal-table-wrap .data-table th {
  color: #6B7280;
  border-bottom-color: #E5E7EB;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.modal-table-wrap .data-table td {
  font-size: 13px;
  vertical-align: top;
}

.modal-table-wrap .data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.nv-rate-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.nv-rate-gray  { background: #F3F4F6; color: #6B7280; }
.nv-rate-red   { background: #FEE2E2; color: #B91C1C; }
.nv-rate-amber { background: #FEF3C7; color: #92400E; }
.nv-rate-green { background: #DCFCE7; color: #166534; }

.nv-loai-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  background: #F3F4F6;
  color: #6B7280;
  white-space: nowrap;
}

/* ── LOADING ─────────────────────────────────────────── */
.k-loading {
  position: fixed;
  inset: 0;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  color: #6B7280;
  font-family: var(--font-main);
  z-index: 9999;
}

.k-loading.hidden {
  display: none;
}

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 900px) {
  .k-columns {
    grid-template-columns: repeat(2, 1fr);
    height: auto;
    overflow-y: auto;
  }

  html, body {
    overflow: auto;
  }

  .k-col {
    min-height: 300px;
    max-height: 60vh;
  }

  .k-col:nth-child(2) {
    border-right: none;
  }
}

@media (max-width: 600px) {
  .k-columns {
    grid-template-columns: 1fr;
  }

  .k-col:nth-child(2) {
    border-right: 1px solid #E5E7EB;
  }

  .k-header-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-summary {
    grid-template-columns: 1fr;
  }

  .modal-summary-item {
    border-right: none;
    border-bottom: 1px solid #F3F4F6;
  }
}
