/* ==========================================================================
   原版管理平台界面复刻 —— 精确对齐 sh1008.shapk.one
   所有颜色/尺寸取自原版 getComputedStyle 与 :root CSS 变量实测值。
   ========================================================================== */

/* ---------- 设计令牌（原版 :root 原样照抄） ---------- */
:root {
    --global-header-bg: #ffffff98;
    --global-header-text: #333;
    --global-header-height: 64px;
    --color-primary: #0958d9;
    --color-primary-sub: #e6f4ff;
    --bg-default: #f5f5f5;
    --bg-layout: #fff;
    --bg-gray: #71717a;
    --bg-foreground: #000;
    --bg-table-th: #fafafa;
    --text-primary: #1e2329;
    --text-white: #fff;
    --text-gray: #8a8a8e;
    --text-black: #0b0e11;
    --text-secondary: #71717a;
    --text-link: #3b82f6;
    --border-primary: var(--color-primary);
    --border-secondary: #eaecef;
    --border-check: #b7bdc6;
    --global-spacing: 8px;
    --color-error: #e33b54;
    --color-error-high: #fef1f2;
    --color-success: #0ecb81;
    --color-success-high: #e6fff1;
    --color-warning: #faad14;
    --color-warning-high: #fffbe6;
    --color-info: #0958d9;
    --color-info-high: #e6f4ff;
    --color-blue: #3b82f6;
    --scroll-pad: 1px;
    --scroll-size: 6px;
    --scroll-bg: #d4d4d8;
    --scroll-color: #a1a1aa;
    --scroll-color-hover: #71717a;
    --scroll-pad: 1px;
    --boxShadow-card: #0000004d;
    --color-rate-none: #b7bdc6;
    --color-rate-down: #eb2650;
    --color-rate-up: #02ad90;
    --shadow-table: #0505050f;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background: var(--bg-default);
    color: var(--text-primary);
    font-family: Geist, Arial, Helvetica, sans-serif;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 滚动条（原版自定义） */
::-webkit-scrollbar { width: var(--scroll-size); height: var(--scroll-size); }
::-webkit-scrollbar-track { background: var(--scroll-bg); }
::-webkit-scrollbar-thumb { background: var(--scroll-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-color-hover); }

/* ---------- 整体布局 ---------- */
.app-shell {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ---------- 顶栏（固定 64px，毛玻璃） ---------- */
.app-header {
    height: var(--global-header-height);
    background: var(--global-header-bg);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    transition: background-color 0.5s;
}

.app-header__left {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    padding-right: 16px;
}

/* 标题：原版有渐变流动文字效果 */
.app-title {
    display: block;
    font-weight: 500;
    font-size: 24px;
    margin-left: 16px;
    background: linear-gradient(90deg, #0958d9, #7c3aed, #0958d9);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: liner-text 6s linear infinite;
}

@keyframes liner-text {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* 顶栏两个方形按钮 */
.app-header__actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-left: 16px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s, opacity 0.15s;
}

.icon-btn:hover { opacity: 0.9; }
.icon-btn:active { transform: scale(0.97); }
.icon-btn svg { font-size: 24px; width: 24px; height: 24px; }

/* 右侧用户区 */
.app-header__user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: color 0.15s;
}

.app-header__user:hover { color: var(--text-link); }

.avatar-ring {
    border-radius: 9999px;
    padding: 2px;
    overflow: hidden;
    display: flex;
    width: 36px;
    height: 36px;
    background: conic-gradient(from 180deg, #a78bfa, #60a5fa, #34d399, #fbbf24, #f472b6, #a78bfa);
}

.avatar-ring__inner {
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    outline: 2px solid #fff;
    background: conic-gradient(from 90deg, #f472b6, #818cf8, #38bdf8, #34d399, #fbbf24, #f472b6);
}

.app-header__username {
    font-weight: 500;
    font-size: 20px;
}

/* ---------- 二级菜单（原版树形菜单） ---------- */
.app-sidebar__item--group {
    list-style: none;
}

.app-menu-item--parent {
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    display: grid;
    grid-template-columns: 20px 1fr 12px;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: 40px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--fg);
    transition: background-color 0.15s;
}

.app-menu-item--parent:hover {
    background: rgba(0, 0, 0, 0.04);
}

.app-menu-item--parent.is-parent-active {
    color: var(--accent);
    font-weight: 500;
}

.app-menu-item__arrow {
    font-size: 10px;
    color: var(--fg-2);
    text-align: right;
    transition: transform 0.15s;
}

.app-sidebar__sub {
    list-style: none;
    margin: 0;
    padding: 2px 0 2px 0;
    overflow: hidden;
}

.app-sidebar__sub.is-collapsed {
    display: none;
}

.app-sidebar__sub-item {
    list-style: none;
}

.app-menu-sub {
    display: flex;
    align-items: center;
    height: 34px;
    /* 左缩进对齐父级图标右侧 */
    padding: 0 12px 0 42px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--fg-2);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
    position: relative;
}

.app-menu-sub:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--fg);
}

.app-menu-sub.is-active {
    background: rgba(0, 111, 238, 0.1);
    color: var(--accent);
    font-weight: 500;
}

/* 子项前面的竖线，复刻原版层级感 */
.app-menu-sub::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 3px;
    border-radius: 9999px;
    background: currentColor;
    opacity: 0.35;
}

/* ---------- 主体区 ---------- */
.app-body {
    flex: 1;
    display: flex;
    min-height: 0;
    width: 100%;
}

/* ---------- 侧边栏（宽 224px = w-56） ---------- */
.app-sidebar {
    width: 224px;
    flex-shrink: 0;
    background: var(--bg-layout);
    position: fixed;
    left: 0;
    top: var(--global-header-height);
    bottom: 0;
    padding: 8px 0;
    overflow-y: auto;
}

.app-sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-sidebar__item {
    position: relative;
}

/* 菜单项：h-40px / 圆角 8 / 左右 padding 8 / 三列网格 20px 1fr 20px */
.app-menu-item {
    height: 40px;
    display: grid;
    grid-template-columns: 20px 1fr 20px;
    gap: 8px;
    align-items: center;
    padding: 0 8px;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 16px;
    transition: background-color 0.2s;
    text-decoration: none;
}

.app-menu-item:hover { background: rgba(0, 0, 0, 0.04); }

/* 选中态：浅蓝底 + 主色文字 */
.app-menu-item.is-active {
    background: var(--color-primary-sub);
    color: var(--color-primary);
}

.app-menu-item__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.app-menu-item__icon svg { width: 20px; height: 20px; }

.app-menu-item__label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- 内容区 ---------- */
.app-main {
    flex: 1;
    min-width: 0;
    margin-left: 224px;
    padding-top: var(--global-header-height);
    padding: 24px;
    padding-top: calc(var(--global-header-height) + 24px);
}

/* ---------- 全屏工作区（终端页：无侧边栏、内容占满） ---------- */
.app-shell--full .app-body--full {
    display: block;
    width: 100%;
}

.app-shell--full .app-main {
    margin-left: 0;
    padding: 0;
    padding-top: var(--global-header-height);
    width: 100%;
    max-width: none;
    height: 100%;
    overflow: hidden;
}

.app-shell--full .app-main > div {
    height: calc(100vh - var(--global-header-height));
}

/* ---------- Home 页 ---------- */
.home-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 100%;
}

/* Hero 卡：浅紫到浅蓝渐变，圆角 24 */
.home-hero {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    padding: 32px 40px;
    background: linear-gradient(120deg, #eef2ff 0%, #f5f3ff 40%, #eff6ff 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 154px;
}

.home-hero::before {
    content: '';
    position: absolute;
    right: -60px;
    top: -80px;
    width: 320px;
    height: 320px;
    border-radius: 9999px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.22), transparent 70%);
    pointer-events: none;
}

.home-hero__text { position: relative; z-index: 1; }

.home-hero__eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: 12px;
}

.home-hero__title {
    margin: 0 0 8px;
    font-size: 30px;
    font-weight: 700;
    line-height: 36px;
    color: #18181b;
}

.home-hero__desc {
    margin: 0;
    font-size: 16px;
    color: #52525b;
    line-height: 24px;
}

/* 主按钮 */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    background: #0958d9;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary svg { width: 16px; height: 16px; }

/* ---------- 统计卡 ---------- */
.home-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid #e4e4e7;
    padding: 24px;
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card--default {
    background: linear-gradient(to bottom right, rgba(250, 250, 250, 0.5), rgba(250, 250, 250, 0));
}

.stat-card--success {
    background: linear-gradient(to bottom right, #f0fdf4, #ffffff);
    border-color: #dcfce7;
}

.stat-card__inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.stat-card__label {
    font-size: 14px;
    font-weight: 500;
    color: #71717a;
    margin-bottom: 8px;
}

.stat-card__value {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.1;
    color: #18181b;
    letter-spacing: -0.02em;
}

.stat-card__foot {
    margin-top: 8px;
    font-size: 13px;
    color: #a1a1aa;
}

/* 卡片右上角图标块 */
.stat-card__badge {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card--default .stat-card__badge {
    background: #e0e7ff;
    color: #0958d9;
}

.stat-card--success .stat-card__badge {
    background: #dcfce7;
    color: #16a34a;
}

.stat-card__badge svg { width: 24px; height: 24px; }

/* ---------- 登录页 ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 35%, #3b82f6 70%, #06b6d4 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before,
.login-page::after {
    content: '';
    position: absolute;
    border-radius: 9999px;
    filter: blur(80px);
    opacity: 0.5;
}

.login-page::before {
    width: 480px; height: 480px;
    background: #a78bfa;
    top: -160px; left: -120px;
}

.login-page::after {
    width: 420px; height: 420px;
    background: #38bdf8;
    bottom: -140px; right: -100px;
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
}

.login-card__title {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 700;
    color: #18181b;
}

.login-card__desc {
    margin: 0 0 28px;
    font-size: 14px;
    color: #71717a;
}

.form-field { margin-bottom: 18px; }

.form-field__label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #3f3f46;
}

.form-field__input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid #d4d4d8;
    border-radius: 10px;
    font-size: 15px;
    color: #18181b;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.form-field__input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(9, 88, 217, 0.12);
}

.btn-login {
    width: 100%;
    height: 46px;
    border: none;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.15s;
    font-family: inherit;
}

.btn-login:hover { opacity: 0.92; }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- 通用 ---------- */
.text-muted { color: var(--text-secondary); }
.hidden { display: none !important; }

@media (max-width: 768px) {
    .app-sidebar { display: none; }
    .app-main { margin-left: 0; }
    .home-stats { grid-template-columns: 1fr; }
    .home-hero { flex-direction: column; align-items: flex-start; }
}
