* {
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    margin: 0;
    padding: 0;
    background: #f0f2f5;
    color: #333;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 220px;
    background: #001529;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.brand {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.15);
}

.brand-logo {
    height: 36px;
    width: 36px;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.brand-title {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.55);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.menu-item {
    width: 100%;
    padding: 14px 24px;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: rgba(255,255,255,0.75);
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.menu-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.menu-item.active {
    color: #fff;
    background: rgba(24, 144, 255, 0.15);
    border-left-color: #1890ff;
}

.menu-item .icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logout-btn {
    background: transparent;
    color: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

.logout-btn:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}

/* 主内容区 */
.content {
    flex: 1;
    margin-left: 220px;
    padding: 24px;
    min-height: 100vh;
}

.page-header {
    background: #fff;
    padding: 20px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.page-header h1,
.page-header-title {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: bold;
    color: #1f1f1f;
}

.page-header-row {
    display: block;
}

.page-header-subtitle {
    margin-top: 12px;
    color: #666;
    font-size: 14px;
}

.page-header-stats {
    display: none;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filters label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: #666;
}

.filters select, .filters input {
    padding: 6px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    min-width: 100px;
    font-size: 14px;
    background: #fff;
}

.filters input:focus, .filters select:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* 按钮 */
.btn {
    padding: 7px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn-primary {
    background: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-secondary {
    background: #fff;
    color: #333;
    border: 1px solid #d9d9d9;
}

.btn-secondary:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.btn-danger {
    background: #fff;
    color: #f5222d;
    border: 1px solid #ff4d4f;
}

.btn-danger:hover {
    background: #fff1f0;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 12px;
}

.btn-disabled {
    background: #f5f5f5;
    color: #bbb;
    border: 1px solid #d9d9d9;
    cursor: not-allowed;
}

/* 面板 */
.panel {
    background: #fff;
    padding: 20px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}

.panel h2 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #1f1f1f;
}

.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.panel .desc {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: #888;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    border: 1px solid #e8e8e8;
    padding: 12px 16px;
    text-align: left;
}

.data-table th {
    background: #fafafa;
    font-weight: 600;
    color: #666;
}

.data-table tbody tr:hover {
    background: #f0f7ff;
}

/* 表单 */
.form-input {
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* 登录页 */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #e6f7ff 0%, #f6f6f6 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-bg-img {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-65%);
    width: 75%;
    height: auto;
    max-width: 1100px;
    object-fit: contain;
    pointer-events: none;
    z-index: 0;
}

.login-box {
    position: relative;
    width: 420px;
    background: rgba(255, 255, 255, 0.98);
    padding: 44px 40px;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    z-index: 1;
}

.login-box h2 {
    margin: 0 0 8px 0;
    font-size: 26px;
    color: #1f1f1f;
    text-align: center;
    letter-spacing: 1px;
}

.login-box .login-subtitle {
    text-align: center;
    color: #888;
    font-size: 14px;
    margin-bottom: 32px;
}

.login-form-row {
    margin-bottom: 20px;
}

.login-form-row label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.login-form-row input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.2s;
}

.login-form-row input:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.15);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.25);
}

.login-btn:hover {
    background: linear-gradient(135deg, #40a9ff 0%, #69c0ff 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(24, 144, 255, 0.35);
}

.login-error {
    color: #f5222d;
    padding: 12px;
    background: #fff1f0;
    border-radius: 4px;
    margin-top: 16px;
    display: none;
    font-size: 14px;
}

.login-brand-logos {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    z-index: 1;
    text-align: center;
    background: transparent;
    padding: 0;
    max-width: 96%;
}

.login-brand-title {
    font-size: 26px;
    color: #666;
    margin-bottom: 18px;
    letter-spacing: 3px;
}

.login-brand-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
}

.login-brand-list img {
    height: 220px;
    width: auto;
    max-width: 360px;
    object-fit: contain;
    transition: transform 0.2s;
    background: transparent;
    border: none;
    box-shadow: none;
}

.login-brand-list img[alt="喜茶"],
.login-brand-list img[alt="茶百道"] {
    height: 330px;
    max-width: 520px;
}

.login-brand-list img:hover {
    transform: translateY(-4px);
}

/* 标签 */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 4px;
    margin-bottom: 4px;
}

.tag-blue {
    background: #e6f7ff;
    color: #1890ff;
}

.tag-green {
    background: #f6ffed;
    color: #52c41a;
}

.tag-yellow {
    background: #fffbe6;
    color: #faad14;
}

.tag-red {
    background: #fff1f0;
    color: #f5222d;
}

.tag-orange {
    background: #fff7e6;
    color: #fa8c16;
}

/* 手机端顶部导航 */
.mobile-header {
    display: none;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 150;
}

.sidebar-overlay.show {
    display: block;
}

/* 响应式 */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: #001529;
        color: #fff;
        padding: 0 16px;
        z-index: 160;
        gap: 12px;
    }

    .mobile-title {
        font-size: 16px;
        font-weight: bold;
    }

    .menu-toggle {
        background: transparent;
        border: none;
        color: #fff;
        font-size: 20px;
        padding: 8px;
        cursor: pointer;
        line-height: 1;
    }

    .sidebar {
        position: fixed;
        left: -220px;
        top: 0;
        width: 220px;
        height: 100vh;
        transition: left 0.25s ease;
        z-index: 200;
    }

    .sidebar.open {
        left: 0;
    }

    .content {
        margin-left: 0;
        padding: 72px 12px 16px;
        min-width: 0;
    }

    .page-header {
        padding: 12px 16px;
        margin-bottom: 12px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .page-header-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .page-header-title,
    .page-header h1 {
        font-size: 16px;
        margin-bottom: 0;
    }

    .page-header-subtitle {
        margin-top: 0;
        font-size: 13px;
    }

    .page-header-stats {
        display: flex;
        gap: 6px;
        font-size: 11px;
        white-space: nowrap;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .filters label {
        width: 100%;
    }

    .filters select,
    .filters input,
    .filters button,
    .filters .btn {
        width: 100%;
        box-sizing: border-box;
    }

    .panel {
        padding: 16px;
        margin-bottom: 12px;
    }

    .panel h2 {
        font-size: 14px;
    }

    .panel-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .panel-header-row > div {
        width: 100%;
        gap: 4px !important;
    }

    .panel-header-row .btn {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 6px 10px;
        font-size: 12px;
    }

    /* 表格横向滚动 */
    .data-table {
        min-width: 600px;
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    .panel > .data-table,
    .panel > form + .data-table,
    .panel > h2 + .data-table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }

    /* 按钮组自动换行 */
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    /* 手机端隐藏统计卡片，信息全部放到 page-header */
    .stats-grid {
        display: none !important;
    }

    /* 统计卡片手机端合并全职/兼职人员 */
    .stat-staff-desktop {
        display: none !important;
    }
    .stat-staff-combined {
        display: block !important;
    }

    /* 日期选择器手机端：年份、月份、日期一行显示 */
    .filters.date-filters {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: 8px;
    }
    .filters.date-filters label {
        width: auto;
        flex: 1 1 auto;
        min-width: 60px;
    }
    .filters.date-filters select {
        width: 100%;
    }
    .filters.date-filters .date-quick-btns {
        display: none !important;
    }

    /* 导出区域手机端：导出开始/结束一行，隐藏近7天，导出按钮另起一行 */
    .filters.export-filters {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: 8px;
    }
    .filters.export-filters label {
        width: auto;
        flex: 1 1 auto;
        min-width: 100px;
    }
    .filters.export-filters input {
        width: 100%;
    }
    .filters.export-filters .export-last7 {
        display: none !important;
    }
    .filters.export-filters .export-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
        margin-top: 8px;
    }

    /* 日期选择和导出区域手机端更紧凑 */
    .filters.date-filters,
    .filters.export-filters {
        gap: 6px !important;
    }
    .filters.export-filters {
        margin-top: 8px !important;
        padding-top: 8px !important;
    }

    /* 昨天/今天/明天按钮手机端显示在取消排班后面（尽量同一行） */
    .mobile-quick-btns {
        display: inline-flex !important;
        flex-wrap: nowrap;
        margin-left: 4px;
    }
    .mobile-quick-btns .btn {
        padding: 6px 8px;
        font-size: 12px;
    }

    /* 手机端天气隐藏来源，保留发布时间 */
    .weather-source,
    .weather-source-sep {
        display: none;
    }

    /* 天气信息手机端整行显示，时间字体缩小 */
    #date-info-weather {
        display: inline-flex;
        flex-wrap: nowrap;
        align-items: center;
        white-space: nowrap;
        font-size: 12px;
    }
    #date-info-weather .weather-report-time {
        font-size: 10px;
    }

    /* 登录页 */
    .login-page {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 16px;
        gap: 16px;
    }

    .login-box {
        width: 100%;
        max-width: 400px;
        padding: 28px 24px;
        flex-shrink: 0;
    }

    .login-brand-logos {
        position: relative;
        left: auto;
        bottom: auto;
        transform: none;
        margin: 0 auto;
        width: 100%;
        max-width: 100%;
    }

    .login-brand-title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .login-brand-list {
        gap: 10px;
        flex-wrap: wrap;
        overflow-x: visible;
        padding-bottom: 0;
        justify-content: center;
    }

    .login-brand-list img {
        height: 80px;
        max-width: calc(33.333% - 8px);
        flex-shrink: 0;
        flex-grow: 0;
    }

    .login-brand-list img[alt="喜茶"],
    .login-brand-list img[alt="茶百道"] {
        height: 80px;
        max-width: calc(33.333% - 8px);
    }

    /* 员工管理手机端适配：两行显示一个员工 */
    #employee-table,
    #employee-table thead,
    #employee-table tbody,
    #employee-table th,
    #employee-table td,
    #employee-table tr {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    #employee-table {
        min-width: 0 !important;
        border: none;
    }

    #employee-table thead {
        display: none;
    }

    #employee-table tbody {
        background: transparent;
    }

    #employee-table tr {
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 12px;
        border: 1px solid #e8e8e8;
        border-radius: 8px;
        padding: 8px;
        background: #fff;
    }

    #employee-table td {
        border: none;
        border-bottom: 1px solid #f5f5f5;
        padding: 6px 4px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        font-size: 13px;
        word-break: break-all;
    }

    #employee-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        font-size: 11px;
        margin-bottom: 4px;
    }

    /* 第一行：姓名、职位、类别、状态 */
    #employee-table td:nth-child(1),
    #employee-table td:nth-child(2),
    #employee-table td:nth-child(3),
    #employee-table td:nth-child(7) {
        flex: 1 1 25%;
        max-width: 25%;
    }

    /* 第二行：corpid、银行卡、开户行、操作 */
    #employee-table td:nth-child(4),
    #employee-table td:nth-child(5),
    #employee-table td:nth-child(6),
    #employee-table td:nth-child(8) {
        flex: 1 1 25%;
        max-width: 25%;
        border-bottom: none;
    }

    /* 操作列按钮垂直排列适应窄列 */
    #employee-table td:nth-child(8) {
        align-items: center;
    }

    #employee-table td:nth-child(8) .btn,
    #employee-table td:nth-child(8) form,
    #employee-table td:nth-child(8) form .btn {
        width: 100%;
        margin: 2px 0 !important;
        box-sizing: border-box;
    }

    /* 排班表手机端适配：卡片式4行布局 */
    #schedule-table,
    #schedule-table thead,
    #schedule-table tbody,
    #schedule-table th,
    #schedule-table td,
    #schedule-table tr {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    #schedule-table {
        min-width: 0 !important;
        border: none;
    }

    #schedule-table thead {
        display: none;
    }

    #schedule-table tbody {
        background: transparent;
    }

    #schedule-table tr {
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 12px;
        border: 1px solid #e8e8e8;
        border-radius: 8px;
        padding: 8px;
        background: #fff;
    }

    #schedule-table td {
        border: none;
        border-bottom: 1px solid #f5f5f5;
        padding: 6px 4px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        font-size: 13px;
        box-sizing: border-box;
    }

    #schedule-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        font-size: 11px;
        margin-bottom: 4px;
        margin-right: 0;
        flex-shrink: 0;
    }

    /* 覆盖基础 width: 100%，避免 flex 布局下单元格内容重叠 */
    #schedule-table td:nth-child(1),
    #schedule-table td:nth-child(2),
    #schedule-table td:nth-child(3),
    #schedule-table td:nth-child(4),
    #schedule-table td:nth-child(5),
    #schedule-table td:nth-child(6),
    #schedule-table td:nth-child(7),
    #schedule-table td:nth-child(8),
    #schedule-table td:nth-child(9),
    #schedule-table td:nth-child(10),
    #schedule-table td:nth-child(11),
    #schedule-table td:nth-child(12),
    #schedule-table td:nth-child(13),
    #schedule-table td:nth-child(14) {
        width: auto;
    }

    /* 第一行：姓名、职位、类别、休息（标签与内容同行） */
    #schedule-table td:nth-child(1),
    #schedule-table td:nth-child(2),
    #schedule-table td:nth-child(3),
    #schedule-table td:nth-child(4) {
        flex: 1 1 25%;
        max-width: 25%;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 4px;
    }

    #schedule-table td:nth-child(1)::before,
    #schedule-table td:nth-child(2)::before,
    #schedule-table td:nth-child(3)::before,
    #schedule-table td:nth-child(4)::before {
        margin-bottom: 0;
        margin-right: 0;
    }

    /* 第二行：上班1、下班1、上班2、下班2 */
    #schedule-table td:nth-child(5),
    #schedule-table td:nth-child(6),
    #schedule-table td:nth-child(7),
    #schedule-table td:nth-child(8) {
        flex: 1 1 25%;
        max-width: 25%;
    }

    /* 第三行：快捷排班、当天工时、本月已上、已休、钉钉核对 */
    #schedule-table td:nth-child(9) {
        flex: 0 0 20%;
        max-width: 20%;
        padding-left: 2px;
        padding-right: 2px;
    }

    #schedule-table td:nth-child(10) {
        flex: 0 0 15%;
        max-width: 15%;
        margin-left: auto;
        padding: 6px 2px;
        font-size: 11px;
    }

    #schedule-table td:nth-child(11),
    #schedule-table td:nth-child(12) {
        flex: 0 0 15%;
        max-width: 15%;
        padding: 6px 2px;
        font-size: 11px;
    }

    #schedule-table td:nth-child(13) {
        flex: 0 0 auto;
        max-width: none;
        align-items: flex-end;
        padding-right: 4px;
    }

    /* 第四行：备注 */
    #schedule-table td:nth-child(14) {
        flex: 1 1 100%;
        max-width: 100%;
        border-bottom: none;
    }

    /* 时间输入区域适配窄单元格 */
    #schedule-table .time-cell-wrapper {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        width: 100%;
        gap: 1px;
        white-space: nowrap;
    }

    #schedule-table .time-cell-wrapper select {
        flex: 1 1 auto;
        min-width: 0 !important;
        width: 100%;
        padding: 2px 1px;
        font-size: 11px;
    }

    #schedule-table .time-cell-wrapper span {
        margin: 0 1px !important;
    }

    /* 快捷排班下拉框手机端适配 */
    #schedule-table td[data-label="快捷排班"] select {
        width: 100%;
        min-width: 0;
        padding: 3px 1px;
        font-size: 11px;
    }

    /* 备注列折行 */
    #schedule-table td[data-label="备注"] {
        word-break: break-all;
    }
}
