/* 家庭薪资计算网站 —— 长辈版样式
   设计原则：大字号、高对比、大按钮、少点击 */

:root {
    --bg: #F2F5F9;
    --card: #FFFFFF;
    --ink: #16191D;
    --ink-2: #4A5260;
    --line: #D3DAE4;
    --brand: #0B5FFF;
    --brand-dark: #0846C4;
    --brand-soft: #E7EFFF;
    --ok: #147A3B;
    --ok-soft: #E4F5EA;
    --warn: #8A5A00;
    --warn-bg: #FFF6DC;
    --warn-line: #E0A800;
    --danger: #C02626;
    --danger-bg: #FDECEC;
    --radius: 16px;
    --shadow: 0 2px 8px rgba(20, 30, 50, .08);
}

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

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    font-size: 20px;           /* 正文基准 ≥20px */
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

body { padding-bottom: 104px; }   /* 给底部导航留位置 */

.wrap { max-width: 900px; margin: 0 auto; padding: 16px 14px 24px; }

/* ---------- 顶栏 ---------- */
.topbar {
    background: var(--brand);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.topbar h1 { font-size: 24px; margin: 0; font-weight: 700; letter-spacing: .5px; }
.topbar .who { font-size: 17px; opacity: .9; }
.topbar a { color: #fff; font-size: 17px; text-decoration: underline; }

/* ---------- 汇总卡片 ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.card {
    background: var(--card);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
}
.card .label { font-size: 19px; color: var(--ink-2); font-weight: 600; }
.card .money {
    font-size: 40px;               /* 关键金额 ≥32px */
    font-weight: 800;
    line-height: 1.25;
    color: var(--brand-dark);
    word-break: break-all;
}
.card .money .unit { font-size: 22px; font-weight: 700; margin-left: 2px; }
.card .sub { font-size: 17px; color: var(--ink-2); margin-top: 4px; }
.card.today { background: var(--brand-soft); border-color: #B9D0FF; }
.card.month { background: var(--ok-soft); border-color: #B7E1C6; }
.card.month .money { color: var(--ok); }

/* ---------- 通用组件 ---------- */
h2 { font-size: 25px; margin: 22px 0 12px; font-weight: 800; }
h3 { font-size: 21px; margin: 18px 0 10px; font-weight: 700; }
.hint { font-size: 18px; color: var(--ink-2); margin: 6px 0 12px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 60px;                 /* 主按钮 ≥56px */
    padding: 0 22px;
    font-size: 22px; font-weight: 700;
    border-radius: 14px;
    border: 2px solid transparent;
    background: var(--brand); color: #fff;
    cursor: pointer;
    width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); }
.btn.ok { background: var(--ok); }
.btn.ghost { background: #fff; color: var(--brand-dark); border-color: var(--brand); }
.btn.gray { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 48px; font-size: 19px; padding: 0 14px; width: auto; border-radius: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-row > * { flex: 1 1 160px; }

input, select {
    width: 100%;
    font-size: 22px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    border: 2px solid var(--line);
    border-radius: 12px;
    padding: 14px 14px;
    min-height: 60px;
}
input:focus, select:focus { outline: 3px solid #9CC0FF; border-color: var(--brand); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #4A5260 50%), linear-gradient(135deg, #4A5260 50%, transparent 50%); background-position: calc(100% - 22px) 28px, calc(100% - 14px) 28px; background-size: 8px 8px, 8px 8px; background-repeat: no-repeat; }

.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 19px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }

/* ---------- 上传区 ---------- */
.drop {
    border: 3px dashed var(--brand);
    border-radius: 20px;
    background: #fff;
    padding: 30px 18px;
    text-align: center;
    cursor: pointer;
    transition: background .15s;
}
.drop.drag { background: var(--brand-soft); }
.drop .big { font-size: 26px; font-weight: 800; color: var(--brand-dark); }
.drop .small { font-size: 18px; color: var(--ink-2); margin-top: 8px; }
.drop .icon { font-size: 56px; line-height: 1; }

.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; border: 2px solid var(--line); }

/* ---------- 识别结果 / 记录行 ---------- */
.item {
    background: #fff;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 14px;
}
.item.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.item .row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.item .row .grow { flex: 1 1 200px; min-width: 150px; }
.item .amt {
    font-size: 30px; font-weight: 800; color: var(--brand-dark);
    min-width: 130px; text-align: right;
}
.item .del {
    min-height: 52px; min-width: 76px;
    font-size: 19px; font-weight: 700;
    background: #fff; color: var(--danger);
    border: 2px solid var(--danger); border-radius: 12px; cursor: pointer;
}
.item .tag {
    display: inline-block; font-size: 16px; font-weight: 700;
    padding: 4px 10px; border-radius: 8px; background: var(--warn-bg);
    color: var(--warn); border: 1px solid var(--warn-line); margin-bottom: 8px;
}

/* ---------- 提示条 ---------- */
.note {
    border-radius: 14px; padding: 14px 16px; font-size: 19px; margin: 12px 0;
    border: 2px solid var(--warn-line); background: var(--warn-bg); color: var(--warn);
}
.note.ok { border-color: #8CD0A6; background: var(--ok-soft); color: var(--ok); }
.note ul { margin: 6px 0 0; padding-left: 22px; }

/* ---------- 明细 ---------- */
.day {
    background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
    padding: 14px 16px; margin-bottom: 16px;
}
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; border-bottom: 2px solid var(--line); padding-bottom: 10px; }
.day-head .d { font-size: 24px; font-weight: 800; }
.day-head .m { font-size: 30px; font-weight: 800; color: var(--ok); }
.rec { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.rec:last-child { border-bottom: none; }
.rec .name { font-size: 21px; font-weight: 700; }
.rec .meta { font-size: 17px; color: var(--ink-2); }
.rec .money { font-size: 24px; font-weight: 800; }
.rec .ops { display: flex; gap: 8px; }
.rec .ops button { min-height: 46px; font-size: 18px; padding: 0 12px; border-radius: 10px; background: #fff; border: 2px solid var(--line); cursor: pointer; }
.rec .ops button.del { color: var(--danger); border-color: var(--danger); }

/* ---------- 单价表 ---------- */
.prod { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; flex-wrap: wrap; }
.prod .pname { font-size: 22px; font-weight: 800; }
.prod .pmeta { font-size: 17px; color: var(--ink-2); }
.prod .pprice { font-size: 28px; font-weight: 800; color: var(--brand-dark); }
.prod .ops { display: flex; gap: 8px; }
.prod .ops button { min-height: 50px; font-size: 18px; padding: 0 14px; border-radius: 10px; background: #fff; border: 2px solid var(--line); cursor: pointer; }
.prod .ops button.del { color: var(--danger); border-color: var(--danger); }
.prod.off { opacity: .55; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(10, 15, 25, .55); display: none; align-items: flex-end; justify-content: center; z-index: 50; }
.modal-mask.show { display: flex; }
.modal {
    background: #fff; width: 100%; max-width: 640px;
    border-radius: 20px 20px 0 0; padding: 20px 18px 26px;
    max-height: 88vh; overflow: auto;
}
.modal h3 { margin-top: 0; font-size: 24px; }

/* ---------- 底部导航 ---------- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: #fff; border-top: 2px solid var(--line);
    box-shadow: 0 -2px 10px rgba(20, 30, 50, .08);
    z-index: 40;
}
.tabbar button {
    background: none; border: none; padding: 10px 4px 12px;
    font-size: 18px; font-weight: 700; color: var(--ink-2);
    font-family: inherit; cursor: pointer; min-height: 84px;
}
.tabbar button .ti { display: block; font-size: 30px; line-height: 1.2; }
.tabbar button.on { color: var(--brand); background: var(--brand-soft); }

/* ---------- 成功遮罩 ---------- */
.done-mask { position: fixed; inset: 0; background: rgba(255, 255, 255, .96); display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 60; text-align: center; padding: 24px; }
.done-mask.show { display: flex; }
.done-mask .tick { font-size: 96px; line-height: 1; }
.done-mask .t1 { font-size: 32px; font-weight: 800; margin-top: 8px; }
.done-mask .t2 { font-size: 22px; color: var(--ink-2); margin: 10px 0 22px; }
.done-mask .btn { max-width: 420px; }

/* ---------- 加载 ---------- */
.loading { position: fixed; inset: 0; background: rgba(255, 255, 255, .85); display: none; align-items: center; justify-content: center; z-index: 70; flex-direction: column; gap: 14px; font-size: 22px; font-weight: 700; }
.loading.show { display: flex; }
.spinner { width: 54px; height: 54px; border: 6px solid #CFDEF8; border-top-color: var(--brand); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.view { display: none; }
.view.on { display: block; }

/* ---------- 大屏优化 ---------- */
@media (min-width: 760px) {
    body { font-size: 21px; padding-bottom: 110px; }
    .cards { gap: 18px; }
    .card .money { font-size: 46px; }
    .tabbar button { min-height: 90px; font-size: 19px; }
    .modal-mask { align-items: center; }
    .modal { border-radius: 20px; }
}

/* ---------- 日历 ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 14px; }
.cal-head .mon { font-size: 26px; font-weight: 800; flex: 1; text-align: center; }
.cal-nav { min-width: 60px; min-height: 60px; font-size: 32px; font-weight: 800; border-radius: 14px; background: #fff; border: 2px solid var(--line); color: var(--brand-dark); cursor: pointer; }
.cal-nav:active { transform: translateY(1px); }
.cal-today { min-height: 60px; font-size: 18px; font-weight: 700; padding: 0 16px; border-radius: 14px; background: var(--brand); color: #fff; border: none; cursor: pointer; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-dow { text-align: center; font-size: 17px; font-weight: 700; color: var(--ink-2); padding: 4px 0; }
.cal-cell { background: #fff; border: 2px solid var(--line); border-radius: 12px; min-height: 76px; padding: 6px 2px; text-align: center; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; align-items: center; position: relative; }
.cal-cell .dnum { font-size: 22px; font-weight: 800; }
.cal-cell .amt { font-size: 14px; font-weight: 800; color: var(--ok); line-height: 1.1; word-break: break-all; }
.cal-cell.has { background: var(--ok-soft); border-color: #B7E1C6; }
.cal-cell.today { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cal-cell.future { opacity: .42; }
.cal-cell.empty { background: transparent; border: none; cursor: default; }
.cal-cell:not(.empty):active { transform: translateY(1px); }
.cal-legend { display: flex; gap: 16px; margin: 12px 2px 4px; font-size: 16px; color: var(--ink-2); flex-wrap: wrap; }
.cal-legend i { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: middle; margin-right: 5px; }

/* ---------- 日面板（底部抽屉） ---------- */
.sheet-mask { position: fixed; inset: 0; background: rgba(10, 15, 25, .5); display: none; z-index: 55; }
.sheet-mask.show { display: block; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 22px 22px 0 0; padding: 18px 16px calc(22px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; z-index: 56; box-shadow: 0 -4px 16px rgba(0, 0, 0, .15); animation: slideup .2s ease; }
.sheet.show { display: block; }
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet h3 { margin: 0 0 4px; font-size: 24px; }
.sheet .close-x { position: absolute; top: 12px; right: 16px; font-size: 34px; line-height: 1; background: none; border: none; cursor: pointer; color: var(--ink-2); padding: 0 6px; }
.day-rec { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.day-rec .name { font-size: 21px; font-weight: 700; }
.day-rec .meta { font-size: 16px; color: var(--ink-2); }
.day-rec .money { font-size: 23px; font-weight: 800; color: var(--brand-dark); }
.day-rec .ops { display: flex; gap: 8px; }
.day-rec .ops button { min-height: 46px; font-size: 17px; padding: 0 12px; border-radius: 10px; background: #fff; border: 2px solid var(--line); cursor: pointer; }
.day-rec .ops button.del { color: var(--danger); border-color: var(--danger); }
.day-empty { text-align: center; color: var(--ink-2); font-size: 18px; padding: 14px 0; }
.entry { background: var(--brand-soft); border: 2px solid #B9D0FF; border-radius: 16px; padding: 14px; margin: 14px 0; }
.entry .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.entry .grow { flex: 2 1 200px; min-width: 150px; }
.entry .qty { flex: 1 1 120px; min-width: 110px; }
.entry .price-hint { font-size: 18px; color: var(--ink-2); margin: 10px 2px 2px; }
.entry .price-hint b { color: var(--brand-dark); font-size: 22px; }
.entry .amt-line { font-size: 26px; font-weight: 800; color: var(--ok); text-align: right; margin: 6px 2px 12px; }

/* ---------- 统计 ---------- */
.day-stat { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; cursor: pointer; }
.day-stat:active { transform: translateY(1px); }
.day-stat .d { font-size: 20px; font-weight: 700; }
.day-stat .m { font-size: 26px; font-weight: 800; color: var(--ok); }
.range-row { display: flex; gap: 10px; flex-wrap: wrap; }
.range-row > div { flex: 1 1 150px; }

