/* Portal Desa — light + dark (hacker) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --portal-sidebar-w: 260px;
    --portal-bg: #f0f4f8;
    --portal-surface: #ffffff;
    --portal-surface-2: #f8fafc;
    --portal-text: #1e293b;
    --portal-muted: #64748b;
    --portal-border: #e2e8f0;
    --portal-primary: #2563eb;
    --portal-primary-hover: #1d4ed8;
    --portal-accent: #10b981;
    --portal-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    --portal-radius: 12px;
    --portal-font: 'Inter', system-ui, sans-serif;
}

[data-theme="dark"] {
    --portal-bg: #050805;
    --portal-surface: #0a120a;
    --portal-surface-2: #0d160d;
    --portal-text: #b8ffc9;
    --portal-muted: #5cb86a;
    --portal-border: #1a3d22;
    --portal-primary: #00ff41;
    --portal-primary-hover: #00cc34;
    --portal-accent: #00ff41;
    --portal-shadow: 0 0 12px rgba(0, 255, 65, 0.08);
    --portal-font: 'JetBrains Mono', 'Consolas', monospace;
}

[data-theme="dark"] body {
    background-image:
        linear-gradient(rgba(0, 255, 65, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
}

* { box-sizing: border-box; }

body.portal-body {
    margin: 0;
    font-family: var(--portal-font);
    background: var(--portal-bg);
    color: var(--portal-text);
    min-height: 100vh;
}

.portal-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.portal-sidebar {
    width: var(--portal-sidebar-w);
    background: var(--portal-surface);
    border-right: 1px solid var(--portal-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform 0.2s;
}

.portal-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--portal-border);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.portal-brand img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
}

.portal-brand-fallback {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--portal-primary), var(--portal-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 1.25rem;
}

[data-theme="dark"] .portal-brand-fallback {
    color: #000;
    box-shadow: 0 0 16px rgba(0, 255, 65, 0.4);
}

.portal-brand h1 {
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

.portal-brand p {
    font-size: 0.65rem;
    color: var(--portal-muted);
    margin: 0.15rem 0 0;
}

.portal-nav {
    flex: 1;
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
}

.portal-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    margin-bottom: 2px;
    border-radius: 8px;
    color: var(--portal-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.portal-nav a:hover {
    background: var(--portal-surface-2);
    color: var(--portal-text);
}

.portal-nav a.active {
    background: rgba(37, 99, 235, 0.12);
    color: var(--portal-primary);
}

[data-theme="dark"] .portal-nav a.active {
    background: rgba(0, 255, 65, 0.12);
    box-shadow: inset 0 0 0 1px rgba(0, 255, 65, 0.25);
}

.portal-nav svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
}

.portal-sidebar-foot {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--portal-border);
    font-size: 0.7rem;
    color: var(--portal-muted);
}

.portal-status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--portal-accent);
    margin-right: 4px;
    animation: portal-pulse 2s infinite;
}

[data-theme="dark"] .portal-status-dot {
    box-shadow: 0 0 6px var(--portal-accent);
}

@keyframes portal-pulse {
    50% { opacity: 0.5; }
}

/* Main */
.portal-main {
    flex: 1;
    margin-left: var(--portal-sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.portal-topbar {
    background: var(--portal-surface);
    border-bottom: 1px solid var(--portal-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 30;
}

.portal-topbar h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.portal-topbar p {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: var(--portal-muted);
}

.portal-theme-btn {
    border: 1px solid var(--portal-border);
    background: var(--portal-surface-2);
    color: var(--portal-text);
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
}

.portal-theme-btn:hover {
    border-color: var(--portal-primary);
}

.portal-content {
    padding: 1.25rem 1.5rem 2rem;
    flex: 1;
}

/* Cards */
.portal-card {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    padding: 1.25rem;
}

[data-theme="dark"] .portal-card {
    box-shadow: 0 0 0 1px rgba(0, 255, 65, 0.06), 0 4px 24px rgba(0, 0, 0, 0.4);
}

.portal-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 1rem;
}

/* Quick access */
.portal-quick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.portal-quick a {
    text-decoration: none;
    color: inherit;
    text-align: center;
}

.portal-quick-icon {
    width: 100%;
    aspect-ratio: 1;
    max-width: 72px;
    margin: 0 auto 0.5rem;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
}

.portal-quick span {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--portal-text);
    line-height: 1.2;
}

.q-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.q-orange { background: linear-gradient(135deg, #fb923c, #ea580c); }
.q-green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.q-purple { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.q-red { background: linear-gradient(135deg, #f87171, #dc2626); }
.q-teal { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.q-slate { background: linear-gradient(135deg, #64748b, #475569); }

/* Stats */
.portal-stats-bar {
    height: 8px;
    background: var(--portal-border);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.portal-stats-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--portal-accent), var(--portal-primary));
    border-radius: 99px;
    transition: width 0.4s;
}

.portal-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.portal-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.portal-stat-num {
    font-weight: 700;
    font-size: 1rem;
}

/* Workflow */
.portal-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.portal-flow-step {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: var(--portal-surface-2);
    border: 1px solid var(--portal-border);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.portal-flow-arrow {
    color: var(--portal-muted);
    font-size: 1.25rem;
}

/* Forms */
.portal-input {
    width: 100%;
    border: 1px solid var(--portal-border);
    background: var(--portal-surface-2);
    color: var(--portal-text);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    font-family: inherit;
}

.portal-input:focus {
    outline: none;
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .portal-input:focus {
    box-shadow: 0 0 0 2px rgba(0, 255, 65, 0.2);
}

.portal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--portal-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1.25rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}

[data-theme="dark"] .portal-btn {
    color: #000;
}

.portal-btn:hover {
    background: var(--portal-primary-hover);
}

.portal-btn-outline {
    background: transparent;
    border: 1px solid var(--portal-border);
    color: var(--portal-text);
}

.portal-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--portal-border);
    font-size: 0.85rem;
    text-decoration: none;
    color: inherit;
}

.portal-list-item:last-child { border-bottom: none; }

.portal-info-row {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    font-size: 0.8rem;
    margin-bottom: 0.65rem;
    color: var(--portal-muted);
}

.portal-info-row strong { color: var(--portal-text); display: block; }

.portal-quote {
    border-left: 3px solid var(--portal-primary);
    padding-left: 1rem;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--portal-muted);
}

/* FAQ */
.portal-faq details {
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: var(--portal-surface-2);
}

.portal-faq summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    list-style: none;
}

.portal-faq summary::-webkit-details-marker { display: none; }

.portal-faq details[open] summary {
    border-bottom: 1px solid var(--portal-border);
}

.portal-faq .portal-faq-body {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--portal-muted);
    line-height: 1.5;
}

.portal-alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.portal-alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #b91c1c;
}

[data-theme="dark"] .portal-alert-error {
    color: #ff6b6b;
}

/* Pengajuan — status & sukses */
.portal-success-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: rgba(16, 185, 129, 0.15);
    color: var(--portal-accent);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

[data-theme="dark"] .portal-success-icon {
    box-shadow: 0 0 16px rgba(0, 255, 65, 0.25);
}

.portal-kode {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--portal-primary);
    letter-spacing: 0.02em;
    margin: 0.25rem 0 0;
}

.portal-dl-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--portal-border);
    font-size: 0.85rem;
}

.portal-dl-row:last-child { border-bottom: none; }

.portal-dl-row dt {
    color: var(--portal-muted);
    margin: 0;
}

.portal-dl-row dd {
    margin: 0;
    text-align: right;
    font-weight: 500;
}

.portal-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.portal-badge-wait {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.portal-badge-process {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.portal-badge-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.portal-badge-fail {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

[data-theme="dark"] .portal-badge-wait { color: #fbbf24; }
[data-theme="dark"] .portal-badge-process { color: #60a5fa; }
[data-theme="dark"] .portal-badge-ok { color: var(--portal-accent); }
[data-theme="dark"] .portal-badge-fail { color: #f87171; }

.portal-note-fail {
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.06);
    font-size: 0.85rem;
}

.portal-history-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    padding: 1rem;
    margin-bottom: 0.65rem;
    background: var(--portal-surface-2);
    transition: border-color 0.15s;
}

.portal-history-card:hover {
    border-color: var(--portal-primary);
}

.portal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
    margin-top: 1.25rem;
}

.portal-grid-2 {
    display: grid;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .portal-grid-2 { grid-template-columns: 1fr 320px; }
    .portal-grid-main { display: grid; gap: 1rem; }
}

.portal-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--portal-text);
    cursor: pointer;
}

@media (max-width: 900px) {
    .portal-sidebar {
        transform: translateX(-100%);
    }
    .portal-sidebar.open {
        transform: translateX(0);
    }
    .portal-main {
        margin-left: 0;
    }
    .portal-mobile-toggle {
        display: block;
    }
}

.portal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 35;
}
.portal-overlay.show { display: block; }
