﻿/* ============================================================
   寰俊搴旂敤涓彴 - 鍚庡彴鏍峰紡锛堥浂渚濊禆锛岀函鎵嬪啓锛?   ============================================================ */

:root {
    --c-primary: #2563eb;
    --c-primary-dark: #1d4ed8;
    --c-text: #1f2937;
    --c-text-light: #6b7280;
    --c-border: #e5e7eb;
    --c-bg: #f5f7fb;
    --c-panel: #ffffff;
    --c-success: #059669;
    --c-danger: #dc2626;
    --c-warn: #d97706;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--c-bg);
    color: var(--c-text);
    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;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 12.5px;
}

.muted { color: var(--c-text-light); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--c-danger); }

/* ---------------------------------------------------------- 甯冨眬 */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 208px;
    flex: 0 0 208px;
    background: #111827;
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--c-primary);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .5px;
}

.brand-text { font-size: 14px; font-weight: 600; color: #f9fafb; }

.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
    display: block;
    padding: 9px 12px;
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 13.5px;
}

.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--c-primary); color: #fff; }

.sidebar-foot {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: #6b7280;
    font-size: 12px;
}

.sidebar-foot .version { letter-spacing: .4px; opacity: .8; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 56px;
    background: var(--c-panel);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user-name { color: var(--c-text); }

.content { padding: 20px; flex: 1; }

.foot {
    padding: 14px 20px;
    color: var(--c-text-light);
    font-size: 12px;
    text-align: center;
    border-top: 1px solid var(--c-border);
    background: var(--c-panel);
}

/* ---------------------------------------------------------- 椤靛ご */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.page-head h2 { font-size: 18px; margin: 0; font-weight: 600; }
.page-actions { display: flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------- 鍗＄墖 */
.card {
    background: var(--c-panel);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-bottom: 1px solid var(--c-border);
}

.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-body { padding: 16px; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

/* ---------------------------------------------------------- 缁熻鍗?*/
.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat {
    background: var(--c-panel);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
}

.stat-label { color: var(--c-text-light); font-size: 12.5px; }
.stat-value { font-size: 24px; font-weight: 600; line-height: 1.3; margin-top: 2px; }
.stat-sub { color: var(--c-text-light); font-size: 12px; margin-top: 2px; }
.stat-warn { border-color: #fecaca; background: #fff7f7; }
.stat-warn .stat-value { color: var(--c-danger); }

/* ---------------------------------------------------------- 琛ㄦ牸 */
.table-wrap { width: 100%; overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table thead th {
    text-align: left;
    padding: 10px 12px;
    background: #f9fafb;
    color: var(--c-text-light);
    font-weight: 600;
    font-size: 12.5px;
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f3f6;
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fbfcfe; }
.table .empty { text-align: center; color: var(--c-text-light); padding: 26px 12px; }

.col-actions { text-align: right; white-space: nowrap; }
.col-actions form { display: inline-block; }
.col-actions .btn { margin-left: 4px; }

/* ---------------------------------------------------------- 寰芥爣 */
.badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 18px;
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #e0e7ff;
}

.badge-gray { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.badge-success { background: #ecfdf5; color: var(--c-success); border-color: #d1fae5; }
.badge-danger { background: #fef2f2; color: var(--c-danger); border-color: #fee2e2; }
.badge-warn { background: #fffbeb; color: var(--c-warn); border-color: #fef3c7; }
.badge-role { background: #eff6ff; color: var(--c-primary-dark); border-color: #dbeafe; }

/* ---------------------------------------------------------- 鎻愮ず鏉?*/
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 13px;
    border: 1px solid transparent;
}

.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ---------------------------------------------------------- 鎸夐挳 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid var(--c-border);
    background: #fff;
    color: var(--c-text);
    font-size: 13px;
    cursor: pointer;
    line-height: 1;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}

.btn:hover { background: #f9fafb; text-decoration: none; }

.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }

.btn-danger { color: var(--c-danger); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: #fef2f2; }

.btn-sm { height: 26px; padding: 0 9px; font-size: 12.5px; }

.btn-link {
    background: none;
    border: none;
    color: var(--c-primary);
    padding: 0 4px;
    height: auto;
}

.btn-block { width: 100%; height: 38px; font-size: 14px; }

/* ---------------------------------------------------------- 琛ㄥ崟 */
.form { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-full { grid-column: 1 / -1; }
.field-label { font-size: 13px; color: #374151; font-weight: 500; }
.field-label em { color: var(--c-danger); font-style: normal; }
.field-hint { font-size: 12px; color: var(--c-text-light); }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0 10px;
    height: 34px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: #fff;
    font-size: 13.5px;
    color: var(--c-text);
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

textarea { height: auto; padding: 8px 10px; line-height: 1.6; resize: vertical; }

input:focus, select:focus, textarea:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

select { padding-right: 6px; }

.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 4px; }

.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--c-panel);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}

.filter-bar input[type="text"], .filter-bar select { width: auto; min-width: 150px; height: 32px; }
.filter-bar .btn { height: 32px; }

.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

/* ---------------------------------------------------------- 閿€艰〃 */
.kv {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 9px 14px;
    margin: 0;
    align-items: start;
}

.kv dt { color: var(--c-text-light); font-size: 13px; }
.kv dd { margin: 0; font-size: 13.5px; word-break: break-all; }

/* ---------------------------------------------------------- 鍒嗛〉 */
.pager { display: flex; align-items: center; gap: 6px; padding: 12px 16px; flex-wrap: wrap; font-size: 13px; }

.page-link {
    display: inline-block;
    min-width: 30px;
    height: 28px;
    line-height: 26px;
    text-align: center;
    padding: 0 8px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    color: var(--c-text);
    background: #fff;
}

.page-link:hover { background: #f3f4f6; text-decoration: none; }
.page-link.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.page-link.disabled { color: #cbd5e1; pointer-events: none; }
.page-gap { color: var(--c-text-light); }
.page-info { margin-left: auto; color: var(--c-text-light); font-size: 12.5px; }

/* ---------------------------------------------------------- 姝ｆ枃鍧?*/
.prose ul { margin: 0; padding-left: 20px; }
.prose li { margin: 5px 0; color: #374151; }
.prose code {
    background: #f3f4f6;
    padding: 1px 5px;
    border-radius: 4px;
    color: #be123c;
}

.link { font-weight: 500; }

/* ---------------------------------------------------------- 鐧诲綍椤?*/
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 60%, #111827 100%);
    padding: 20px;
}

.login-wrap { width: 100%; max-width: 380px; }

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px 26px 22px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, .28);
}

.login-brand { text-align: center; margin-bottom: 18px; }
.login-brand .brand-mark { width: 42px; height: 42px; font-size: 15px; margin-bottom: 6px; }
.login-brand h1 { font-size: 17px; margin: 4px 0 2px; font-weight: 600; }
.login-sub { margin: 0; color: var(--c-text-light); font-size: 12.5px; }

.login-card .form .field { margin-bottom: 12px; }
.login-tip { color: var(--c-text-light); font-size: 12px; margin: 14px 0 0; text-align: center; }

/* ---------------------------------------------------------- 閿欒椤?*/
.error-card { text-align: center; }
.error-code { font-size: 46px; font-weight: 700; color: var(--c-primary); line-height: 1.2; }
.error-message { color: #374151; font-size: 13.5px; margin: 6px 0 18px; word-break: break-all; }
.error-actions { display: flex; gap: 10px; justify-content: center; }

/* ---------------------------------------------------------- 鍝嶅簲寮?*/
@media (max-width: 1080px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: column; }
    .nav { flex-direction: row; overflow-x: auto; gap: 6px; }
    .nav-item { white-space: nowrap; }
    .sidebar-foot { display: none; }
    .content { padding: 14px; }
    .stats { grid-template-columns: minmax(0, 1fr); }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .kv { grid-template-columns: 84px minmax(0, 1fr); }
    .page-head { align-items: flex-start; }
}

/* ---- v2：项目应用编排（左右两栏 / 候选列表 / 小按钮组） ---- */
.grid-2-asym { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1080px) { .grid-2-asym { grid-template-columns: 1fr; } }
.candidate-group + .candidate-group { margin-top: 14px; }
.candidate-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--c-muted); letter-spacing: .02em; }
.candidate-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.candidate-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--c-border); border-radius: 8px; background: #fcfcfd; }
.candidate-item:hover { border-color: #c7d2fe; background: #f8faff; }
.candidate-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.candidate-info strong { font-size: 14px; }
.btn-xs { padding: 1px 7px; font-size: 12px; line-height: 18px; border-radius: 5px; }
.btn-group { display: inline-flex; gap: 4px; margin-top: 4px; }
.btn-group form { margin: 0; }
.table td .badge + .badge { margin-left: 4px; }

/* ---- v3：开放平台 / 统一身份 / API 调用方 ---- */
.kv-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kv-table th { width: 132px; text-align: left; vertical-align: top; padding: 8px 10px 8px 0; color: var(--c-text-light); font-weight: 500; font-size: 13px; border-bottom: 1px dashed var(--c-border); white-space: nowrap; }
.kv-table td { padding: 8px 0; border-bottom: 1px dashed var(--c-border); word-break: break-all; }
.kv-table tr:last-child th, .kv-table tr:last-child td { border-bottom: 0; }
.mt-2 { margin-top: 14px; }
.card-highlight { border-color: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, .16); }
.secret-box { background: #f1f5f9; border: 1px solid var(--c-border); border-radius: 6px; padding: 7px 10px; line-height: 1.5; user-select: all; }
.stat-sub { white-space: normal; }
@media (max-width: 720px) {
    .kv-table th { width: 96px; white-space: normal; }
}
