/* ======================================================================
 *  税后工资反推税前 /tools/net-to-gross
 *  依赖 home.css 全局变量 + tool-detail.css 公共类，支持黑夜模式
 * ====================================================================== */

/* 隐藏态兜底：避免 [hidden] 被组件自身的 display:flex 规则覆盖而常显 */
[hidden] { display: none !important; }

.ng-layout {
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 24px;
    align-items: start;
}
.ng-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}
.ng-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 18px;
}

/* ---------- 表单 ---------- */
.ng-field { margin-bottom: 16px; }
.ng-field > label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-sub);
    margin-bottom: 7px;
}
.ng-input-wrap { position: relative; display: flex; align-items: center; }
.ng-input {
    width: 100%;
    height: 43px;
    padding: 0 52px 0 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--c-text);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
    -moz-appearance: textfield;
}
.ng-input::-webkit-outer-spin-button,
.ng-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ng-input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}
.ng-input--pre { padding-left: 34px; }
.ng-select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 36px;
    font-size: 13px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a8' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
}
.ng-prefix {
    position: absolute;
    left: 14px;
    font-size: 13px;
    color: var(--c-text-muted);
    pointer-events: none;
}
.ng-suffix {
    position: absolute;
    right: 14px;
    font-size: 12px;
    color: var(--c-text-muted);
    pointer-events: none;
}
.ng-help {
    font-size: 11.5px;
    line-height: 1.65;
    color: var(--c-text-muted);
    margin-top: 6px;
}
.ng-help b { color: var(--c-text-sub); }

.ng-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 800;
    color: var(--c-text);
    margin: 20px 0 14px;
}
.ng-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--c-border);
    order: -1;
}

.btn-block { width: 100%; margin-top: 8px; }

/* ---------- 结果区 ---------- */
.ng-result-card { min-height: 320px; }
.ng-result-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 300px;
    text-align: center;
    color: var(--c-text-muted);
    font-size: 13.5px;
    line-height: 1.8;
}
.ng-result-empty .emoji { font-size: 46px; opacity: 0.75; }

.ng-result-body { animation: ngFade 0.28s ease; }
@keyframes ngFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.ng-hero {
    padding: 22px 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.10), rgba(0, 200, 150, 0.08));
    border: 1px solid rgba(0, 102, 255, 0.2);
    margin-bottom: 14px;
}
.ng-hero-label { font-size: 12.5px; color: var(--c-text-sub); margin-bottom: 6px; }
.ng-hero-num {
    display: flex;
    align-items: baseline;
    gap: 4px;
    color: var(--c-primary);
    line-height: 1.1;
}
.ng-hero-num .cur { font-size: 20px; font-weight: 700; }
.ng-hero-num b { font-size: 40px; font-weight: 800; letter-spacing: -0.035em; }
.ng-hero-sub { font-size: 12.5px; color: var(--c-text-sub); margin-top: 8px; }

.ng-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.ng-split-item {
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
}
.ng-split-num {
    font-size: 18px;
    font-weight: 800;
    color: var(--c-text);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.ng-split-key { font-size: 11.5px; color: var(--c-text-muted); }

.ng-bill {
    list-style: none;
    border: 1px solid var(--c-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
}
.ng-bill li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--c-border);
}
.ng-bill li:last-child { border-bottom: none; }
.ng-bill .k { color: var(--c-text-sub); }
.ng-bill .v { font-weight: 700; color: var(--c-text); }
.ng-bill li.total { background: var(--c-surface-soft); }
.ng-bill li.total .v { color: var(--c-accent-green); }

/* 构成条 */
.ng-meter {
    padding: 15px 18px;
    border-radius: 14px;
    border: 1px solid var(--c-border);
    background: var(--c-surface-soft);
    margin-bottom: 14px;
}
.ng-meter-label { font-size: 12px; font-weight: 700; color: var(--c-text-sub); margin-bottom: 10px; }
.ng-meter-bar {
    display: flex;
    height: 14px;
    border-radius: 7px;
    overflow: hidden;
    background: var(--c-border);
}
.ng-meter-bar .seg { display: block; height: 100%; transition: width 0.3s ease; }
.ng-meter-bar .seg-net { background: var(--c-accent-green); }
.ng-meter-bar .seg-ins { background: var(--c-primary); }
.ng-meter-bar .seg-tax { background: var(--c-accent-orange); }
.ng-meter-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    margin-top: 11px;
    font-size: 11.5px;
    color: var(--c-text-muted);
}
.ng-meter-legend .dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 4px;
}
.ng-meter-legend .dot-net { background: var(--c-accent-green); }
.ng-meter-legend .dot-ins { background: var(--c-primary); }
.ng-meter-legend .dot-tax { background: var(--c-accent-orange); }
.ng-meter-legend b { color: var(--c-text); }

.ng-note {
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--c-text-sub);
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--c-primary-soft);
    border: 1px dashed rgba(0, 102, 255, 0.28);
}
.ng-note b { color: var(--c-text); }

/* ---------- 对照表 ---------- */
.ng-table-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 20px;
}
.ng-table-head { margin-bottom: 14px; }
.ng-table-head .ng-title { margin-bottom: 4px; }
.ng-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}
.ng-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 560px;
}
.ng-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
.ng-table tbody td {
    padding: 11px 16px;
    color: var(--c-text-sub);
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}
.ng-table tbody tr:last-child td { border-bottom: none; }
.ng-table tbody td b { color: var(--c-text); font-weight: 700; }
.ng-table tbody td.c-gross { color: var(--c-primary); font-weight: 700; }
.ng-table tbody td.c-tax { color: var(--c-accent-orange); font-weight: 600; }
.ng-table tbody tr.is-current { background: var(--c-primary-soft); }
.ng-table tbody tr.is-current td { color: var(--c-text); }
.ng-table-empty {
    text-align: center;
    color: var(--c-text-muted) !important;
    padding: 30px 16px !important;
}

/* ---------- 免责 / 简介 ---------- */
.ng-disclaim {
    font-size: 12px;
    line-height: 1.85;
    color: var(--c-text-muted);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 26px;
}
.ng-info { margin-bottom: 26px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
    .ng-layout { grid-template-columns: 1fr; }
    .ng-result-card { min-height: auto; }
    .ng-result-empty { min-height: 180px; }
}
@media (max-width: 620px) {
    .ng-card, .ng-table-card { padding: 18px; }
    .ng-hero-num b { font-size: 32px; }
    .ng-split { grid-template-columns: 1fr; }
    .ng-bill li { flex-direction: column; align-items: flex-start; gap: 4px; }
    .ng-bill .v { text-align: left; }
}

/* ============ 黑夜模式 ============ */
[data-theme="dark"] .ng-input { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .ng-input option { background: #131c31; color: #e5e9f0; }
[data-theme="dark"] .ng-hero {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(0, 200, 150, 0.13));
    border-color: rgba(59, 130, 246, 0.28);
}
[data-theme="dark"] .ng-hero-num { color: #6ea8ff; }
[data-theme="dark"] .ng-note {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.32);
}
[data-theme="dark"] .ng-split-item,
[data-theme="dark"] .ng-meter,
[data-theme="dark"] .ng-bill li.total,
[data-theme="dark"] .ng-table thead th,
[data-theme="dark"] .ng-disclaim { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .ng-table tbody tr.is-current { background: rgba(59, 130, 246, 0.14); }
[data-theme="dark"] .ng-table tbody td.c-gross { color: #6ea8ff; }
[data-theme="dark"] .ng-bill li.total .v { color: #34d399; }
