/* 施工人员考勤表：一张 31 列宽表的样式（姓名与类别列冻结、表头冻结）。
   结构与原表一致：每人三行（考勤 / 高温补贴 / 交通费），右边是出勤天数与备注。 */

.as-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.as-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
}
.as-title-icon {
    background: linear-gradient(135deg, #0f4c5c, #1a6b7c, #2a93a8);
    box-shadow: 0 6px 18px rgba(15, 76, 92, 0.28);
}
.as-title {
    margin: 0;
    color: var(--water-dark);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.3px;
    font-family: var(--font-display);
}
.as-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.as-month {
    padding: 9px 12px;
    border: 2px solid #e0e8ed;
    border-radius: 10px;
    font-size: 14px;
    color: var(--ink-dark);
    background: #fff;
}
.as-actions .btn {
    padding: 9px 16px;
    font-size: 14px;
}
.as-actions .btn-busy {
    opacity: 0.6;
    pointer-events: none;
}
.as-alert {
    display: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
}
.as-alert.as-alert-success {
    display: block;
    background: #e8f5e9;
    color: #1e8449;
    border: 1px solid #a5d6a7;
}
.as-alert.as-alert-danger {
    display: block;
    background: #ffebee;
    color: #922b21;
    border: 1px solid #ef9a9a;
}

.as-table-wrap {
    overflow: auto;
    /* 这一栏是宽表：横着放不下时靠底下那条横条拖。
       max-height 用视口的一小部分——横条就在这个框的下边缘，框太高就跑到屏幕外了，
       所以高度收着点，保证那条横条一直在眼前（纯 CSS，不靠脚本去显示/隐藏）。 */
    max-height: 66vh;
    border: 1px solid #dce6e9;
    border-radius: 12px;
    background: #fff;
}
.as-table-wrap::-webkit-scrollbar { height: 12px; width: 10px; }
.as-table-wrap::-webkit-scrollbar-thumb {
    background: #b6cdd4;
    border-radius: 8px;
    border: 2px solid #fff;
}
.as-table-wrap::-webkit-scrollbar-thumb:hover { background: #8fb2bd; }
.as-table {
    border-collapse: separate;
    border-spacing: 0;
    /* 列宽按内容与下面写死的宽度来（出勤工日/交通费那两行的格子里有「工地」下拉 + 数字，
       窄了就把工地名截断了，所以每天给足 108px）；整张表因此比屏幕宽，靠横向拖动看。
       width: max-content 而不是 100%——100% 会把列挤回容器宽度、把写死的列宽冲掉。 */
    table-layout: auto;
    width: max-content;
    min-width: 100%;
    font-size: 13px;
}
.as-table th,
.as-table td {
    border-right: 1px solid #e2ebed;
    border-bottom: 1px solid #e2ebed;
    padding: 3px 4px;
    text-align: center;
    vertical-align: middle;
}
.as-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f1f7f8;
    color: #0f4c5c;
    font-weight: 700;
    font-size: 12px;
    line-height: 1.35;
    padding: 7px 3px;
}
.as-table .as-day {
    /* 每天一格：够放下「工地名」下拉和数字两行 */
    width: 108px;
    white-space: nowrap;
}
.as-table .as-name {
    position: sticky;
    left: 0;
    z-index: 3;
    width: 96px;
    background: #f8fbfc;
    font-weight: 700;
    color: #0f4c5c;
}
.as-table .as-cat {
    position: sticky;
    left: 96px;
    z-index: 3;
    width: 76px;
    background: #f8fbfc;
    font-size: 12px;
    color: #37505a;
}
.as-table thead .as-name,
.as-table thead .as-cat {
    z-index: 4;
}
.as-table .as-total {
    width: 68px;
    background: #f8fbfc;
    font-weight: 700;
    color: #0f4c5c;
}
.as-table .as-weekend {
    background: #faf7ef;
}
.as-table .as-today {
    background: #fff4d6;
}
.as-table .as-left {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: #98a6ab;
}

.as-cell-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    color: var(--ink-dark);
    font-family: inherit;
    text-align: center;
    padding: 8px 3px;
    font-weight: 600;
}
.as-cell-input:focus {
    border-color: #2a93a8;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(42, 147, 168, 0.16);
}
.as-cell-input.as-dirty {
    background: #fff8e1;
}

/* 出勤工日/交通费那两行：格子里上面是「选哪个工地（或总计）」的小下拉，下面是数字 */
.as-split-cell { padding: 2px 3px 4px; }
.as-split-cell .as-cell-input { padding: 4px 3px 6px; }
.as-site-select {
    width: 100%;
    max-width: 100%;
    margin-top: 3px;
    border: 1px solid rgba(15, 76, 92, 0.16);
    border-radius: 6px;
    background: #f4f8f9;
    color: var(--ink-mid);
    font-family: inherit;
    font-size: 11px;
    padding: 1px 2px;
    cursor: pointer;
}
.as-site-select:focus { outline: none; border-color: #2a93a8; background: #fff; }
.as-empty {
    padding: 40px 16px;
    text-align: center;
    color: #6f8086;
    font-size: 14px;
}

/* ---------------- 手机端：月度考勤表按人一张卡（只读查看，2026-10-06） ----------------
   31 天的宽表在手机屏上没法看，所以窄屏不摆网格：一人一张卡，
   四行「类别 · 合计 · 小计工资」，右上角总计工资，底下把有数的日子列成小标签。 */
.as-mobile-hint {
    margin: 0 0 10px;
    padding: 8px 10px;
    background: #f2f8fa;
    border-left: 3px solid #2a93a8;
    border-radius: 6px;
    color: #4a6672;
    font-size: 12px;
    line-height: 1.5;
}
.as-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.as-card {
    background: #fff;
    border: 1px solid #e2ecf0;
    border-radius: 12px;
    padding: 10px 12px 8px;
    box-shadow: 0 1px 3px rgba(15, 76, 92, 0.06);
}
.as-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.as-card-name {
    font-size: 15px;
    font-weight: 700;
    color: #0f4c5c;
}
.as-card-wage {
    font-size: 13px;
    font-weight: 700;
    color: #c2410c;
    white-space: nowrap;
}
.as-card-legend,
.as-card-line {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 4px 10px;
    align-items: baseline;
    font-size: 13px;
    padding: 5px 0;
    border-top: 1px dashed #eef4f6;
}
.as-card-legend {
    border-top: 0;
    padding: 0 0 4px;
    color: #8aa3ac;
    font-size: 11px;
}
.as-card-legend span:last-child,
.as-card-sub {
    min-width: 88px;
    text-align: right;
}
.as-card-cat { color: #334155; }
.as-card-total {
    color: #0f4c5c;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.as-card-sub {
    color: #b45309;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.as-card-days {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #eef4f6;
    font-size: 12px;
    color: #334155;
    line-height: 1.9;
}
.as-card-days-label {
    display: inline-block;
    min-width: 52px;
    color: #6b8299;
    margin-right: 4px;
}
.as-chip {
    display: inline-block;
    margin: 0 4px 2px 0;
    padding: 1px 6px;
    background: #f2f8fa;
    border: 1px solid #dceaf0;
    border-radius: 8px;
}
.as-chip b {
    color: #0f4c5c;
    margin-right: 3px;
    font-variant-numeric: tabular-nums;
}
/* 日子标签与「按天填」都是按钮：手指点得着、看着像可以点 */
button.as-chip {
    cursor: pointer;
    font: inherit;
    color: #334155;
}
button.as-chip:active {
    background: #e3f1f5;
}
.as-card-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}
.as-card-edit {
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 13px;
}

/* ---- 按天编辑层（手机端）：一个人一天一层，底部弹出来 ---- */
.as-day-editor {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 78px;            /* 让开底部那条导航 */
    z-index: 40;
    max-height: 72vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #cfe3ea;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(15, 76, 92, 0.22);
    padding: 10px 12px 12px;
}
.as-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    color: #0f4c5c;
    font-size: 14px;
}
.as-editor-head b {
    font-size: 15px;
}
.as-editor-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.as-editor-nav button {
    padding: 4px 8px;
    border: 1px solid #cfe3ea;
    background: #f7fbfc;
    border-radius: 8px;
    color: #2a93a8;
    font-size: 12px;
    cursor: pointer;
}
.as-editor-close {
    color: #6b8299 !important;
    font-size: 14px !important;
    padding: 4px 9px !important;
}
.as-editor-days {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px dashed #eef4f6;
}
.as-day-pick {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border: 1px solid #e2ecf0;
    background: #fff;
    border-radius: 8px;
    color: #4a6672;
    font-size: 12px;
    cursor: pointer;
    position: relative;
}
.as-day-pick.has-data::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 3px;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    border-radius: 50%;
    background: #2a93a8;
}
.as-day-pick.active {
    background: #2a93a8;
    border-color: #2a93a8;
    color: #fff;
    font-weight: 700;
}
.as-day-pick.active.has-data::after {
    background: #fff;
}
.as-editor-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
/* 一行：类别 · （有排班时才有工地）· 格子 · 合计。用 flex + 换行，窄屏也不会叠在一起 */
.as-editor-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
}
.as-editor-cat {
    flex: 0 0 62px;
    color: #334155;
    font-size: 13px;
}
.as-site-select.as-editor-site {
    flex: 1 1 110px;
    min-width: 0;
    padding: 7px 6px;
    border: 1px solid #dbe8ec;
    border-radius: 8px;
    background: #f7fbfc;
    color: #2a93a8;
    font-size: 12px;
}
.as-editor-input {
    flex: 1 1 76px;
    min-width: 0;
    padding: 8px 6px;
    border: 1px solid #cfe3ea;
    border-radius: 8px;
    font-size: 15px;
    text-align: center;
}
.as-editor-input:focus {
    outline: none;
    border-color: #2a93a8;
    background: #f7fbfc;
}
.as-editor-total {
    flex: 0 0 auto;
    margin-left: auto;
    color: #0f4c5c;
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}
.as-editor-est,
.as-editor-month {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #eef4f6;
    color: #4a6672;
    font-size: 12px;
    line-height: 1.7;
}
.as-editor-month {
    border-top: 0;
    margin-top: 2px;
    padding-top: 0;
    color: #6b8299;
}

/* 手机端：整表横向滚动，列宽收窄（卡片版用不到这一套，桌面网格才会走） */
@media (max-width: 768px) {
    .as-header {
        align-items: flex-start;
    }
    .as-title {
        font-size: 18px;
    }
    .as-actions {
        width: 100%;
    }
    .as-actions .btn {
        flex: 1 1 auto;
        min-width: 96px;
        justify-content: center;
    }
    .as-month {
        flex: 1 1 100%;
    }
    .as-table {
        min-width: 0;
        font-size: 12px;
    }
    .as-table .as-name {
        width: 64px;
    }
    .as-table .as-cat {
        left: 64px;
        width: 56px;
    }
    .as-table .as-day {
        width: 92px;
    }
    .as-table .as-total {
        width: 62px;
    }
    .as-table-wrap {
        max-height: none;
    }
}
