:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f9fafb;
    --text: #1f2933;
    --muted: #667085;
    --line: #d9e0e8;
    --line-soft: #edf1f5;
    --primary: #0f766e;
    --primary-strong: #0b5f59;
    --primary-soft: #e4f5f2;
    --blue: #2563a8;
    --danger: #b42318;
    --danger-soft: #fff1f0;
    --success: #0f7a4f;
    --success-soft: #e7f6ee;
    --warning-soft: #fff7df;
    --shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: linear-gradient(180deg, #eef4f6 0, var(--bg) 240px);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.22);
    outline-offset: 2px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 32px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 20px;
    color: #14213d;
}

.brand::before {
    content: "";
    width: 12px;
    height: 28px;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--primary), #d99b2b);
}

.topbar nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.topbar nav a, .link-button {
    border-radius: 6px;
    color: #344054;
    font-weight: 650;
    padding: 8px 10px;
}
.topbar nav a:hover, .link-button:hover {
    background: var(--primary-soft);
    color: var(--primary-strong);
    text-decoration: none;
}

.page { max-width: 1220px; margin: 0 auto; padding: 30px 28px 44px; }

.hero {
    display: grid;
    gap: 14px;
    margin-bottom: 24px;
    padding: 26px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero h1, .page-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.25;
    letter-spacing: 0;
    color: #111827;
}

.hero p { margin: 0; }
.muted { color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
}

a.card {
    display: block;
    color: var(--text);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
a.card:hover {
    border-color: rgba(15, 118, 110, 0.42);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    text-decoration: none;
}

.card h2, .card h3 { margin: 0 0 10px; color: #172033; }
.card p:last-child { margin-bottom: 0; }

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.search { display: flex; gap: 10px; max-width: 720px; }

input, select, textarea {
    width: 100%;
    border: 1px solid #c8d2de;
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover, select:hover, textarea:hover { border-color: #9fb0c2; }
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

textarea {
    min-height: 320px;
    resize: vertical;
    font-family: Consolas, "SFMono-Regular", monospace;
    line-height: 1.6;
}

label {
    display: block;
    font-weight: 700;
    color: #344054;
    margin: 14px 0 6px;
}

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

button:hover, .button:hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
    color: #fff;
    text-decoration: none;
}

.button.secondary, button.secondary {
    background: #fff;
    color: var(--primary-strong);
    border-color: #a8d6cf;
}
.button.secondary:hover, button.secondary:hover { background: var(--primary-soft); color: var(--primary-strong); }
.button.danger, button.danger { background: var(--danger); border-color: var(--danger); }
.button.danger:hover, button.danger:hover { background: #8f1d14; border-color: #8f1d14; }
.link-button { border: 0; background: none; min-height: auto; cursor: pointer; }
.inline { display: inline; }

.notice {
    margin-bottom: 18px;
    border: 1px solid #abd7c3;
    background: var(--success-soft);
    color: #085536;
    padding: 12px 14px;
    border-radius: 8px;
}
.notice.error { border-color: #f0b8b3; background: var(--danger-soft); color: #842029; }

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
}

th, td {
    text-align: left;
    padding: 13px 14px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
tr:last-child td { border-bottom: 0; }
th {
    background: #f6f8fb;
    color: #475467;
    font-size: 13px;
    font-weight: 800;
}
tbody tr:hover td { background: #fbfcfd; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

.admin-shell {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 86px;
    display: grid;
    align-content: start;
    gap: 6px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
}

.sidebar a {
    padding: 10px 12px;
    border-radius: 6px;
    color: #344054;
    font-weight: 700;
}
.sidebar a:hover {
    background: var(--primary-soft);
    color: var(--primary-strong);
    text-decoration: none;
}

.workspace { min-width: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
    font-weight: 700;
}

.check-item input { width: auto; }

.tag-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 3px rgba(31, 41, 51, 0.12);
}

.stat-number {
    margin: 0;
    color: #111827;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.2;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eef2f6;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}
.badge.ok { background: var(--success-soft); color: var(--success); }

.markdown {
    line-height: 1.8;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
}
.markdown h1, .markdown h2, .markdown h3 { color: #111827; line-height: 1.35; }
.markdown code { background: #eef2f6; padding: 2px 5px; border-radius: 4px; }
.markdown pre {
    overflow-x: auto;
    background: #111827;
    color: #f8fafc;
    padding: 14px;
    border-radius: 6px;
}
.markdown pre code { background: transparent; padding: 0; color: inherit; }

@media (max-width: 900px) {
    .topbar { height: auto; min-height: 64px; padding: 12px 16px; align-items: flex-start; }
    .page { padding: 18px; }
    .grid.two, .grid.three, .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .toolbar, .search { flex-direction: column; align-items: stretch; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
}
