:root{
 color-scheme:light;
 --bg:#eef1f5;--group:#dce2ea;--group-ink:#27374a;--group-link:#235998;--panel:#fff;--ink:#20252d;--muted:#59616c;
 --line:#b7c2cf;--grid-line:#c4ccd6;--accent:#245cf0;--accent-ink:#fff;
 --nav:#111f35;--nav-ink:#c1ccdd;--soft:#edf2f7;--head:#33465d;--header-ink:#fff;--section:#e6edf5;
 --positive:#086847;--warning:#7c4800;--warning-bg:#ffe2a3;--danger:#b41d36;--shadow:none;
 --input-head:#365570;--input-cell:#f4f8fc;--contract-head:#365570;--contract-cell:#f4f8fc;
 --deduction-head:#475467;--deduction-cell:#fff;--calculated-head:#475467;--calculated-cell:#fff;
 --expense:#b42338;--expense-cell:#fff0f1;--insurance:#73549b;--insurance-cell:#f3effb;--net-head:#17665f;--net-header-ink:#fff;--net-cell:#edf7f4;--net-ink:#155e55;--cost-head:#21364e;--cost-cell:#fff;--cost-ink:#20252d;
 --saturday:#e6eef9;--sunday:#fae9e6;--sunday-head:#a62c35;--saturday-head:#205b9b;
 --card-border:#aebbc9;--float-bg:#142238;--float-ink:#fff;
 --selected:#e3efff;
 --selected-ink:#154c8b;
}
:root[data-theme=dark]{
 color-scheme:dark;
 --bg:#171d27;--group:#252f3f;--group-ink:#e4ebf5;--group-link:#b6d3ff;--panel:#111923;--ink:#eef0f4;--muted:#bdc3cd;
 --line:#53647c;--grid-line:#43516a;--accent:#00d992;--accent-ink:#052318;
 --nav:#0b111b;--nav-ink:#bfcce0;--soft:#263347;--head:#35465d;--header-ink:#fff;--section:#2c3a4e;
 --positive:#66efb9;--warning:#ffdb91;--warning-bg:#684306;--danger:#ff9ca9;--shadow:none;
 --input-head:#354d66;--input-cell:#1c2a3b;--contract-head:#354d66;--contract-cell:#1c2a3b;
 --deduction-head:#3c4a60;--deduction-cell:#111923;--calculated-head:#3c4a60;--calculated-cell:#292c32;
 --expense:#ff9ca9;--expense-cell:#38232c;--insurance:#c8b1ef;--insurance-cell:#302a43;--net-head:#205f59;--net-header-ink:#fff;--net-cell:#172f2c;--net-ink:#8ee0c9;--cost-head:#35465d;--cost-cell:#292c32;--cost-ink:#eef0f4;
 --saturday:#293546;--sunday:#402e33;--sunday-head:#963849;--saturday-head:#245d9f;
 --card-border:#53647c;--float-bg:#e3edfc;--float-ink:#101b2e;
 --selected:#233f59;
 --selected-ink:#c4e5ff;
}

/* 컨테이너·작업 표면·제목 띠 */
.panel{background:var(--group);color:var(--group-ink);border:1px solid var(--card-border);border-radius:8px}
.panel-head,.dialog-head{background:var(--panel);color:var(--ink);border-top:0;border-bottom:1px solid var(--line)}
.panel-head h2,.panel-head small,.dialog-head h2{color:var(--ink)}
.panel-head .text-button{color:var(--accent)}.dialog-head button{color:var(--ink)}
.panel-head .info-tip{color:var(--muted)}.panel-head .info-tip:hover{color:var(--ink)}
.panel-head button:not(.primary):not(.text-button):not(.info-tip){background:var(--panel);color:var(--ink)}
.panel>.panel-head .view-switch button.active{background:var(--accent);color:var(--accent-ink)}
.panel-head .badge{background:var(--soft);color:var(--ink);border:1px solid var(--line)}
.panel-head .badge.warn{background:var(--warning-bg);color:var(--warning)}
.panel-head .badge.green{background:var(--input-cell);color:var(--positive)}
.panel>.pad{background:var(--group)}
.panel>.pad.fields{background:var(--panel);margin:14px}
.fields,.employee-card,.account-intro,.report-paper,.rule-row,.money-line,.provider-list{background:var(--panel);color:var(--ink)}
.fields{padding:14px;border:1px solid var(--card-border);border-top:2px solid var(--line);border-radius:5px}
.fields label{color:var(--ink)}
input:not([type=checkbox]),select,textarea{background:var(--input-cell);border-color:var(--grid-line);color:var(--ink)}
input[readonly]{background:var(--calculated-cell);color:var(--ink)}
input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}
.fields input[name=hourly],.fields input[name=monthly],.fields input[name=annual],.fields input[name=paidHours],.fields input[name=fixedAllowance],.fields select[name=mode]{background:var(--contract-cell);border-color:var(--contract-head)}
.section-label{background:var(--panel);color:var(--ink);padding:7px 10px;border-left:3px solid var(--contract-head);border-radius:3px}
.toolbar,.ledger-navigation,.report-date-control,.staff-filter,.batch-toolbar{background:var(--group);color:var(--group-ink);border-color:var(--card-border)}
.table-scroll,.matrix-scroll,.report-grid-scroll{background:var(--panel);border:1px solid var(--card-border);margin:10px}
.table-foot{background:var(--group);color:var(--group-ink);border-top:1px solid var(--card-border)}
.table-foot .legend i{background:var(--input-cell);border-color:var(--input-head)}
.sheet tbody td{background:var(--panel);color:var(--ink)}
.sheet th{background:var(--head);color:#fff}
.sheet th:first-child{color:#fff}
.sheet tr:hover td{background:var(--role-cell,var(--panel));box-shadow:inset 0 2px color-mix(in srgb,var(--accent) 55%,transparent),inset 0 -2px color-mix(in srgb,var(--accent) 55%,transparent)}
.sheet tfoot tr:hover td{background:var(--cost-head);color:#fff}
.sheet.journal-table tbody tr:hover td:first-child{background:var(--input-head);color:#fff}
.sheet input.edit,.sheet input[readonly],.sheet input,.sheet select{background:transparent;color:inherit}
.sheet .cell.link,.sheet .cell.total,.sheet .total,.sheet .muted{background:transparent;color:inherit}
.sheet tfoot td,.sheet tfoot .cell{background:var(--cost-head);color:#fff}
.sheet tfoot td:last-child,.sheet tfoot .total{color:#ffed79;background:var(--cost-head)}

/* 역할 색은 헤더 중심으로, 본문은 중립 표면과 미세한 색조로 구분 */
.summary-table :is(th,td):nth-child(n+2):nth-child(-n+3),.summary-table :is(th,td):nth-child(n+5):nth-child(-n+7),.roster-table :is(th,td):nth-child(-n+5),.roster-table :is(th,td):nth-child(10){--role-head:var(--input-head);--role-cell:var(--input-cell)}
.summary-table :is(th,td):nth-child(4),.roster-table :is(th,td):nth-child(n+6):nth-child(-n+9){--role-head:var(--contract-head);--role-cell:var(--contract-cell)}
.summary-table :is(th,td):nth-child(8){--role-head:var(--calculated-head);--role-cell:var(--calculated-cell)}
.summary-table :is(th,td):nth-child(9){--role-head:var(--deduction-head);--role-cell:var(--deduction-cell)}
.summary-table :is(th,td):nth-child(10){--role-head:var(--net-head);--role-cell:var(--net-cell);--role-ink:var(--net-ink);--role-header-ink:var(--net-header-ink)}
.summary-table :is(th,td):nth-child(11){--role-head:var(--cost-head);--role-cell:var(--cost-cell);--role-ink:var(--cost-ink)}
:is(.summary-table,.roster-table) thead th{background:var(--role-head,var(--head));color:var(--role-header-ink,#fff)}
:is(.summary-table,.roster-table) tbody td{background:var(--role-cell,var(--panel));color:var(--role-ink,var(--ink))}
.summary-table tbody td:nth-child(n+10){font-weight:700}
.summary-table tfoot td{background:var(--cost-head);color:#fff}
.journal-table :is(th,td){--role-head:var(--input-head);--role-cell:var(--input-cell)}
.journal-table :is(th,td):nth-child(n+7):nth-child(-n+9){--role-head:var(--calculated-head);--role-cell:var(--calculated-cell)}
.journal-table :is(th,td):nth-child(n+10):nth-child(-n+11){--role-head:var(--contract-head);--role-cell:var(--contract-cell)}
.journal-table thead th{background:var(--role-head);color:#fff}
.journal-table tbody td{background:var(--role-cell)}
.journal-table tbody td:first-child{background:var(--input-head);color:#fff}.journal-table td:first-child small{color:#e2f7ff}
.journal-table td input,.journal-table td select{background:transparent;color:inherit}
.journal-table th .info-tip{color:#fff}.journal-table th .info-tip:hover{color:var(--ink)}
.journal-table .dirty td{border-top:2px solid var(--warning);border-bottom:2px solid var(--warning)}
.month-matrix{background:var(--input-cell)}.month-matrix tbody td{background-color:var(--input-cell);color:var(--ink)}
.month-matrix thead th{background:var(--input-head);color:#fff}
.month-matrix .matrix-name{background:var(--head);color:#fff}.month-matrix .matrix-name small{color:#d9e8ff}
.month-matrix tbody .matrix-total,.month-matrix thead .matrix-total{background:var(--cost-cell);color:var(--cost-ink);border-left:2px solid var(--card-border)}
.month-matrix tbody .weekday-0{background-color:var(--sunday);color:var(--ink)}.month-matrix tbody .weekday-6{background-color:var(--saturday)}
.month-matrix thead .weekday-0{background:var(--sunday-head);color:#fff}.month-matrix thead .weekday-6{background:var(--saturday-head);color:#fff}
.month-matrix td.selected{outline:2px solid var(--accent);outline-offset:-2px;box-shadow:inset 0 0 0 3px var(--panel)}
.month-matrix input{background:transparent;color:inherit}.month-matrix small{color:var(--muted)}
.auto-record{background-image:repeating-linear-gradient(135deg,transparent,transparent 6px,color-mix(in srgb,var(--ink) 10%,transparent) 6px,color-mix(in srgb,var(--ink) 10%,transparent) 8px)}
.calendar-grid{background:var(--grid-line);border-color:var(--group)}.calendar-heading{background:var(--input-head);color:#fff}.calendar-day{background-color:var(--panel);border-bottom:3px solid var(--input-head)}.calendar-day.recorded,.calendar-day.auto-record{background-color:var(--input-cell)}.calendar-empty{background:var(--group)}
.ledger-totals{background:var(--calculated-cell);border-color:var(--calculated-head)}.ledger-totals>div:last-child{background:var(--deduction-cell)}

/* 내부 카드와 정보·계정·사업장·신고서 */
.employee-cards{padding-top:16px}.employee-card{border:1px solid var(--card-border);border-top:3px solid var(--contract-head)}.employee-card>.row:first-child{padding-bottom:12px;border-bottom:1px solid var(--line)}.employee-card dl>div{padding:8px;background:var(--input-cell);border-color:var(--card-border)}.employee-card dl>div:nth-child(n+3){background:var(--contract-cell)}
.metric,.metric.featured{--metric-accent:var(--head);background:var(--panel);color:var(--ink);border:1px solid var(--card-border);border-top:4px solid var(--metric-accent)}.metric[data-role=expense]{--metric-accent:var(--expense)}.metric[data-role=net]{--metric-accent:var(--net-ink)}.metric[data-role=insurance]{--metric-accent:var(--insurance)}.metric strong{color:var(--metric-accent)}.metric :is(.metric-label,small){color:var(--muted)}
:is(.rule-row,.rule-row:first-child,.rule-row:last-child){padding:10px;border:1px solid var(--card-border);border-left:5px solid var(--input-head);margin-bottom:8px}.rule-row:last-child{margin-bottom:0}.money-line{padding:10px;border-bottom:1px solid var(--card-border)}.money-line.total{padding:12px;background:var(--net-cell);color:var(--net-ink);border:2px solid var(--net-head)}.money-line.total b{color:var(--net-ink)}
.rate-result{background:var(--panel);color:var(--ink);border:1px solid var(--card-border);border-left:3px solid var(--deduction-head)}.rate-result strong{color:var(--ink)}.staff-count{background:var(--panel);color:var(--ink);padding:14px;border-left:6px solid var(--input-head)}.day-checks{background:var(--panel);color:var(--ink);border:1px solid var(--card-border)}.day-checks legend{background:var(--contract-head);color:#fff;padding:3px 8px}.status-box{background:var(--panel);color:var(--ink);border-left:3px solid var(--deduction-head)}
.staff-history-table th,.shift-table th{background:var(--input-head);color:#fff}.staff-history-table td,.staff-history-table tbody th,.shift-table td{background:var(--panel);color:var(--ink)}.shift-table td:first-child input{background:var(--contract-cell)}
.account-intro{padding:24px;border:1px solid var(--card-border);border-radius:7px}.account-card .panel-head{border-top-color:var(--contract-head)}.account-divider{background:var(--group);color:var(--ink);padding:10px;margin:12px -4px}.provider-list{margin:14px}.event-list>div{background:var(--panel);border-left:5px solid var(--contract-head)}
.report-paper{margin:12px;border:1px solid var(--card-border)}.report-paper h2{background:var(--cost-head);color:#fff;padding:12px}.report-masthead dd{background:var(--panel)}.report-masthead dt{background:var(--input-head);color:#fff}
.report-grid thead th{background:var(--head);color:#fff}.report-grid tbody td{background:var(--calculated-cell)}.report-grid tbody td:nth-child(-n+7){background:var(--input-cell)}.report-grid thead th:nth-child(-n+7){background:var(--input-head)}.report-grid tbody td:last-child{background:var(--net-cell);color:var(--net-ink);font-weight:700}.report-grid thead th:last-child{background:var(--net-head);color:var(--net-header-ink)}.report-grid tfoot td{background:var(--cost-head);color:#fff}.report-grid tfoot td:last-child{color:#fff086}
.rates{background:var(--panel)}.rates th{background:var(--deduction-head);color:#fff}.rates td:nth-child(n+2){background:var(--deduction-cell)}.tax-viewer .panel-head{border-top-color:var(--contract-head)}.tax-placeholder th{background:var(--contract-head);color:#fff}.tax-placeholder td{background:var(--panel)}.sources a{background:var(--panel);padding:10px 12px;margin-bottom:5px;border-left:4px solid var(--input-head)}
.guidance{background:var(--group);color:var(--group-ink)}.guidance>summary,.ledger-navigation+.guidance>summary{background:var(--group)}.guidance-card{background:var(--panel);color:var(--ink);border:1px solid var(--card-border);border-top:2px solid var(--line)}.guidance-grid{gap:8px;padding:8px;background:var(--group)}

dialog{background:var(--group)}#context-help,#toast{background:var(--float-bg);color:var(--float-ink)}.info-tip:hover,.info-tip:focus-visible{background:var(--input-cell);color:var(--ink)}
@media(max-width:760px){.table-scroll,.matrix-scroll,.report-grid-scroll{margin:6px}.account-layout{gap:12px}.account-intro{padding:16px}.report-paper{margin:6px}.fields{padding:10px}.guidance-grid{gap:6px;padding:6px}}

/* 프레임 안의 보조 문구는 프레임 명도에 맞춰 표시 */
.toolbar label,.toolbar>.muted,.ledger-navigation>label,.ledger-tools>.info-tip,.batch-toolbar>.info-tip,.batch-toolbar .compact-toggle,.batch-toolbar #matrix-selection{color:var(--group-ink)}
.guidance>summary small,.guidance-toggle,.panel>.pad>.mini-note,.panel>.pad>.field-label,.panel>.pad>.check-line,.panel>.pad .info-list{color:var(--group-ink)}
.guidance-card small,.guidance-card .mini-note{color:var(--muted)}
.employee-card dl>div,.employee-card dl>div:nth-child(n+3){background:var(--panel)}
.account-layout{color:var(--group-ink)}.account-divider{color:var(--group-ink)}
.guidance-card p,.fields small,.fields .mini-note{color:var(--muted)}
.ledger-navigation+.guidance>summary{color:var(--group-ink)}
.panel>.pad.fields{color:var(--ink)}
.report-date-control .badge{background:var(--panel)}
.toolbar>.text-button,.table-foot .text-button{color:var(--group-link)}
.rates,.tax-placeholder,.ledger-totals,.calendar-day,.report-masthead dd{color:var(--ink)}
.panel>.pad>p,#dialog-body>form>.mini-note{color:var(--group-ink)}
.panel>.pad>.status-box p,.panel>.pad>.rate-result p{color:var(--muted)}
dialog,.panel.empty{color:var(--group-ink)}.event-list>div{color:var(--ink)}
.sheet tfoot td:first-child{color:#fff}
.toolbar .info-tip{color:var(--group-ink)}
.journal-table td:first-child small{color:#fff}
.account-links .text-button{color:var(--group-link)}
