/* 全局字体 */
html { font-size: 17px; }   /* 整体字体/图标按比例放大一档（rem 元素同步变大） */
body {
    font-family: 'Segoe UI', 'Inter', sans-serif;
    background: #f0f2f5;
    margin: 0;
    padding: 0;
    color: #1e293b;
}

/* 登录页背景 */
.login-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* 简约登录卡片 */
.login-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    padding: 40px 36px;
    width: 400px;
    max-width: 90%;
}
.login-card .logo {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    margin-bottom: 8px;
}
.login-card .subtitle {
    color: #64748b;
    text-align: center;
    margin-bottom: 32px;
}
.login-card input, .login-card select {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 16px;
    width: 100%;
    margin-bottom: 16px;
    font-size: 0.95rem;
    transition: 0.2s;
}
.login-card input:focus, .login-card select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
    outline: none;
}
.login-btn {
    background: #1e293b;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px;
    width: 100%;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
}
.login-btn:hover { background: #0f172a; }
.remember-row { display: flex; align-items: center; margin-bottom: 20px; }
.remember-row input[type="checkbox"] { width: auto; margin: 0 8px 0 0; }

/* 主界面布局 */
.app-wrapper { display: flex; flex-direction: column; height: 100vh; }
.top-bar {
    height: 60px;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 10;
}
.top-bar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.25rem;
    color: white;
}
.top-bar .brand svg { width: 32px; height: 32px; }
.top-bar .user-area {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}
.avatar:hover { background: #2563eb; }
.user-name-text { font-size: 0.9rem; color: #cbd5e1; }

/* 右键菜单 */
.context-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    min-width: 150px;
    z-index: 1000;
    overflow: hidden;
}
.context-menu a {
    display: block;
    padding: 10px 20px;
    color: #334155;
    text-decoration: none;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}
.context-menu a:hover { background: #f8fafc; }
.context-menu a.danger { color: #ef4444; }

/* 主体区域 */
.main-body { display: flex; flex: 1; overflow: hidden; }
.sidebar {
    width: 160px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    padding: 20px 0;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.02);
}
.sidebar .menu-item {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    transition: 0.2s;
    margin: 4px 10px;
    border-radius: 8px;
}
.sidebar .menu-item i { width: 20px; margin-right: 8px; text-align: center; }
.sidebar .menu-item:hover { background: #f1f5f9; color: #1e293b; }
.sidebar .menu-item.active { background: #eff6ff; color: #1d4ed8; font-weight: 600; }

/* ===== 侧边栏折叠（窄图标栏）=====
   展开 160px / 收起 58px，收起态只留图标并用 title 原生提示显示菜单名。
   状态由 body.sb-collapsed 控制；base.html 在首次绘制前就设置该 class，避免展开→收起的闪烁。
   内容区是 flex:1，宽度自动跟随，无需 JS 计算。 */
.sidebar { transition: width 0.2s ease; display: flex; flex-direction: column; }
/* 折叠开关：侧栏左下角的纯图标按钮。
   展开态靠右（贴住菜单项右边缘，暗示“往里收”），收起态居中（58px 宽下靠右会显偏）；
   箭头方向由 base.html 的 JS 跟随状态切换（展开 « / 收起 »）。 */
.sb-foot { margin-top: auto; flex-shrink: 0; display: flex; justify-content: flex-end; padding: 0 10px; }
body.sb-collapsed .sb-foot { justify-content: center; padding: 0; }
.sb-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, color 0.2s;
}
.sb-toggle:hover { background: #f1f5f9; color: #1e293b; }
body.sb-collapsed .sidebar { width: 58px; }
body.sb-collapsed .sidebar .menu-item { justify-content: center; padding: 11px 0; margin: 4px 8px; }
body.sb-collapsed .sidebar .menu-item i { margin-right: 0; }
body.sb-collapsed .sidebar .menu-item .mi-text { display: none; }
.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #f8fafc;
}

/* 表格“操作”列：按钮横向排成一行，不换行 */
.table td > form,
.table td > a.btn,
.table td > button.btn {
    display: inline-block;
    vertical-align: middle;
    margin-right: 2px;
    margin-bottom: 0;
    white-space: nowrap;
}
/* 操作列图标按钮：图标稍大，多个图标仍保持一排 */
.table td > form > .btn-sm,
.table td > a.btn-sm,
.table td > button.btn-sm {
    padding: 0.3rem 0.58rem;
    font-size: 0.95rem;
    line-height: 1.4;
}
.table td > form { margin-right: 2px; }
.table td > a.btn-sm,
.table td > button.btn-sm { margin-right: 2px; }

/* ===== 各页统一的页面头部（渐变图标底座 + 标题 + 副标题），与设备看板同款 ===== */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-head-left { display: flex; align-items: center; gap: 12px; }
.page-head-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.12rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 10px 20px -10px rgba(37, 99, 235, .7);
}
.page-title {
    margin: 0;
    font-size: 1.32rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: .2px;
    line-height: 1.25;
}
.page-sub { font-size: .8rem; color: #94a3b8; margin-top: 3px; }
.page-head-right { display: flex; align-items: center; flex-shrink: 0; }

/* 卡片头（含图标的标题行）统一：浅色底 + 细分隔线 + 右侧小字 */
.card-header {
    background: #fff;
    border-bottom: 1px solid #eef2f7;
    font-weight: 600;
    color: #0f172a;
    padding: 14px 20px;
    display: flex;
    align-items: center;
}
.card-header .kg-card-sub { margin-left: auto; font-size: .78rem; color: #94a3b8; font-weight: 400; }
