:root {
    --accent: #35a85b;
    --accent-strong: #228547;
    --accent-soft: #edfdf3;
    --ink: #0f172a;
    --text: #334155;
    --muted: #64748b;
    --line: #e5e7eb;
    --paper: #f8fafc;
    --danger: #b91c1c;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--text);
    font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent-strong); text-decoration: none; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }

.brand-mark {
    width: 52px; height: 52px; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, #4abe6e, #228547);
    color: #fff; font-size: 26px; font-weight: 800;
    box-shadow: 0 8px 24px rgba(34,133,71,.25);
}
.brand-mark.small { width: 32px; height: 32px; border-radius: 9px; font-size: 16px; box-shadow: none; }
.eyebrow { color: var(--accent-strong); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.muted { color: var(--muted); font-size: 12px; }
.error { margin-top: 10px; color: var(--danger); font-size: 12px; }
.notice { margin-bottom: 14px; padding: 12px 14px; border: 1px solid #fde68a; border-radius: 10px; background: #fffbeb; color: #92400e; font-size: 12px; }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(circle at 20% 0%, #edfdf3, transparent 42%), var(--paper); }
.auth-card { width: 380px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: 0 22px 60px rgba(15,23,42,.08); }
.auth-card h1 { margin: 14px 0 4px; color: var(--ink); font-size: 25px; letter-spacing: -.4px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.auth-card input { height: 38px; border: 1px solid #d1d5db; border-radius: 9px; padding: 0 10px; color: var(--ink); outline: none; }
.auth-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-card .hint { margin: 16px 0 0; color: #94a3b8; font-size: 10px; line-height: 1.6; }
.btn { border: 0; border-radius: 8px; padding: 9px 13px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: #fff; border: 1px solid #d1d5db; color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-strong); }
.btn.wecom { display: block; margin-top: 16px; background: #07c160; color: #fff; text-align: center; }
.btn.danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.link-btn { border: 0; background: transparent; color: var(--accent-strong); cursor: pointer; font-size: 12px; padding: 0; text-align: left; }

.side { position: fixed; inset: 0 auto 0 0; width: 230px; background: #0a0a0a; color: #cbd5e1; padding: 20px 14px; display: flex; flex-direction: column; }
.side-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.side-brand strong { display: block; color: #fff; font-size: 14px; }
.side-brand small { display: block; color: #64748b; font-size: 10px; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { border: 0; border-radius: 8px; background: transparent; color: #94a3b8; text-align: left; padding: 10px 12px; font-size: 12px; cursor: pointer; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(74,190,110,.14); color: #4abe6e; font-weight: 700; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px 10px 4px; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot a { color: #94a3b8; font-size: 11px; }
.side-foot a:hover { color: #4abe6e; }

.main { margin-left: 230px; padding: 26px 30px 50px; min-height: 100vh; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.topbar h1 { margin: 5px 0 0; color: var(--ink); font-size: 26px; letter-spacing: -.5px; }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.pill { display: inline-block; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); padding: 2px 8px; font-size: 10px; font-weight: 700; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; }
.card small { display: block; color: #94a3b8; font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.card strong { display: block; margin-top: 5px; color: var(--ink); font-size: 24px; }
.card span { color: var(--muted); font-size: 11px; }

.tab-panel { background: transparent; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.panel-head h2 { margin: 0 0 4px; color: var(--ink); font-size: 17px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 10px; }
.filters input, .filters select, .grid-form input, .grid-form select {
    height: 34px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: var(--text); padding: 0 9px; font-size: 12px; outline: none;
}
.filters input:focus, .filters select:focus, .grid-form input:focus, .grid-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filters input { min-width: 170px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th { color: #94a3b8; font-size: 10px; text-align: left; font-weight: 700; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafafa; }
td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; color: var(--text); font-size: 12px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td .mini { height: 28px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; padding: 0 6px; font-size: 11px; color: var(--text); }
td .mini:focus { border-color: var(--accent); outline: none; }
td .row-actions { display: flex; gap: 6px; align-items: center; }
td .save-btn { border: 0; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong); padding: 5px 8px; font-size: 10px; font-weight: 700; cursor: pointer; }
td .save-btn:hover { background: #d8f8e5; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 7px; font-size: 10px; font-weight: 700; }
.badge.active { background: var(--accent-soft); color: var(--accent-strong); }
.badge.disabled { background: #f1f5f9; color: #64748b; }
.subpanel { margin-top: 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.subpanel h3 { margin: 0 0 10px; color: var(--ink); font-size: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.grid-form label { display: flex; flex-direction: column; gap: 5px; color: #64748b; font-size: 10px; font-weight: 700; }
.grid-form .form-actions { display: flex; align-items: flex-end; }
.key-list { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.oidc-line { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.dot.ok { background: var(--accent); box-shadow: 0 0 0 3px rgba(53,168,91,.14); }
.empty { padding: 28px; text-align: center; color: #94a3b8; font-size: 12px; }

@media (max-width: 1100px) {
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .side { position: static; width: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
    .side-brand { margin: 0 auto 0 0; }
    .side nav { flex-direction: row; }
    .side-foot { margin: 0; border: 0; padding: 0; }
    .main { margin-left: 0; padding: 18px; }
    .cards, .grid-form { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; }
}
