:root {
    --bg: #f4f6fa;
    --card: #ffffff;
    --line: #dfe3ec;
    --text: #22262e;
    --muted: #6b7280;
    --accent: #2f6df6;
    --danger: #d64545;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    font-size: 14px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

.brand { font-weight: 600; font-size: 16px; color: var(--text); text-decoration: none; }

.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar nav a { color: var(--muted); text-decoration: none; }
.topbar nav a:hover { color: var(--accent); }
.who { color: var(--muted); }

main { padding: 24px; max-width: 1200px; margin: 0 auto; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.card.narrow { max-width: 360px; margin: 60px auto; }

h1 { font-size: 20px; margin-top: 0; }
h2 { font-size: 16px; margin-top: 0; }

label { display: block; margin-bottom: 12px; color: var(--muted); }
input[type="text"], input[type="password"] {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
}

button {
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
}

button:hover { border-color: var(--accent); color: var(--accent); }
button[type="submit"].primary, form button[type="submit"] { }
button.danger:hover { border-color: var(--danger); color: var(--danger); }
button.link { border: none; background: none; padding: 0; color: var(--muted); }

.inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline label { margin-bottom: 0; }
.inline label input { width: 160px; }
.inline label.check { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; }
.inline label.check input { width: auto; margin: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.avatar-frame {
    display: block;
    width: 36px;
    height: 36px;
    overflow: hidden;
    border-radius: 50%;
    background: #eef1f4;
}
.avatar-preview {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}
.content { max-width: 320px; word-break: break-word; }

.stats { display: flex; gap: 16px; margin-bottom: 20px; }
.stat {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.stat .num { display: block; font-size: 22px; font-weight: 600; }
.stat .label { color: var(--muted); font-size: 12px; }

.tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #eaf1ff;
    color: var(--accent);
    font-size: 11px;
}

.tag-danger { background: #fdeaea; color: #a12a2a; }
.tag-warn { background: #fff4e0; color: #9a6200; }

.actions { display: flex; flex-direction: column; gap: 6px; }
.actions form { margin: 0; }
.actions details form { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.actions details input { width: 140px; }

.flashes { list-style: none; padding: 0; margin: 0 0 16px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; }
.flash-error { background: #fdeaea; color: #a12a2a; }
.flash-ok { background: #e9f7ee; color: #226b3c; }

.pager { color: var(--muted); }
.pager a { margin-left: 12px; color: var(--accent); text-decoration: none; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 22, 28, 0.55);
    z-index: 50;
}

.modal-backdrop[hidden] { display: none; }

.modal {
    width: min(420px, calc(100vw - 48px));
    background: var(--card);
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.modal-title { margin: 0 0 10px; font-size: 17px; }
.modal-body { margin: 0 0 18px; color: var(--muted); line-height: 1.7; }
.modal-body code {
    padding: 1px 5px;
    border-radius: 4px;
    background: #f1f3f8;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12px;
}

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

button.primary {
    border-color: var(--danger);
    background: var(--danger);
    color: #fff;
}

button.primary:hover { border-color: #b93a3a; background: #b93a3a; color: #fff; }
