/* ==========================================================================
   FRP 管理面板样式表
   ========================================================================== */

:root {
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --brand-light: #eef2ff;
    --bg: #f5f6fa;
    --card: #ffffff;
    --text: #1f2430;
    --text-2: #5b6472;
    --text-3: #8b94a3;
    --border: #e6e9f0;
    --border-2: #d8dde8;
    --green: #16a34a;
    --green-bg: #e8f7ee;
    --red: #dc2626;
    --red-bg: #fdecec;
    --amber: #d97706;
    --amber-bg: #fdf4e3;
    --blue: #2563eb;
    --blue-bg: #e8f0fe;
    --purple: #7c3aed;
    --purple-bg: #f1ebfe;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-lg: 0 8px 24px rgba(16, 24, 40, .10);
    --sidebar-w: 236px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ============================= 布局 ============================= */

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

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

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

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--brand), #6366f1);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .5px;
    flex: 0 0 auto;
}
.brand-mark.lg { width: 56px; height: 56px; font-size: 18px; border-radius: 14px; }

.brand-text {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

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

.nav-group {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .8px;
    color: var(--text-3);
    text-transform: uppercase;
    padding: 14px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: #f4f5f9; color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; }

.sidebar-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-3);
}

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

.topbar {
    height: 60px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(150%) blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.page-title { font-size: 17px; flex: 1; min-width: 0; }

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

.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--brand-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}
.uname { font-weight: 500; }

.content { flex: 1; padding: 22px; max-width: 1280px; width: 100%; }

.footer {
    padding: 18px 22px 26px;
    color: var(--text-3);
    font-size: 12.5px;
}

/* 移动端抽屉 */
.nav-toggle-input { display: none; }
.nav-toggle-btn { display: none; cursor: pointer; color: var(--text-2); }
.nav-toggle-btn svg { width: 22px; height: 22px; display: block; }
.nav-backdrop { display: none; }

/* ============================= 组件 ============================= */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}
.card-head {
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; flex: 1; min-width: 140px; }
.card-head .sub { color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* 统计卡片 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat-label { color: var(--text-3); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 26px; font-weight: 600; margin-top: 6px; letter-spacing: -.3px; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--text-3); }
.stat-foot { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }

.btn-outline { background: #fff; border-color: var(--border-2); color: var(--text); }
.btn-outline:hover { background: #f7f8fb; border-color: var(--text-3); color: var(--text); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f0f1f6; color: var(--text); }

.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; }

.btn-danger-outline { background: #fff; border-color: #f3c9c9; color: var(--red); }
.btn-danger-outline:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }

.btn-success { background: var(--green); }
.btn-success:hover { background: #15803d; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #f0f1f6;
    color: var(--text-2);
    white-space: nowrap;
}
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* 提示条 */
.alert {
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    font-size: 13.5px;
}
.alert-success { background: var(--green-bg); border-color: #bfe8cf; color: #14663a; }
.alert-error,
.alert-danger  { background: var(--red-bg);   border-color: #f6cccc; color: #9b1c1c; }
.alert-warning { background: var(--amber-bg); border-color: #f2ddb0; color: #92600a; }
.alert-info    { background: var(--blue-bg);  border-color: #c9dcfb; color: #1c4ed8; }
.alert p:last-child { margin-bottom: 0; }
.alert p:first-child { margin-top: 0; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.table th,
table.table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.table th {
    background: #fafbfd;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-2);
    white-space: nowrap;
}
table.table tbody tr:hover { background: #fafbfd; }
table.table tbody tr:last-child td { border-bottom: none; }
table.table td.actions { white-space: nowrap; text-align: right; }
table.table td.actions form { display: inline; }

.muted { color: var(--text-3); }
.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
}
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }

.empty { padding: 46px 20px; text-align: center; color: var(--text-3); }
.empty svg { width: 40px; height: 40px; opacity: .45; margin-bottom: 10px; }
.empty p { margin: 4px 0 14px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13.5px; }
.field label .req { color: var(--red); }
.field .hint { color: var(--text-3); font-size: 12.5px; margin-top: 5px; }

input[type="text"], input[type="password"], input[type="email"], input[type="number"],
select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
input:disabled, select:disabled, textarea:disabled { background: #f5f6fa; color: var(--text-3); }
textarea { resize: vertical; min-height: 84px; }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; }
.check input { width: auto; margin-top: 3px; }
.check-row { display: flex; gap: 22px; flex-wrap: wrap; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { width: auto; min-width: 150px; }

/* 代码块 */
.codebox {
    position: relative;
    background: #1f2430;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.codebox pre {
    margin: 0;
    padding: 16px 16px;
    overflow-x: auto;
    color: #e5e9f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
    line-height: 1.7;
    tab-size: 2;
}
.codebox .copy-btn {
    position: absolute;
    top: 9px; right: 9px;
    background: rgba(255, 255, 255, .12);
    border: none;
    color: #e5e9f0;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.codebox .copy-btn:hover { background: rgba(255, 255, 255, .22); }

.copy-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.copy-inline button {
    background: #f0f1f6;
    border: none;
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 11.5px;
    cursor: pointer;
    color: var(--text-2);
    font-family: inherit;
}
.copy-inline button:hover { background: #e2e4ec; color: var(--text); }

/* 标签页 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 0; padding: 0 18px; flex-wrap: wrap; }
.tab {
    padding: 11px 14px;
    color: var(--text-2);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* 分页 */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pager a, .pager span {
    padding: 6px 11px;
    border: 1px solid var(--border-2);
    border-radius: 6px;
    color: var(--text-2);
    font-size: 13px;
    background: #fff;
}
.pager a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pager .cur { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .gap { border: none; background: none; }

/* 说明列表 */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; font-size: 13.5px; align-items: baseline; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-all; }

.desc-list { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 13.5px; }
.desc-list li { margin-bottom: 6px; }

/* 进度条 */
.progress { height: 6px; background: #eceef4; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.progress i.warn { background: var(--amber); }
.progress i.danger { background: var(--red); }

/* 页头操作区 */
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.page-actions .spacer { flex: 1; }

/* ============================= 登录页 ============================= */

.auth-body { background: #fff; }
.auth-wrap { display: flex; min-height: 100vh; }

.auth-hero {
    flex: 1.05;
    background: linear-gradient(150deg, #4f46e5 0%, #6366f1 45%, #8b5cf6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    position: relative;
    overflow: hidden;
}
.auth-hero::after {
    content: "";
    position: absolute;
    width: 460px; height: 460px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    top: -140px; right: -150px;
}
.auth-hero-inner { max-width: 400px; position: relative; z-index: 1; }
.auth-hero-inner .brand-mark { background: rgba(255, 255, 255, .2); backdrop-filter: blur(4px); }
.auth-hero-inner h2 { font-size: 25px; margin: 22px 0 10px; }
.auth-hero-inner p { color: rgba(255, 255, 255, .82); margin: 0 0 26px; font-size: 15px; }
.hero-list { list-style: none; padding: 0; margin: 0; }
.hero-list li {
    padding: 8px 0 8px 26px;
    position: relative;
    color: rgba(255, 255, 255, .9);
    font-size: 13.8px;
}
.hero-list li::before {
    content: "";
    position: absolute;
    left: 2px; top: 15px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .85);
}

.auth-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    min-width: 0;
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-3); margin: 0 0 24px; font-size: 13.5px; }
.auth-links { margin-top: 18px; text-align: center; font-size: 13.5px; color: var(--text-3); }
.auth-foot { margin-top: 30px; color: var(--text-3); font-size: 12.5px; }

/* ============================= 安装向导 ============================= */

.install-body { background: var(--bg); padding: 40px 20px; }
.install-wrap { max-width: 660px; margin: 0 auto; }
.install-head { text-align: center; margin-bottom: 26px; }
.install-head .brand-mark { margin: 0 auto 14px; }
.install-head h1 { font-size: 22px; margin-bottom: 6px; }
.install-head p { color: var(--text-3); margin: 0; }
.steps { display: flex; gap: 8px; margin-bottom: 22px; justify-content: center; flex-wrap: wrap; }
.step {
    display: flex; align-items: center; gap: 7px;
    padding: 6px 14px; border-radius: 20px;
    background: #fff; border: 1px solid var(--border);
    font-size: 13px; color: var(--text-3);
}
.step b {
    width: 19px; height: 19px; border-radius: 50%;
    background: #eceef4; color: var(--text-3);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11.5px;
}
.step.active { border-color: var(--brand); color: var(--brand-dark); }
.step.active b { background: var(--brand); color: #fff; }
.step.done b { background: var(--green); color: #fff; }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 0; border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.check-list li:last-child { border-bottom: none; }
.check-list .ok { color: var(--green); font-weight: 600; }
.check-list .fail { color: var(--red); font-weight: 600; }
.check-list .name { flex: 1; }

/* ============================= 响应式 ============================= */

@media (max-width: 900px) {
    .auth-hero { display: none; }
}

@media (max-width: 820px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-lg);
    }
    .nav-toggle-input:checked ~ .layout .sidebar { transform: translateX(0); }
    .nav-toggle-input:checked ~ .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(16, 24, 40, .38);
        z-index: 25;
    }
    .main { margin-left: 0; }
    .nav-toggle-btn { display: inline-flex; }
    .content { padding: 16px; }
    .topbar { padding: 0 14px; }
    .uname { display: none; }
    .stat-value { font-size: 22px; }
}

@media (max-width: 560px) {
    .card-head { padding: 13px 14px; }
    .card-body { padding: 14px; }
    table.table th, table.table td { padding: 9px 10px; }
}
