:root {
    --primary: #6366f1;
    --primary-light: #eef2ff;
    --accent: #f59e0b;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --input-bg: #f8fafc;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --radius: 16px;
    --red: #ef4444;
    --green: #10b981;
    --blue: #3b82f6;
    --orange: #f59e0b;
    --purple: #8b5cf6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 40%, #f0f4ff 70%, #ede9fe 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 820px;
}

.header {
    text-align: center;
    margin-bottom: 28px;
}

.header .icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin-bottom: 10px;
    box-shadow: 0 8px 24px rgba(99,102,241,0.3);
}

.header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
}

.header p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px 30px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
    border: 1px solid rgba(255,255,255,0.7);
}

.card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 2px;
}

/* 切换模式 */
.mode-tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
    gap: 4px;
    flex-wrap: wrap;
}

.mode-tab {
    flex: 1;
    padding: 10px 10px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.mode-tab.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.mode-tab:hover:not(.active) {
    color: var(--text);
}

.mode-panel { display: none; }
.mode-panel.active { display: block; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-group { margin-bottom: 4px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.input-row {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
}

.input-row:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.input-row input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 14px;
    font-size: 15px;
    color: var(--text);
    outline: none;
    min-width: 0;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
}

.input-row .suffix {
    padding: 12px 16px 12px 0;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    user-select: none;
}

.input-row .prefix {
    padding: 12px 0 12px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 结果区域 */
.result-hero {
    text-align: center;
    padding: 20px 0 10px;
}

.result-badge {
    display: inline-block;
    padding: 8px 24px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.result-value {
    font-size: 64px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
}

.result-label-sub {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* 档位尺 */
.gauge-container {
    position: relative;
    height: 50px;
    margin: 24px 0 12px;
    cursor: default;
}

.gauge-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 13px;
    transform: translateY(-50%);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
}

.gauge-segment {
    flex: 1;
    position: relative;
}

.gauge-segment:nth-child(1) { background: #fde68a; }
.gauge-segment:nth-child(2) { background: #a7f3d0; }
.gauge-segment:nth-child(3) { background: #93c5fd; }
.gauge-segment:nth-child(4) { background: #c4b5fd; }
.gauge-segment:nth-child(5) { background: #fca5a5; }

.gauge-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
    position: relative;
    z-index: 2;
}

.gauge-pointer {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gauge-pointer-dot {
    width: 22px;
    height: 22px;
    background: #fff;
    border: 3px solid #1e293b;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    position: relative;
    margin: 0 auto;
}

.gauge-pointer-label {
    position: absolute;
    top: -36px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.gauge-pointer-label::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
}

/* 档位参考表 */
.tier-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 13px;
}

.tier-table th {
    background: #f8fafc;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tier-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text);
}

.tier-table tr.current {
    background: #eef2ff;
}

.tier-table tr.current td:first-child {
    font-weight: 700;
    color: var(--primary);
}

.tier-table .badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

/* 快捷选择档位 */
.quick-tiers {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.quick-tier {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-family: inherit;
}

.quick-tier:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.quick-tier.selected {
    border-color: var(--primary);
    color: #fff;
    background: var(--primary);
}

/* 信息卡片 */
.info-cards {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    margin-top: 20px;
}

.info-card {
    background: var(--input-bg);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
}

.info-card .label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.info-card .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.info-card .value small {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.btn-row {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99,102,241,0.45);
}

.btn-outline {
    background: var(--input-bg);
    color: var(--text-secondary);
    border: 2px solid var(--border);
}

.btn-outline:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.result-section { display: none; }
.result-section.show { display: block; }

.tip-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
    color: #1e40af;
    margin-bottom: 20px;
    line-height: 1.6;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    font-size: 15px;
    color: var(--text);
    appearance: none;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}

.select-wrapper select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.select-wrapper::after {
    content: '▾';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    font-size: 12px;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeInUp 0.4s ease-out;
}

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .info-cards { grid-template-columns: 1fr; }
    .card { padding: 20px 16px; }
    .result-value { font-size: 48px; }
}

.nav-links {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 8px;
    font-size: 13px;
}

.nav-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.nav-links a:hover {
    text-decoration: underline;
}

/* 历史缴费表格 */
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.history-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.history-table th {
    background: #f1f5f9;
    padding: 8px 8px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    font-size: 12px;
    white-space: nowrap;
}

.history-table td {
    padding: 6px 6px;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.history-table td input {
    width: 100%;
    padding: 7px 8px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    background: var(--input-bg);
    color: var(--text);
    outline: none;
    transition: all 0.2s;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    min-width: 70px;
}

.history-table td input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}

.history-table .index-cell {
    font-weight: 700;
    font-size: 14px;
    border-radius: 6px;
    padding: 4px 6px;
}

.history-table .del-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: #fef2f2;
    color: #ef4444;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    line-height: 30px;
    padding: 0;
}

.history-table .del-btn:hover {
    background: #fee2e2;
}

/* 历年各省社平工资查询表 */
.province-salary-section {
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.province-salary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    background: #f8fafc;
    transition: background 0.2s;
}

.province-salary-header:hover {
    background: #f1f5f9;
}

.province-salary-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.province-salary-arrow {
    font-size: 11px;
    color: var(--text-secondary);
    transition: transform 0.25s ease;
}

.province-salary-section.open .province-salary-arrow {
    transform: rotate(180deg);
}

.province-salary-body {
    display: none;
    padding: 14px 16px 16px;
}

.province-salary-section.open .province-salary-body {
    display: block;
}

.province-search-wrap {
    margin-bottom: 12px;
}

.province-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text);
    outline: none;
    background: var(--input-bg);
    font-family: inherit;
    transition: all 0.2s;
}

.province-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.province-table-wrap {
    max-height: 340px;
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.province-table {
    width: 100%;
    min-width: max-content;
    border-collapse: collapse;
    font-size: 12px;
}

.province-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.province-table th {
    padding: 7px 6px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    background: #f1f5f9;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-size: 11px;
}

.province-table td {
    padding: 5px 6px;
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s;
    font-variant-numeric: tabular-nums;
}

.province-table td:first-child,
.province-table th:first-child {
    text-align: center;
    position: sticky;
    left: 0;
    z-index: 3;
    background: inherit;
}

.province-table thead th:first-child {
    z-index: 4;
}

.province-table tbody tr:hover td {
    background: #eef2ff;
}

.province-table tbody tr:hover td:first-child {
    background: #e0e7ff;
    font-weight: 700;
    color: var(--primary);
}

.province-table td:hover {
    background: #c7d2fe !important;
    font-weight: 700;
}

.province-table td.cell-province {
    text-align: left;
    font-weight: 600;
    color: var(--text);
    cursor: default;
}

.province-table td.cell-province:hover {
    background: inherit !important;
}

.province-table .hidden-row { display: none; }

.province-table td input.province-edit-input {
    width: 100%;
    min-width: 56px;
    padding: 3px 4px;
    border: 2px solid var(--primary);
    border-radius: 4px;
    font-size: 12px;
    text-align: right;
    background: #fff;
    color: var(--text);
    outline: none;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-variant-numeric: tabular-nums;
}

.province-table td.editing {
    padding: 2px 3px;
}

.province-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.province-toolbar label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.province-toolbar input[type="number"] {
    width: 72px;
    padding: 6px 8px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    background: var(--input-bg);
    color: var(--text);
    outline: none;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
}

.province-toolbar input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.province-toolbar .btn-small {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-small-add {
    background: var(--primary);
    color: #fff;
}
.btn-small-add:hover {
    background: #4f46e5;
}

.btn-small-del {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca !important;
}
.btn-small-del:hover {
    background: #fee2e2;
}

.btn-small-reset {
    background: var(--input-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border) !important;
}
.btn-small-reset:hover {
    background: #f1f5f9;
}

.province-table .province-header-year {
    cursor: pointer;
    user-select: none;
}

.province-table .province-header-year:hover {
    background: #e2e8f0;
}

.province-table .province-header-year.selected-for-del {
    background: #fee2e2 !important;
    color: #ef4444 !important;
}
