@charset "utf-8";
/* ============================================================
   文件：assets/css/app.css
   用途：工人管理系统 · 手机端优先样式（后台 + 工人自助端共用）
   说明：无外部依赖，纯手写；桌面端自动限制最大宽度并居中
   ============================================================ */

:root {
    --primary: #1b5c95;
    --primary-dark: #14466f;
    --primary-light: #e8f1fa;
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1f2733;
    --text-sub: #5b6779;
    --muted: #8b96a8;
    --line: #e6ebf2;
    --ok: #178f57;
    --ok-bg: #e6f6ee;
    --warn: #c1761b;
    --warn-bg: #fdf3e2;
    --danger: #c93c3c;
    --danger-bg: #fdeaea;
    --radius: 14px;
    --shadow: 0 2px 10px rgba(26, 45, 71, .06);
    --tabbar-h: 56px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* 桌面端居中限制宽度，模拟手机视图 */
body {
    max-width: 720px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .04);
}

/* ---------------- 顶栏 ---------------- */
.appbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    height: 50px;
    padding: 0 8px 0 12px;
    padding-top: env(safe-area-inset-top);
    background: linear-gradient(135deg, #1b5c95, #2674b8);
    color: #fff;
    box-shadow: 0 1px 6px rgba(20, 60, 100, .18);
}

.appbar-back {
    width: 30px;
    height: 30px;
    line-height: 27px;
    text-align: center;
    font-size: 26px;
    color: #fff;
    opacity: .9;
    flex: 0 0 auto;
}

.appbar-title {
    flex: 1;
    margin: 0 6px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appbar-action {
    flex: 0 0 auto;
    font-size: 14px;
    padding: 0 6px;
}

.appbar-action a,
.appbar-action button {
    color: #fff;
    font-size: 14px;
    opacity: .92;
    background: none;
    border: 0;
    padding: 4px 6px;
}

/* ---------------- 页面主体 ---------------- */
.app-main {
    padding: 12px 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px);
    min-height: calc(100vh - 50px);
}

/* ---------------- 底部导航 ---------------- */
.tabbar {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: 720px;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    background: #fff;
    border-top: 1px solid var(--line);
    z-index: 30;
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--muted);
    position: relative;
    transition: color .15s;
}

.tab.active {
    color: var(--primary);
    font-weight: 600;
}

.tab.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--primary);
}

/* ---------------- 卡片 ---------------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 14px;
    margin-bottom: 12px;
}

.card-tight {
    padding: 10px 12px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.card-title small {
    font-weight: 400;
    font-size: 12px;
    color: var(--muted);
    margin-left: 6px;
}

/* ---------------- 工作台统计 ---------------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.stat {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    display: block;
    color: var(--text);
}

.stat-num {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.stat-num.warn {
    color: var(--warn);
}

.stat-num.danger {
    color: var(--danger);
}

.stat-label {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
}

.hero {
    background: linear-gradient(135deg, #1b5c95, #2a7cc0);
    color: #fff;
    border-radius: var(--radius);
    padding: 18px 16px;
    margin-bottom: 12px;
    box-shadow: 0 4px 14px rgba(27, 92, 149, .22);
}

.hero h2 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 600;
}

.hero p {
    margin: 0;
    font-size: 13px;
    opacity: .88;
    line-height: 1.6;
}

/* ---------------- 列表 ---------------- */
.list {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}

.list-item:last-child {
    border-bottom: 0;
}

.list-item:active {
    background: #f7fafd;
}

.list-main {
    flex: 1;
    min-width: 0;
}

.list-title {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-sub {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-side {
    flex: 0 0 auto;
    text-align: right;
    font-size: 12.5px;
    color: var(--muted);
}

.avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------------- 徽章 ---------------- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    line-height: 18px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.badge-warn {
    background: var(--warn-bg);
    color: var(--warn);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-mute {
    background: #eef1f6;
    color: var(--muted);
}

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: opacity .15s, background .15s;
}

.btn:active {
    opacity: .85;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.btn-ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--text-sub);
}

.btn-danger {
    background: #fff;
    border-color: #f2c4c4;
    color: var(--danger);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13.5px;
    border-radius: 9px;
}

.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.btn-row .btn {
    flex: 1;
}

.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

/* ---------------- 表单 ---------------- */
.form .field {
    margin-bottom: 14px;
}

.field-label {
    display: block;
    font-size: 13.5px;
    color: var(--text-sub);
    margin-bottom: 6px;
    font-weight: 500;
}

.req {
    color: var(--danger);
    font-style: normal;
    margin-left: 2px;
}

.input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fbfcfe;
    color: var(--text);
    font-size: 16px; /* 防止 iOS 聚焦时自动放大 */
    font-family: inherit;
    line-height: 1.5;
    outline: none;
    transition: border-color .15s, background .15s;
    -webkit-appearance: none;
    appearance: none;
}

.input:focus {
    border-color: var(--primary);
    background: #fff;
}

.input[readonly] {
    background: #f3f5f9;
    color: var(--muted);
}

.textarea {
    min-height: 84px;
    resize: vertical;
}

.select {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238b96a8' stroke-width='1.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.err {
    font-size: 12.5px;
    color: var(--danger);
    margin-top: 4px;
}

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
}

.form-group-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin: 4px 0 10px;
    padding-left: 9px;
    border-left: 3px solid var(--primary);
    line-height: 1.2;
}

.form-actions {
    position: sticky;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 6px);
    margin-top: 6px;
    padding: 10px 0;
    background: linear-gradient(180deg, rgba(244, 246, 249, 0), var(--bg) 30%);
}

/* 上传控件 */
.upload {
    border: 1px dashed #cfd8e5;
    border-radius: 11px;
    background: #fbfcfe;
    padding: 12px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    position: relative;
    overflow: hidden;
}

.upload input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
}

.upload-preview {
    margin-top: 8px;
    border-radius: 10px;
    overflow: hidden;
}

/* ---------------- 键值明细 ---------------- */
.kv {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 8px 10px;
    font-size: 14px;
}

.kv dt {
    color: var(--muted);
    font-size: 13px;
}

.kv dd {
    margin: 0;
    color: var(--text);
    word-break: break-all;
}

.section-title {
    font-size: 13px;
    color: var(--muted);
    margin: 16px 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title .link {
    font-size: 13px;
    color: var(--primary);
}

/* ---------------- 提示 ---------------- */
.alert {
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13.5px;
    margin-bottom: 12px;
    line-height: 1.6;
}

.alert-err {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.alert-warn {
    background: var(--warn-bg);
    color: var(--warn);
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary);
}

.alert-list {
    margin: 0;
    padding-left: 18px;
    list-style: disc;
}

.toast {
    position: fixed;
    left: 50%;
    top: 60px;
    transform: translateX(-50%);
    z-index: 60;
    max-width: 80%;
    padding: 10px 16px;
    border-radius: 22px;
    font-size: 14px;
    color: #fff;
    background: rgba(31, 39, 51, .92);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
    transition: opacity .3s, transform .3s;
}

.toast-success {
    background: rgba(23, 143, 87, .95);
}

.toast-error {
    background: rgba(201, 60, 60, .95);
}

.toast-warning {
    background: rgba(193, 118, 27, .95);
}

.toast.hide {
    opacity: 0;
    transform: translate(-50%, -8px);
}

.empty {
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
    padding: 28px 12px;
    background: #fff;
    border-radius: var(--radius);
}

/* ---------------- 分页 ---------------- */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 0 4px;
}

.pager-btn {
    padding: 7px 16px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: 13.5px;
    color: var(--text-sub);
}

.pager-btn.disabled {
    color: #c3cad6;
}

.pager-info {
    font-size: 13px;
    color: var(--muted);
}

/* ---------------- 搜索栏 / 筛选 ---------------- */
.searchbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.searchbar .input {
    min-height: 40px;
    font-size: 14px;
}

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 2px;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: 0 0 auto;
    padding: 6px 14px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: 13px;
    color: var(--text-sub);
}

.chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 500;
}

/* ---------------- 快捷入口 ---------------- */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.quick-item {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 14px 6px;
    text-align: center;
    color: var(--text);
    font-size: 13px;
}

.quick-item .q-dot {
    width: 34px;
    height: 34px;
    margin: 0 auto 8px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
}

/* ---------------- 桌面表格（备用） ---------------- */
.table-wrap {
    overflow-x: auto;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 520px;
}

table.data th,
table.data td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.data th {
    background: #f7fafd;
    color: var(--text-sub);
    font-weight: 600;
    font-size: 13px;
}

table.data td.num,
table.data th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---------------- 合同文档（A4 打印） ---------------- */
.contract-page {
    background: #e9edf3;
    padding: 10px 0 30px;
}

.contract-toolbar {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--line);
    justify-content: flex-end;
}

.contract-sheet {
    width: 794px;
    max-width: 100%;
    margin: 12px auto;
    background: #fff;
    padding: 48px 56px 60px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, .08);
    font-family: "SimSun", "Songti SC", serif;
    font-size: 14px;
    line-height: 1.9;
    color: #000;
}

.contract-sheet h1 {
    text-align: center;
    font-size: 22px;
    letter-spacing: 4px;
    margin: 0 0 6px;
    font-family: "SimHei", "Heiti SC", sans-serif;
}

.contract-sheet .doc-no {
    text-align: right;
    font-size: 12.5px;
    color: #444;
    margin-bottom: 18px;
}

.contract-sheet h2 {
    font-size: 15px;
    margin: 18px 0 6px;
    font-family: "SimHei", "Heiti SC", sans-serif;
}

.contract-sheet p {
    margin: 0 0 6px;
    text-indent: 2em;
    text-align: justify;
}

.contract-sheet p.no-indent {
    text-indent: 0;
}

.contract-sheet .party {
    margin: 10px 0 0;
    text-indent: 0;
}

.contract-sheet .sign-area {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    gap: 40px;
}

.contract-sheet .sign-box {
    flex: 1;
    line-height: 2.4;
}

.contract-sheet .stamp {
    margin-top: 10px;
    color: #b3261e;
    border: 1px dashed #b3261e;
    display: inline-block;
    padding: 2px 10px;
    font-size: 12px;
    transform: rotate(-6deg);
}

.contract-sheet .divider {
    border-top: 1px solid #bbb;
    margin: 16px 0;
}

/* 手机端纵向浏览时按比例缩小纸张 */
@media screen and (max-width: 820px) {
    .contract-sheet {
        width: 100%;
        padding: 22px 18px 28px;
        font-size: 13px;
        line-height: 1.85;
    }

    .contract-sheet h1 {
        font-size: 18px;
        letter-spacing: 2px;
    }

    .contract-sheet .sign-area {
        flex-direction: column;
        gap: 14px;
    }
}

@media print {
    body {
        max-width: none;
        box-shadow: none;
        background: #fff;
    }

    .contract-page {
        background: #fff;
        padding: 0;
    }

    .contract-toolbar,
    .appbar,
    .tabbar {
        display: none !important;
    }

    .contract-sheet {
        width: auto;
        max-width: none;
        margin: 0;
        padding: 0;
        box-shadow: none;
        font-size: 12pt;
        line-height: 1.9;
    }

    @page {
        size: A4;
        margin: 18mm 16mm;
    }
}

/* ---------------- 登录页 ---------------- */
.login-wrap {
    padding: 44px 22px 22px;
}

.login-logo {
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1b5c95, #2a7cc0);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(27, 92, 149, .3);
}

.login-title {
    text-align: center;
    font-size: 19px;
    font-weight: 600;
    margin: 0 0 4px;
}

.login-sub {
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 22px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(26, 45, 71, .1);
    padding: 20px 18px;
}

.login-foot {
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 18px;
    line-height: 1.8;
}

/* ---------------- 通用工具类 ---------------- */
.mt8 {
    margin-top: 8px;
}

.mt12 {
    margin-top: 12px;
}

.mt16 {
    margin-top: 16px;
}

.mb8 {
    margin-bottom: 8px;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 12.5px;
}

.big-num {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.flex {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.text-danger {
    color: var(--danger);
}

.text-ok {
    color: var(--ok);
}

.nowrap {
    white-space: nowrap;
}

.divider-line {
    height: 1px;
    background: var(--line);
    margin: 12px 0;
}
