/* =============================================================
   医数云联 · 管理后台统一样式
   与首页 /index.html 保持一致：青蓝绿渐变 (#14507a / #1a7fa3 / #2ab5a0)
   现代后端设计：圆角、阴影、玻璃拟态、柔和过渡
   ============================================================= */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --c-primary: #1a7fa3;
    --c-primary-dark: #14507a;
    --c-accent: #2ab5a0;
    --c-bg: #f4f7fb;
    --c-card: #ffffff;
    --c-ink: #1f2d3d;
    --c-muted: #6b8a9e;
    --c-line: #e6edf3;
    --c-danger: #e53e3e;
    --c-warning: #ed8936;
    --c-success: #2ab5a0;
    --shadow-sm: 0 2px 8px rgba(20, 80, 120, 0.05);
    --shadow-md: 0 8px 24px rgba(20, 80, 120, 0.08);
    --shadow-lg: 0 16px 48px rgba(20, 80, 120, 0.12);
    --radius: 14px;
    --radius-lg: 20px;
    --sidebar-w: 240px;
    --topbar-h: 64px;
    --gradient: linear-gradient(135deg, #1a7fa3, #2ab5a0);
    --gradient-dark: linear-gradient(135deg, #14507a, #1a7fa3);
}

html, body { height: 100%; }

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--c-bg);
    color: var(--c-ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* =============================================================
   侧边栏
   ============================================================= */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: linear-gradient(180deg, #14507a 0%, #1a6a8a 60%, #1a7fa3 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(20, 80, 120, 0.08);
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sb-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #2ab5a0, #5eead4);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #14507a;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(94, 234, 212, 0.3);
}

.sb-title { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.5px; }
.sb-sub { font-size: 0.72rem; color: rgba(255, 255, 255, 0.6); letter-spacing: 1px; }

.sidebar-nav {
    flex: 1;
    padding: 14px 12px;
    overflow-y: auto;
}

.nav-group-title {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 16px 12px 8px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.78);
    border-radius: 10px;
    font-size: 0.92rem;
    margin-bottom: 2px;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item i { width: 18px; text-align: center; font-size: 0.95rem; color: rgba(255, 255, 255, 0.65); transition: color 0.2s; }

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.nav-item:hover i { color: #5eead4; }

.nav-item.active {
    background: linear-gradient(135deg, rgba(42, 181, 160, 0.25), rgba(94, 234, 212, 0.18));
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.nav-item.active i { color: #5eead4; }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: linear-gradient(180deg, #2ab5a0, #5eead4);
    border-radius: 0 4px 4px 0;
}

.sidebar-foot {
    padding: 14px 18px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.back-home {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.82rem;
    padding: 8px 10px;
    border-radius: 8px;
    transition: all 0.2s;
}
.back-home:hover { color: #5eead4; background: rgba(255, 255, 255, 0.06); }

/* =============================================================
   顶栏
   ============================================================= */
.admin-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--topbar-h);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--c-line);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 90;
    box-shadow: 0 1px 0 rgba(20, 80, 120, 0.04);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--c-primary-dark);
    font-size: 1.2rem;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 8px;
    margin-right: 12px;
    transition: background 0.2s;
}
.sidebar-toggle:hover { background: rgba(26, 127, 163, 0.08); }

.topbar-page { flex: 1; }
.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--c-primary-dark);
    letter-spacing: -0.2px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hospital-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(42, 181, 160, 0.1);
    color: var(--c-primary);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.hospital-switcher, .user-menu { position: relative; }

.hs-btn, .um-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f4f7fb;
    border: 1px solid var(--c-line);
    border-radius: 50px;
    padding: 6px 14px;
    font-size: 0.88rem;
    color: var(--c-ink);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.hs-btn:hover, .um-btn:hover { border-color: rgba(26, 127, 163, 0.3); background: #fff; }

.hs-caret, .um-caret {
    font-size: 0.7rem !important;
    color: var(--c-muted);
    transition: transform 0.2s;
}
.hospital-switcher.open .hs-caret,
.user-menu.open .um-caret { transform: rotate(180deg); }

.um-avatar {
    width: 30px;
    height: 30px;
    background: var(--gradient);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
}
.um-name { font-weight: 600; color: var(--c-primary-dark); }

.hs-menu, .um-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--c-line);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: 6px;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.2s;
    z-index: 200;
}
.hospital-switcher.open .hs-menu,
.user-menu.open .um-menu { opacity: 1; visibility: visible; transform: translateY(0); }

.hs-menu li a, .um-menu li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--c-ink);
    font-size: 0.88rem;
    transition: background 0.15s;
}
.hs-menu li a:hover, .um-menu li a:hover { background: rgba(26, 127, 163, 0.08); color: var(--c-primary); }
.hs-menu li a.active { background: rgba(42, 181, 160, 0.12); color: var(--c-primary); font-weight: 600; }
.hs-menu li a i, .um-menu li a i { width: 14px; text-align: center; color: var(--c-muted); }

/* =============================================================
   主内容区
   ============================================================= */
.admin-main {
    margin-left: var(--sidebar-w);
    padding-top: var(--topbar-h);
    min-height: 100vh;
}
.admin-content {
    padding: 28px 32px 48px;
    max-width: 100%;
}

/* =============================================================
   通用组件
   ============================================================= */

/* 页面标题区 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--c-line);
}
.page-header h1 {
    font-size: 1.6rem;
    color: var(--c-primary-dark);
    font-weight: 700;
    letter-spacing: -0.3px;
}
.page-header .sub-text {
    color: var(--c-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}
.page-header .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* 卡片 */
.card, .admin-card {
    background: var(--c-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--c-line);
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
    overflow: hidden;
    transition: box-shadow 0.25s;
}
.card:hover, .admin-card:hover { box-shadow: var(--shadow-md); }

.card-header, .admin-card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--c-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, #fafcfe, #fff);
}
.card-header h3, .admin-card-header h3 {
    font-size: 1.05rem;
    color: var(--c-primary-dark);
    font-weight: 700;
}
.card-body, .admin-card-body { padding: 22px; }

/* 统计卡（Dashboard） */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    border: 1px solid var(--c-line);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 90px; height: 90px;
    background: var(--c-primary);
    opacity: 0.06;
    border-radius: 50%;
    transform: translate(30px, -30px);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--c-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat-card .stat-value {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--c-primary-dark);
    letter-spacing: -0.5px;
    line-height: 1.2;
}
.stat-card .stat-icon {
    position: absolute;
    top: 22px;
    right: 22px;
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, rgba(26, 127, 163, 0.1), rgba(42, 181, 160, 0.1));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-primary);
    font-size: 1.2rem;
}
.stat-card.accent .stat-icon { background: linear-gradient(135deg, rgba(42, 181, 160, 0.12), rgba(94, 234, 212, 0.18)); color: var(--c-accent); }
.stat-card.warning .stat-icon { background: linear-gradient(135deg, rgba(237, 137, 54, 0.12), rgba(237, 137, 54, 0.05)); color: var(--c-warning); }
.stat-card.danger .stat-icon { background: linear-gradient(135deg, rgba(229, 62, 62, 0.12), rgba(229, 62, 62, 0.05)); color: var(--c-danger); }

/* 提示框 */
.alert {
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 0.9rem;
    margin-bottom: 18px;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert i { font-size: 1.1rem; }
.alert-success { background: #eafaf3; color: #1c7a55; border-color: rgba(42, 181, 160, 0.2); }
.alert-success i { color: var(--c-accent); }
.alert-danger, .alert-warning { background: #fff4f4; color: #b03030; border-color: rgba(229, 62, 62, 0.18); }
.alert-warning { background: #fff7e8; color: #a76308; border-color: rgba(237, 137, 54, 0.2); }
.alert-warning i { color: var(--c-warning); }
.alert-danger i { color: var(--c-danger); }
.alert-info { background: rgba(26, 127, 163, 0.08); color: #14507a; border-color: rgba(26, 127, 163, 0.18); }
.alert-info i { color: var(--c-primary); }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    background: #f4f7fb;
    color: var(--c-ink);
    cursor: pointer;
    transition: all 0.22s;
    font-family: inherit;
    line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
    background: var(--gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(42, 181, 160, 0.28);
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(42, 181, 160, 0.4); color: #fff; }

.btn-success {
    background: linear-gradient(135deg, #2ab5a0, #5eead4);
    color: #fff;
    box-shadow: 0 4px 14px rgba(42, 181, 160, 0.28);
}

.btn-info {
    background: linear-gradient(135deg, #1a7fa3, #2ab5a0);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: var(--c-muted);
    border-color: var(--c-line);
}
.btn-secondary:hover { color: var(--c-primary); border-color: rgba(26, 127, 163, 0.3); background: #fff; }

.btn-danger {
    background: #fff;
    color: var(--c-danger);
    border-color: rgba(229, 62, 62, 0.25);
}
.btn-danger:hover { background: #fff4f4; color: var(--c-danger); border-color: var(--c-danger); }

.btn-sm { padding: 6px 12px; font-size: 0.82rem; border-radius: 8px; }

.btn:disabled, .btn.disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* 表单 */
.form-group { margin-bottom: 18px; }
.form-label, .form-group label {
    display: block;
    font-weight: 600;
    color: var(--c-ink);
    font-size: 0.88rem;
    margin-bottom: 7px;
}
.form-label .required, .text-danger { color: var(--c-danger); margin-left: 2px; }
.form-text { font-size: 0.78rem; color: var(--c-muted); margin-top: 6px; }

.form-control, .form-select, input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="tel"], input[type="url"], input[type="date"],
input[type="time"], input[type="datetime-local"], input:not([type]), textarea, select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1.5px solid #d8e3eb;
    background: #fafcfe;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--c-ink);
    transition: all 0.22s;
    outline: none;
}
.form-control:focus, .form-select:focus,
input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus,
input[type="number"]:focus, input[type="tel"]:focus, input[type="url"]:focus,
input[type="date"]:focus, input[type="time"]:focus, input[type="datetime-local"]:focus,
input:not([type]):focus, textarea:focus, select:focus {
    border-color: var(--c-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(26, 127, 163, 0.1);
}
.form-control.error { border-color: var(--c-danger); }
.form-control.error:focus { box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.1); }

textarea { resize: vertical; min-height: 90px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check-input { width: 18px; height: 18px; accent-color: var(--c-primary); }

/* 表格 */
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}
.admin-table thead th {
    background: #f4f7fb;
    color: var(--c-primary-dark);
    font-weight: 600;
    text-align: left;
    padding: 13px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--c-line);
    white-space: nowrap;
}
.admin-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--c-line);
    color: var(--c-ink);
    vertical-align: middle;
}
.admin-table tbody tr:hover { background: rgba(26, 127, 163, 0.03); }
.admin-table tbody tr:last-child td { border-bottom: none; }

.admin-table .col-actions { white-space: nowrap; }
.admin-table .col-actions .btn { margin-right: 6px; }
.admin-table .col-actions .btn:last-child { margin-right: 0; }

.table-responsive { overflow-x: auto; border-radius: var(--radius); }
.table-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--c-muted);
}
.table-empty i { font-size: 2rem; color: rgba(26, 127, 163, 0.3); display: block; margin-bottom: 10px; }

/* 徽标 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.5;
}
.badge-success { background: rgba(42, 181, 160, 0.14); color: #1c7a55; }
.badge-danger  { background: rgba(229, 62, 62, 0.12); color: #b03030; }
.badge-info    { background: rgba(26, 127, 163, 0.12); color: var(--c-primary-dark); }
.badge-warning { background: rgba(237, 137, 54, 0.14); color: #a76308; }
.badge-muted   { background: #eef2f6; color: var(--c-muted); }

/* 搜索条 */
.search-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid var(--c-line);
    border-radius: 14px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.search-bar input { max-width: 320px; }
.search-bar .search-spacer { flex: 1; }

/* 快捷入口 */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.quick-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 22px 14px;
    background: linear-gradient(135deg, #f0f8fa, #f6fcfb);
    border: 1px solid rgba(26, 127, 163, 0.08);
    border-radius: 14px;
    color: var(--c-primary-dark);
    transition: all 0.25s;
    text-align: center;
    gap: 10px;
}
.quick-tile i { font-size: 1.55rem; color: var(--c-primary); }
.quick-tile span { font-size: 0.9rem; font-weight: 600; }
.quick-tile:hover {
    transform: translateY(-3px);
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 12px 28px rgba(42, 181, 160, 0.28);
}
.quick-tile:hover i { color: #fff; }

/* 信息列表 */
.info-list { list-style: none; }
.info-list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px dashed var(--c-line);
    color: var(--c-ink);
    font-size: 0.9rem;
}
.info-list li:last-child { border-bottom: none; }
.info-list .il-label { color: var(--c-muted); }

/* Toast */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: #1a2d3d;
    color: #fff;
    padding: 12px 26px;
    border-radius: 50px;
    font-size: 0.88rem;
    opacity: 0;
    transition: all 0.3s;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 仪表板小贴士卡 */
.tip-card {
    background: linear-gradient(135deg, rgba(26, 127, 163, 0.08), rgba(42, 181, 160, 0.06));
    border: 1px solid rgba(26, 127, 163, 0.12);
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--c-primary-dark);
    font-size: 0.9rem;
}
.tip-card i { color: var(--c-accent); font-size: 1.15rem; }

/* 分页 */
.pagination { display: flex; gap: 6px; padding: 16px 0 0; justify-content: center; flex-wrap: wrap; }
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--c-line);
    color: var(--c-ink);
    font-size: 0.85rem;
    transition: all 0.2s;
}
.pagination a:hover { background: rgba(26, 127, 163, 0.08); color: var(--c-primary); border-color: rgba(26, 127, 163, 0.3); }
.pagination .active { background: var(--gradient); color: #fff; border-color: transparent; }
.pagination .disabled { opacity: 0.5; pointer-events: none; }

/* =============================================================
   登录 / 切换医院等独立页面
   ============================================================= */
.auth-main {
    min-height: 100vh;
    background: linear-gradient(160deg, #e8f4f8 0%, #f0faf7 35%, #f7f9fc 70%, #eef2f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* =============================================================
   响应式
   ============================================================= */
@media (max-width: 960px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-topbar { left: 0; }
    .admin-main { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
}

@media (max-width: 600px) {
    .admin-content { padding: 18px 16px 32px; }
    .page-header h1 { font-size: 1.3rem; }
    .um-name { display: none; }
    .hospital-tag { font-size: 0.78rem; padding: 6px 10px; }
}

/* 滚动条 */
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
