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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    padding: 20px;
    color: #333;
}

.top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}
.action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}


/* 工具栏 */
.toolbar {
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.toolbar h2 {
    font-size: 16px;      /* 改为您需要的大小 */
    font-weight: bold;    /* 可选 */
    margin: 0;            /* 去除默认外边距 */
}
.toolbar select, .toolbar button, .toolbar a {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    color: #333;
}
.toolbar button, .toolbar a  {
    background-color: #007bff;
    color: white;
    border: none;
}

.toolbar1 button{
    background-color: #17A2B8;
    color: white;
    border: none;           /* 无边框 */
    border-radius: 6px;     /* 圆角大小 */
    width: 120px;           /* 宽度 */
    height: 25px;           /* 高度 */
    padding: 1px 1px;      /* 内边距（上下8px，左右16px） */
    
    
}

button:hover {
    background-color: #0F7E8F;  /* 悬停时变深蓝色 */
    
    cursor: pointer;             /* 鼠标变手型 */
}
.toolbar button:hover, .toolbar a:hover {
    background-color: #0056b3;
}

/* 表格通用容器 */
.circuit-table, .switchgear-table, .accessory-table {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
}

/* 表头和行通用样式（仅用于开关库和附件库，回路单独定义） */
.switchgear-table .table-header,
.switchgear-table .table-row,
.accessory-table .table-header,
.accessory-table .table-row {
    display: grid;
    gap: 8px;
    padding: 2px 12px;
    border-bottom: 1px solid #eee;
    align-items: center;
    font-size: 13px;
}
.table-header {
    background-color: #e9ecef;
    font-weight: bold;
    position: sticky;
    top: 0;
}
.table-row.spare {
    background-color: #fff3cd;
}

/* 单相回路行 - 根据相序显示不同底色 */
.circuit-table .table-row:not(.total-switch-row).L1-row {
    background-color: #DDF2FD;  /* L1 浅蓝色 */
}
.circuit-table .table-row:not(.total-switch-row).L2-row {
    background-color: #e8f5e9;  /* L2 浅绿色 */
}
.circuit-table .table-row:not(.total-switch-row).L3-row {
    background-color: #fff3e0;  /* L3 浅橙色 */
}


/* ========== 回路计算表格列宽（优化后，大屏幕无滚动条，小屏幕滚动） ========== */
.circuit-table {
    width: 100%;
    overflow-x: visible;
}
.circuit-table .table-header,
.circuit-table .table-row {
    display: grid;
    grid-template-columns: 
        minmax(50px, 0.7fr)   /* 回路编号 */
        minmax(70px, 1fr)     /* 回路名称 */
        minmax(50px, 1fr)   /* 功率 */
        minmax(40px, 0.8fr)   /* 需要系数 */
        minmax(40px, 0.9fr)   /* 功率因数 */
        minmax(180px, 0.6fr)     /* 开关类别品牌 */
        minmax(100px, 1fr)     /* 开关型号 */
        minmax(55px, 1fr)     /* 级数 */
        minmax(60px, 1fr)     /* 整定值 */
        minmax(40px, 0.6fr)   /* 计算电流 */
        minmax(230px, 0.6fr)     /* 附件 */
        minmax(200px, 1fr)     /* 线缆规格 */
        minmax(30px, 0.8fr)   /* 相序 */
        minmax(30px, 0.5fr)   /* 备用 */
        minmax(70px, 0.6fr);  /* 操作 */
    gap: 6px;
    padding: 6px 8px;
    font-size: 12px;
    align-items: center;      /* 关键：垂直居中 */
}

/* 备用列复选框左对齐且垂直居中 */
.circuit-table .table-row label.spare-checkbox {
    display: inline-flex;      /* 宽度由内容撑开，不占满单元格 */
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    cursor: pointer;
    justify-self: start;       /* 在网格单元格内左对齐 */
}

/* 文本单元格垂直居中 */
.circuit-table .table-row span,
.circuit-table .table-row .rating-cell {
    display: flex;
    align-items: center;
    height: 100%;
}

/* 小屏幕滚动 */
@media (max-width: 1200px) {
    .circuit-table {
        overflow-x: auto;
    }
    .circuit-table .table-header,
    .circuit-table .table-row {
        min-width: 1100px;
    }
}

/* 开关库表格列宽 */
.switchgear-table .table-header,
.switchgear-table .table-row {
    grid-template-columns:
        minmax(40px, 1fr)   /* 编号 */
        minmax(200px, 0.6fr)   /* 品牌系列 */
        minmax(56px, 0.6fr)   /* 型号系列 */
        minmax(40px, 0.6fr)   /* 级数 */
        minmax(56px, 0.6fr)   /* 整定值(A) */
        minmax(40px, 0.6fr)   /* 宽度 */
        minmax(40px, 0.6fr)   /* 高度 */
        minmax(40px, 0.6fr)   /* 深度 */
        minmax(30px, 0.6fr)   /* 间距 */
        minmax(40px, 0.6fr)   /* 接线空间 */
        minmax(500px, 0.6fr)  /* 对应线缆规格 */
        minmax(80px, 0.8fr); /* 操作 */
}

/* 附件库表格列宽 */
.accessory-table .table-header,
.accessory-table .table-row {
    grid-template-columns:
        minmax(5px, 0.5fr)   /* 编号 */
        minmax(300px, 0.6fr)   /* 品牌系列型号 */
        minmax(56px, 1fr)   /* 宽度 */
        minmax(56px, 1fr)   /* 高度 */
        minmax(56px, 1fr)   /* 深度 */
        minmax(56px, 1fr)   /* 间距 */
        minmax(56px, 1fr)   /* 接线空间 */
        minmax(80px, 0.8fr); /* 操作 */
}

/* 表单元素 */
input, select {
    width: 100%;
    padding: 5px 3px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 11.5px;
}
button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    margin: 0 2px;
}
.actions button {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 100px 40px;
    font-size: 10px;
    flex-shrink: 0;
}
.actions button:hover {
    background: #e2e6ea;
}
.add-btn {
    margin: 20px auto;
    display: block;
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}
.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 550px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    cursor: move;
    user-select: none;
}
.modal-header h3 {
    margin: 0;
}
.close-btn {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
}
.close-btn:hover {
    color: #333;
}
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.modal-buttons {
    padding: 15px 20px;
    text-align: right;
    border-top: 1px solid #eee;
}
.modal-buttons button {
    padding: 8px 16px;
    margin-left: 10px;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
}
.modal-buttons button:last-child {
    background-color: #6c757d;
}
.modal-buttons button:hover {
    opacity: 0.9;
}
.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.form-group label {
    width: 130px;
    font-weight: bold;
}
.form-group input,
.form-group select {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* 响应式 */
@media (max-width: 1200px) {
    .circuit-table {
        overflow-x: auto;
    }
    .circuit-table .table-header,
    .circuit-table .table-row {
        min-width: 1100px;
    }
    .form-group {
        flex-direction: column;
        align-items: flex-start;
    }
    .form-group label {
        width: auto;
        margin-bottom: 5px;
    }
    .form-group input,
    .form-group select {
        width: 100%;
        min-width: auto;
    }
}

/* 工具栏中的复选框样式 */
.force-16a-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #e9ecef;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}
.force-16a-checkbox input {
    width: 16px;
    height: 12px;
    margin: 0;
    cursor: pointer;
}

/* 强制操作按钮组不换行 */
.actions {
    display: flex;
    gap: 2px;
    flex-wrap: nowrap;
    white-space: nowrap;
    flex-shrink: 0;
}
.actions button {
    padding: 2px 2px;
    font-size: 12px;
    flex-shrink: 0;
}

/* 开关库/附件库表格小屏幕滚动 */
.switchgear-table,
.accessory-table {
    overflow-x: auto;
}
.switchgear-table .table-header,
.switchgear-table .table-row,
.accessory-table .table-header,
.accessory-table .table-row {
    min-width: 1000px;
}

/* 入口导航页样式 */
.dashboard {
    max-width: 600px;
    margin: 50px auto;
    text-align: center;
}
.menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}
.menu-item {
    display: block;
    padding: 12px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 18px;
    transition: 0.3s;
}
.menu-item:hover {
    background-color: #0056b3;
}
/* 用户管理表格行距拉大 */
.user-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.user-table th,
.user-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #dee2e6;
    text-align: left;
}
.user-table th {
    background: #e9ecef;
    font-weight: bold;
}
.user-table tr:hover {
    background: #f8f9fa;
}
/* 修改密码弹窗样式优化 */
.modal .modal-content {
    width: 900px;
    max-width: 90%;
    background: white;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.modal .modal-content h3 {
    margin: 0 0 20px 0;
    text-align: center;
    font-size: 20px;
}
.modal .modal-content input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}
.modal .modal-content input:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}
.modal .modal-content button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}
.modal .modal-content button:first-of-type {
    background-color: #28a745;
    color: white;
}
.modal .modal-content button:first-of-type:hover {
    background-color: #218838;
}
.modal .modal-content button:last-of-type {
    background-color: #6c757d;
    color: white;
}
.modal .modal-content button:last-of-type:hover {
    background-color: #5a6268;
}
.modal .modal-content .error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 8px;
    text-align: center;
}
/* 登录页面样式优化 */
.login-container {
    max-width: 420px;
    margin: 80px auto;
    background: white;
    padding: 35px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}
.login-container .form-group {
    margin-bottom: 20px;
}
.login-container .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}
.login-container .form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: 0.2s;
}
.login-container .form-group input:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}
.captcha-row {
    display: flex;
    gap: 12px;
    align-items: center;
}
.captcha-row input {
    flex: 1;
}
.captcha-row img {
    height: 42px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
}
.login-container button {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}
.login-container button:hover {
    background-color: #0056b3;
}
.login-container .error {
    margin-top: 15px;
    text-align: center;
    color: #dc3545;
    font-size: 14px;
}
.modal-content label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 20px;
    cursor: pointer;
}
.modal-content input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}
/* 总开关行独特样式：浅灰背景、左侧蓝条、圆角、阴影 */
.circuit-table .total-switch-row {
    background-color: #E6E8F0;   /* 浅灰蓝背景 */
    border-left: 5px solid #007bff; /* 左侧蓝色强调条 */
    border-radius: 8px;
    margin: 12px 0;               /* 上下留出间距，与回路行区分 */
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

/* 可选：总开关行内的输入框和下拉框稍微调亮 */
.circuit-table .total-switch-row input,
.circuit-table .total-switch-row select {
    background-color: #ffffff;
    border-color: #ced4da;
}

/* 第一列“总开关”文字加粗并显示图标 */
.circuit-table .total-switch-row span:first-child {
    font-weight: bold;
    color: #007bff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* 添加一个开关图标（使用伪元素） */
.circuit-table .total-switch-row span:first-child::before {
    content: "🔌";
    font-size: 14px;
}
/* 统一所有返回链接的样式（强制覆盖） */
.back-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 15px !important;
    padding: 6px 12px !important;
    background-color: rgba(0, 123, 255, 0.1) !important;
    border-radius: 20px !important;
    color: #007bff !important;
    text-decoration: none !important;
    font-size: 14px !important;
    transition: all 0.2s !important;
}
.back-link:hover {
    background-color: rgba(0, 123, 255, 0.2) !important;
    color: #0056b3 !important;
}

/* 针对回路计算页工具栏内的链接，覆盖默认按钮样式（优先级更高） */
.toolbar .back-link {
    /* 继承上面的样式，无需重复，但确保优先级足够 */
    background-color: rgba(0, 123, 255, 0.1);
    color: #007bff;
}
.toolbar .back-link:hover {
    background-color: rgba(0, 123, 255, 0.2);
    color: #0056b3;
}
/* ========== 全局提示消息样式（屏幕居中、半透明、文字清晰） ========== */
.global-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 15px 30px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease;
    opacity: 1;
    pointer-events: auto;   /* 改为 auto */
}

.global-toast .close-btn {
    margin-left: 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
}
/* 错误消息 */
.global-toast.error {
    background-color: rgba(220, 53, 69, 0.8);
}

/* 成功消息 */
.global-toast.success {
    background-color: rgba(40, 167, 69, 0.8);
}

/* 小屏幕时允许换行 */
@media (max-width: 768px) {
    .global-toast {
        white-space: normal;
        max-width: 90%;
        padding: 10px 20px;
        font-size: 13px;
    }

}
/* 持久提示（带关闭按钮，不自动消失） */
.persistent-toast {
    display: flex !important;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10002;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 15px 30px;
    border-radius: 40px;
    font-size: 14px;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.persistent-toast .close-btn {
    margin-left: 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
}
.persistent-toast .close-btn:hover {
    opacity: 0.8;
}
@media (max-width: 768px) {
    .persistent-toast {
        white-space: normal;
        max-width: 90%;
        padding: 10px 20px;
    }
}