/* ===== Cycle Matrix Dashboard (HR-app style) ===== */
.cyc-card { border: 1px solid #e3e8ef; }
.cyc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cyc-head .card-title { font-weight: 800; color: #0d4f8a; }

.cyc-follows { font-size: .76rem; color: #8795a3; background: #f1f4f8; padding: 4px 12px; border-radius: 16px; font-weight: 600; }

/* stat cards (inside section header) */
.mx-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.mx-stat { background: rgba(255,255,255,.95); border-left: 4px solid #999; border-radius: 9px; padding: 5px 12px; min-width: 78px; }
.mx-stat-l { font-size: .68rem; color: #6b7886; }
.mx-stat-v { font-size: 1.1rem; font-weight: 800; color: #1a2733; line-height: 1.1; }
.mx-stat-amber  { border-left-color: #f5a623; }
.mx-stat-green  { border-left-color: #2bb673; }
.mx-stat-purple { border-left-color: #8b5cf6; }
.mx-stat-red    { border-left-color: #e35d5d; }

/* gradient section header */
.mx-section { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  border-radius: 13px; padding: 12px 18px; color: #fff; margin-bottom: 12px; box-shadow: 0 3px 10px rgba(0,0,0,.10); }
.mx-section-r { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mx-grad-amber  { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.mx-grad-orange { background: linear-gradient(90deg, #f97316, #f59e0b); }
.mx-grad-blue   { background: linear-gradient(90deg, #0d4f8a, #2f86c9); }
.mx-section-l { display: flex; align-items: center; gap: 12px; }
.mx-section-emoji { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.25); display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.mx-section-t { font-size: 1.15rem; font-weight: 800; line-height: 1.15; }
.mx-section-s { font-size: .72rem; opacity: .92; }
.mx-section-pct { background: rgba(255,255,255,.95); color: #1a2733; font-weight: 800; font-size: 1.05rem; border-radius: 10px; padding: 5px 14px; }

/* legend */
.mx-legend { display: flex; gap: 14px; font-size: .76rem; color: #5a6b7b; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.mx-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mx-legend-hint { margin-left: auto; color: #8795a3; font-style: italic; }
.mx-dot { width: 13px; height: 13px; border-radius: 4px; display: inline-block; }

/* matrix table */
.mx-wrap { overflow-x: auto; border: 1px solid #e6ebf1; border-radius: 12px; }
.mx-table { border-collapse: separate; border-spacing: 0; width: 100%; }
.mx-table thead th { background: #f1f4f8; font-size: .72rem; font-weight: 700; color: #5a6b7b; padding: 7px 4px; text-align: center; position: sticky; top: 0; }
.mx-rowh-h, .mx-rowh { position: sticky; left: 0; z-index: 2; background: #f1f4f8; text-align: left !important; min-width: 168px; padding-left: 12px !important; }
.mx-rowpct-h { min-width: 46px; }
.mx-colh { min-width: 30px; }
.mx-colh.mx-col-cur { background: #dbeafe; color: #0d4f8a; border-radius: 6px 6px 0 0; }
.mx-colh.mx-col-we { color: #c0758a; }

.mx-row { border-top: 1px solid #f1f4f8; cursor: pointer; }
.mx-row:hover { background: #f7fafd; }
.mx-row:hover .mx-rowh { background: #f7fafd; }
.mx-rowh { background: #fff; border-top: 1px solid #f1f4f8; }
.mx-rowi { width: 24px; height: 24px; border-radius: 7px; background: #eef2f7; color: #5a6b7b; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; margin-right: 8px; vertical-align: middle; }
.mx-rowl { font-size: .86rem; font-weight: 600; color: #1a2733; vertical-align: middle; }
.mx-rowpct { text-align: center; }
.mx-pctbadge { font-size: .72rem; font-weight: 800; padding: 2px 7px; border-radius: 12px; }

.mx-td { text-align: center; padding: 4px 3px; }
.mx-cell { width: 24px; height: 24px; margin: 0 auto; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 800; }
.mx-cell-m { width: auto; min-width: 46px; height: 28px; padding: 0 8px; font-size: .8rem; }
.mx-cell-d { width: auto; min-width: 26px; padding: 0 4px; font-size: .66rem; }
.mx-cell-pct { display: block; font-size: .56rem; color: #b9700d; font-weight: 700; line-height: 1; margin-top: 1px; }
.mx-cell-cur { outline: 2px solid #2f86c9; outline-offset: 0; }

/* status colors (cells + dots + badges) */
.mx-done    { background: #d8f5e4; color: #138a4b; }
.mx-partial { background: #fdedd3; color: #b9700d; }
.mx-overdue { background: #fcdada; color: #c92a2a; }
.mx-pending { background: #fff; border: 2px dashed #c3ccd6; }
.mx-future  { background: #f4f6f8; }
.mx-na      { background: #f4f4f6; color: #c2c8d0; }
.mx-dot.mx-pending { background: #fff; border: 2px dashed #c3ccd6; }
.mx-dot.mx-future { background: #eceff2; }
.mx-pctbadge.mx-done { background: #d8f5e4; color: #138a4b; }
.mx-pctbadge.mx-partial { background: #fdedd3; color: #b9700d; }
.mx-pctbadge.mx-overdue { background: #fcdada; color: #c92a2a; }

@media (max-width: 640px) {
  .mx-ctrl { flex-direction: column; align-items: stretch; }
  .mx-stats { justify-content: space-between; }
  .mx-stat { flex: 1; min-width: 0; padding: 8px 10px; }
  .mx-rowh-h, .mx-rowh { min-width: 120px; }
  .mx-rowl { font-size: .76rem; }
  .mx-cell, .mx-rowi { width: 21px; height: 21px; }
}

/* ===== Dept-overview controls ("ภาพรวมตามแผนก" style) ===== */
.do-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.do-fbtn { border: 0; padding: 4px 11px; border-radius: 9px; font-size: .78rem; font-weight: 700; cursor: pointer; background: #eef1f5; color: #5a6b7b; }
.do-fbtn:hover { background: #e2e7ee; }
.do-fbtn.active { background: #4f46e5; color: #fff; }
.do-nav { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.do-navbtn { border: 0; padding: 4px 9px; border-radius: 8px; font-size: .74rem; cursor: pointer; background: #eef1f5; color: #5a6b7b; }
.do-navbtn:hover:not(:disabled) { background: #e2e7ee; }
.do-navbtn:disabled { background: #f4f6f8; color: #cbd5e1; cursor: not-allowed; }
.do-navbtn.now { background: #fef3c7; color: #b45309; font-weight: 700; }
.do-range { font-size: .74rem; font-weight: 700; color: #475569; background: #eef1f5; border-radius: 7px; padding: 3px 9px; margin-left: 2px; }
.do-depts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.do-depts > .do-lbl { font-size: .74rem; color: #6b7886; }
.do-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 9px; border: 1px solid #e2e8f0; font-size: .74rem; color: #8795a3; cursor: pointer; }
.do-chip.on { border-color: #c7d2fe; background: #eef2ff; color: #4f46e5; }
.do-chip input { accent-color: #4f46e5; }
.do-legend2 { font-size: .74rem; color: #5a6b7b; margin: 6px 0 10px; line-height: 1.9; }
