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

.loading-mask {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    background: #fff;
    padding: 20px 30px;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    color: #555;
}

body {
    font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
    font-size: 13px;
    background: #f5f5f5;
    color: #333;
    padding-top: 50px;
}

/* 顶部导航 */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(to bottom, #5bc0de 0%, #46b8da 100%);
    border-bottom: 1px solid #31b0d5;
    height: 50px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.navbar-inner {
    max-width: 100%;
    padding: 0 15px;
    display: flex;
    align-items: center;
    height: 50px;
}

.top-navbar .brand {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    margin-right: 25px;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.top-navbar .brand:hover {
    color: #fff;
    opacity: 0.9;
}

.nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    flex: 1;
}

.nav-menu > li {
    position: relative;
}

.nav-menu > li > a {
    display: block;
    padding: 15px 12px;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.2s;
}

.nav-menu > li > a:hover,
.nav-menu > li.active > a,
.nav-menu > li.open > a {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.nav-menu > li > a i {
    margin-right: 4px;
}

.nav-menu .caret {
    margin-left: 4px;
}

.nav-menu .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    padding: 5px 0;
    z-index: 1001;
}

.nav-menu > li.open .dropdown-menu {
    display: block;
}

.nav-menu .dropdown-menu li a {
    display: block;
    padding: 8px 20px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
}

.nav-menu .dropdown-menu li a:hover {
    background: #f5f5f5;
    color: #337ab7;
}

.nav-menu .dropdown-menu .divider {
    height: 1px;
    margin: 5px 0;
    background: #e5e5e5;
    list-style: none;
}

/* 主内容区 */
.main-container {
    padding: 15px;
    max-width: 100%;
}

.view-panel {
    display: none;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    min-height: calc(100vh - 80px);
}

.view-panel.active {
    display: block;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.toolbar .form-inline label {
    margin-right: 6px;
    font-weight: normal;
    color: #555;
}

.toolbar .form-inline .form-control {
    margin-right: 8px;
    margin-bottom: 5px;
}

.toolbar-right {
    display: flex;
    gap: 4px;
}

.view-toggle.active {
    background: #337ab7;
    color: #fff;
    border-color: #2e6da4;
}

/* 表格 */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    margin-bottom: 0;
    font-size: 13px;
}

.data-table th {
    background: #f9f9f9;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: middle !important;
}

.data-table td {
    vertical-align: middle !important;
}

.pay-method {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pay-icon {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    font-weight: bold;
}

.pay-icon.alipay {
    background: #1677ff;
}

.pay-icon.wxpay {
    background: #09bb07;
}

.pay-icon.qqpay {
    background: #12b7f5;
}

.badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: normal;
}

.badge-on {
    background: #5cb85c;
    color: #fff;
}

.badge-off {
    background: #999;
    color: #fff;
}

.badge-success {
    background: #5cb85c;
    color: #fff;
}

.badge-pending {
    background: #f0ad4e;
    color: #fff;
}

.badge-failed {
    background: #d9534f;
    color: #fff;
}

.amount-link {
    color: #337ab7;
    cursor: pointer;
}

.amount-link:hover {
    text-decoration: underline;
}

.refresh-link {
    color: #337ab7;
    font-size: 12px;
    margin-left: 4px;
    cursor: pointer;
}

.refresh-link:hover {
    text-decoration: underline;
}

.action-btns {
    white-space: nowrap;
}

.action-btns .btn {
    margin: 2px 1px;
    padding: 2px 8px;
    font-size: 12px;
}

.action-btns .btn-link-action {
    color: #337ab7;
    cursor: pointer;
    margin: 0 4px;
    font-size: 12px;
}

.action-btns .btn-link-action:hover {
    text-decoration: underline;
}

.action-btns .btn-link-action.danger {
    color: #d9534f;
}

.table-footer {
    padding: 12px 0 0;
    color: #666;
    font-size: 13px;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

/* 首页仪表盘 */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.dash-card {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dash-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    margin-right: 15px;
}

.bg-blue { background: #5bc0de; }
.bg-green { background: #5cb85c; }
.bg-teal { background: #1abc9c; }
.bg-orange { background: #f0ad4e; }
.bg-purple { background: #9b59b6; }

.dash-card.clickable {
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
}

.dash-card.clickable:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.panel-body.no-padding {
    padding: 0;
}

.panel-body.no-padding .table {
    margin-bottom: 0;
}

.settings-panel,
.cleanup-panel,
.user-id-panel {
    max-width: 720px;
}

.export-hint {
    margin: 12px 0;
}

.user-id-result {
    margin-top: 15px;
}

#loginModal .modal-content {
    margin-top: 80px;
}

.dash-num {
    font-size: 22px;
    font-weight: 600;
    color: #333;
}

.dash-label {
    color: #888;
    font-size: 13px;
    margin-top: 4px;
}

/* 占位页 */
.placeholder-box {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.placeholder-box h3 {
    margin: 20px 0 10px;
    color: #666;
}

/* 分账接收方 */
.receiver-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.receiver-row .form-control {
    flex: 1;
}

.receiver-row .receiver-ratio {
    max-width: 100px;
}

.split-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.split-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #eef6fc;
    border: 1px solid #bce8f1;
    border-radius: 3px;
    font-size: 12px;
    color: #31708f;
}

/* Toast */
.toast {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 9999;
    padding: 12px 20px;
    background: #333;
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s;
    pointer-events: none;
    max-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { background: #5cb85c; }
.toast.error { background: #d9534f; }
.toast.info { background: #5bc0de; }

/* 模态框微调 */
.modal-title {
    font-size: 16px;
}

.record-detail dl {
    margin: 0;
}

.record-detail dt {
    float: left;
    width: 100px;
    clear: left;
    text-align: right;
    color: #888;
    font-weight: normal;
}

.record-detail dd {
    margin-left: 110px;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    body {
        padding-top: auto;
    }

    .top-navbar {
        position: relative;
        height: auto;
    }

    .navbar-inner {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }

    .nav-menu {
        flex-direction: column;
        width: 100%;
    }

    .nav-menu > li {
        width: 100%;
    }

    .nav-menu > li > a {
        padding: 10px 15px;
    }

    body {
        padding-top: 0;
    }
}
