:root {
    --bg: #efe7db;
    --bg-soft: #f8f3ea;
    --panel: rgba(255, 251, 245, 0.9);
    --panel-strong: #fffaf2;
    --line: #dcc9ab;
    --line-soft: rgba(130, 97, 53, 0.12);
    --text: #2e2419;
    --muted: #7c6a56;
    --accent: #9e5a1f;
    --accent-strong: #7e4311;
    --accent-soft: #f0ddc4;
    --danger: #ab3c30;
    --success: #2f6b4b;
    --shadow: 0 20px 60px rgba(78, 53, 26, 0.10);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 0 0, rgba(243, 192, 116, 0.28), transparent 24%),
        radial-gradient(circle at 100% 0, rgba(179, 113, 47, 0.14), transparent 18%),
        linear-gradient(135deg, #f8f3ec 0%, #efe6d8 42%, #eadcc7 100%);
}

.lookup-body {
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    padding: 0 18px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    box-shadow: 0 10px 24px rgba(158, 90, 31, 0.24);
}

button:hover,
.button:hover {
    transform: translateY(-1px);
    background: var(--accent-strong);
}

.button.secondary,
button.secondary {
    background: #ead8be;
    color: #62492f;
    box-shadow: none;
}

.button.ghost,
button.ghost {
    background: rgba(255, 255, 255, 0.58);
    color: #65462a;
    border: 1px solid rgba(126, 67, 17, 0.16);
    box-shadow: none;
    backdrop-filter: blur(8px);
}

.button.danger,
button.danger {
    background: var(--danger);
    box-shadow: 0 10px 24px rgba(171, 60, 48, 0.18);
}

.compact-button {
    min-height: 36px;
    padding: 0 14px;
    font-size: 13px;
}

.block-button {
    width: 100%;
}

.page {
    max-width: 1380px;
    margin: 0 auto;
    padding: 24px 18px 48px;
}

.shell-page {
    display: grid;
    gap: 20px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.95fr);
    gap: 20px;
    align-items: stretch;
}

.hero-compact .hero-copy {
    padding-top: 24px;
    padding-bottom: 24px;
}

.hero-copy,
.hero-side,
.panel,
.glass-card {
    border: 1px solid rgba(220, 201, 171, 0.68);
    box-shadow: var(--shadow);
}

.hero-copy {
    position: relative;
    overflow: hidden;
    padding: 34px;
    border-radius: 34px;
    background:
        linear-gradient(135deg, rgba(109, 61, 20, 0.94), rgba(158, 90, 31, 0.82)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0));
    color: #fff7f0;
}

.hero-copy::after {
    content: "";
    position: absolute;
    inset: auto -60px -80px auto;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(255, 240, 214, 0.36), transparent 70%);
}

.hero-kicker {
    display: inline-flex;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.hero-copy h1,
.brand h1,
.brand h2 {
    margin: 14px 0 10px;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.12;
    letter-spacing: 0.02em;
}

.hero-copy p,
.brand p {
    margin: 0;
    max-width: 720px;
    color: rgba(255, 244, 232, 0.86);
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.hero-side {
    display: grid;
    gap: 16px;
    align-content: start;
}

.hero-side-equal {
    height: 100%;
}

.glass-card {
    padding: 22px;
    border-radius: 26px;
    background: rgba(255, 251, 245, 0.72);
    backdrop-filter: blur(16px);
}

.glass-card-stretch {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.glass-title {
    color: var(--muted);
    font-size: 13px;
}

.glass-value {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 800;
}

.glass-meta {
    margin: 10px 0 16px;
    color: #6a5845;
    line-height: 1.7;
    font-size: 14px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 6px;
}

.userbox {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(158, 90, 31, 0.10);
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 700;
}

.panel {
    background: var(--panel);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(220, 201, 171, 0.68);
    background: linear-gradient(180deg, rgba(255, 249, 239, 0.9), rgba(255, 252, 247, 0.75));
}

.panel-header h3 {
    margin: 0;
    font-size: 20px;
}

.panel-header p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 13px;
}

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

.panel-body {
    padding: 24px;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.9fr);
    gap: 20px;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field label {
    font-size: 14px;
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 13px 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(158, 90, 31, 0.55);
    box-shadow: 0 0 0 4px rgba(158, 90, 31, 0.10);
}

.field input[readonly] {
    background: #f8f1e6;
    color: #634e39;
}

.comparison-field {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
}


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

.filters {
    display: grid;
    gap: 16px;
}

.filters-rich {
    grid-template-columns: 2fr 1fr 1fr auto;
    align-items: end;
}

.filter-grid-advanced {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.filter-grid-compact {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.filter-grid-tight {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 10px 12px;
}

.filter-grid-tight .field label {
    font-size: 13px;
}

.filter-grid-tight .field input,
.filter-grid-tight .field select {
    padding: 10px 12px;
    min-height: 42px;
    border-radius: 14px;
}

.compact-panel .panel-body {
    padding-top: 16px;
    padding-bottom: 16px;
}

.compact-actions {
    grid-column: span 2;
}

.compact-actions-row {
    grid-column: 1 / -1;
    justify-content: flex-end;
    margin-top: 2px;
}

.query-actions {
    align-items: center;
}

.checkbox-row {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    min-height: 52px;
    padding: 8px 0;
}

.checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.checkbox-panel {
    padding: 14px;
    border: 1px solid rgba(220, 201, 171, 0.78);
    border-radius: 18px;
    background: rgba(255, 250, 242, 0.86);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stats-hero .stat-card {
    min-height: 148px;
}

.stat-card {
    display: grid;
    gap: 10px;
    align-content: start;
    padding: 22px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.95), rgba(246, 237, 222, 0.82));
    border: 1px solid rgba(220, 201, 171, 0.78);
}

.stat-card.featured {
    background: linear-gradient(135deg, #fff4df 0%, #efddbe 100%);
}

.stat-card span,
.stat-card small {
    color: var(--muted);
}

.stat-card strong {
    font-size: 34px;
    line-height: 1;
}

.quick-panel {
    display: grid;
    gap: 16px;
}

.quick-item {
    display: grid;
    gap: 8px;
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 248, 237, 0.92);
    border: 1px solid rgba(220, 201, 171, 0.8);
}

.quick-item strong {
    font-size: 16px;
}

.quick-item span {
    color: var(--muted);
    line-height: 1.7;
    font-size: 14px;
}

.stats-page-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.mini-chart-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 251, 245, 0.94);
    border: 1px solid rgba(220, 201, 171, 0.72);
    box-shadow: 0 10px 30px rgba(80, 56, 29, 0.06);
}

.mini-chart-card h4 {
    margin: 0;
    font-size: 16px;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.chart-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 249, 239, 0.9);
    border: 1px solid rgba(220, 201, 171, 0.78);
}

.chart-card-wide {
    grid-column: 1 / -1;
}

.chart-card h4 {
    margin: 0;
    font-size: 17px;
}

.bar-item {
    display: grid;
    gap: 7px;
}

.bar-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

.bar-track {
    height: 12px;
    border-radius: 999px;
    background: rgba(125, 92, 50, 0.12);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #9e5a1f, #d09a64);
}

.bar-fill.alt {
    background: linear-gradient(90deg, #7a4d2f, #d6ac77);
}

.bar-fill.green {
    background: linear-gradient(90deg, #2d7753, #76b597);
}

.bar-fill.red {
    background: linear-gradient(90deg, #a33f35, #d98f7e);
}

.bar-fill.gold {
    background: linear-gradient(90deg, #bb7c1f, #efc05d);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(220, 201, 171, 0.66);
    border-radius: 20px;
}


table {
    width: 100%;
    min-width: 1320px;
    border-collapse: collapse;
    background: rgba(255, 253, 249, 0.92);
}

.simple-table {
    min-width: 1500px;
}

thead {
    background: linear-gradient(180deg, #f5ead8, #f9f1e4);
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid #eee1ca;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    white-space: nowrap;
    color: #5f472c;
    font-weight: 800;
}

.simple-table .col-household_number {
    width: 90px;
    max-width: 90px;
}

.simple-table .col-name {
    width: 90px;
    max-width: 90px;
}

.simple-table .col-gender {
    width: 54px;
    max-width: 54px;
}

.simple-table .col-identity_card {
    width: 180px;
    max-width: 180px;
}

.simple-table .col-relationship_to_head {
    width: 100px;
    max-width: 100px;
}

.simple-table .col-age {
    width: 55px;
    max-width: 55px;
}

.simple-table .col-phone {
    width: 128px;
    max-width: 128px;
}

.simple-table .col-bank_card_number {
    width: 200px;
    max-width: 200px;
}

.simple-table .col-group_name {
    width: 60px;
    max-width: 60px;
}

.household-family-table {
    min-width: 2400px;
}

.lookup-form {
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 360px);
    gap: 14px;
    align-items: end;
    max-width: 700px;
}

.lookup-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
}

.lookup-page {
    max-width: 1220px;
    min-height: 100vh;
    align-content: center;
    width: 100%;
    min-width: 0;
}

.lookup-page .panel {
    overflow: hidden;
    width: 100%;
    min-width: 0;
}

.lookup-result {
    margin-top: 20px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.lookup-page .panel-header p {
    max-width: 520px;
}

.lookup-scroll-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scrollbar-width: thin;
    border-radius: 20px;
    border: 1px solid rgba(220, 201, 171, 0.66);
    background: rgba(255, 253, 249, 0.92);
}

.lookup-scroll-wrap table {
    width: max-content;
    min-width: 1080px;
}

.lookup-scroll-wrap::after {
    content: "左右滑动查看全部字段";
    display: none;
}

.lookup-dragbar {
    display: none;
    margin-top: 10px;
    padding: 0 2px;
}

.lookup-dragbar input[type="range"] {
    width: 100%;
    height: 28px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
}

.lookup-dragbar input[type="range"]::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(158, 90, 31, 0.18);
}

.lookup-dragbar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 26px;
    height: 26px;
    margin-top: -9px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(180deg, #b9702a, #8a4d19);
    box-shadow: 0 8px 18px rgba(138, 77, 25, 0.28);
}

.lookup-dragbar input[type="range"]::-moz-range-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(158, 90, 31, 0.18);
}

.lookup-dragbar input[type="range"]::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(180deg, #b9702a, #8a4d19);
    box-shadow: 0 8px 18px rgba(138, 77, 25, 0.28);
}

.simple-table .col-household_number,
.simple-table .col-name,
.simple-table .col-gender,
.simple-table .col-identity_card,
.simple-table .col-relationship_to_head,
.simple-table .col-age,
.simple-table .col-phone,
.simple-table .col-bank_card_number,
.simple-table .col-group_name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.household-family-table td {
    white-space: normal;
    word-break: break-all;
}

.household-family-table .col-household_number,
.household-family-table .col-name,
.household-family-table .col-gender,
.household-family-table .col-identity_card,
.household-family-table .col-birth_date,
.household-family-table .col-age,
.household-family-table .col-household_type,
.household-family-table .col-relationship_to_head,
.household-family-table .col-phone,
.household-family-table .col-farmland_area,
.household-family-table .col-medical_insurance_status,
.household-family-table .col-bank_card_number,
.household-family-table .col-bank_name,
.household-family-table .col-group_name {
    white-space: nowrap;
}

.household-family-table .col-name {
    width: 92px;
    max-width: 92px;
}

.household-family-table .col-gender {
    width: 56px;
    max-width: 56px;
}

.household-family-table .col-identity_card {
    width: 170px;
    max-width: 170px;
}

.household-family-table .col-phone {
    width: 122px;
    max-width: 122px;
}

.household-family-table .col-age {
    width: 56px;
    max-width: 56px;
}

.household-family-table .col-relationship_to_head {
    width: 92px;
    max-width: 92px;
}

.household-family-table .col-group_name {
    width: 70px;
    max-width: 70px;
}

.household-family-table .col-farmland_area {
    width: 78px;
    max-width: 78px;
}

.household-family-table .col-bank_card_number {
    width: 190px;
    max-width: 190px;
}

.household-family-table .col-bank_name {
    width: 128px;
    max-width: 128px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.flash {
    padding: 15px 18px;
    border-radius: 18px;
    font-size: 14px;
}

.flash.success {
    background: rgba(47, 107, 75, 0.12);
    color: var(--success);
    border: 1px solid rgba(47, 107, 75, 0.20);
}

.flash.error {
    background: rgba(171, 60, 48, 0.12);
    color: var(--danger);
    border: 1px solid rgba(171, 60, 48, 0.20);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(100%, 480px);
}

.hint {
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}

.inline-note {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f4ebde;
    color: #725942;
    font-size: 13px;
}

.empty-state {
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 42px 16px;
    border: 1px dashed rgba(158, 90, 31, 0.24);
    border-radius: 22px;
    background: rgba(255, 249, 240, 0.68);
}

.empty-state strong {
    font-size: 18px;
}

.empty-state span {
    color: var(--muted);
}

.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.page-link {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255,255,255,0.88);
    border: 1px solid rgba(220, 201, 171, 0.72);
    color: #6c4f30;
    font-weight: 700;
}

.page-link.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

.mobile-cards {
    display: grid;
    gap: 14px;
}

.resident-card {
    display: grid;
    gap: 16px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 252, 246, 0.96);
    border: 1px solid rgba(220, 201, 171, 0.82);
    box-shadow: 0 14px 34px rgba(80, 56, 29, 0.06);
}

.resident-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.resident-top strong {
    display: block;
    font-size: 20px;
}

.resident-top span {
    color: var(--muted);
    font-size: 13px;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #6d451f;
    font-weight: 700;
}

.resident-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.resident-grid div {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(248, 241, 230, 0.92);
}

.resident-grid label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.resident-grid span {
    line-height: 1.6;
    word-break: break-all;
}

@media (max-width: 1120px) {
    .hero,
    .content-grid,
    .stats,
    .chart-grid,
    .stats-page-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .page {
        padding: 16px 12px 32px;
    }

    .hero-copy,
    .glass-card,
    .panel-body,
    .panel-header {
        padding-left: 18px;
        padding-right: 18px;
    }

    .grid.cols-2,
    .grid.cols-3,
    .grid.cols-4,
    .filters-rich,
    .filter-grid-advanced,
    .filter-grid-compact,
    .resident-grid {
        grid-template-columns: 1fr;
    }

    .lookup-form {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .lookup-page {
        max-width: 100%;
        min-height: auto;
        width: 100%;
    }

    .lookup-page .panel-header h3 {
        font-size: 22px;
    }

    .lookup-page .panel-header p {
        max-width: none;
        font-size: 14px;
        line-height: 1.6;
    }

    .lookup-result {
        margin-top: 16px;
    }

    .lookup-scroll-wrap {
        margin: 0 -6px;
        padding: 0 6px 8px;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    .lookup-scroll-wrap::after {
        display: block;
        margin-top: 8px;
        color: var(--muted);
        font-size: 12px;
        text-align: right;
    }

    .lookup-dragbar {
        display: block;
        margin-top: 6px;
    }

    .panel-header-split,
    .topbar,
    .resident-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-actions,
    .userbox,
    .actions,
    .query-actions {
        width: 100%;
    }

    .button,
    button {
        width: 100%;
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
    }
}
