:root {
    --ink: #17211b;
    --muted: #6f776f;
    --paper: #f2f0e9;
    --surface: #fffef9;
    --line: #dcd9ce;
    --green: #184f3a;
    --green-2: #2d7355;
    --lime: #c7e657;
    --amber: #d68d2d;
    --red: #b54a3b;
    --shadow: 0 16px 40px rgba(30, 42, 34, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: "Avenir Next", "Noto Sans SC", "PingFang SC", sans-serif;
    color: var(--ink);
    background:
        linear-gradient(rgba(23,33,27,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23,33,27,.025) 1px, transparent 1px),
        var(--paper);
    background-size: 24px 24px;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { display: grid; grid-template-columns: 246px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; padding: 26px 18px;
    background: var(--ink); color: #f7f4e9; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; border-bottom: 1px solid rgba(255,255,255,.12); }
.beta-pill { margin-left:auto; padding:4px 7px; border:1px solid rgba(199,230,87,.5); border-radius:99px; color:var(--lime); font-size:8px; font-weight:800; white-space:nowrap; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--lime); color: var(--ink); font-weight: 800; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; letter-spacing: .08em; }
.brand span { margin-top: 2px; font-size: 11px; color: rgba(255,255,255,.55); }
.step-nav { display: grid; gap: 6px; margin-top: 24px; }
.step-link {
    width: 100%; border: 0; color: rgba(255,255,255,.58); background: transparent;
    padding: 12px 10px; border-radius: 10px; display: grid; grid-template-columns: 34px 1fr;
    text-align: left; align-items: center; transition: .2s ease;
}
.step-link span { grid-row: 1 / 3; font: 700 11px/1 "SFMono-Regular", Consolas, monospace; color: rgba(255,255,255,.36); }
.step-link b { font-size: 13px; letter-spacing: .03em; }
.step-link small { font-size: 10px; margin-top: 2px; opacity: .62; }
.step-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.step-link.active { background: var(--lime); color: var(--ink); }
.step-link.active span { color: var(--green); }
.sidebar-foot { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 14px 10px; background: rgba(255,255,255,.06); border-radius: 10px; }
.sidebar-link { margin-top:8px; border:0; background:transparent; color:rgba(255,255,255,.55); padding:8px; font-size:9px; text-decoration:underline; text-underline-offset:3px; }
.sidebar-foot b, .sidebar-foot small { display: block; }
.sidebar-foot b { font-size: 11px; }
.sidebar-foot small { font-size: 9px; opacity: .55; margin-top: 2px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(199,230,87,.12); }
.workspace { min-width: 0; padding: 34px clamp(28px, 4vw, 64px) 90px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 34px; }
.eyebrow { margin: 0 0 7px; color: var(--green-2); font: 700 10px/1 "SFMono-Regular", Consolas, monospace; letter-spacing: .2em; }
h1 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: clamp(30px, 4vw, 46px); font-weight: 700; letter-spacing: -.03em; }
.top-stats { display: flex; border: 1px solid var(--line); background: rgba(255,254,249,.72); border-radius: 12px; overflow: hidden; }
.top-stats div { min-width: 88px; padding: 10px 16px; border-left: 1px solid var(--line); text-align: center; }
.top-stats div:first-child { border-left: 0; }
.top-stats small, .top-stats strong { display: block; }
.top-stats small { color: var(--muted); font-size: 10px; }
.top-stats strong { margin-top: 2px; font-size: 18px; font-variant-numeric: tabular-nums; }
.step-panel { display: none; animation: enter .28s ease both; }
.step-panel.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
.section-heading { display: flex; justify-content: space-between; gap: 28px; align-items: end; margin-bottom: 18px; }
.section-heading > div { display: flex; align-items: center; gap: 12px; }
.section-heading h2 { margin: 0; font-size: 19px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 12px; max-width: 430px; text-align: right; }
.section-no { font: 800 10px/1 "SFMono-Regular", Consolas, monospace; color: var(--green); border-bottom: 3px solid var(--lime); padding-bottom: 4px; }
.public-notice { display:grid; grid-template-columns:auto 1fr auto; gap:12px; align-items:center; margin-bottom:18px; padding:11px 14px; border:1px solid #d6d9b2; border-radius:10px; background:#f7f9df; color:#4e5841; font-size:10px; }
.public-notice b { color:var(--green); }
.public-notice button { border:0; background:transparent; color:var(--green); font-weight:800; text-decoration:underline; }
.panel-grid { display: grid; gap: 18px; }
.panel-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.panel-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.stack { display: grid; gap: 18px; align-content: start; }
.surface {
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px;
    box-shadow: 0 1px 0 rgba(255,255,255,.8), var(--shadow);
}
.surface h3 { margin: 0 0 17px; font-size: 14px; letter-spacing: .02em; }
.surface-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 17px; }
.surface-head h3 { margin: 0; }
.subtle-copy { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.deduction-divider { border-top: 1px solid var(--line); margin: 20px 0 16px; }
.surface-head.deduction-head { margin-bottom: 14px; }
.accent-surface { border-top: 4px solid var(--green); }
.field-grid { display: grid; gap: 14px; }
.field-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.field { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.field input, .field select, .surface-head select, .year-row select {
    width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
    color: var(--ink); padding: 8px 10px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(45,115,85,.11); }
.field small { color: #92978e; font-size: 9px; }
.field.readonly output { min-height: 38px; display: flex; align-items: center; padding: 8px 10px; background: #edf3e9; color: var(--green); border-radius: 8px; font-weight: 700; }
.field.compact { grid-template-columns: auto 120px; align-items: center; }
.formula-note, .info-note { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 10px; }
.badge { padding: 4px 8px; border-radius: 999px; background: #e8f1df; color: var(--green); font-size: 10px; font-weight: 700; }
.badge.neutral { background: #f1efe8; color: var(--muted); }
.year-row, .toolbar, .calendar-toolbar { display: flex; align-items: end; gap: 9px; flex-wrap: wrap; }
.year-row { justify-content: space-between; }
.month-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 18px; }
.month-button { border: 1px solid var(--line); background: #fff; min-height: 42px; border-radius: 8px; color: var(--muted); }
.month-button.selected { background: var(--green); border-color: var(--green); color: #fff; box-shadow: inset 0 -3px 0 var(--lime); }
.selected-chips { display: flex; gap: 6px; flex-wrap: wrap; min-height: 28px; margin-top: 15px; }
.chip { background: #edf3e9; color: var(--green); border-radius: 999px; padding: 5px 9px; font-size: 10px; font-weight: 700; }
.muted { color: var(--muted); font-size: 11px; }
.btn { min-height: 36px; border: 1px solid transparent; border-radius: 8px; padding: 7px 13px; font-size: 11px; font-weight: 700; transition: .18s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-2); }
.btn.secondary { background: #eef0e9; border-color: var(--line); color: var(--ink); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.danger-text { background: transparent; color: var(--red); }
.btn.large { min-height: 48px; padding-inline: 24px; font-size: 13px; }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.toolbar { margin-bottom: 16px; }
.inline-status { min-height:15px; margin:-8px 0 10px; color:var(--muted); font-size:10px; }
.inline-status.error { color:var(--red); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10px; min-width: 940px; }
.data-table th { position: sticky; top: 0; z-index: 1; background: #eef0e9; color: #596159; padding: 9px 8px; text-align: left; white-space: nowrap; }
.data-table td { border-top: 1px solid #ece9df; padding: 6px; background: #fff; }
.data-table input, .data-table select { width: 100%; min-width: 70px; border: 1px solid transparent; background: transparent; border-radius: 5px; padding: 6px; font-size: 10px; }
.data-table input:focus, .data-table select:focus { outline: none; border-color: var(--green-2); background: #fff; }
.data-table .icon-btn { border: 0; background: transparent; color: #9b6a62; font-size: 16px; }
.target-table { min-width: 820px; }
.target-table td:nth-child(-n+3) { color: var(--muted); white-space: nowrap; }
.weekly-preview-surface { margin-bottom: 18px; }
.weekly-table { min-width: 720px; }
.decision-dialog { width: min(860px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 16px; padding: 24px; color: var(--ink); box-shadow: 0 24px 70px rgba(24,31,25,.24); }
.decision-dialog::backdrop { background: rgba(22,29,24,.48); backdrop-filter: blur(3px); }
.dialog-head h2 { margin: 10px 0 6px; font-size: 19px; }
.dialog-head p { margin: 0 0 18px; color: var(--muted); font-size: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.empty-state { display: grid; place-items: center; text-align: center; padding: 44px 20px; color: var(--muted); }
.table-wrap:not(.hidden) + .empty-state { display: none; }
.empty-state div { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #eef0e9; color: var(--green); font-family: serif; }
.empty-state h3 { margin: 10px 0 4px; color: var(--ink); }
.empty-state p { margin: 0; font-size: 11px; }
.empty-state.compact { padding: 28px; }
.time-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 10px; color: var(--muted); }
.toggle input { display: none; }
.toggle span { width: 34px; height: 18px; border-radius: 99px; background: #c9cbc5; position: relative; transition: .2s; }
.toggle span::after { content:""; position:absolute; width:14px; height:14px; top:2px; left:2px; background:#fff; border-radius:50%; transition:.2s; }
.toggle input:checked + span { background: var(--green); }
.toggle input:checked + span::after { transform: translateX(16px); }
.disabled-block { opacity: .43; pointer-events: none; }
.disabled-block.enabled { opacity: 1; pointer-events: auto; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 8px; padding: 3px; background: #f1efe8; }
.segmented button { border: 0; padding: 8px; border-radius: 6px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; }
.segmented button.active { background: #fff; color: var(--green); box-shadow: 0 1px 5px rgba(0,0,0,.08); }
.top-gap { margin-top: 14px; }
.night-hours-summary { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:10px; }
.night-hours-summary span { display:flex; justify-content:space-between; gap:8px; padding:9px 10px; border-radius:8px; background:#eef0e9; color:var(--muted); font-size:10px; }
.night-hours-summary output { color:var(--green); font-weight:800; }
.check-line { display: grid; grid-template-columns: 18px auto 90px auto; align-items: center; gap: 8px; margin-top: 14px; font-size: 10px; color: var(--muted); }
.check-line input[type=checkbox] { accent-color: var(--green); }
.check-line input[type=number] { min-height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 6px; }
.check-line em { font-style: normal; font-size: 9px; }
.check-line.plain { grid-template-columns: 18px 1fr; }
.option-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.option-grid label { border: 1px solid var(--line); border-radius: 8px; padding: 9px; font-size: 10px; background: #fff; }
.option-grid input { accent-color: var(--green); margin-right: 5px; }
.constraint-result { margin-top: 16px; padding: 13px; border-radius: 9px; display: grid; gap: 3px; font-size: 10px; }
.constraint-result b { font-size: 11px; }
.constraint-result.neutral { background: #f1efe8; color: var(--muted); }
.constraint-result.pass { background: #e7f1e4; color: var(--green); }
.constraint-result.fail { background: #fae8e2; color: var(--red); }
.surface-subtitle { margin:4px 0 0; color:var(--muted); font-size:10px; }
.range-list { display:grid; gap:10px; margin-top:14px; }
.range-empty { padding:18px; border:1px dashed var(--line); border-radius:10px; color:var(--muted); text-align:center; background:#fafbfd; font-size:10px; }
.range-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) 120px auto; gap:10px; align-items:end; padding:11px; border:1px solid var(--line); border-radius:10px; background:#fafbfd; }
.range-row .field { margin:0; }
.range-remove { min-height:38px; }
.calendar-toolbar { margin-bottom: 10px; }
.calendar { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; user-select: none; }
.calendar-header, .calendar-body { display: grid; grid-template-columns: repeat(7,1fr); }
.calendar-header { background: #eef0e9; }
.calendar-header span { padding: 7px 2px; text-align: center; color: var(--muted); font-size: 9px; font-weight: 700; }
.calendar-day { min-height: 52px; border-top: 1px solid #ece9df; border-right: 1px solid #ece9df; padding: 6px; background: #fff; cursor: pointer; position: relative; }
.calendar-day.empty { background: #f6f4ed; cursor: default; }
.calendar-day b { display: block; font-size: 11px; }
.calendar-day small { font-size: 8px; color: #a0a49c; }
.calendar-day.rest b { color: #9e7553; }
.calendar-day.legal { background: #fff6e7; }
.calendar-day.selected { box-shadow: inset 0 0 0 2px var(--green); background: #edf3e9; }
.calendar-day.selected::after { content:"✓"; position:absolute; right:5px; top:3px; font-size:9px; color:var(--green); font-weight:900; }
.legend { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 10px; color: var(--muted); font-size: 9px; }
.legend span { display: flex; align-items: center; gap: 4px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; background: #fff; border: 1px solid var(--line); }
.legend i.rest { background: #f7efe8; }.legend i.legal { background: #fff1d5; }.legend i.selected { background: #edf3e9; border-color:var(--green); }
.rate-list { display: grid; gap: 7px; }
.rate-list div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 7px; font-size: 10px; }
.rate-list span { color: var(--muted); }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.social-rule-grid { display: grid; grid-template-columns: 1fr; gap: 7px; margin-top: 10px; }
.rule-box { display: grid; grid-template-columns: 68px repeat(3, minmax(0, 1fr)); align-items: end; gap: 6px; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: #f7f6ef; }
.rule-box b { align-self: center; font-size: 10px; }
.rule-box label { display: block; color: var(--muted); font-size: 8px; }
.rule-box input { width: 100%; min-width: 0; margin-top: 3px; padding: 7px 5px; font-size: 9px; }
.rule-source a { color: var(--green); font-weight: 700; }
.rule-register { border-left:4px solid var(--amber); }
.rule-register-list { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.rule-item { padding:12px; border:1px solid var(--line); border-radius:10px; background:#faf9f3; }
.rule-item b,.rule-item span,.rule-item a { display:block; }
.rule-item b { font-size:11px; }
.rule-item span { margin-top:5px; color:var(--muted); font-size:9px; line-height:1.5; }
.rule-item a { margin-top:7px; color:var(--green); font-size:9px; font-weight:800; }
.rule-item.stale { border-color:#e5b1a7; background:#fff4f0; }
.generation-surface { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-left: 5px solid var(--lime); margin-bottom: 18px; }
.generation-surface h3 { margin-bottom: 5px; }
.generation-surface p { margin: 0; color: var(--muted); font-size: 11px; }
.progress-card { background: var(--ink); color:#fff; padding: 14px 18px; border-radius: 10px; margin-bottom: 18px; }
.progress-track { height: 5px; background: rgba(255,255,255,.12); border-radius: 99px; overflow: hidden; }
.progress-track span { display:block; height:100%; width:0; background:var(--lime); transition:.25s; }
.progress-card p { margin:7px 0 0; font-size:10px; color:rgba(255,255,255,.68); }
.review-surface { margin-bottom:18px; }
.review-metrics { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; }
.review-metric { padding:12px; border-radius:9px; background:#eef0e9; }
.review-metric small,.review-metric b { display:block; }
.review-metric small { color:var(--muted); font-size:9px; }
.review-metric b { margin-top:5px; font-size:17px; font-variant-numeric:tabular-nums; }
.review-checks { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; margin-top:12px; }
.review-check { padding:9px 11px; border:1px solid var(--line); border-radius:8px; font-size:10px; }
.review-check.pass { color:var(--green); background:#edf5e9; }
.review-check.warn { color:#8a4c3f; background:#fff1ec; border-color:#ebc5bc; }
.preview-table { min-width: 760px; }
.preview-table td:nth-last-child(-n+3), .preview-table th:nth-last-child(-n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.export-grid { display: grid; gap: 12px; }
.export-card { display: grid; grid-template-columns: 48px 1fr auto; align-items:center; gap:16px; padding:18px; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.export-card h3 { margin:0 0 4px; font-size:13px; }.export-card p { margin:0; color:var(--muted); font-size:10px; }
.file-icon { width:44px; height:44px; display:grid; place-items:center; border-radius:9px; font-weight:900; }
.file-icon.excel { color:#fff; background:#287451; }.file-icon.pdf { color:#fff; background:#bd5143; }.file-icon.json { color:var(--ink); background:var(--lime); font-size:10px; }
.file-icon.restore { color:#fff; background:#5e6f84; }.file-icon.feedback { color:var(--ink); background:#e7d6a7; }
.button-pair { display:flex; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.step-actions { position: fixed; bottom: 0; left: 246px; right: 0; display:flex; justify-content:space-between; padding:12px clamp(28px,4vw,64px); background:rgba(242,240,233,.92); backdrop-filter:blur(14px); border-top:1px solid var(--line); z-index:5; }
.app-version { align-self:center; margin-right:auto; color:var(--muted); font-size:9px; }
.step-actions .app-version + .btn { margin-left:18px; }
.notice-dialog { width:min(920px,calc(100vw - 32px)); }
.notice-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.notice-grid section { padding:16px; border:1px solid var(--line); border-radius:11px; background:#faf9f3; }
.notice-grid h3 { margin:0 0 8px; font-size:12px; }
.notice-grid p { margin:7px 0 0; color:var(--muted); font-size:10px; line-height:1.65; }
.consent-line { display:flex; gap:9px; align-items:flex-start; margin-top:14px; font-size:11px; font-weight:700; }
.secondary-consent { margin-top:8px; color:var(--muted); font-weight:500; }
.notice-links { display:flex; gap:14px; margin-top:12px; }
.notice-links a { color:var(--green); font-size:9px; }
.split-actions { justify-content:space-between; }
.hidden { display:none !important; }
@media (max-width: 1050px) {
    .panel-grid.three { grid-template-columns: 1fr; }
    .time-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 820px) {
    .app-shell { display:block; }
    .sidebar { position:relative; width:100%; height:auto; padding:16px; }
    .brand { padding-bottom:14px; }.step-nav { grid-template-columns:repeat(3,1fr); margin-top:12px; }.step-link { grid-template-columns:26px 1fr; padding:9px 7px; }.step-link small { display:none; }
    .sidebar-foot { display:none; }.workspace { padding:24px 16px 90px; }.step-actions { left:0; padding-inline:16px; }
    .topbar { align-items:flex-start; }.top-stats { display:none; }.section-heading { display:block; }.section-heading p { text-align:left; margin-top:7px; }
    .panel-grid.two, .field-grid.two { grid-template-columns:1fr; }.month-picker { grid-template-columns:repeat(4,1fr); }.option-grid { grid-template-columns:repeat(2,1fr); }
    .range-row { grid-template-columns:1fr 1fr; }
    .rule-register-list,.review-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .review-checks,.notice-grid { grid-template-columns:1fr; }
    .public-notice { grid-template-columns:1fr; }
    .app-version { display:none; }
}
