/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* 登录页 */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #2c3e50 0%, #4a6278 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
}

.login-dialog {
    background-color: white;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.login-header {
    text-align: center;
    padding: 32px 24px 16px;
    background-color: #2c3e50;
    color: white;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 4px;
    margin-bottom: 6px;
}

.login-header p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.login-body {
    padding: 28px 24px;
}

.login-error {
    color: #e74c3c;
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 8px;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

/* 头部 */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 12px 0 0;
    margin-bottom: 16px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 2px;
}

.btn.btn-logout {
    background-color: #e74c3c;
    color: #ffffff;
    border: 1px solid #e74c3c;
}

.btn.btn-logout:hover {
    background-color: #c0392b;
    border-color: #c0392b;
    color: #ffffff;
}

/* 导航标签 */
.nav-tabs {
    display: flex;
    gap: 4px;
    margin-top: 10px;
}

.nav-tab {
    padding: 7px 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.nav-tab:hover:not(:disabled) {
    color: white;
    background-color: rgba(255, 255, 255, 0.08);
}

.nav-tab.active {
    color: white;
    border-bottom-color: #3498db;
}

.nav-tab:disabled {
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
}

/* 主体 */
.main {
    background-color: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 页面切换 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 掉落物品页 */
.drops-toolbar {
    margin-bottom: 8px;
}

.drops-view {
    margin: 0;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.6;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
    background-color: #fafafa;
    border: 1px solid #eee;
    border-radius: 4px;
    min-height: 300px;
}

.drops-view.drops-empty {
    color: #aaa;
}

.drops-editor {
    width: 100%;
    min-height: 300px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.6;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    color: #333;
    border: 1px solid #3498db;
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
}

/* 委托地址页 */
.addr-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.addr-select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background-color: #fff;
    cursor: pointer;
    max-width: 240px;
}

.addr-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

.btn-del-file {
    background-color: #fff;
    color: #e74c3c;
    border-color: #e74c3c;
}

.btn-del-file:hover {
    background-color: #e74c3c;
    color: #fff;
}

/* 工作表自定义下拉 */
.sheet-picker {
    position: relative;
    display: inline-block;
}

.sheet-picker-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 120px;
    max-width: 200px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 13px;
    cursor: pointer;
}

.sheet-picker-btn:hover {
    border-color: #3498db;
}

.sheet-picker-btn #addr-sheet-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sheet-caret {
    color: #999;
    font-size: 11px;
    flex: none;
}

.sheet-picker-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 190px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
    z-index: 60;
    overflow: hidden;
}

.sheet-picker-menu.show {
    display: block;
}

.sheet-picker-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 4px 0;
}

.sheet-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.sheet-option:hover {
    background-color: #f0f6fc;
}

.sheet-option.active {
    background-color: #e8f2fb;
    color: #2980b9;
    font-weight: 600;
}

.sheet-option-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sheet-option-ops {
    display: inline-flex;
    gap: 4px;
    flex: none;
}

.sheet-option-rename,
.sheet-option-del {
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    border-radius: 3px;
    font-size: 12px;
}

.sheet-option-rename {
    color: #2980b9;
    border: 1px solid #2980b9;
}

.sheet-option-rename:hover {
    background-color: #2980b9;
    color: #fff;
}

.sheet-option-del {
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.sheet-option-del:hover {
    background-color: #e74c3c;
    color: #fff;
}

.sheet-picker-add {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-top: 1px solid #eee;
    background-color: #fafafa;
    font-size: 13px;
    color: #2980b9;
    cursor: pointer;
    text-align: left;
}

.sheet-picker-add:hover {
    background-color: #eef6fc;
}

.addr-blank {
    color: #ccc;
}

/* 表头不换行，内容格允许长文本（如地址）换行，避免表格过宽 */
#addr-table th {
    white-space: nowrap;
}

/* 自定义表格导入页：表格区域独立滚动，表头置顶 */
#page-addresses .table-container {
    max-height: calc(100vh - 330px);
    overflow: auto;
}

#addr-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background-color: #f8f9fa;
    box-shadow: 0 1px 0 #dee2e6;
}

#addr-table td {
    white-space: normal;
    word-break: break-all;
    max-width: 320px;
    vertical-align: top;
}

/* 表头编辑面板 */
.addr-col-panel {
    background-color: #f7f9fb;
    border: 1px solid #dce4ec;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.addr-col-title {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 8px;
}

.addr-col-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.addr-col-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.addr-col-input {
    width: 140px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.addr-col-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

.addr-col-del {
    width: 24px;
    height: 24px;
    border: 1px solid #e74c3c;
    background-color: #fff;
    color: #e74c3c;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.addr-col-del:hover {
    background-color: #e74c3c;
    color: #fff;
}

.addr-col-ops {
    display: flex;
    gap: 8px;
}

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    max-width: 360px;
}

.search-box input {
    width: 100%;
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: #3498db;
}

/* 按钮 */
.btn {
    padding: 9px 18px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f5f5f5;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background-color: #e8e8e8;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-primary {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-edit {
    background-color: #fff;
    color: #3498db;
    border-color: #3498db;
    margin-right: 6px;
}

.btn-edit:hover {
    background-color: #3498db;
    color: white;
}

.btn-del {
    background-color: #fff;
    color: #e74c3c;
    border-color: #e74c3c;
}

.btn-del:hover {
    background-color: #e74c3c;
    color: white;
}

/* 统计 */
.stats {
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
}

.stats .count {
    color: #e74c3c;
    font-weight: bold;
    font-size: 18px;
    margin: 0 4px;
}

/* 表格 */
.table-container {
    overflow-x: auto;
}
/* 表格 */
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

td, th {
    white-space: nowrap;
}

thead {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

th {
    padding: 6px 10px;
    text-align: left;
    font-weight: 500;
    font-size: 13px;
    color: #495057;
    white-space: nowrap;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    background-color: #e9ecef;
}

th.sortable .sort-icon {
    margin-left: 4px;
    font-size: 10px;
    color: #3498db;
}

th.sortable.sorting {
    color: #3498db;
}

td {
    padding: 5px 10px;
    border-bottom: 1px solid #dee2e6;
    font-size: 13px;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody tr.editing {
    background-color: #fffdf5;
}

tbody tr.editing:hover {
    background-color: #fffdf5;
}

/* 表头"角色名称"可点击新增 */
.th-add {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    color: #2c3e50;
    transition: color 0.15s;
}

.th-add:hover {
    color: #3498db;
}

/* 行内输入框 */
.cell-input {
    width: 100%;
    padding: 3px 6px;
    border: 1px solid #3498db;
    border-radius: 3px;
    font-size: 13px;
    outline: none;
    background-color: white;
    font-family: inherit;
}

/* 数字输入框上下箭头常显 */
.cell-input[type="number"]::-webkit-inner-spin-button,
.cell-input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    height: 24px;
}

.cell-input:focus {
    border-color: #2980b9;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

/* 角色名称点击样式 */
.name-link {
    color: #3498db;
    cursor: pointer;
    text-decoration: none;
}

.name-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* 等级数字点击样式 */
.level-num-value,
.level-text-value {
    cursor: pointer;
    color: #3498db;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.15s;
}

.level-num-value:hover,
.level-text-value:hover {
    background-color: #eaf4fb;
    color: #2980b9;
}

/* 快速编辑时的数字输入框：始终显示上下箭头 */
.level-num-input {
    width: 110px;
}

.level-text-input {
    min-width: 110px;
    max-width: 180px;
}

.level-num-input::-webkit-inner-spin-button,
.level-num-input::-webkit-outer-spin-button {
    opacity: 1;
    height: 24px;
}

/* 编辑行内的名称单元格（含删除按钮） */
.name-cell-edit {
    display: flex;
    align-items: center;
    gap: 6px;
}

.name-cell-edit .cell-input {
    flex: 1;
}

.row-del-btn {
    width: 26px;
    height: 26px;
    border: 1px solid #e74c3c;
    background-color: #fff;
    color: #e74c3c;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.15s;
}

.row-del-btn:hover {
    background-color: #e74c3c;
    color: white;
}

.empty {
    text-align: center;
    color: #999;
    padding: 40px !important;
}

/* 模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-dialog {
    background-color: white;
    border-radius: 8px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-sm {
    max-width: 480px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 1;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 500;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid #eee;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #666;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #3498db;
}

/* 消息弹窗 */
.message-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.message-modal.show {
    display: flex;
}

.message-dialog {
    background-color: #f5f5f5;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 28px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.message-title {
    font-size: 20px;
    font-weight: 500;
    color: #333;
    margin-bottom: 12px;
}

.message-content {
    font-size: 16px;
    color: #444;
    margin-bottom: 24px;
    line-height: 1.6;
}

.message-actions {
    text-align: right;
}

.message-actions .btn {
    padding: 8px 28px;
    font-size: 15px;
}

/* 响应式 */
@media (max-width: 768px) {
    .main {
        padding: 16px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .modal-overlay {
        padding: 0;
    }

    .modal-dialog {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .btn {
        padding: 10px 14px;
    }

    .nav-tab {
        padding: 10px 16px;
        font-size: 14px;
    }
}
