/* rpsnew.css — selaras dengan palet myrps.css */
:root {
    /* Pakai variabel dari myrps bila ada; fallback ke nilai lama rpsnew */
    --_bg: var(--bg, #0b0f1a);
    --_panel: var(--card, #0f1530);
    --_card: var(--card, #0f172a);
    --_line: var(--line, rgba(255, 255, 255, .08));
    --_muted: var(--muted, #94a3b8);
    --_text: var(--text, #e2e8f0);
    --_brand: var(--brand, #7c3aed);
    --_brand2: var(--brand2, #2563eb);
    --_ring: var(--ring, rgba(124, 58, 237, .35));
    --_ok: var(--ok, #22c55e);
    --_warn: var(--warn, #f59e0b);
    --_bad: var(--bad, #ef4444);
    --_header-h: 72px;
    --brand: #7c3aed;
    --brand2: #2563eb;
    --ring: rgba(124, 58, 237, .35);
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(180deg, var(--_bg), #0a0d17);
    color: var(--_text)
}

a {
    color: inherit;
    text-decoration: none
}

.app {
    display: flex;
    gap: 16px;
    padding: 16px
}

/* Left workspace */
.left {
    width: 55vw;
    min-width: 560px
}

.section {
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--_line);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .3);
    margin-bottom: 16px
}

.section h2 {
    margin: .2rem 0 1rem 0;
    font-size: 1.1rem;
    letter-spacing: .3px;
    color: var(--_text)
}

.row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap
}

.input,
textarea {
    background: var(--_card);
    color: var(--_text);
    border: 1px solid var(--_line);
    border-radius: 12px;
    padding: 10px 12px;
}

textarea {
    width: 100%;
    min-height: 80px
}

/* Buttons */
.btn {
    background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .03));
    border: 1px solid var(--_line);
    color: var(--_text);
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    height: 35px
}

.btn.primary {
    background: linear-gradient(135deg, var(--_brand), var(--_brand2));
    border: none;
    color: #fff
}

.btn.secondary {
    background: #121826;
    border: 1px solid var(--_line)
}

.btn.warning {
    background: var(--_warn);
    border: none;
    color: #111
}

.btn.danger {
    background: var(--_bad);
    border: none
}

.btn.success {
    background: var(--_ok);
    border: none;
    color: #0b111f
}

.btn.ghost {
    background: transparent;
    border: 1px dashed var(--_line);
    color: var(--_muted)
}

/* Pills, text tones */
.muted {
    color: var(--_muted)
}

.pill {
    padding: 4px 8px;
    background: #121826;
    border: 1px solid var(--_line);
    color: var(--_text);
    border-radius: 999px;
    font-size: .78rem
}

/* CPL / CPMK tree */
.cpl {
    border-left: 3px solid var(--_brand2);
    padding-left: 12px;
    margin-bottom: 12px
}

.cpl .title {
    font-weight: 700;
    margin-bottom: 6px
}

.cpmk {
    border-left: 3px solid var(--_brand);
    padding-left: 12px;
    margin: 8px 0
}

.inline-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap
}

/* Backlog subCPMK cards */
.backlog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px
}

.card {
    background: var(--_card);
    border: 1px solid var(--_line);
    border-radius: 14px;
    padding: 10px;
    cursor: grab;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
}

.card:active {
    cursor: grabbing
}

.card .edge {
    width: 6px;
    border-radius: 10px;
    margin-right: 10px;
    background: linear-gradient(90deg, var(--_brand), var(--_brand2))
}

.card .title {
    font-weight: 700
}

.card .meta {
    font-size: .8rem;
    color: var(--_muted)
}

.card-row {
    display: flex;
    gap: 10px
}

/* Right sticky planner */
.planner {
    position: fixed;
    right: 0;
    top: 0;
    width: 45vw;
    min-width: 520px;
    height: 100vh;
    padding: 10px;
    border-left: 1px solid var(--_line);
    background: linear-gradient(160deg, rgba(10, 15, 40, .95), rgba(8, 10, 24, .95));
    backdrop-filter: blur(6px);
    overflow: auto
}

.planner h2 {
    margin: 6px 0 10px 6px
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    padding-bottom: 40px
}

.week {
    background: rgba(255, 255, 255, .03);
    border: 1px dashed var(--_line);
    border-radius: 14px;
    min-height: 160px;
    padding: 8px;
    position: relative
}

.week .wkhead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px
}

.week .wknum {
    font-weight: 800;
    color: var(--_text)
}

.dropzone {
    min-height: 120px
}

.drop-hint {
    position: absolute;
    inset: 0;
    border: 1px solid var(--_brand2);
    border-radius: 14px;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--_ring) inset;
    display: none
}

.placement {
    background: #10163b;
    border: 1px solid var(--_line);
    border-radius: 10px;
    padding: 8px;
    margin-bottom: 8px
}

.placement .subtitle {
    font-size: .8rem;
    color: var(--_muted)
}

/* Overlay modal */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10
}

.modal {
    width: min(720px, 92vw);
    background: rgba(15, 15, 15, 0.959);
    border: 1px solid var(--_line);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 16px 60px rgba(0, 0, 0, .5)
}

.modal h3 {
    margin: 0 0 10px 0
}

.tiny {
    font-size: .78rem
}

.footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end
}

.spacer {
    flex: 1
}

/* Helper */
.hidden {
    display: none !important
}

@media (max-width:1200px) {
    .left {
        width: 52vw
    }

    .planner {
        width: 48vw
    }
}

@media (max-width:1024px) {
    .app {
        flex-direction: column
    }

    .left {
        width: 100%
    }

    .planner {
        position: static;
        width: 100%;
        height: auto;
        min-width: auto
    }
}

.inline-actions {
    display: flex;
    gap: 4px;
    align-items: center
}

.card-row {
    display: flex;
    align-items: center;
    gap: 8px
}

/* --- Komponen tambahan yang ikut palet myrps --- */

/* Input indikator */
.indikator-input-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
    transition: all .3s ease
}

.indikator-input-wrapper:last-child {
    margin-bottom: 0
}

.indikator-input-wrapper input {
    flex: 1;
    margin: 0;
    background: var(--_card);
    color: var(--_text);
    border: 1px solid var(--_line);
    border-radius: 12px;
    padding: 8px 12px
}

.indikator-baru {
    border: 2px dashed var(--_line) !important;
    background: rgba(255, 255, 255, .03)
}

.indikator-baru:focus {
    border-color: var(--_brand) !important;
    background: #0b0f1a;
    outline: none
}

#indikator-container {
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto
}

.indikator-input-wrapper .btn.danger {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold
}

/* Responsif modal properti */
@media (max-width:768px) {
    #ovl-prop .modal {
        max-width: 95% !important;
        margin: 10px
    }

    #ovl-prop .row {
        flex-direction: column
    }

    #ovl-prop .row label.tiny {
        width: 100% !important;
        margin-bottom: 4px
    }
}

/* Judul CPL */
.titlecpl {
    color: var(--_ok) !important
}

/* Referensi */
.referensi-container {
    border: 1px solid var(--_line);
    border-radius: 14px;
    padding: 12px;
    background: var(--_card);
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .25)
}

.referensi-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, .03);
    border-radius: 10px;
    border-left: 4px solid var(--_brand);
    border: 1px solid var(--_line);
    transition: .2s ease
}

.referensi-item:hover {
    background: #121826;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, .2)
}

.referensi-item.pendukung {
    border-left-color: var(--_brand2)
}

.referensi-text {
    flex: 1;
    margin-right: 10px;
    font-size: 14px;
    color: var(--_text);
    line-height: 1.4
}

.referensi-actions {
    display: flex;
    gap: 6px
}

.referensi-input-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center
}

.referensi-input-wrapper input {
    flex: 1;
    background: var(--_card);
    color: var(--_text);
    border: 1px solid var(--_line);
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 14px
}

.referensi-input-wrapper input:focus {
    outline: none;
    border-color: var(--_brand);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, .2)
}

.referensi-actions .btn.tiny {
    padding: 4px 8px;
    font-size: .75rem;
    border-radius: 8px
}

@media (max-width:768px) {
    .referensi-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px
    }

    .referensi-actions {
        align-self: flex-end
    }

    .referensi-text {
        margin-right: 0
    }
}



/* Focus ring untuk aksesibilitas */
.focusable:focus {
    outline: 3px solid var(--_ring);
    outline-offset: 2px
}

header.container.nav,
header.container,
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--_bg);
    border-bottom: 1px solid var(--_line);
    backdrop-filter: saturate(160%) blur(6px);
}

body {
    padding-top: var(--_header-h);
}

.planner {
    top: var(--_header-h);
    height: calc(100vh - var(--_header-h));
}

@media (max-width:1024px) {
    .planner {
        position: static;
        top: auto;
        height: auto;
        min-width: auto;
    }
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), var(--brand2));
    display: grid;
    place-items: center;
    font-weight: 800;
}

.brand h1 {
    font-size: 18px;
    margin: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

#ovl-prop {
    z-index: 9999
}

/* Layout modal kolom dengan tinggi maksimal viewport */
#ovl-prop .modal {
    display: flex;
    flex-direction: column;
    width: min(1000px, 92vw) !important;
    max-height: 90vh;
    /* penting agar body bisa scroll */
    overflow: hidden;
    /* cegah scroll ganda */
}

/* Header sticky (selalu di atas) */
#ovl-prop .modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(15, 23, 42, .96);
    /* gelap semi transparan */
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line, rgba(255, 255, 255, .08));
    padding-bottom: 10px;
    margin-bottom: 12px;
}

/* Body fleksibel dan scroll */
#ovl-prop .modal-body {
    flex: 1 1 auto;
    overflow: auto;
    padding-right: 4px;
    /* space utk scrollbar */
}

/* Footer selalu di bawah */
#ovl-prop .footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: rgba(15, 23, 42, .96);
    backdrop-filter: blur(6px);
    border-top: 1px solid var(--line, rgba(255, 255, 255, .08));
    margin-top: 12px;
    /* beri jarak dari body */
    padding-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Util */
#ovl-prop .spacer {
    flex: 1
}

.overlaypaste {
    z-index: 999999 !important
}

#ai-loader[hidden] {
    display: none !important;
}

#ai-loader {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .25);
    z-index: 99999999;
    backdrop-filter: blur(1px);
}

.ai-box {
    min-width: 280px;
    max-width: 90vw;
    padding: 16px 18px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border, #e6e6e6);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid #eee;
    border-top-color: var(--brand, #3b82f6);
    animation: ai-spin 0.9s linear infinite;
    flex: 0 0 auto;
}

@keyframes ai-spin {
    to {
        transform: rotate(360deg);
    }
}

.ai-title {
    font-weight: 700;
    font-size: 14px;
    color: #0b111f;
}

.ai-desc {
    font-size: 12px;
    color: #555;
    margin-top: 2px;
    line-height: 1.3;
}