/* ===================================================================
   标准法律 · 法律计算器 统一样式表 (calculator.css)
   风格：藏青学术典雅 —— 衬线字体、纸面质感、细线饰边（2026-08-30 定稿）
   全部计算器子页与信息页共用；品牌色取自标准法律 logo（深藏青 + 卡其）
   =================================================================== */

/* ---------- 设计变量 ---------- */
:root {
    /* 字体：西文衬线优先，中文宋体族；about 页同款 */
    --serif: Georgia, "Times New Roman", "Songti SC", "STSong",
        "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;

    --navy-deep: #071d30;            /* 墨藏青：标题/页脚 */
    --navy: #1b4a72;                 /* 主藏青：交互 */
    --navy-hover: #12385a;
    --navy-soft: rgba(27, 74, 114, 0.07);
    --khaki: #b3a592;                /* 卡其：点缀 */
    --khaki-strong: #9a8a72;
    --khaki-soft: rgba(179, 165, 146, 0.16);

    --paper: #f4f0e6;                /* 页面底色：宣纸暖白 */
    --ivory: #fdfbf5;                /* 卡片：象牙白 */
    --ivory-dim: #f8f4ea;

    --text-primary: #26313b;
    --text-secondary: #66707a;
    --line: #ddd5c4;                 /* 常规细线 */
    --line-strong: rgba(7, 29, 48, 0.35);

    --radius-small: 4px;
    --radius-medium: 6px;
    --radius-large: 8px;
    --shadow: 0 1px 3px rgba(7, 29, 48, 0.07);
    --shadow-hover: 0 3px 10px rgba(7, 29, 48, 0.1);
    --focus-ring: 0 0 0 3px rgba(27, 74, 114, 0.16);
    --transition: all 0.22s ease;

    /* 页面统一留白（页头/页脚全出血反推用） */
    --pad: clamp(12px, 2.6vw, 26px);

    /* 旧变量别名（大量页面内联样式仍在引用，勿删） */
    --primary-color: var(--navy);
    --primary-hover: var(--navy-hover);
    --secondary-color: var(--text-secondary);
    --background-color: var(--paper);
    --card-bg: var(--ivory);
    --card-bg-hover: var(--ivory);
    --border-color: var(--line);
    --warning-color: #b3402e;       /* 必填星号/警示（此前从未定义过，顺带补齐） */
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--serif);
    background-color: var(--paper);
    background-image: linear-gradient(180deg, #f7f3ea 0%, var(--paper) 240px);
    color: var(--text-primary);
    line-height: 1.75;
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: var(--pad);
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--khaki-soft);
    color: var(--navy-deep);
}

/* ---------- 顶部导航（纸面吸顶 + 双细线） ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) clamp(20px, 4vw, 30px);
    padding: 10px clamp(14px, 3vw, 24px);
    background: var(--paper);
    border-bottom: 3px double var(--line-strong);
}

.header-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.header-brand img {
    height: 32px;
    width: auto;
    display: block;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.header-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    padding: 6px 12px;
    border-radius: var(--radius-small);
    transition: var(--transition);
}

.header-nav a:hover {
    color: var(--navy);
    background: var(--khaki-soft);
}

/* ---------- 容器与卡片 ---------- */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 0 clamp(28px, 5vw, 46px);
    width: 100%;
    flex: 1;
}

.card {
    background: var(--ivory);
    border-radius: var(--radius-large);
    padding: clamp(20px, 4vw, 32px);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.widget-card {
    background: var(--ivory);
    border-radius: var(--radius-medium);
    padding: 18px 20px;
    border: 1px solid var(--line);
    margin-bottom: 18px;
}

/* ---------- 标题 ---------- */
h1 {
    font-size: clamp(1.6rem, 4.5vw, 2.2rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: 14px;
    color: var(--navy-deep);
    letter-spacing: 0.05em;
    line-height: 1.35;
}

/* 标题下的卡其饰线 */
h1::after {
    content: "";
    display: block;
    width: 52px;
    height: 3px;
    margin: 14px auto 0;
    border-top: 1px solid var(--khaki-strong);
    border-bottom: 1px solid var(--khaki-strong);
}

h2, h3, h4 {
    color: var(--navy-deep);
    letter-spacing: 0.03em;
    line-height: 1.4;
}

.page-desc {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    margin: 0 0 26px;
}

/* ---------- 按钮 ---------- */
.btn {
    background-color: var(--navy);
    color: #f6f2e9;
    border: 1px solid var(--navy-deep);
    padding: 13px 20px;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-family: var(--serif);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-indent: 0.14em; /* 视觉居中补偿 */
    min-height: 48px;
    width: 100%;
    transition: var(--transition);
    margin-top: 10px;
}

.btn:hover {
    background-color: var(--navy-hover);
}

.btn:active {
    transform: translateY(1px);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ---------- 表单 ---------- */
label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.97rem;
    color: var(--navy-deep);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.form-group {
    margin-bottom: 22px;
}

.calculator-container {
    width: 100%;
}

select,
input[type="number"],
input[type="text"],
input[type="date"],
textarea {
    -webkit-appearance: none;
    appearance: textfield;
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    font-size: 16px; /* ≥16px，避免 iOS 聚焦缩放 */
    background-color: #fff;
    color: var(--text-primary);
    font-family: var(--serif);
    line-height: 1.5;
    transition: var(--transition);
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231b4a72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 15px;
    cursor: pointer;
    padding-right: 40px;
}

select:hover,
input[type="date"]:hover {
    border-color: var(--khaki-strong);
}

select:focus,
input[type="number"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background-color: var(--ivory-dim);
}

input.error,
select.error {
    border-color: #b3402e;
}

input.error:focus,
select.error:focus {
    border-color: #b3402e;
    box-shadow: 0 0 0 3px rgba(179, 64, 46, 0.12);
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    accent-color: var(--navy);
    flex: none;
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: 400;
    color: var(--text-primary);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* ---------- 选项卡（学术下划线式） ---------- */
.tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--line);
    background: transparent;
    border-radius: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 12px 18px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--serif);
    font-weight: 500;
    flex: 1 0 auto;
    text-align: center;
    white-space: nowrap;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    letter-spacing: 0.03em;
}

.tab:hover {
    color: var(--navy);
}

.tab.active {
    background: transparent;
    color: var(--navy);
    font-weight: 700;
    border-bottom: 2px solid var(--navy);
}

/* ---------- 结果区域 ---------- */
.result {
    margin-top: 28px;
    padding: clamp(18px, 3.5vw, 26px);
    background-color: var(--ivory);
    border-radius: var(--radius-medium);
    border: 1px solid var(--line);
    border-left: 4px solid var(--navy);
    display: none;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.result.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.result h2 {
    font-size: 1.28rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    color: var(--navy-deep);
}

.fee-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dotted var(--line);
    font-size: 0.96rem;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.fee-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.fee-item strong {
    color: var(--text-secondary);
    font-weight: 600;
}

.date-result {
    color: var(--navy);
    font-weight: 600;
}

.amount-result {
    font-weight: 700;
    color: var(--navy);
}

.note-small {
    font-size: 0.855rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.help-text {
    font-size: 0.855rem;
    color: var(--text-secondary);
    margin-top: 5px;
    line-height: 1.65;
}

.note {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 28px;
    padding: 4px 0 4px 14px;
    border-left: 3px solid var(--khaki);
    line-height: 1.8;
}

.note p {
    margin-bottom: 6px;
}

.note p:last-child {
    margin-bottom: 0;
}

.warning {
    color: #b3402e;
    font-weight: 700;
}

/* ---------- 通用显隐（页面脚本依赖） ---------- */
.hidden {
    display: none !important;
}

/* ---------- 动态列表项 ---------- */
.property-item {
    background-color: var(--ivory-dim);
    padding: 14px 16px;
    margin-bottom: 14px;
    border-radius: var(--radius-small);
    border: 1px solid var(--line);
}

.property-header {
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--navy-deep);
}

.split-inputs {
    display: flex;
    gap: 10px;
}

.split-inputs input {
    flex: 1;
    min-width: 0;
}

.shareholder-list {
    margin-bottom: 15px;
}

.shareholder-item {
    display: flex;
    margin-bottom: 10px;
}

.shareholder-item input {
    flex: 1;
    min-width: 0;
    margin-right: 10px;
}

.shareholder-item button {
    width: auto;
    min-width: 84px;
    padding: 10px 15px;
    margin-top: 0;
}

.add-btn {
    margin-bottom: 20px;
}

/* ---------- 表格（学术三线表气质） ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background-color: var(--ivory);
    border: 1px solid var(--line);
    font-size: 0.93rem;
}

th, td {
    padding: 10px 13px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
}

th {
    background-color: var(--navy-soft);
    color: var(--navy-deep);
    font-weight: 700;
    border-bottom: 2px solid var(--navy);
}

tr:nth-child(even) {
    background-color: rgba(248, 244, 234, 0.6);
}

/* ---------- 页脚 ---------- */
.site-footer {
    margin: clamp(28px, 5vw, 44px) calc(-1 * var(--pad)) calc(-1 * var(--pad));
    padding: 30px clamp(16px, 3vw, 24px) 32px;
    background: var(--navy-deep);
    border-top: 3px double var(--khaki);
    color: rgba(255, 255, 255, 0.72);
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

.footer-brand img {
    height: 30px;
    width: auto;
    display: block;
}

.footer-name {
    color: #f6f2e9;
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: 0.22em;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 4px 18px;
    flex-wrap: wrap;
    padding: 4px 0 14px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    padding: 4px 8px;
    transition: var(--transition);
}

.footer-links a:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.footer-copy {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.52);
}

.footer-copy a {
    color: var(--khaki);
    text-decoration: none;
}

.footer-copy a:hover {
    text-decoration: underline;
}

.footer-beian {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 18px;
}

.footer-beian a {
    color: rgba(255, 255, 255, 0.52);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
}

.footer-beian a:hover {
    color: var(--khaki);
}

.beian-icon {
    width: 14px;
    height: auto;
    display: inline-block;
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--ivory-dim);
}

::-webkit-scrollbar-thumb {
    background: rgba(27, 74, 114, 0.28);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(27, 74, 114, 0.48);
}

/* ---------- 动效 ---------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result.show {
    animation: fadeInUp 0.45s ease forwards;
}

/* ---------- 响应式 ---------- */
/* 平板：收紧卡片留白，结果数值行允许换行 */
@media (max-width: 820px) {
    .fee-item {
        font-size: 0.94rem;
    }
}

/* 手机 */
@media (max-width: 560px) {
    .site-header {
        padding: 8px 12px;
    }

    .header-brand img {
        height: 26px;
    }

    .header-nav a {
        padding: 5px 8px;
        font-size: 0.85rem;
    }

    .card {
        padding: 20px 16px;
        border-radius: var(--radius-medium);
    }

    .widget-card {
        padding: 14px;
    }

    .tabs {
        margin-bottom: 18px;
    }

    .tab {
        flex: 1 0 auto;
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .result {
        margin-top: 22px;
    }

    .result h2 {
        font-size: 1.12rem;
    }

    .split-inputs {
        flex-wrap: wrap;
    }

    .split-inputs input {
        min-width: 46%;
    }

    .shareholder-item {
        flex-wrap: nowrap;
    }

    /* 窄屏表格横向滚动 */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .site-footer {
        padding: 24px 16px 26px;
    }

    .footer-name {
        font-size: 1rem;
        letter-spacing: 0.16em;
    }
}

/* 触控设备：加大可点区域 */
@media (pointer: coarse) {
    .header-nav a,
    .footer-links a {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .tab {
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
