/* KKLH Dashboards — Platform Style Guide tokens (--khe-*), scoped to .kklh-dash.
   Mobile-first: base styles target phones; min-width queries enhance upward.
   Touch targets ≥44px, no input font under 16px. */

.kklh-dash {
    --khe-primary: #439bc0;
    --khe-primary-dark: #2c5f7a;
    --khe-navy: #1d3040;
    --khe-teal: #1ec1a1;
    --khe-teal-dark: #085041;
    --khe-purple: #924cd8;
    --khe-purple-dark: #3c3489;
    --khe-amber: #f5c842;
    --khe-text: #1d3040;
    --khe-text-body: #5a6a7a;
    --khe-text-muted: #8a9bab;
    --khe-border: #d0dce6;
    --khe-card-border: #ddedf4;
    --khe-soft: #eef7fb;
    --khe-teal-soft: #e3f7f2;
    --khe-purple-soft: #f1e9fb;
    --khe-danger: #c0392b;
    --khe-danger-soft: #fdecea;
    --khe-amber-soft: #fdf6dd;
    --khe-success: #1e6e3a;
    --khe-radius: 12px;
    --khe-font: 'DM Sans', sans-serif;

    font-family: var(--khe-font) !important;
    color: var(--khe-text-body);
    max-width: 920px;
    margin: 0 auto;
    padding: 4px;
}

/* ── Loading / states ───────────────────────────────────────────────────── */
.kklh-dash-loading { text-align: center; padding: 48px 16px; color: var(--khe-text-muted); }
.kklh-spinner { width: 34px; height: 34px; border: 3px solid var(--khe-card-border); border-top-color: var(--khe-primary); border-radius: 50%; margin: 0 auto 14px; animation: kklh-spin .8s linear infinite; }
@keyframes kklh-spin { to { transform: rotate(360deg); } }
.kklh-card { background: #fff; border: 1.5px solid var(--khe-card-border); border-radius: var(--khe-radius); padding: 18px; margin: 0 0 16px; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.kklh-dash-header { display: flex; flex-direction: column; gap: 12px; margin: 0 0 18px; }
.kklh-dash-title { font-family: var(--khe-font) !important; color: var(--khe-navy) !important; font-size: 23px !important; margin: 0 0 4px !important; line-height: 1.2; }
.kklh-dash-sub { margin: 0; color: var(--khe-text-muted); font-size: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.kklh-dash-section-title { font-family: var(--khe-font); color: var(--khe-navy); font-size: 17px; margin: 18px 0 12px; }
.kklh-back-link { display: inline-block; color: var(--khe-primary); text-decoration: none; font-size: 14px; margin-bottom: 6px; min-height: 44px; line-height: 44px; }

/* Buttons (kh-btn) — 44px min touch target */
.kklh-dash .kh-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 11px 18px !important; border-radius: var(--khe-radius) !important; font-family: var(--khe-font) !important; font-size: 16px !important; font-weight: 700 !important; cursor: pointer; text-decoration: none !important; border: 1.5px solid transparent !important; box-sizing: border-box; }
.kklh-dash .kh-btn-primary { background: var(--khe-primary) !important; color: #fff !important; }
.kklh-dash .kh-btn-primary:hover { background: var(--khe-primary-dark) !important; }
.kklh-dash .kh-btn-ghost { background: #fff !important; color: var(--khe-primary) !important; border-color: var(--khe-border) !important; }

/* ── Banners ─────────────────────────────────────────────────────────────── */
.kklh-banner-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0 0 18px; }
.kklh-dash-banner { border-radius: var(--khe-radius); padding: 16px; }
.kklh-dash-banner-teal { background: var(--khe-teal-soft); }
.kklh-dash-banner-purple { background: var(--khe-purple-soft); }
.kklh-dash-banner-title { font-weight: 700; color: var(--khe-navy); font-size: 15px; }
.kklh-dash-banner-sub { font-size: 13px; color: var(--khe-text-muted); margin: 2px 0 10px; }
.kklh-dash-banner-btn { display: inline-block; font-weight: 700; font-size: 14px; text-decoration: none; min-height: 44px; line-height: 44px; }
.kklh-dash-banner-teal .kklh-dash-banner-btn { color: var(--khe-teal-dark); }
.kklh-dash-banner-purple .kklh-dash-banner-btn { color: var(--khe-purple-dark); }

/* ── Stats ───────────────────────────────────────────────────────────────── */
.kklh-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 8px; }
.kklh-stat { background: #fff; border: 1.5px solid var(--khe-card-border); border-radius: var(--khe-radius); padding: 14px 12px; text-align: center; }
.kklh-stat-label { font-size: 12px; color: var(--khe-text-muted); margin-bottom: 6px; }
.kklh-stat-value { font-size: 26px; font-weight: 800; color: var(--khe-navy); font-family: var(--khe-font); }

/* ── Program list ────────────────────────────────────────────────────────── */
.kklh-program-list { display: grid; grid-template-columns: 1fr; gap: 12px; }
.kklh-program-card { background: #fff; border: 1.5px solid var(--khe-card-border); border-radius: var(--khe-radius); padding: 16px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.kklh-program-card:hover { border-color: var(--khe-primary); box-shadow: 0 4px 16px rgba(67,155,192,.10); }
.kklh-program-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.kklh-program-card-name { font-weight: 700; color: var(--khe-navy); font-size: 16px; }
.kklh-program-card-meta { font-size: 13px; color: var(--khe-text-muted); }
.kklh-program-card-setup { margin-top: 12px; }

.kklh-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: capitalize; }
.kklh-pill-active { background: var(--khe-teal-soft); color: var(--khe-teal-dark); }
.kklh-pill-completed { background: var(--khe-soft); color: var(--khe-primary-dark); }

/* ── Progress bar ────────────────────────────────────────────────────────── */
.kklh-progress { display: flex; align-items: center; gap: 10px; }
.kklh-progress-bar { flex: 1; height: 8px; background: var(--khe-soft); border-radius: 999px; overflow: hidden; }
.kklh-progress-bar span { display: block; height: 100%; width: 0; background: var(--khe-teal); border-radius: 999px; transition: width .3s ease; }
.kklh-progress-label { font-size: 13px; font-weight: 700; color: var(--khe-navy); min-width: 38px; text-align: right; }

/* ── Setup checklist (v0.2 component) ────────────────────────────────────── */
.kklh-checklist-card { background: #fff; border: 1.5px solid var(--khe-card-border); border-radius: var(--khe-radius); padding: 18px; margin: 0 0 16px; }
.kklh-checklist-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.kklh-checklist-head h3 { margin: 0; font-family: var(--khe-font); color: var(--khe-navy); font-size: 18px; }
.kklh-checklist-intro { font-size: 13.5px; color: var(--khe-text-muted); margin: 0 0 14px; }
.kklh-checklist { list-style: none; margin: 0; padding: 0; }

.kklh-mod { border: 1.5px solid var(--khe-card-border); border-radius: var(--khe-radius); margin: 0 0 10px; overflow: hidden; }
.kklh-mod-gated { border-color: var(--khe-amber); }
.kklh-mod-urgent { border-color: var(--khe-danger); }
.kklh-mod-done { opacity: .7; }
.kklh-mod-head { display: flex; align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer; min-height: 44px; box-sizing: border-box; }
.kklh-mod-check { width: 22px; height: 22px; flex: 0 0 22px; border: 2px solid var(--khe-border); border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: #fff; }
.kklh-mod-done .kklh-mod-check { background: var(--khe-teal); border-color: var(--khe-teal); color: #fff; }
.kklh-mod-label { font-weight: 700; color: var(--khe-navy); font-size: 15px; flex: 1; }
.kklh-mod-done .kklh-mod-label { text-decoration: line-through; color: var(--khe-text-muted); }
.kklh-mod-toggle { color: var(--khe-text-muted); font-size: 13px; background: none; border: 0; cursor: pointer; min-height: 44px; padding: 0 6px; }
.kklh-gate-line { font-size: 12.5px; font-weight: 700; padding: 0 14px 10px 48px; }
.kklh-gate-amber { color: #9a7b00; }
.kklh-gate-block { color: var(--khe-text-muted); }
.kklh-gate-urgent { color: var(--khe-danger); }

.kklh-subtasks { list-style: none; margin: 0; padding: 0 14px 10px 14px; border-top: 1px solid var(--khe-soft); }
.kklh-subtask { display: flex; align-items: center; gap: 10px; padding: 9px 0 9px 34px; font-size: 14px; color: var(--khe-text-body); cursor: pointer; min-height: 44px; box-sizing: border-box; }
.kklh-subtask-check { width: 18px; height: 18px; flex: 0 0 18px; border: 2px solid var(--khe-border); border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; background: #fff; }
.kklh-subtask-done .kklh-subtask-check { background: var(--khe-primary); border-color: var(--khe-primary); color: #fff; }
.kklh-subtask-done { color: var(--khe-text-muted); text-decoration: line-through; }
.kklh-checklist-done { background: var(--khe-teal-soft); color: var(--khe-teal-dark); border-radius: var(--khe-radius); padding: 14px 16px; font-size: 14px; }

/* ── Events ──────────────────────────────────────────────────────────────── */
.kklh-event { padding: 10px 0; border-bottom: 1px solid var(--khe-soft); font-size: 14px; }
.kklh-event:last-child { border-bottom: 0; }
.kklh-event-name { font-weight: 700; color: var(--khe-navy); }
.kklh-event-meta { color: var(--khe-text-muted); font-size: 13px; }

/* ── Tablet / desktop enhancements ───────────────────────────────────────── */
@media (min-width: 600px) {
    .kklh-dash { padding: 8px; }
    .kklh-dash-title { font-size: 27px !important; }
    .kklh-dash-header { flex-direction: row; justify-content: space-between; align-items: center; }
    .kklh-banner-grid { grid-template-columns: 1fr 1fr; }
    .kklh-checklist-head { flex-direction: row; align-items: center; justify-content: space-between; }
    .kklh-checklist-head .kklh-progress { flex: 0 0 240px; }
}
@media (min-width: 800px) {
    .kklh-program-list { grid-template-columns: 1fr 1fr; }
}

/* ── Module screens (Phase 4) ────────────────────────────────────────────── */
.kklh-module-card { background: #fff; border: 1.5px solid var(--khe-card-border); border-radius: var(--khe-radius); padding: 20px; max-width: 720px; margin: 0 auto; }
.kklh-module-head { margin-bottom: 14px; }
.kklh-module-head .kklh-dash-title { display: inline-block; margin-right: 10px !important; }
.kklh-module-body { margin: 10px 0 18px; }
.kklh-banner-gate { background: var(--khe-amber-soft); color: #9a7b00; border: 1.5px solid var(--khe-amber); border-radius: var(--khe-radius); padding: 12px 14px; font-size: 13.5px; font-weight: 600; margin-bottom: 16px; }
.kklh-banner-info { background: var(--khe-soft); color: var(--khe-primary-dark); border-radius: var(--khe-radius); padding: 12px 14px; font-size: 13.5px; margin: 12px 0; }

.kklh-mq { margin: 0 0 20px; }
.kklh-mq-label { font-weight: 700; color: var(--khe-navy); font-size: 15px; margin-bottom: 6px; }
.kklh-mq-hint { font-size: 13px; color: var(--khe-text-muted); margin-bottom: 8px; }
.kklh-module .kh-input { width: 100%; max-width: 480px; padding: 11px 12px !important; min-height: 44px; border: 1.5px solid var(--khe-border) !important; border-radius: var(--khe-radius) !important; font-family: var(--khe-font) !important; font-size: 16px !important; color: var(--khe-text) !important; background: #fff !important; box-sizing: border-box; }
.kklh-module textarea.kh-input { min-height: 80px; }
.kklh-module .kh-input:focus { border-color: var(--khe-primary) !important; outline: none !important; box-shadow: 0 0 0 3px rgba(67,155,192,.18) !important; }
.kklh-opt { font-weight: 400; color: var(--khe-text-muted); font-size: 13px; }

.kklh-module .kklh-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.kklh-module .kklh-chip { min-height: 44px; padding: 10px 18px !important; border-radius: 999px !important; border: 1.5px solid var(--khe-border) !important; background: #fff !important; font-family: var(--khe-font) !important; font-size: 15px !important; color: var(--khe-text-body) !important; cursor: pointer; display: inline-flex; align-items: center; }
.kklh-module .kklh-chip.is-selected { background: var(--khe-primary) !important; border-color: var(--khe-primary) !important; color: #fff !important; font-weight: 700; }

.kklh-module .kklh-ack { background: var(--khe-soft); border: 1.5px solid var(--khe-card-border); border-radius: var(--khe-radius); padding: 14px 16px; margin: 0 0 20px; }
.kklh-module .kklh-ack-statement { margin: 0 0 10px; color: var(--khe-text-body); font-size: 14px; }
.kklh-module .kklh-ack-check { display: flex; align-items: center; gap: 8px; color: var(--khe-navy); cursor: pointer; min-height: 44px; }
.kklh-module .kklh-ack-check input { width: 20px; height: 20px; accent-color: var(--khe-primary); }

.kklh-cond[hidden] { display: none !important; }

.kklh-addrcard { border: 1.5px solid var(--khe-card-border); border-radius: var(--khe-radius); padding: 12px; margin-bottom: 10px; }
.kklh-addrcard-row { margin-bottom: 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kklh-addrcard-row:last-child { margin-bottom: 0; }

.kklh-upload { border: 1.5px dashed var(--khe-border); border-radius: var(--khe-radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; max-width: 480px; }
.kklh-upload-label { font-size: 13px; color: var(--khe-text-muted); }

.kklh-module-footer { display: flex; gap: 10px; justify-content: flex-end; padding-top: 16px; border-top: 1.5px solid var(--khe-card-border); flex-wrap: wrap; }
.kklh-module-msg { margin: 12px 0 0; font-weight: 700; font-size: 14px; }

@media (max-width: 600px) {
    .kklh-module-card { padding: 16px; }
    .kklh-module-footer { flex-direction: column-reverse; }
    .kklh-module-footer .kh-btn { width: 100%; }
}

/* ── Phase 6: program spend + prepay register ─────────────────────────────── */
.kklh-spend-amount { font-size:28px; font-weight:800; color:var(--khe-text,#1d3040); }
.kklh-prepay-balance { float:right; font-weight:700; color:var(--khe-success,#1e7e34); }
.kklh-prepay-table { width:100%; border-collapse:collapse; margin-top:6px; }
.kklh-prepay-table th { text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.03em; color:var(--khe-text-faint,#7a8a9a); padding:6px 8px; border-bottom:1px solid var(--khe-border,#e2ecf1); }
.kklh-prepay-table td { padding:8px; border-bottom:1px solid var(--khe-border,#eef4f7); font-size:14px; }

/* Order management actions (program dashboard) — v0.7.5 */
.kklh-order-row { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:6px 0; border-bottom:1px solid var(--khe-border, #e5e7eb); }
.kklh-order-row:last-child { border-bottom:0; }
.kklh-order-actions { display:inline-flex; gap:6px; flex-shrink:0; }
.kklh-order-btn { padding:4px 12px !important; font-size:12px !important; min-height:32px; line-height:1.2; }
.kklh-order-btn-ghost { background:transparent !important; color:var(--khe-text, #333) !important; border:1.5px solid var(--khe-border, #d0d5dd) !important; }
.kklh-order-btn[disabled] { opacity:.5; cursor:default; }
