/* ============================================
   Kernel Pro — Module Config v2
   ============================================ */

:root {
    --bg-base:      #0c0d12;
    --bg-elevated:  #13141c;
    --bg-card:      #181924;
    --bg-card-hover:#1e2030;
    --bg-input:     #1a1b26;
    --text-primary:   #e4e6ed;
    --text-secondary: #8b8fa4;
    --text-muted:     #555871;
    --border:       #222436;
    --border-hover: #2e3148;
    --accent:       #4f7cff;
    --accent-dim:   rgba(79,124,255,0.12);
    --accent-hover: #3d6af0;
    --green:  #34d399;
    --red:    #f87171;
    --amber:  #fbbf24;
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-pill: 100px;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03);
    --shadow-float: 0 8px 32px rgba(0,0,0,0.5);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Noto Sans SC', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    font-size: 14px;
    letter-spacing: -0.011em;
}

/* ───── Layout ───── */

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    position: relative;
    z-index: 1;
}

/* ───── Header ───── */

.page-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
    padding-top: 8px;
}
.btn-back {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
    cursor: pointer;
}
.btn-back:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}
.page-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.page-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    padding-left: 50px;
}

/* ───── Stats ───── */

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
    box-shadow: var(--shadow-card);
}
.stat-box.accent {
    border-color: rgba(79,124,255,0.25);
    background: linear-gradient(135deg, rgba(79,124,255,0.08) 0%, var(--bg-card) 100%);
}
.stat-num {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.stat-box.accent .stat-num { color: var(--accent); }
.stat-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ───── Card ───── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}
.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

/* ───── Form ───── */

.form-group {
    margin-bottom: 14px;
}
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}
select.input-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23555871' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
select.input-field:focus { border-color: var(--accent); }

/* ───── Buttons ───── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    font-family: inherit;
}
.btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}
.btn:active { transform: scale(0.97); }

.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.full {
    width: 100%;
    padding: 11px;
    font-size: 14px;
}

.btn.danger {
    background: rgba(248,113,113,0.08);
    border-color: rgba(248,113,113,0.2);
    color: var(--red);
}
.btn.danger:hover {
    background: rgba(248,113,113,0.15);
    border-color: rgba(248,113,113,0.35);
}

.btn.sm { padding: 5px 10px; font-size: 12px; }

/* ───── Secrets list ───── */

.secrets-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.secrets-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.secrets-list li:last-child { border-bottom: none; }
.secrets-list li:hover {
    background: var(--bg-card-hover);
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
    border-radius: var(--radius-sm);
}

.secret-info { flex: 1; min-width: 0; }
.secret-id {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    word-break: break-all;
    line-height: 1.4;
}

.empty-hint {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ───── Modal ───── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    padding: 24px;
    box-shadow: var(--shadow-float);
    position: relative;
}
.modal-box h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}
.modal-close {
    position: absolute;
    top: 14px; right: 16px;
    width: 28px; height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.secret-warning {
    font-size: 12px;
    color: var(--amber);
    line-height: 1.6;
    margin: 8px 0 14px;
    padding: 10px 12px;
    background: rgba(251,191,36,0.08);
    border: 1px solid rgba(251,191,36,0.15);
    border-radius: var(--radius-sm);
}

.secret-output {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    word-break: break-all;
    line-height: 1.6;
    color: var(--accent);
    margin: 12px 0;
}

.expiry-notice {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ───── Toast ───── */

.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 5000;
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-float);
    transition: transform 0.25s var(--ease);
    pointer-events: none;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success {
    background: rgba(52,211,153,0.12);
    color: var(--green);
    border-color: rgba(52,211,153,0.25);
}
.toast.error {
    background: rgba(248,113,113,0.12);
    color: var(--red);
    border-color: rgba(248,113,113,0.25);
}

/* ───── LV6 Modal ───── */

#lv6-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s var(--ease);
}
#lv6-overlay.active { opacity: 1; pointer-events: auto; }

#lv6-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-top: -200px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-float);
    transition: margin-top 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}
#lv6-overlay.active #lv6-box { margin-top: 80px; }
#lv6-box h3 {
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 10px;
}
#lv6-box p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 20px;
}
#lv6-box button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 9px 28px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}
#lv6-box button:hover { background: var(--accent-hover); }

/* ───── Scrollbar ───── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (min-width: 1024px) {
    .page { padding: 36px 32px 64px; }
}
