:root {
    --bg-dark: #0b1120;
    --card-bg: #1e293b;
    --card-hover: #243248;
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --radius: 16px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Top Nav */
.top-nav {
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 40;
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 68px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
    font-size: 1.15rem;
}

.badge-ver {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    font-weight: 800;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: white;
}

.admin-status {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
}

/* Main Layout */
.main-layout {
    flex: 1;
    padding: 36px 20px 60px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Hero Card */
.hero-card {
    background: linear-gradient(135deg, #1e1b4b 0%, #31104b 100%);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: var(--radius);
    padding: 32px 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.status-pill {
    color: #34d399;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 8px;
}

.hero-left h1 {
    font-size: 1.85rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.hero-desc {
    color: #cbd5e1;
    font-size: 0.95rem;
    max-width: 560px;
}

.hero-right {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 20px 28px;
    text-align: center;
    min-width: 230px;
}

.active-badge {
    font-size: 0.75rem;
    color: #c084fc;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.active-ver-num {
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    line-height: 1.2;
}

.guide-note {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 6px;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toolbar-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.toolbar-title h2 {
    font-size: 1.35rem;
    font-weight: 700;
}

.counter-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Version Cards (Accordion Structure) */
.version-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ver-accordion-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.ver-accordion-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: var(--shadow);
}

.ver-accordion-card.is-active {
    border: 2px solid var(--success);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.06), #1e293b 80px);
}

/* Header Row */
.ver-header-row {
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.ver-header-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.ver-info-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ver-tag-badge {
    background: #334155;
    color: #e2e8f0;
    font-size: 1.1rem;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 8px;
    min-width: 75px;
    text-align: center;
}

.ver-accordion-card.is-active .ver-tag-badge {
    background: var(--success);
    color: #0f172a;
}

.ver-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ver-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ver-message {
    font-weight: 700;
    font-size: 1.05rem;
    color: white;
}

.current-pill {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.ver-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.ver-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-arrow-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.ver-accordion-card.expanded .toggle-arrow-btn {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border-color: var(--primary);
}

/* Accordion Detail Body */
.ver-detail-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: #141d2e;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ver-accordion-card.expanded .ver-detail-body {
    max-height: 800px;
}

.detail-content-inner {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Section Boxes */
.detail-section h4 {
    font-size: 0.95rem;
    color: #e2e8f0;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-list-item {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.item-bullet {
    color: var(--primary);
    font-weight: bold;
}

/* File Badges */
.file-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.file-badge.added {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.file-badge.modified {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.file-badge.deleted {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.file-badge.normal {
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}

.file-name {
    font-family: Consolas, Monaco, monospace;
    color: #e0e7ff;
    font-size: 0.88rem;
    flex: 1;
}

/* Detail Action Bar */
.detail-action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

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

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

.btn-secondary {
    background: #334155;
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
}

.btn-outline:hover {
    color: white;
    border-color: white;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.btn-rollback {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.btn-rollback:hover {
    background: var(--primary);
    color: white;
}

.btn-preview {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(99, 102, 241, 0.25));
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.45);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.15);
}

.btn-preview:hover {
    background: linear-gradient(135deg, #0284c7, #4f46e5);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    padding: 20px;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: #1e293b;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal-lg .modal-dialog {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--card-border);
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.hint-box {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.85rem;
    color: #c7d2fe;
    margin-bottom: 20px;
}

.hint-box code {
    background: #0f172a;
    padding: 2px 6px;
    border-radius: 4px;
    color: #38bdf8;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #cbd5e1;
}

.form-group input, .file-selector select {
    width: 100%;
    padding: 10px 14px;
    background: #0f172a;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus, .file-selector select:focus {
    border-color: var(--primary);
    outline: none;
}

.form-error {
    color: #f87171;
    font-size: 0.85rem;
    margin-bottom: 14px;
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px;
}

.warning-box {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    padding: 16px;
    font-size: 0.9rem;
    color: #fca5a5;
    margin-bottom: 24px;
}

.highlight-ver {
    font-weight: 800;
    color: white;
    background: #7f1d1d;
    padding: 2px 6px;
    border-radius: 4px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Code Viewer */
.file-selector {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.code-viewer {
    background: #090d16;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 16px;
    max-height: 420px;
    overflow: auto;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.85rem;
    color: #38bdf8;
    line-height: 1.5;
}

/* Loading & Empty */
.loading-state, .empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.footer {
    border-top: 1px solid var(--card-border);
    padding: 24px 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .hero-card {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    .ver-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
    .ver-actions {
        width: 100%;
        justify-content: space-between;
    }
}
