@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --navy: #1F2F65;
    --navy-deep: #162149;
    --gold: #C9A227;
    --gold-soft: #E3C45A;
    --bg: #F6F7FB;
    --card-bg: #ffffff;
    --text: #1B2138;
    --muted: #6B7290;
    --border: #E2E5F0;
    --primary: var(--navy);
    --primary-dark: var(--navy-deep);
    --primary-soft: #E9EBF6;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --neutral-bg: #f1f5f9;
    --neutral-text: #475569;
    --warning-bg: #ffedd5;
    --warning-text: #9a3412;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --sidebar-w: 252px;
    --shadow-sm: 0 1px 2px rgba(31, 47, 101, 0.05);
    --shadow-md: 0 4px 12px rgba(31, 47, 101, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ===== Layout aplikasi (sidebar + konten) ===== */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
    border-bottom: 3px solid var(--gold);
}

.sidebar-brand .brand-name {
    color: #fff;
}

.sidebar-brand .brand-sub {
    color: #B9C0DC;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 100%);
    color: var(--navy);
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.5px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(201, 162, 39, 0.35);
}

.brand-name {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.2px;
}

.brand-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: -2px;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 12px;
    overflow-y: auto;
}

.nav-section {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    padding: 14px 10px 6px;
}

.nav-section:first-child {
    padding-top: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    margin-bottom: 2px;
    transition: background 0.12s, color 0.12s;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: var(--neutral-bg);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-foot {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.nav-item.nav-logout:hover {
    background: var(--error-bg);
    color: var(--danger);
}

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

.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 9px;
    cursor: pointer;
    color: var(--text);
    line-height: 0;
}

.page-title {
    font-size: 16.5px;
    font-weight: 700;
    letter-spacing: -0.2px;
    margin: 0;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    background: var(--neutral-bg);
    border-radius: 999px;
    padding: 5px 12px 5px 5px;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.content {
    padding: 24px;
    max-width: 1080px;
    width: 100%;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 35;
}

@media (max-width: 860px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-md);
    }

    .sidebar.open + .sidebar-overlay {
        display: block;
    }

    .main {
        margin-left: 0;
    }

    .menu-btn {
        display: inline-flex;
    }

    .content {
        padding: 16px;
    }
}

/* ===== Kartu ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -0.1px;
}

.card-header .sub {
    font-size: 12px;
    color: var(--muted);
    font-weight: 400;
}

.card-header-right {
    margin-left: auto;
}

.card-body {
    padding: 20px;
}

h1 {
    font-size: 20px;
    margin-top: 0;
}

/* ===== Form ===== */
label {
    display: block;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.field-help {
    display: block;
    font-weight: 400;
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="file"],
textarea,
select {
    width: 100%;
    margin-top: 6px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    font-weight: 400;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.12s, box-shadow 0.12s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 560px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

fieldset.platforms {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin: 0 0 16px;
}

fieldset.platforms legend {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    padding: 0 6px;
}

label.checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 9px;
    font-size: 13.5px;
    font-weight: 500;
}

label.checkbox:last-child {
    margin-bottom: 0;
}

label.checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    margin: 0;
}

.chip {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px;
    vertical-align: middle;
}

.chip-connected {
    background: var(--success-bg);
    color: var(--success-text);
}

.chip-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

/* ===== Tombol ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s, filter 0.12s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-primary:disabled {
    background: var(--muted);
    cursor: not-allowed;
}

.btn-small {
    padding: 5px 11px;
    font-size: 12px;
    background: var(--neutral-bg);
    color: var(--text);
}

.btn-small:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--error-bg);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

/* ===== Alert ===== */
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13.5px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: #b7ecc7;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: #f6bcbc;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

/* ===== Halaman login ===== */
.page-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    padding: 28px;
    border-top: 3px solid var(--gold);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    text-align: center;
}

.auth-brand .brand-mark {
    width: 46px;
    height: 46px;
    font-size: 18px;
    border-radius: 12px;
}

.auth-card .btn {
    width: 100%;
    margin-top: 4px;
}

/* ===== Tabel riwayat ===== */
.riwayat-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

.riwayat-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
}

.riwayat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.riwayat-table th,
.riwayat-table td {
    padding: 13px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.riwayat-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    background: var(--bg);
}

.riwayat-table tr:last-child td {
    border-bottom: none;
}

.riwayat-table tbody tr:hover {
    background: #fafbfd;
}

.riwayat-table .col-tanggal {
    white-space: nowrap;
    color: var(--muted);
}

.riwayat-table .col-judul {
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.riwayat-table .col-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
    flex: 0 0 auto;
}

.status-pill-label {
    line-height: 1;
}

.status-pill.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: #b7ecc7;
}

.status-pill.badge-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: #f6bcbc;
}

.status-pill.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: #fbd2a4;
}

.status-pill.badge-neutral {
    background: var(--neutral-bg);
    color: var(--neutral-text);
    border-color: var(--border);
}

.status-pill[title] {
    cursor: help;
}

.status-pill-form {
    display: inline-flex;
    margin: 0;
}

.btn-resend {
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.7);
    color: inherit;
    line-height: 1.4;
    white-space: nowrap;
}

.btn-resend:hover {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.16);
}

.col-aksi {
    white-space: nowrap;
}

.col-aksi form {
    display: inline;
}

/* ===== Daftar project ===== */
.project-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.project-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 4px;
    border-bottom: 1px solid var(--border);
}

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

.project-row a {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
}

.project-row a:hover {
    color: var(--primary);
}

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.empty-state svg {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    color: var(--border);
}
