body {
    margin: 0;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    background: #f5f7fb;
    color: #1f2937;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.btn:hover {
    text-decoration: none;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card,
.page-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

.login-card {
    width: 360px;
    padding: 28px;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: #111827;
    color: #fff;
    padding: 24px 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    padding: 0 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.menu {
    padding: 16px 12px 0;
}

.menu a {
    display: block;
    color: #d1d5db;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.menu a:hover,
.menu a.active {
    background: #1f2937;
    color: #fff;
    text-decoration: none;
}

.main {
    flex: 1;
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.topbar h1 {
    margin: 0;
    font-size: 26px;
}

.user-meta {
    font-size: 14px;
    color: #6b7280;
}

.page-card {
    padding: 20px;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.stat-box {
    padding: 16px;
    border-radius: 10px;
    background: #eef2ff;
}

.stat-label {
    font-size: 13px;
    color: #6b7280;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 6px;
}

.dashboard-overview-label {
    margin-bottom: 18px;
    font-size: 14px;
    color: #4b5563;
}

.dashboard-overview-label span {
    color: #047857;
    font-weight: 700;
}

.dashboard-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.dashboard-metric-card {
    padding: 22px 24px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.dashboard-metric-card-soft-danger {
    background: #fff7f7;
    border-color: #f3c1c1;
}

.dashboard-metric-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: #6b7280;
}

.dashboard-metric-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex: 0 0 12px;
}

.dashboard-metric-dot-warning {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.dashboard-metric-dot-primary {
    background: linear-gradient(135deg, #60a5fa, #2563eb);
}

.dashboard-metric-dot-danger {
    background: linear-gradient(135deg, #fb7185, #ef4444);
}

.dashboard-metric-dot-success {
    background: linear-gradient(135deg, #4ade80, #16a34a);
}

.dashboard-metric-value {
    margin-top: 14px;
    font-size: 38px;
    line-height: 1.1;
    font-weight: 700;
    color: #1f2937;
}

.dashboard-metric-value-danger {
    color: #c0392b;
}

.dashboard-metric-sub {
    margin-top: 8px;
    font-size: 13px;
    color: #6b7280;
}

.toolbar,
.filter-form,
.form-grid {
    display: grid;
    gap: 12px;
}

.filter-form {
    /* 网格列模板：自动适配容器宽度，每列最小宽度180px，剩余空间平均分配 */
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: end;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-actions input[type="text"] {
    flex: 1;
    min-width: 80px;
}

.form-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full {
    grid-column: 1 / -1;
}

label {
    font-size: 14px;
    color: #374151;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    padding: 10px 5px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 8px;
    border: 0;
    cursor: pointer;
}

.btn-primary,
button.btn-primary,
a.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-secondary,
button.btn-secondary,
a.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-success,
button.btn-success,
a.btn-success {
    background: #16a34a;
    color: #fff;
}

.btn-danger,
button.btn-danger,
a.btn-danger {
    background: #dc2626;
    color: #fff;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 4px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    background: #f9fafb;
    color: #374151;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.tag-success {
    background: #dcfce7;
    color: #166534;
}

.tag-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.tag-muted {
    background: #e5e7eb;
    color: #4b5563;
}

.flash {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 8px;
}

.flash-success {
    background: #dcfce7;
    color: #166534;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.toast-container {
    position: fixed;
    left: 50%;
    top: 32px;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    align-items: center;
}

.toast {
    min-width: 240px;
    max-width: 420px;
    padding: 12px 14px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    word-break: break-word;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #dcfce7;
    color: #166534;
}

.toast-error {
    background: #fee2e2;
    color: #991b1b;
}

.inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.table-wrap td .inline-actions {
    gap: 4px;
    flex-wrap: wrap;
}

.table-wrap td .inline-actions .btn,
.table-wrap td .inline-actions button {
    min-height: 28px;
    padding: 4px 7px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.15;
    white-space: nowrap;
}

.table-wrap td .inline-actions form {
    margin: 0;
}

.choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
}

.choice-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #374151;
}

.choice-item input {
    margin: 0;
}

.choice-item input[type="number"] {
    width: 110px;
}

.muted {
    color: #6b7280;
}

.td-truncate {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.pagination-info {
    color: #6b7280;
    font-size: 14px;
    margin-right: 4px;
}
