/* 米欧米医疗器械合规与培训系统 - 全局样式（零外部依赖） */
:root {
    --primary: #0f4c81;
    --primary-dark: #0a355c;
    --primary-light: #e8f1f8;
    --accent: #0d9488;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #16a34a;
    --bg: #f3f6fa;
    --card: #ffffff;
    --border: #dce4ee;
    --text: #1e293b;
    --muted: #64748b;
    --radius: 8px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

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

/* 后台布局 */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 230px;
    background: #0f2942;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-brand {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand-badge {
    display: inline-block;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    margin-bottom: 6px;
}
.brand-title { font-size: 16px; font-weight: 700; color: #fff; }
.brand-sub { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.sidebar-nav { padding: 12px 10px; flex: 1; }
.sidebar-nav .nav-link {
    display: block;
    padding: 10px 14px;
    margin-bottom: 4px;
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 14px;
    transition: background .15s, color .15s;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar-nav .nav-link.active { background: var(--primary); color: #fff; font-weight: 600; }
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-footer .btn-outline { color: #e2e8f0; border-color: rgba(255,255,255,0.3); }
.sidebar-footer .btn-outline:hover { background: rgba(255,255,255,0.12); color: #fff; }

.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
    height: 58px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text); }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.admin-content { padding: 22px 24px; flex: 1; }

/* 卡片与网格 */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eef2f7;
    flex-wrap: wrap;
    gap: 10px;
}
.card-title { font-size: 15px; font-weight: 700; margin: 0; color: var(--text); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
.stat-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.stat-label { font-size: 13px; color: var(--muted); }
.stat-val { font-size: 26px; font-weight: 700; color: var(--primary); margin: 4px 0; }
.stat-sub { font-size: 12px; color: var(--muted); }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    transition: background .15s;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-outline:hover { background: var(--primary-light); color: var(--primary-dark); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn-block { width: 100%; }

/* 表单 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.form-control {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(15, 76, 129, 0.12); }
textarea.form-control { min-height: 90px; resize: vertical; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline-form .form-control { width: auto; min-width: 150px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data-table th, table.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e8eef5;
    vertical-align: middle;
}
table.data-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
}
table.data-table tr:hover td { background: #fafcff; }

/* 徽章与提示 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-muted { background: #f1f5f9; color: #475569; }

.alert {
    padding: 11px 15px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid transparent;
}
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-danger, .alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* 登录与安装卡片 */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(180deg, #e9f1f8 0%, #f5f8fc 100%);
}
.auth-card {
    width: 100%;
    max-width: 430px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 26px;
    box-shadow: 0 10px 30px rgba(15, 76, 129, 0.08);
}
.auth-card.wide { max-width: 620px; }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo h1 { font-size: 20px; margin: 8px 0 4px; color: var(--primary-dark); }
.auth-logo p { font-size: 13px; color: var(--muted); margin: 0; }

/* 手机端 H5 专用 */
.h5-wrap { max-width: 720px; margin: 0 auto; padding: 14px 14px 48px; }
.h5-header {
    background: var(--primary);
    color: #fff;
    padding: 16px 18px;
    border-radius: 12px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.h5-header h2 { margin: 0 0 4px; font-size: 17px; }
.h5-header .meta { font-size: 12px; opacity: 0.9; }
.task-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.task-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.task-meta { font-size: 12px; color: var(--muted); }

/* 考试题目与签名画板 */
.q-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 14px;
    background: #fff;
}
.q-stem { font-weight: 600; margin-bottom: 10px; font-size: 14px; }
.q-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
}
.q-option:hover { background: #f8fafc; }
.sig-box {
    border: 2px dashed #94a3b8;
    border-radius: 8px;
    background: #fff;
    touch-action: none;
    display: block;
    width: 100%;
    height: 170px;
}
.sig-preview { max-height: 44px; border: 1px solid #e2e8f0; background: #fff; border-radius: 4px; }
.role-checks { display: flex; flex-wrap: wrap; gap: 10px; padding: 6px 0; }
.role-checks label { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; cursor: pointer; }

@media (max-width: 820px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar { width: 100%; }
    .sidebar-nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .sidebar-nav .nav-link { padding: 6px 10px; font-size: 12px; }
    .admin-content { padding: 14px; }
    .task-item { flex-direction: column; align-items: flex-start; }
}
