/* Academic Parent - pelengkap app.css tema V2 (memakai token warna yang sama). Mobile-first untuk orang tua. */

.ap-wrap { display: grid; gap: 18px; }
.ap-h2 { font-size: 1.25rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.ap-h2 small { font-size: .78rem; background: var(--navy-900); color: var(--gold-300); border-radius: 999px; padding: 1px 9px; font-weight: 700; }
.ap-h3 { font-size: 1.08rem; margin: 6px 0 12px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.ap-h3 small { color: var(--muted); font-weight: 500; font-size: .85rem; }
.ap-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ap-card-accent { border-top: 4px solid var(--gold-500); }
.ap-wrap .ib-guide a:not(.btn) { color: var(--gold-300); text-decoration: underline; text-underline-offset: 2px; font-weight: 650; }
.ap-wrap .ib-guide a:not(.btn):hover { color: #fff; }
.ap-wrap .ib-guide .btn-outline { color: #fff; border-color: rgba(255, 255, 255, .5); }
.ap-wrap .ib-guide .btn-outline:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* ---------- tahapan ---------- */
.ap-wrap .ib-steps li b { font-weight: inherit; }

/* ---------- hero dasbor anak + foto (rasio KTM 2:3) ---------- */
.ap-hero-anak { display: flex; align-items: center; gap: 24px; }
.ap-hero-teks { min-width: 0; }
.ap-hero-teks h1 { overflow-wrap: anywhere; }
.ap-foto { margin: 0; flex: 0 0 auto; width: 112px; aspect-ratio: 2 / 3; border-radius: 16px; overflow: hidden; position: relative;
    background: var(--navy-800); border: 3px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 3px var(--gold-500), var(--shadow-lg); }
.ap-foto img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.ap-foto-inisial { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.2rem; font-weight: 800; letter-spacing: .02em;
    color: var(--gold-300); background: linear-gradient(160deg, var(--navy-700), var(--navy-950)); }

/* ---------- bilah akun ---------- */
.ap-userbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; box-shadow: var(--shadow-sm); }
.ap-user { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.ap-user img { border-radius: 50%; width: 36px; height: 36px; flex: none; }
.ap-user > span { display: flex; flex-direction: column; min-width: 0; }
.ap-user b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-user small { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.ap-userbar-act { display: flex; gap: 8px; flex-wrap: wrap; }
.ap-userbar-act form { margin: 0; }

/* ---------- tombol Google ---------- */
.ap-google { display: inline-flex; align-items: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #dadce0;
    box-shadow: var(--shadow-sm); font-weight: 600; margin: 6px 0 14px; }
.ap-google:hover { background: #f8f9fb; color: #1f1f1f; border-color: #c6cad2; }

/* ---------- daftar anak ---------- */
.ap-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
.ap-children { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.ap-child { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column; }
.ap-child-link { display: flex; align-items: center; gap: 14px; padding: 16px; color: var(--ink); flex: 1; }
.ap-child-link:hover { background: #f8fafd; color: var(--ink); }
.ap-child-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--navy-900); color: var(--gold-400); flex: none;
    font-weight: 800; font-size: 1.05rem; }
.ap-child-foto { width: 52px; height: 78px; border-radius: 12px; object-fit: cover; object-position: center top; flex: none;
    box-shadow: 0 0 0 2px var(--gold-500); background: var(--navy-800); }
.ap-child-txt { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.ap-child-txt strong { overflow-wrap: anywhere; }
.ap-child-txt small { color: var(--muted); }
.ap-child-go { color: var(--navy-700); }
.ap-child form { margin: 0; border-top: 1px solid var(--line); padding: 6px 16px; text-align: right; }
.ap-link-btn { background: none; border: 0; color: var(--danger); font-size: .82rem; padding: 4px 0; }
.ap-link-btn:hover { text-decoration: underline; }
.ap-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.ap-actions form { margin: 0; }
.ap-preview { margin: 12px 0; }

/* ---------- modal (dialog) ---------- */
.ap-dialog { border: 0; border-radius: 22px; padding: 22px; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--ink); }
.ap-dialog::backdrop { background: rgba(4, 11, 32, .55); backdrop-filter: blur(2px); }
.ap-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.ap-dialog-head h2 { margin: 0; font-size: 1.2rem; }
.ap-dialog-x { border: 0; background: #eef1f7; color: var(--ink); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ap-dialog-x:hover { background: #e1e6f0; }
html:not(.js) .ap-dialog { display: block; position: static; width: auto; box-shadow: var(--shadow-sm); }

/* ---------- lencana ---------- */
.ap-badge { display: inline-block; font-size: .72rem; font-weight: 650; line-height: 1.5; padding: 1px 9px; border-radius: 999px;
    background: #eef1f7; color: var(--ink-2); margin: 2px 4px 2px 0; white-space: nowrap; vertical-align: middle; }
.ap-badge-navy  { background: var(--navy-900); color: var(--gold-300); }
.ap-badge-hijau { background: #e3f5ee; color: var(--success); }
.ap-badge-merah { background: #fde8e6; color: var(--danger); }
.ap-badge-kuning{ background: #fff3d6; color: var(--warning); }

/* ---------- profil anak ---------- */
.ap-profile dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 22px; margin: 0; }
.ap-profile dt { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ap-profile dd { margin: 2px 0 0; font-weight: 650; overflow-wrap: anywhere; }
.ap-wa { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; padding: 2px 10px; border-radius: 999px; background: #25d366; color: #fff;
    font-size: .76rem; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.ap-wa:hover { background: #1ebe5a; color: #fff; }

/* ---------- tab (geser horizontal, kontras tinggi) ---------- */
.ap-tabs { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 6px; background: var(--navy-950); border-radius: 16px; box-shadow: var(--shadow); }
.ap-tabs::-webkit-scrollbar { display: none; }
.ap-tabs button { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: #e8ecf5; padding: 11px 16px; border-radius: 12px;
    font-weight: 650; font-size: .93rem; transition: background .15s, color .15s; }
.ap-tabs button:hover { background: rgba(255, 255, 255, .12); }
.ap-tabs button[aria-selected="true"] { background: var(--gold-grad); color: var(--navy-950); border-color: transparent; box-shadow: 0 6px 16px -6px rgba(212, 165, 55, .7); }
.ap-tabs button[aria-selected="true"] .ic { color: var(--navy-950); }
.ap-panel { display: grid; gap: 14px; }
.js .ap-panel:not(.is-active) { display: none; }
html:not(.js) .ap-tabs, html:not(.js) .ap-bottomnav { display: none; }

/* ---------- ringkasan angka ---------- */
.ap-stats { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; margin-bottom: 14px; }
.ap-stats > div { background: #f6f8fc; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; min-width: 130px; }
.ap-stats span { display: block; font-size: .76rem; color: var(--muted); }
.ap-stats strong { font-size: 1.25rem; }
.ap-stats > .ap-stats-act { background: none; border: 0; display: flex; align-items: center; margin-left: auto; padding: 0; }

/* ---------- tabel ---------- */
.ap-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.ap-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
.ap-table th, .ap-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ap-table thead th { background: var(--navy-900); color: #fff; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.ap-table tfoot th { background: #f6f8fc; }
.ap-table tbody tr:hover { background: #fafbfe; }
.ap-table tr.is-warn { background: #fff8e8; }
.ap-table small { display: block; color: var(--muted); font-size: .8rem; }
.ap-table small.ap-inline { display: inline; }
.ap-table .c { text-align: center; } .ap-table .r { text-align: right; }
.ap-nilai { display: inline-flex; align-items: baseline; justify-content: center; gap: 5px; white-space: nowrap; }
.ap-nilai strong { font-size: 1rem; }
.ap-table small.ap-inline { display: inline; }
.ap-smt-hp { display: none; }
.ap-att { min-width: 170px; }
.ap-att progress { width: 100%; height: 8px; accent-color: var(--success); display: block; margin: 4px 0; }
.ap-att b { font-size: .95rem; }
.ap-mini { width: 100%; border-collapse: collapse; font-size: .88rem; }
.ap-mini td { padding: 6px 4px; border-bottom: 1px dashed var(--line); }
.ap-mini .r { text-align: right; white-space: nowrap; }

.ap-empty { margin: 0; padding: 14px; background: #f6f8fc; border-radius: 12px; color: var(--ink-2); }
.ap-note { font-size: .84rem; color: var(--muted); margin: 10px 0 0; }

/* ---------- akordion ---------- */
.ap-acc { display: grid; gap: 10px; }
.ap-acc details, .ap-pay { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.ap-acc summary, .ap-pay summary { cursor: pointer; list-style: none; padding: 14px 16px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ap-acc summary::-webkit-details-marker, .ap-pay summary::-webkit-details-marker { display: none; }
.ap-acc summary::after, .ap-pay summary::after { content: "+"; margin-left: auto; font-size: 1.2rem; color: var(--navy-700); font-weight: 700; }
.ap-acc details[open] > summary::after, .ap-pay[open] > summary::after { content: "–"; }
.ap-acc summary small { color: var(--muted); font-weight: 500; }
.ap-acc details.is-current { border-color: var(--gold-400); }
.ap-acc-body { padding: 0 16px 16px; }
.ap-acc-body > small { color: var(--muted); }
.ib-card > .ap-acc-body { padding: 0; }

/* ---------- pembayaran ---------- */
.ap-pay-list { display: grid; gap: 10px; }
.ap-pay.is-unpaid { border-left: 4px solid var(--danger); }
.ap-pay.is-paid { border-left: 4px solid var(--success); }
.ap-pay-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ap-pay-main small { color: var(--muted); font-weight: 500; }
.ap-pay-amt { display: flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.ap-pay-body { padding: 0 16px 14px; }

/* ---------- menu bawah melayang (hanya HP) ---------- */
.ap-bottomnav { display: none; }

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

@media (max-width: 768px) {
    body.page-academic-parent main { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
    body.page-academic-parent .helpdesk-fab { bottom: calc(96px + env(safe-area-inset-bottom)); }
    .ap-wrap { gap: 14px; }
    .ap-wrap .ib-card { padding: 18px 16px; border-radius: 18px; }

    .ap-bottomnav { display: flex; position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
        background: rgba(10, 26, 63, .96); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .08); border-radius: 22px;
        box-shadow: 0 16px 36px -10px rgba(4, 11, 32, .6); padding: 6px; gap: 2px; }
    .ap-bottomnav > a, .ap-bottomnav > button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        padding: 8px 2px; border: 0; background: transparent; color: #b9c3da; border-radius: 16px; font: inherit; font-size: .7rem; font-weight: 650;
        text-decoration: none; -webkit-tap-highlight-color: transparent; }
    .ap-bottomnav span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ap-bottomnav [aria-current="page"], .ap-bottomnav [aria-selected="true"] { color: var(--navy-950); background: var(--gold-grad); }
    .ap-bottomnav > a:active, .ap-bottomnav > button:active { transform: scale(.96); }

    .ap-userbar { padding: 10px 12px; }
    .ap-userbar-act .btn-outline[href] { display: none; } /* "Anak saya" sudah ada di menu bawah */

    /* tab atas disembunyikan: navigasi tab pindah ke menu bawah */
    .ap-tabs { display: none; }

    /* tahapan sejajar: lingkaran bernomor + garis penghubung */
    .ap-wrap .ib-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 14px 6px 12px;
        background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }
    .ap-wrap .ib-steps li { position: relative; flex-direction: column; justify-content: flex-start; gap: 7px; padding: 0 4px; min-width: 0;
        background: none; border: 0; box-shadow: none; border-radius: 0; text-align: center; font-size: .72rem; line-height: 1.25; color: var(--muted); }
    .ap-wrap .ib-steps li::before { content: ""; position: absolute; top: 16px; right: 50%; width: 100%; height: 3px; background: var(--line); }
    .ap-wrap .ib-steps li:first-child::before { display: none; }
    .ap-wrap .ib-steps li.is-done::before { background: var(--success); }
    .ap-wrap .ib-steps li.is-current::before { background: linear-gradient(90deg, var(--success), var(--gold-500)); }
    .ap-wrap .ib-steps span { position: relative; z-index: 1; width: 34px; height: 34px; font-size: .9rem; box-shadow: 0 0 0 4px var(--surface); }
    .ap-wrap .ib-steps .is-current { box-shadow: none; color: var(--navy-900); font-weight: 700; }
    .ap-wrap .ib-steps .is-current span { box-shadow: 0 0 0 4px var(--surface), 0 0 0 7px rgba(212, 165, 55, .35); }
    .ap-wrap .ib-steps .is-done { color: var(--success); }

    /* hero dasbor: foto lebih kecil, tetap rasio 2:3 */
    .ap-hero-anak { gap: 14px; align-items: center; }
    .ap-foto { width: 76px; border-radius: 12px; border-width: 2px; box-shadow: 0 0 0 2px var(--gold-500), var(--shadow); }
    .ap-foto-inisial { font-size: 1.5rem; }
    .ap-hero-anak h1 { font-size: 1.35rem; margin-bottom: .25em; }
    .ap-hero-anak p { font-size: .88rem; margin: 0; }
    .ap-hero-anak .kicker { font-size: .66rem; }

    .ap-children { grid-template-columns: 1fr; }
    .ap-profile dl { grid-template-columns: 1fr 1fr; gap: 12px 14px; }
    .ap-stats > div { flex: 1 1 calc(50% - 10px); min-width: 0; }
    .ap-stats > .ap-stats-act { flex-basis: 100%; margin: 0; }
    .ap-stats-act .btn { width: 100%; justify-content: center; }
    .ap-acc summary, .ap-pay summary { padding: 13px 14px; }
    .ap-acc-body, .ap-pay-body { padding: 0 12px 14px; }
    .ap-pay-amt { width: 100%; justify-content: space-between; }

    /* tabel menjadi kartu */
    .ap-table-wrap { border: 0; border-radius: 0; overflow: visible; }
    .ap-table { min-width: 0; font-size: .9rem; }
    .ap-table thead { display: none; }
    .ap-table, .ap-table tbody, .ap-table tfoot { display: block; }
    .ap-table tbody tr { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 0 6px;
        margin-bottom: 10px; box-shadow: var(--shadow-sm); }
    .ap-table tbody tr:hover { background: var(--surface); }
    .ap-table tbody tr.is-warn { background: #fff8e8; }
    .ap-table td { display: grid; grid-template-columns: 34% 1fr; gap: 10px; border: 0; padding: 5px 14px; text-align: left !important; }
    .ap-table td::before { content: attr(data-label); color: var(--muted); font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; padding-top: 2px; }
    .ap-table td.ap-td-no { display: none; }
    .ap-table td.ap-td-main { display: block; padding: 2px 14px 8px; margin-bottom: 4px; border-bottom: 1px dashed var(--line); font-size: .98rem; }
    .ap-table td.ap-td-main::before { content: none; }
    .ap-table td:empty { display: none; }
    .ap-table tfoot tr { display: flex; justify-content: space-between; align-items: center; background: var(--navy-900); color: #fff; border-radius: 14px; padding: 10px 14px; }
    .ap-table tfoot th { background: none; border: 0; padding: 0; color: inherit; text-align: left !important; }
    .ap-table tfoot th:empty { display: none; }
    .ap-att { min-width: 0; }

    /* KHS & transkrip: nama MK selebar penuh, lalu SKS/Nilai/Bobot/Mutu sebagai kotak 2 kolom */
    .ap-table.ap-table-nilai tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; }
    .ap-table.ap-table-nilai td { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 8px 10px; min-width: 0;
        background: #f6f8fc; border-radius: 10px; font-weight: 650; }
    .ap-table.ap-table-nilai td::before { padding: 0; font-size: .68rem; }
    .ap-table.ap-table-nilai td.ap-td-main { grid-column: 1 / -1; display: block; background: none; border-radius: 0; padding: 0 2px 8px; margin: 0;
        font-weight: 400; }
    .ap-table.ap-table-nilai td.ap-td-smt, .ap-table.ap-table-nilai td.ap-td-no { display: none; }
    .ap-table.ap-table-nilai .ap-nilai { justify-content: flex-start; }
    .ap-smt-hp { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; background: #eef1f7; color: var(--ink-2); font-size: .72rem; font-weight: 650; }
}

@media (max-width: 380px) {
    .ap-bottomnav { left: 8px; right: 8px; }
    .ap-bottomnav > a, .ap-bottomnav > button { font-size: .64rem; }
    .ap-profile dl { grid-template-columns: 1fr; }
}

/* modal jadi bottom sheet di HP */
@media (max-width: 640px) {
    .ap-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
}
