/* ── 东莞市美石家园石材 · 报价核算系统 ── */
/* UI v3: Apple / Mac style */

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

:root {
    --bg: #f5f5f7;
    --panel: #ffffff;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #3b82f6;
    --nav-bg: rgba(255,255,255,0.84);
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
    --radius: 12px;
    --gold: #b8955a;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-bg: #fef2f2;
    --success: #16a34a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg); color: var(--text); min-height: 100vh;
    display: flex; flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ═══════ Navigation ═══════ */
.top-nav {
    background: var(--nav-bg); backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    position: sticky; top: 0; z-index: 200; min-height: 64px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.nav-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; gap: 18px; min-height: 64px;
}
.nav-brand {
    text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
    flex-shrink: 0; padding: 5px 0;
}
.nav-brand-cn { font-size: 18px; font-weight: 700; color: #1d1d1f; letter-spacing: 0.03em; line-height: 1.2; }
.nav-brand-en { font-size: 10px; font-weight: 500; color: #8a8f98; letter-spacing: 0.12em; text-transform: uppercase; text-align: center; }
.nav-links { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.nav-link {
    text-decoration: none; font-size: 14px; padding: 8px 14px; border-radius: 8px;
    color: var(--muted); white-space: nowrap; transition: all 0.15s; font-weight: 450;
}
.nav-link:hover { background: #f3f4f6; color: var(--text); }
.nav-link.active { background: #eff6ff; color: var(--primary); font-weight: 550; }
.nav-logout { color: #9ca3af; }
.nav-logout:hover { color: var(--danger); background: var(--danger-bg); }

/* ═══════ Login ═══════ */
body.login-page {
    background: linear-gradient(160deg, #f5f5f7 0%, #e8ecf1 100%);
    justify-content: center; align-items: center;
}
.login-box {
    background: var(--panel); border-radius: 20px; padding: 44px 36px;
    width: 100%; max-width: 400px; box-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04); text-align: center;
}
.login-box h1 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.login-box .subtitle { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input {
    padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px;
    font-size: 15px; outline: none; background: #fafafa; transition: all 0.2s;
}
.login-form input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,0.08); }
.login-form button {
    padding: 13px; background: var(--primary); color: #fff;
    border: none; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: background 0.2s;
    letter-spacing: 0.02em;
}
.login-form button:hover { background: var(--primary-hover); }
.remember-row { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 4px 0; }
.remember-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.remember-row label { font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.error { color: var(--danger); font-size: 14px; margin-top: 12px; }

/* ═══════ Header ═══════ */
.header {
    background: #fff; border-bottom: 1px solid var(--line);
    position: sticky; top: 60px; z-index: 99;
}
.header-inner { max-width: 1200px; margin: 0 auto; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; }
.header-inner h1 { font-size: 18px; font-weight: 650; color: var(--text); }
.add-btn, .back-btn { text-decoration: none; font-size: 13px; color: var(--primary); padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; }
.header-actions { display: flex; gap: 8px; }
.btn-sm { font-size: 12px; padding: 6px 12px; background: var(--primary); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-weight: 500; }
.btn-sm:hover { background: var(--primary-hover); }
.btn-del { background: #fff !important; color: var(--danger) !important; border: 1px solid #fecaca !important; }
.btn-del:hover { background: var(--danger-bg) !important; }

/* ═══════ Quote lists ═══════ */
.main-content { flex: 1; padding-bottom: 48px; }
.card-list {
    max-width: 920px; margin: 18px auto 0; padding: 0 20px;
    display: flex; flex-direction: column; gap: 10px;
}
.card-list-item {
    background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow); color: inherit; text-decoration: none;
    padding: 16px 18px; display: flex; justify-content: space-between; gap: 16px;
    align-items: center; transition: all 0.16s;
}
.card-list-item:hover { transform: translateY(-1px); border-color: #c7d2fe; box-shadow: 0 6px 18px rgba(0,0,0,0.06); }
.card-list-left, .card-list-right { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card-list-left { flex: 1; }
.card-list-right { align-items: flex-end; flex-shrink: 0; }
.quote-no { font-size: 16px; font-weight: 700; color: var(--text); }
.quote-meta, .quote-by, .quote-date { font-size: 13px; color: var(--muted); }
.quote-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-amount { font-size: 20px; font-weight: 700; color: var(--danger); }

/* ═══════ Home ═══════ */
.home-main-wide {
    max-width: 1120px;
    width: calc(100% - 48px);
    margin: 0 auto;
    padding: 0 0 32px;
    flex: 1;
    box-sizing: border-box;
}
.home-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 20px; }
.home-page .welcome-bar {
    max-width: none;
    width: 100%;
    margin: 16px 0 0;
    padding: 10px 0;
    box-sizing: border-box;
}

.home-page .home-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
}
.home-page .card {
    background: var(--panel); border-radius: 16px; box-shadow: var(--shadow);
    text-decoration: none; color: inherit; display: flex; flex-direction: column;
    align-items: center; text-align: center; padding: 32px 20px 26px;
    transition: all 0.2s; cursor: pointer; border: 1px solid var(--line);
}
.home-page .card {
    min-height: 246px;
    border-radius: 14px;
    border-color: #e5e7eb;
    justify-content: center;
}
.home-page .card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.06); }
.home-page .card-home:hover { border-color: var(--accent); }
.home-page .card-furniture:hover { border-color: var(--accent); }
.home-page .card-icon { font-size: 44px; margin-bottom: 12px; line-height: 1; }
.home-page .card-title { font-size: 19px; font-weight: 650; margin-bottom: 10px; color: var(--text); }
.home-page .card-desc { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 14px; min-height: 42px; }
.home-page .card-badge { font-size: 11px; background: #f3f4f6; color: var(--muted); padding: 5px 12px; border-radius: 20px; font-weight: 500; margin-top: auto; }

.three-cols { grid-template-columns: repeat(3, 1fr); }
.four-cols { grid-template-columns: repeat(4, 1fr); }
.home-page .four-cols {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.home-page .card-mini {
    background: var(--panel); border-radius: 14px; box-shadow: var(--shadow);
    text-decoration: none; color: inherit; display: flex; flex-direction: column;
    align-items: center; padding: 20px 12px 16px; transition: all 0.15s; border: 1px solid var(--line);
    min-height: 108px;
    justify-content: center;
}
.home-page .card-mini:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.05); }
.home-page .card-mini .card-icon { font-size: 28px; margin-bottom: 6px; }
.home-page .card-mini .card-title { font-size: 13px; font-weight: 600; color: var(--text); }

.home-page .sub-title { font-size: 14px; color: var(--muted); font-weight: 600; text-align: center; margin: 0 0 10px; }
.home-page .home-sub-section { margin-top: 20px; }

/* Stats */
.home-page .stats-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 12px 0 20px;
}
.home-page .stat-card {
    background: #fff; border-radius: 14px; padding: 0 12px; box-shadow: var(--shadow);
    text-align: center; border: 1px solid #e5e7eb; min-height: 76px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.home-page .stat-num { display: block; font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; }
.home-page .stat-label { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Recent */
.home-page .recent-section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.home-page .recent-col { min-width: 0; }
.home-page .mini-list { display: flex; flex-direction: column; gap: 6px; }
.home-page .mini-item {
    background: #fff; border-radius: 14px; padding: 10px 14px;
    display: grid; grid-template-columns: 72px minmax(0, 1fr) 82px 70px 76px;
    align-items: center; gap: 10px; min-height: 44px;
    text-decoration: none; color: inherit; box-shadow: var(--shadow);
    border: 1px solid #e5e7eb; font-size: 13px;
}
.home-page .mini-item:hover { transform: translateX(2px); border-color: var(--accent); }
.home-page .mini-no { font-weight: 650; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-page .mini-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); min-width: 0; }
.home-page .mini-amount { font-weight: 700; color: var(--danger); white-space: nowrap; text-align: right; }
.home-page .mini-date { font-size: 11px; color: #aaa; white-space: nowrap; text-align: right; }
.home-page .mini-status { font-size: 10px; padding: 1px 6px; border-radius: 10px; text-align: center; white-space: nowrap; }
.home-page .mini-empty { color: var(--muted); font-size: 13px; padding: 12px; text-align: center; background: #fff; border-radius: 14px; border: 1px solid #e5e7eb; box-shadow: var(--shadow); }

/* ═══════ List Page ═══════ */
.list-main { max-width: 920px; margin: 0 auto; padding: 16px 20px; flex: 1; }
.quote-list { display: flex; flex-direction: column; gap: 8px; }
.quote-card { background: #fff; border-radius: 12px; padding: 14px 18px; display: flex; align-items: center; box-shadow: var(--shadow); border: 1px solid var(--line); }
.qc-main { display: flex; justify-content: space-between; align-items: center; flex: 1; text-decoration: none; color: inherit; }
.qc-no { font-weight: 650; font-size: 15px; color: var(--text); }
.qc-addr { font-size: 13px; color: var(--muted); margin-top: 1px; }
.qc-customer { font-size: 12px; color: var(--muted); }
.qc-total { font-size: 19px; font-weight: 700; color: var(--danger); text-align: right; }
.qc-date { font-size: 11px; color: #aaa; text-align: right; margin-top: 1px; }
.qc-delete-form { flex-shrink: 0; margin-left: 14px; }
.qc-delete-form .btn-del-sm {
    width: 30px; height: 30px; border-radius: 50%; font-size: 14px;
    background: #fff; border: 1px solid var(--line); cursor: pointer; color: var(--muted);
}
.qc-delete-form .btn-del-sm:hover { background: var(--danger-bg); border-color: #fecaca; color: var(--danger); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state p { font-size: 16px; margin-bottom: 16px; }
.btn-primary { display: inline-block; background: var(--primary); color: #fff; padding: 11px 26px; border-radius: 10px; text-decoration: none; font-size: 14px; font-weight: 500; }

/* ═══════ Workbench ═══════ */
.workbench {
    display: flex; gap: 24px; max-width: 1360px; margin: 0 auto;
    padding: 20px 20px 48px; flex: 1; align-items: flex-start;
}
.wb-sidebar { width: 340px; flex-shrink: 0; position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.wb-card { background: #fff; border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.wb-quote-no { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.wb-info-form { display: flex; flex-direction: column; gap: 8px; }
.wb-field { display: flex; flex-direction: column; gap: 3px; }
.wb-field label { font-size: 11px; color: var(--muted); font-weight: 600; }
.wb-field input, .wb-field select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; outline: none; background: #fafafa; }
.wb-field input:focus, .wb-field select:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,0.06); }
.wb-btn-save { background: var(--primary); color: #fff; border: none; padding: 10px 0; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; width: 100%; margin-top: 4px; }
.wb-btn-save:hover { background: var(--primary-hover); }
.wb-total-card { text-align: center; }
.wb-total-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.wb-total-amount { font-size: 32px; font-weight: 700; color: var(--danger); letter-spacing: -0.02em; }
.wb-actions { display: flex; flex-direction: column; gap: 7px; }
.wb-btn { display: block; width: 100%; padding: 10px 0; border-radius: 8px; font-size: 13px; cursor: pointer; text-align: center; text-decoration: none; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 500; transition: all 0.15s; }
.wb-btn:hover { background: #f9fafb; }
.wb-btn-del { color: var(--danger); border-color: #fecaca; background: var(--danger-bg); }
.wb-btn-del:hover { background: #fee2e2; }
.wb-btn-back { color: var(--muted); }
.wb-main { flex: 1; min-width: 0; }

/* ═══════ Sections ═══════ */
.sections-area { display: flex; flex-direction: column; gap: 14px; }
.section-block { background: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #f3f4f6; }
.section-name { font-size: 16px; font-weight: 650; color: var(--text); }
.section-actions { display: flex; align-items: center; gap: 10px; }
.section-subtotal { font-weight: 700; color: var(--danger); font-size: 15px; }
.btn-del-sm { background: #fff; color: var(--muted); border: 1px solid var(--line); width: 26px; height: 26px; border-radius: 50%; font-size: 13px; cursor: pointer; text-align: center; line-height: 24px; }
.btn-del-sm:hover { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }

/* Items table */
.items-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 10px; }
.items-table th { background: #f9fafb; padding: 8px 5px; text-align: left; font-weight: 600; color: var(--muted); white-space: nowrap; }
.items-table td { padding: 7px 5px; border-bottom: 1px solid #f3f4f6; }
.td-remark { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.col-cat { width: 42px; } .col-name { min-width: 60px; } .col-spec { width: 50px; }
.col-mat { width: 50px; } .col-qty { width: 42px; } .col-unit { width: 36px; }
.col-price { width: 52px; } .col-amount { width: 60px; font-weight: 600; }
.col-remark { width: 60px; } .col-act { width: 26px; }
.btn-del-td { background: none; border: none; color: #d1d5db; cursor: pointer; font-size: 14px; padding: 0 4px; }
.btn-del-td:hover { color: var(--danger); }

/* Add item */
.add-item-header { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; margin-top: 2px; }
.add-item-title { font-size: 12px; color: var(--muted); font-weight: 600; }
.btn-copy-prev { font-size: 11px; padding: 4px 10px; background: #f9fafb; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; color: var(--muted); }
.btn-copy-prev:hover { background: #f3f4f6; color: var(--text); }
.add-item-grid { display: grid; grid-template-columns: 52px minmax(60px,1fr) 50px 50px 48px 40px 60px 50px 48px; gap: 4px; align-items: center; }
.add-item-grid select, .add-item-grid input { padding: 6px 4px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; outline: none; width: 100%; background: #fafafa; }
.add-item-grid select:focus, .add-item-grid input:focus { border-color: var(--primary); }
.btn-add-item { background: var(--primary); color: #fff; border: none; border-radius: 6px; padding: 6px 4px; font-size: 12px; cursor: pointer; white-space: nowrap; font-weight: 500; }
.add-section-form { display: flex; gap: 10px; }
.add-section-form input { flex: 1; padding: 12px 14px; border: 2px dashed var(--line); border-radius: 10px; font-size: 14px; outline: none; background: #fafafa; }
.add-section-form input:focus { border-color: var(--accent); }
.btn-add-section { background: var(--text); color: #fff; border: none; padding: 11px 20px; border-radius: 10px; font-size: 14px; cursor: pointer; white-space: nowrap; font-weight: 500; }

/* Search Pickers */
.search-pickers { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 0; margin-bottom: 2px; border-top: 1px dashed var(--line); }
.search-picker-row { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 140px; }
.sp-label { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.sp-input-wrap { position: relative; flex: 1; }
.sp-input { width: 100%; padding: 7px 26px 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; outline: none; background: #fafafa; }
.sp-input:focus { border-color: var(--primary); background: #fff; }
.sp-selected { border-color: var(--primary); background: #eff6ff; }
.sp-clear { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #d1d5db; cursor: pointer; font-size: 13px; padding: 2px 6px; }
.sp-clear:hover { color: var(--danger); }
.sp-results { display: none; position: absolute; top: 100%; left: 0; right: 0; max-height: 260px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-top: none; border-radius: 0 0 10px 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.08); z-index: 300; }
.sp-result-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 12px; border-bottom: 1px solid #f3f4f6; }
.sp-result-item:hover { background: #f0f7ff; }
.spr-cat { font-size: 10px; color: var(--muted); background: #f3f4f6; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.spr-name { flex: 1; font-weight: 600; color: var(--text); }
.spr-price { font-weight: 700; color: var(--danger); white-space: nowrap; }
.spr-unit { font-size: 10px; color: var(--muted); white-space: nowrap; }
.sp-no-result { padding: 12px; text-align: center; color: var(--muted); font-size: 12px; }

/* ═══════ Price List ═══════ */
.price-list-main { max-width: 920px; margin: 0 auto; padding: 16px 20px 40px; flex: 1; }
.search-bar { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; background: #fff; padding: 12px; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--line); flex-wrap: wrap; }
.search-bar input[type="text"] { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; outline: none; min-width: 140px; background: #fafafa; }
.search-bar select { padding: 9px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; outline: none; background: #fff; }
.search-bar button { padding: 9px 14px; background: var(--text); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn-clear { font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }

.add-panel { background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 14px; border: 1px solid var(--line); }
.add-panel summary { font-weight: 650; cursor: pointer; padding: 3px 0; color: var(--text); font-size: 14px; }
.add-price-form { margin-top: 10px; }
.apf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 8px; }
.apf-grid input, .apf-grid select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; outline: none; background: #fafafa; }
.apf-grid input:focus, .apf-grid select:focus { border-color: var(--primary); }
.btn-add-price { background: var(--primary); color: #fff; border: none; padding: 10px 22px; border-radius: 8px; font-size: 13px; cursor: pointer; font-weight: 500; }
.checkbox-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-bottom: 6px; }

.price-table-wrap { overflow-x: auto; }
.price-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); font-size: 13px; }
.price-table th { background: #f9fafb; padding: 10px 8px; text-align: left; font-weight: 600; color: var(--muted); white-space: nowrap; }
.price-table td { padding: 9px 8px; border-bottom: 1px solid #f3f4f6; }
.price-table tr:hover { background: #fafbfc; }
.td-price { font-weight: 700; color: var(--danger); }
.td-empty { text-align: center; color: var(--muted); padding: 30px; }
.type-badge { font-size: 9px; padding: 2px 6px; border-radius: 4px; margin-left: 4px; font-weight: 600; }
.type-stone { background: #dbeafe; color: #1e40af; }
.type-finished { background: #fef3c7; color: #92400e; }
.type-formula { background: #f3e8ff; color: #6b21a8; }

/* ═══════ Furniture ═══════ */
.f-section { background: #fff; border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px; border: 1px solid var(--line); }
.f-section-title { font-size: 15px; font-weight: 650; color: var(--text); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #f3f4f6; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-5 { grid-template-columns: repeat(5, 1fr); }
.auto-badge { font-size: 9px; background: #d1fae5; color: #065f46; padding: 2px 6px; border-radius: 4px; margin-left: 4px; }
.readonly-input { background: #f9fafb !important; color: var(--muted); }
.f-checkbox-field label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text); }
.f-checkbox-field input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.picker-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.picker-row select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; outline: none; background: #fff; }
.btn-save-full { width: 100%; padding: 14px; font-size: 15px; font-weight: 600; margin-bottom: 16px; }

/* Quote info form (for new/edit pages) */
.quote-info-form { background: #fff; border-radius: 14px; padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.quote-edit-main { max-width: 920px; margin: 0 auto; padding: 16px 20px 40px; flex: 1; }
.flash-msg { background: #ecfdf5; color: #065f46; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 13px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.info-field-full { grid-column: 1 / -1; }
.info-field { display: flex; flex-direction: column; gap: 4px; }
.info-field label { font-size: 11px; color: var(--muted); font-weight: 600; }
.info-field input, .info-field select { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; outline: none; background: #fafafa; }
.info-field input:focus, .info-field select:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,0.06); }
.type-add-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.type-add-row .btn-sm { white-space: nowrap; border-radius: 8px; }
.btn-save-info { background: var(--primary); color: #fff; border: none; padding: 10px 22px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; }
.btn-save-info:hover { background: var(--primary-hover); }
.total-bar { background: #fff; border: 1px solid var(--line); padding: 16px 20px; border-radius: 14px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; box-shadow: var(--shadow); }
.total-label { font-size: 15px; color: var(--muted); }
.total-amount { font-size: 28px; font-weight: 700; color: var(--danger); letter-spacing: -0.02em; }

/* Furniture result */
.f-result { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-top: 4px; box-shadow: var(--shadow); }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.result-grid-price { grid-template-columns: repeat(5, 1fr); }
.result-item { display: flex; flex-direction: column; gap: 2px; padding: 11px 12px; background: #fafafa; border-radius: 10px; border: 1px solid #f0f0f0; text-align: center; }
.result-item span:first-child { font-size: 11px; color: var(--muted); font-weight: 600; }
.result-item span:last-child { font-size: 17px; font-weight: 700; color: var(--text); }
.result-total { background: #fef2f2; border-color: #fecaca; }
.result-total span:last-child { color: var(--danger); font-size: 21px; }
.result-highlight { background: #eff6ff; border-color: #bfdbfe; }
.result-highlight span:last-child { color: var(--primary); font-size: 20px; }
.result-note { background: #f0fdf4; border-color: #bbf7d0; }
.result-note span:last-child { color: var(--success); }
.result-note em { font-size: 10px; font-style: normal; font-weight: 400; color: var(--muted); display: block; }
.result-warn { background: #fffbeb; border-color: #fde68a; }
.result-warn span:last-child { color: #92400e; }
.result-warn em { font-size: 10px; font-style: normal; font-weight: 400; color: var(--muted); display: block; }
.result-profit { background: #f0fdf4; border-color: #bbf7d0; }
.result-profit span:last-child { color: var(--success); }

/* ═══════ System ═══════ */
.backup-action { background: #fff; border-radius: 14px; padding: 18px; box-shadow: var(--shadow); text-align: center; border: 1px solid var(--line); }
.backup-action p { margin-bottom: 8px; font-size: 13px; color: var(--text); }
.backup-action code { background: #f3f4f6; padding: 2px 8px; border-radius: 5px; font-size: 12px; }


/* ═══════ Multi-user / Status / Logs ═══════ */

.welcome-bar {
    max-width: 1200px; margin: 16px auto 0; padding: 10px 20px;
    font-size: 14px; color: var(--muted);
}
.nav-user {
    font-size: 13px; color: var(--muted); padding: 6px 10px;
    border-left: 1px solid var(--line); margin-left: 4px;
}
.nav-user small { font-size: 10px; color: #999; text-transform: uppercase; }

.status-badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.status-草稿 { background: #f3f4f6; color: #6b7280; }
.status-已报价 { background: #dbeafe; color: #1d4ed8; }
.status-已成交 { background: #dcfce7; color: #16a34a; }
.status-已作废 { background: #fee2e2; color: #dc2626; }

.status-display { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.quote-by { font-size: 11px; color: var(--muted); }
.status-select { font-size: 12px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; }

.mini-status { font-size: 10px; padding: 1px 6px; border-radius: 10px; flex-shrink: 0; }

.wb-info-readonly { padding: 8px 0; }
.wb-info-readonly .wb-field { margin-bottom: 8px; }
.wb-info-readonly .wb-field label { font-size: 11px; color: var(--muted); display: block; }
.wb-info-readonly .wb-field span { font-size: 14px; color: var(--text); }

.role-badge { font-size: 12px; padding: 2px 8px; border-radius: 12px; font-weight: 600; }
.role-boss { background: #fef3c7; color: #92400e; }
.role-sales { background: #dbeafe; color: #1d4ed8; }

.status-dot { font-size: 12px; }
.status-dot.enabled { color: #16a34a; }
.status-dot.disabled { color: #dc2626; }

.log-count { font-size: 13px; color: var(--muted); }
.log-action { font-weight: 600; color: var(--primary); }

.pagination { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 20px 0; font-size: 14px; }
.pagination a { color: var(--primary); text-decoration: none; }
.pagination a:hover { text-decoration: underline; }

.data-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.data-table th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; background: #fafafa; }
.data-table tr:hover { background: #f9fafb; }
.td-actions { white-space: nowrap; display: flex; gap: 4px; flex-wrap: wrap; }
.td-actions form { display: inline; }
.td-actions .btn-sm { font-size: 11px; padding: 3px 8px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ═══════ Footer ═══════ */
.footer { text-align: center; padding: 16px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

/* ═══════ Mobile ═══════ */
@media (max-width: 860px) {
    .nav-inner { flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 14px; }
    .nav-brand { padding: 3px 0; }
    .nav-brand-cn { font-size: 14px; }
    .nav-brand-en { font-size: 8px; }
    .nav-link { font-size: 12px; padding: 6px 10px; }
    .workbench { flex-direction: column; padding: 12px 10px 30px; gap: 14px; }
    .wb-sidebar { width: 100%; position: static; }
    .wb-total-amount { font-size: 28px; }
    .wb-actions { flex-direction: row; flex-wrap: wrap; }
    .wb-btn { flex: 1; min-width: 100px; }
    .header-inner h1 { font-size: 15px; }
}

@media (max-width: 600px) {
    .nav-inner { padding: 6px 10px; }
    .nav-links { gap: 0; }
    .nav-link { font-size: 11px; padding: 5px 8px; }
    .four-cols { grid-template-columns: repeat(2, 1fr); }
    .three-cols { grid-template-columns: repeat(2, 1fr); }
    .home-grid { grid-template-columns: 1fr; gap: 12px; }
    .info-grid, .cols-2, .cols-3, .cols-5, .result-grid { grid-template-columns: 1fr; }
    .result-grid-price { grid-template-columns: repeat(2, 1fr); }
    .stats-row { gap: 6px; } .stat-card { padding: 10px 8px; min-width: 60px; } .stat-num { font-size: 22px; }
    .recent-section { grid-template-columns: 1fr; }
    .search-pickers { flex-direction: column; }
    .sp-input { font-size: 11px; }
    .add-section-form { flex-direction: column; }
    .items-table { font-size: 10px; display: block; overflow-x: auto; white-space: nowrap; }
    .col-remark { display: none; }
    .add-item-grid { grid-template-columns: 46px 1fr 40px 36px 50px; gap: 2px; }
    .add-price-form .apf-grid { grid-template-columns: 1fr; }
    .home-main-wide { padding: 16px 10px 36px; }
    .quote-edit-main, .price-list-main, .list-main { padding: 12px 10px 30px; }
}

@media (max-width: 900px) {
    .home-page .stats-row { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
}

@media (max-width: 768px) {
    .home-main-wide { width: calc(100% - 32px); }
    .home-page .home-grid { grid-template-columns: 1fr; }
    .home-page .four-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-page .recent-section { grid-template-columns: 1fr; }
    .home-page .card { min-height: 220px; }
    .home-page .mini-item { grid-template-columns: 64px minmax(0, 1fr) 76px 64px 68px; }
}

@media (max-width: 480px) {
    .home-main-wide { width: calc(100% - 24px); padding: 0 0 32px; }
    .home-page .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-page .card { min-height: 210px; padding: 24px 16px 20px; }
    .home-page .card-desc { min-height: auto; }
    .home-page .mini-item {
        grid-template-columns: 58px minmax(0, 1fr) 68px;
        grid-template-areas:
            "no desc amount"
            "status desc date";
        row-gap: 4px;
    }
    .home-page .mini-no { grid-area: no; }
    .home-page .mini-desc { grid-area: desc; }
    .home-page .mini-amount { grid-area: amount; }
    .home-page .mini-status { grid-area: status; text-align: left; }
    .home-page .mini-date { grid-area: date; }
}
