:root {
    --primary: #3A4F82;
    --primary-dark: #2d3e68;
    --text: #172033;
    --muted: #697386;
    --background: #f6f8fc;
    --white: #ffffff;
    --border: #e5e9f2;
    --success: #237a57;
    --warning: #a66a00;
    --danger: #b42318;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body.member-page {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.member-container {
    width: min(1100px, calc(100% - 40px));
    margin: 0 auto;
}

.member-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.member-header-inner {
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.member-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.member-brand .brand-logo,
.auth-brand .brand-logo {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 800;
}

.member-brand strong,
.auth-brand strong {
    display: block;
    font-size: 16px;
}

.member-brand span,
.auth-brand span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.member-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.member-nav a {
    padding: 9px 13px;
    border-radius: 9px;
    font-size: 14px;
    color: var(--muted);
}

.member-nav a:hover,
.member-nav a.active {
    color: var(--primary);
    background: #eef2fa;
}

.logout-button {
    border: 0;
    background: transparent;
    color: var(--danger);
    padding: 9px 13px;
    cursor: pointer;
    font-size: 14px;
}

.member-main {
    padding-top: 42px;
    padding-bottom: 60px;
}

.page-heading {
    margin-bottom: 30px;
}

.page-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
}

.eyebrow {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
}

.page-heading h1 {
    margin: 8px 0 8px;
    font-size: 34px;
    line-height: 1.15;
}

.page-heading p {
    color: var(--muted);
    margin: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: .2s ease;
}

.dashboard-card:not(.disabled-card):hover {
    transform: translateY(-2px);
    border-color: #c9d3e8;
    box-shadow: 0 10px 30px rgba(23, 32, 51, .07);
}

.dashboard-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 13px;
    background: #eef2fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
}

.dashboard-card h3 {
    margin: 2px 0 7px;
    font-size: 17px;
}

.dashboard-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
    font-size: 14px;
}

.dashboard-arrow {
    margin-left: auto;
    color: var(--primary);
    font-size: 20px;
}

.disabled-card {
    opacity: .68;
}

.btn-primary {
    border: 0;
    border-radius: 10px;
    padding: 11px 17px;
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

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

.btn-full {
    width: 100%;
}

/* Tombol dasar & toolbar (dipakai halaman Templates, Detail, Mapping) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

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

.btn-secondary {
    background: var(--white);
    border-color: var(--border);
    color: var(--text);
}

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

.btn:disabled,
.btn-small:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn:focus-visible,
.btn-small:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

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

.btn-small.btn-danger {
    color: var(--danger);
}

.btn-small.btn-danger:hover {
    border-color: var(--danger);
    background: #fff1f0;
    color: var(--danger);
}

.template-card .template-actions {
    margin-top: 14px;
}

#versionUploadMessage {
    white-space: pre-line;
}

/* Header detail template: judul + tag status + ringkasan */
.template-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: 8px 0;
}

.template-title-row h1 {
    margin: 0;
}

.template-subline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.template-subline code {
    padding: 3px 8px;
    border-radius: 6px;
    background: #eef2fa;
    color: var(--primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
}

.copy-id-button {
    padding: 3px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    color: var(--primary);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.copy-id-button:hover {
    border-color: var(--primary);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.tag::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.tag-success {
    background: #e7f6ee;
    color: var(--success);
}

.tag-danger {
    background: #fdecea;
    color: var(--danger);
}

.tag-muted {
    background: #f1f3f6;
    color: var(--muted);
}

.detail-card.template-summary {
    padding: 0;
}

.summary-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
}

.summary-item {
    min-width: 0;
    padding: 18px 22px;
}

.summary-item + .summary-item {
    border-left: 1px solid var(--border);
}

.summary-item dt {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
}

.summary-item dd {
    margin: 0;
    overflow: hidden;
    font-size: 16px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .summary-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .summary-item {
        padding: 14px 16px;
    }

    .summary-item + .summary-item {
        border-left: 0;
    }

    .summary-item:nth-child(even) {
        border-left: 1px solid var(--border);
    }

    .summary-item:nth-child(n + 3) {
        border-top: 1px solid var(--border);
    }
}

.template-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.form-group {
    margin-bottom: 17px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 700;
}

.form-group input {
    width: 100%;
    border: 1px solid var(--border);
    background: white;
    border-radius: 10px;
    padding: 12px 13px;
    font-size: 14px;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(58, 79, 130, .1);
}

.form-message {
    display: none;
    padding: 11px 13px;
    border-radius: 9px;
    margin-bottom: 16px;
    font-size: 13px;
}

.form-message.show {
    display: block;
}

.form-message.error {
    color: var(--danger);
    background: #fff1f0;
}

.form-message.success {
    color: var(--success);
    background: #edf9f3;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
}

.auth-card {
    width: min(430px, 100%);
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 34px;
    box-shadow: 0 18px 50px rgba(23, 32, 51, .08);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.auth-heading {
    margin-bottom: 26px;
}

.auth-heading h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.auth-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.back-link {
    display: inline-block;
    color: var(--primary);
    font-size: 14px;
    margin-bottom: 20px;
}

.auth-card .back-link {
    display: block;
    text-align: center;
    margin: 20px 0 0;
}

.template-list {
    display: grid;
    gap: 14px;
}

.template-card {
    display: block;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 21px;
    transition: .2s ease;
}

.template-card:hover {
    border-color: #c9d3e8;
    box-shadow: 0 8px 25px rgba(23, 32, 51, .06);
}

.template-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.template-card h3 {
    margin: 0 0 7px;
    font-size: 17px;
}

.template-id {
    color: var(--muted);
    font-size: 12px;
}

.template-type {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    background: #eef2fa;
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
}

.template-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.meta-item {
    color: var(--muted);
    font-size: 12px;
    background: #f7f8fb;
    padding: 6px 9px;
    border-radius: 7px;
}

.status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.status-published {
    background: #edf9f3;
    color: var(--success);
}

.status-draft {
    background: #fff8e8;
    color: var(--warning);
}

.status-archived {
    background: #f1f3f6;
    color: var(--muted);
}

.detail-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 18px;
}

.detail-card h2 {
    margin: 0 0 18px;
    font-size: 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.detail-item {
    padding: 13px;
    background: #f8f9fc;
    border-radius: 9px;
}

.detail-item span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 5px;
}

.detail-item strong {
    font-size: 14px;
}

.version-list {
    display: grid;
    gap: 10px;
}

.version-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.version-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.version-number {
    font-weight: 800;
}

.version-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.btn-small {
    display: inline-block;
    font-family: inherit;
    line-height: 1.3;
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    cursor: pointer;
}

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

.loading-state,
.empty-state {
    text-align: center;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 45px 20px;
    color: var(--muted);
}

.error-state {
    background: #fff1f0;
    color: var(--danger);
    border-radius: var(--radius);
    padding: 18px;
}

@media (max-width: 700px) {
    .member-container {
        width: min(100% - 28px, 1100px);
    }

    .member-header-inner {
        height: auto;
        padding: 14px 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .member-nav {
        width: 100%;
        flex-wrap: wrap;
        gap: 4px;
    }

    .member-nav a,
    .member-nav .logout-button {
        padding: 8px 10px;
        white-space: nowrap;
    }

    .dashboard-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .page-heading-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-heading h1 {
        font-size: 29px;
    }

    .auth-card {
        padding: 25px;
    }

    .version-row {
        align-items: flex-start;
        flex-direction: column;
    }
}
