:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --text: #1f2937;
    --text-muted: #6b7280;
    --primary: #1f3a8a;
    --primary-hover: #1e40af;
    --primary-soft: #eef2ff;
    --danger: #b91c1c;
    --success: #166534;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.04);
    --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
        "Helvetica Neue", Helvetica, Arial, "Source Han Sans CN", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }

code {
    background: #f3f4f6;
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    color: #111827;
}

/* Header */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-mark {
    width: 18px; height: 18px;
    background: var(--primary);
    border-radius: 4px;
    box-shadow: inset 0 0 0 3px #fff, 0 0 0 1px var(--primary);
}
.brand-text { color: var(--text); letter-spacing: 0.2px; }
.nav a {
    color: var(--text-muted);
    margin-left: 20px;
    font-weight: 500;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
}
.nav a.active {
    color: var(--text);
    border-bottom-color: var(--primary);
}
.nav a:hover { text-decoration: none; color: var(--text); }

.main { padding: 28px 20px 40px; }

.hero h1 {
    font-size: 22px;
    margin: 0 0 6px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.hero p { margin: 0 0 20px; }

/* Tabs */
.tabs {
    display: inline-flex;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 16px;
}
.tab {
    border: 0;
    background: transparent;
    padding: 7px 16px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
}
.tab.active {
    background: var(--primary-soft);
    color: var(--primary);
}

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.panel {
    padding: 22px 24px;
    margin-bottom: 18px;
}
.panel-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
}

/* Forms */
.form-row {
    margin-top: 14px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 240px;
}
.field.full { flex: 1 1 100%; }
.label { font-size: 13px; color: var(--text-muted); }

input[type="text"], input[type="password"], input[type="number"], select {
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 58, 138, 0.12);
}

.file-drop {
    position: relative;
    border: 1px dashed var(--border-strong);
    border-radius: 6px;
    background: #fafbfc;
    padding: 22px;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}
.file-drop:hover, .file-drop.dragover {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.file-drop input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.file-drop-title { font-weight: 500; color: var(--text); }
.file-drop-sub { margin-top: 4px; }
.file-name {
    margin-top: 8px;
    font-size: 13px;
    color: var(--primary);
    word-break: break-all;
}

/* Actions */
.actions {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.actions.inline { margin-top: 0; }
.btn {
    height: 38px;
    padding: 0 18px;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-ghost { background: transparent; }

.status { font-size: 13px; }
.status.success { color: var(--success); }
.status.error { color: var(--danger); }

/* Admin */
.filter-bar {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin: 14px 0 18px;
}
.filter-bar .field { flex: 0 0 200px; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 880px;
}
.data-table th, .data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.data-table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: #fafbfc; }

.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    border: 1px solid transparent;
}
.tag-prefix { background: #eef2ff; color: #1e40af; border-color: #c7d2fe; }
.tag-split  { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.tag-success{ background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.tag-fail   { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

.pager {
    margin-top: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: #fff;
    padding: 16px 0;
    margin-top: 20px;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.copyright { color: var(--text-muted); }

/* Responsive */
@media (max-width: 640px) {
    .header-inner { height: 52px; }
    .brand-text { font-size: 14px; }
    .nav a { margin-left: 14px; font-size: 13px; }
    .panel { padding: 18px 16px; }
    .hero h1 { font-size: 19px; }
    .field { flex: 1 1 100%; }
    .filter-bar .field { flex: 1 1 100%; }
    .actions { width: 100%; }
    .btn, .btn-primary { width: 100%; }
    .actions.inline .btn { width: auto; flex: 1; }
    .pager { justify-content: space-between; }
}
