/* ============================================================
   PERFORMANCE HUB — สไตล์เฉพาะของฟีเจอร์เสริม
   หน้าแรก (Home) · หน้าทีม (Team) · รายการวันนี้ · บันทึกย้อนหลัง
   ============================================================ */

/* ---------- หน้าแรก: Hero ---------- */
.home-hero {
    display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap;
    background: linear-gradient(135deg, #0F3D22 0%, #166534 55%, #15803D 100%);
    color: #fff; border: none; padding: 26px 28px;
    position: relative; overflow: hidden;
}
.home-hero::after {
    content: ""; position: absolute; right: -70px; top: -70px; width: 240px; height: 240px;
    background: radial-gradient(circle, rgba(255,255,255,.1) 0%, transparent 70%); border-radius: 50%;
}
.home-greet { color: #BBF7D0; font-size: .78rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.home-hero h3 { color: #fff; font-weight: 800; font-size: 1.45rem; margin: 4px 0 2px; }
.home-date-line { color: rgba(255,255,255,.8); font-size: .76rem; margin-bottom: 10px; }
.home-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.home-hero-actions .btn { border-radius: 10px; font-size: .8rem; font-weight: 600; padding: 9px 15px; }
.home-hero-actions .btn-outline-light2 { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.home-hero-actions .btn-outline-light2:hover { background: rgba(255,255,255,.22); color: #fff; }
.home-hero-actions .btn-business-primary { background: #fff; color: var(--primary-hover); box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.home-hero-actions .btn-business-primary:hover { background: #F0FDF4; color: var(--primary-hover); }
.home-ring-zone { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.home-ring { width: 92px; height: 92px; transform: rotate(-90deg); }
.home-ring .ring-bg { fill: none; stroke: rgba(255,255,255,.2); stroke-width: 8; }
.home-ring .ring-fg {
    fill: none; stroke: #4ADE80; stroke-width: 8; stroke-linecap: round;
    stroke-dasharray: 213.6; stroke-dashoffset: 213.6; transition: stroke-dashoffset .8s ease;
}
.home-ring-text {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; line-height: 1.1;
}
.home-ring-text b { font-size: 1.15rem; }
.home-ring-text small { font-size: .58rem; opacity: .8; }
.home-ring-cap { font-size: .7rem; color: rgba(255,255,255,.85); line-height: 1.7; }
.home-ring-cap b { color: #fff; }

/* ---------- เมนูลัด (Quick actions) ---------- */
.quick-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px;
}
.quick-btn {
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
    background: #FAFBFA; border: 1px solid var(--border-color); border-radius: 14px;
    padding: 14px; cursor: pointer; transition: all .22s ease; text-align: left; font-family: inherit;
}
.quick-btn:hover { border-color: var(--primary-green); background: var(--accent-light); transform: translateY(-3px); box-shadow: 0 6px 16px rgba(22,163,74,.12); }
.quick-btn i {
    width: 38px; height: 38px; border-radius: 10px; background: var(--accent-light); color: var(--primary-green);
    display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.quick-btn.admin i { background: #ECFDF5; color: #047857; }
.quick-btn .qb-title { font-weight: 700; font-size: .84rem; color: var(--text-main); }
.quick-btn .qb-sub { font-size: .66rem; color: var(--text-muted); }

/* ---------- แท่ง 7 วันย้อนหลัง (Home) ---------- */
.week-bars { display: flex; align-items: stretch; gap: 8px; height: 130px; padding-top: 6px; }
.wb-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.wb-zone { flex-grow: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.wb-bar { width: 68%; max-width: 44px; border-radius: 7px 7px 3px 3px; min-height: 3px; transition: height .5s ease; }
.wb-val { font-size: .62rem; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.wb-label { font-size: .62rem; color: var(--text-muted); white-space: nowrap; }

/* ---------- ชิปสรุปประเภทงานวันนี้ (Home) ---------- */
.home-cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.home-cat-chip {
    background: #FAFBFA; border: 1px solid var(--border-color); border-radius: 12px;
    padding: 8px 14px; display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 600;
}
.home-cat-chip b { font-size: 1rem; color: var(--primary-green); font-variant-numeric: tabular-nums; }

/* ---------- Snapshot ทีม (Home · admin) ---------- */
.mini-team-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 0;
    border-bottom: 1px dashed var(--border-color); font-size: .8rem;
}
.mini-team-row:last-child { border-bottom: none; }
.mini-team-rank { width: 26px; text-align: center; font-weight: 800; color: var(--text-muted); }
.mini-team-name { flex-grow: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- รายการวันนี้ + ลบด่วน (หน้าบันทึก) ---------- */
.today-list { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.tl-row {
    display: flex; align-items: center; gap: 10px; padding: 7px 12px;
    background: #FAFBFA; border: 1px solid var(--border-color); border-radius: 10px; font-size: .78rem;
    transition: all .2s;
}
.tl-row:hover { border-color: var(--primary-green); background: var(--accent-light); }
.tl-time { color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .72rem; }
.tl-id { flex-grow: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text-main); }
.tl-del {
    flex-shrink: 0; border: none; background: #FEE2E2; color: #B91C1C;
    width: 26px; height: 26px; border-radius: 8px; cursor: pointer; transition: all .2s;
    display: flex; align-items: center; justify-content: center; font-size: .7rem;
}
.tl-del:hover { background: #DC2626; color: #fff; transform: scale(1.08); }
.tl-empty { text-align: center; color: var(--text-muted); font-size: .75rem; padding: 14px 6px; }

/* ---------- ป้ายบันทึกย้อนหลัง ---------- */
.bd-banner {
    background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E;
    border-radius: 12px; padding: 10px 16px; font-size: .8rem; font-weight: 600;
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.bd-banner i { font-size: 1rem; }

/* ---------- หน้าทีม (Team Dashboard + Leaderboard) ---------- */
.team-hero {
    display: flex; justify-content: space-between; align-items: center; gap: 15px; flex-wrap: wrap;
    background: linear-gradient(135deg, #0F3D22 0%, #166534 55%, #15803D 100%);
    color: #fff; border: none; padding: 22px 26px;
    position: relative; overflow: hidden;
}
.team-hero::after {
    content: ""; position: absolute; right: -60px; bottom: -80px; width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,.09) 0%, transparent 70%); border-radius: 50%;
}
.team-hero h4 { color: #fff; font-weight: 800; font-size: 1.25rem; margin: 3px 0; }
.team-hero .th-eyebrow { color: #BBF7D0; font-size: .64rem; letter-spacing: 2.2px; font-weight: 700; }
.team-hero .th-meta { color: rgba(255,255,255,.82); font-size: .74rem; }
.team-hero-actions { display: flex; gap: 8px; position: relative; z-index: 1; flex-wrap: wrap; }
.team-hero-actions .btn { border-radius: 10px; font-size: .8rem; font-weight: 600; padding: 9px 15px; }
.team-hero-actions .btn-outline-light2 { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.team-hero-actions .btn-outline-light2:hover { background: rgba(255,255,255,.22); color: #fff; }
.team-hero-actions .btn-business-primary { background: #fff; color: var(--primary-hover); }

/* ตารางทีม */
.team-table td, .team-table th { white-space: nowrap; vertical-align: middle; }
.team-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.tr-row-low { background: #FFF7F7; }
.tr-row-low:hover { background: #FEF2F2 !important; }
.tr-name { font-weight: 700; }
.tr-name small { display: block; color: var(--text-muted); font-weight: 500; }
.team-status {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: .66rem; font-weight: 700; white-space: nowrap;
}
.ts-done { background: #DCFCE7; color: #15803D; }
.ts-near { background: #FEF3C7; color: #B45309; }
.ts-low { background: #FEE2E2; color: #B91C1C; }
.ts-off { background: #F3F4F6; color: #9CA3AF; }
.ts-none { background: #F3F4F6; color: #6B7280; border: 1px dashed #D1D5DB; }
.pct-cell-mini { font-weight: 800; }
.pct-green { color: #15803D; }
.pct-amber { color: #B45309; }
.pct-red { color: #B91C1C; }
.pct-gray { color: #9CA3AF; }

/* Leaderboard */
.lb-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border: 1px solid var(--border-color); border-radius: 12px; margin-bottom: 8px;
    background: #FAFBFA; transition: all .2s;
}
.lb-row:hover { border-color: var(--primary-green); background: var(--accent-light); }
.lb-row.lb-top1 { background: linear-gradient(90deg, #FEF9C3, #FAFBFA); border-color: #FDE047; }
.lb-row.lb-top2 { background: linear-gradient(90deg, #F1F5F9, #FAFBFA); border-color: #CBD5E1; }
.lb-row.lb-top3 { background: linear-gradient(90deg, #FFF7ED, #FAFBFA); border-color: #FDBA74; }
.lb-rank { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.15rem; font-weight: 800;
    background: #fff; border: 1px solid var(--border-color); color: var(--text-muted); }
.lb-info { flex-grow: 1; min-width: 0; }
.lb-name { font-weight: 700; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-sub { font-size: .68rem; color: var(--text-muted); }
.lb-bar-zone { width: 180px; flex-shrink: 0; background: #E5E7EB; border-radius: 8px; height: 14px; overflow: hidden; }
.lb-bar { height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--accent-green), var(--primary-green)); transition: width .6s ease; }
.lb-pct { width: 58px; text-align: right; font-weight: 800; font-size: .95rem; color: var(--primary-green); flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ปุ่มช่วงเวลาของ Leaderboard (ใช้ preset-btn เดิม + สถานะ active) */
.preset-btn.active { background: var(--primary-green); border-color: var(--primary-green); color: #fff; }

/* ---------- มือถือ ---------- */
@media (max-width: 767.98px) {
    .home-hero { padding: 20px 18px; }
    .home-hero h3 { font-size: 1.15rem; }
    .home-ring { width: 76px; height: 76px; }
    .lb-bar-zone { width: 90px; }
    .home-cat-chip { padding: 6px 10px; font-size: .72rem; }
}
