:root {
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --ink: #17352e;
  --ink-soft: #60736d;
  --green: #17483c;
  --green-2: #236251;
  --cream: #f5f0e7;
  --paper: #fffdf8;
  --line: #e5ded2;
  --red: #c45d49;
  --amber: #d8a248;
  --shadow: 0 14px 40px rgba(39, 52, 47, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 75% 5%, rgba(216, 162, 72, .11), transparent 27rem),
    var(--cream);
  font-family: var(--font-system);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.auth-checking .app-shell { visibility: hidden; }
.login-screen {
  min-height: 100vh; padding: 24px; display: grid; place-items: center;
  background:
    radial-gradient(circle at 70% 10%, rgba(216,162,72,.18), transparent 28rem),
    linear-gradient(150deg, #f7f2e8, #eee7d9);
}
.login-card {
  width: min(420px, 100%); padding: 34px; border: 1px solid rgba(84,85,69,.12);
  border-radius: 24px; background: rgba(255,253,248,.96); box-shadow: 0 24px 70px rgba(31,55,48,.15);
}
.login-card > img { display: block; width: min(270px, 100%); margin: 0 auto 30px; }
.login-card h1 { margin: 6px 0 8px; font: 750 27px/1.25 var(--font-system); }
.login-intro { margin: 0 0 24px; color: var(--ink-soft); font-size: 13px; }
.login-card form { padding: 0; }
.login-button { width: 100%; margin-top: 3px; }
.login-error { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; color: #96483c; background: #f4e1dd; font-size: 12px; }
.login-card > small { display: block; margin-top: 18px; color: #89958f; text-align: center; font-size: 10px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px 22px;
  color: #eef6f1;
  background: linear-gradient(165deg, #173f35, #0f3028 76%);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.brand { padding: 0 2px 28px; }
.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.nav-list { display: grid; gap: 7px; }
.nav-item {
  border: 0; width: 100%; padding: 12px 13px; border-radius: 12px; display: flex; align-items: center;
  gap: 11px; background: transparent; color: #bdd0ca; text-align: left; transition: .18s ease;
}
.nav-item:hover { color: white; background: rgba(255,255,255,.07); }
.nav-item.active { color: #173f35; background: #f3c96f; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.nav-icon { width: 24px; font-size: 18px; text-align: center; }

.account-card {
  margin-top: auto; margin-bottom: 9px; padding: 12px 13px; border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px; background: rgba(255,255,255,.05); display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.account-card strong, .account-card small { display: block; }
.account-card strong { font-size: 11px; }
.account-card small { max-width: 145px; margin-top: 3px; overflow: hidden; color: #91aaa2; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.account-card button { padding: 5px 7px; border: 0; border-radius: 7px; color: #d9e6e1; background: rgba(255,255,255,.08); font-size: 9px; }
.account-card.hidden + .local-badge { margin-top: auto; }

.local-badge {
  display: flex; gap: 10px; align-items: flex-start; padding: 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 13px;
}
.status-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: #6bd69b; box-shadow: 0 0 0 4px rgba(107,214,155,.11); }
.local-badge.local .status-dot { background: #f3c96f; box-shadow: 0 0 0 4px rgba(243,201,111,.12); }
.local-badge.offline .status-dot { background: #e78270; box-shadow: 0 0 0 4px rgba(231,130,112,.12); }
.local-badge strong, .local-badge small { display: block; }
.local-badge strong { font-size: 12px; }
.local-badge small { margin-top: 3px; color: #91aaa2; font-size: 10px; }

.main-content { min-width: 0; padding: 0 34px 46px; }
.topbar {
  min-height: 94px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  border-bottom: 1px solid rgba(61,79,72,.10); margin-bottom: 26px;
}
.topbar h2 { margin: 3px 0 0; font: 700 27px/1.2 var(--font-system); }
.eyebrow { margin: 0; color: #8b7d67; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow.light { color: #bdcfc8; }
.topbar-actions { display: flex; align-items: flex-end; gap: 10px; }
.month-control { display: grid; gap: 5px; }
.month-control span { color: #7b8b85; font-size: 10px; font-weight: 700; }
.month-control input, .month-control select, .record-filters select {
  height: 39px; border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; color: var(--ink); background: rgba(255,255,255,.65);
}
.mobile-menu { display: none; border: 0; background: transparent; font-size: 22px; color: var(--ink); }

.month-lock-banner { display: flex; align-items: center; gap: 12px; margin: -10px 0 18px; padding: 13px 16px; border: 1px solid #dccb92; border-radius: 13px; color: #705720; background: #f7efd7; }
.month-lock-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; color: #fff9e8; background: #9a772b; font-size: 11px; font-weight: 800; }
.month-lock-banner strong, .month-lock-banner small { display: block; }
.month-lock-banner strong { font-size: 12px; }
.month-lock-banner small { margin-top: 3px; color: #8a7441; font-size: 10px; }

.page { display: none; animation: page-in .22s ease; }
.page.active { display: block; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } }

.button { border: 0; border-radius: 11px; padding: 11px 16px; font-weight: 750; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--green); box-shadow: 0 7px 18px rgba(23,72,60,.18); }
.button.primary:hover { background: var(--green-2); }
.button.secondary { color: var(--ink); background: #eee8de; }
.button.light { color: var(--green); background: #f6cf7a; }
.button.ghost-light { color: white; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.07); }
.button.danger { color: white; background: var(--red); }
.button.compact { padding: 10px 14px; font-size: 13px; }
.text-button { border: 0; color: var(--green-2); background: transparent; font-weight: 700; }

.hero-card {
  min-height: 204px; padding: 28px 30px; border-radius: 24px; color: white;
  background:
    linear-gradient(110deg, rgba(13,48,39,.96), rgba(26,87,70,.95)),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,.03) 10px, rgba(255,255,255,.03) 20px);
  box-shadow: 0 18px 45px rgba(23,63,53,.20);
  display: grid; grid-template-columns: 1.4fr 1fr auto; align-items: center; gap: 34px;
  position: relative; overflow: clip;
}
.hero-card::after { content: "柿"; position: absolute; right: 24%; bottom: -48px; color: rgba(255,255,255,.035); font: 800 160px/1 var(--font-system); }
.hero-card h3 { margin: 8px 0 1px; color: #f5cc73; font: 750 43px/1 var(--font-system); }
.hero-caption { margin: 5px 0 0; color: #b5c8c1; font-size: 13px; }
.hero-split { padding-left: 28px; border-left: 1px solid rgba(255,255,255,.15); display: grid; gap: 18px; }
.hero-split span, .hero-split strong { display: block; }
.hero-split span { color: #b6c7c2; font-size: 11px; margin-bottom: 4px; }
.hero-split strong { font-size: 20px; }
.hero-actions { display: grid; gap: 10px; z-index: 2; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.metric-card { padding: 20px; border: 1px solid rgba(84,85,69,.10); border-radius: var(--radius); background: rgba(255,253,248,.82); box-shadow: var(--shadow); display: flex; align-items: center; gap: 15px; }
.ledger-balance-card { border-color: rgba(216,162,72,.30); background: linear-gradient(145deg, rgba(255,249,231,.96), rgba(255,253,248,.88)); }
.metric-icon { width: 43px; height: 43px; flex: 0 0 43px; display: grid; place-items: center; border-radius: 13px; font-weight: 800; }
.metric-icon.ledger { color: #fff7e6; background: var(--green); }
.metric-icon.capital { color: #7b561d; background: #f4e4b7; }
.metric-icon.income { color: #17604a; background: #dceee6; }
.metric-icon.other-income { color: #28617a; background: #dcebf1; }
.metric-icon.expense { color: #ad513f; background: #f4dfd9; }
.metric-icon.balance { color: #8b6525; background: #f4e8c7; }
.metric-card span, .metric-card strong { display: block; }
.metric-card span { color: var(--ink-soft); font-size: 11px; margin-bottom: 5px; }
.metric-card strong { font: 750 22px/1.2 var(--font-system); }
.metric-card small { display: block; margin-top: 5px; color: #8b7d67; font-size: 9px; line-height: 1.35; }
.inline-edit-button { margin-top: 6px; padding: 0; border: 0; color: var(--green-2); background: transparent; font-size: 10px; font-weight: 750; }

.attendance-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.payroll-attendance-lock { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid #b8d1c6; border-radius: 12px; color: #285f4e; background: #e5f1eb; font-size: 11px; }
.payroll-attendance-lock span { color: #58756b; }
.attendance-summary-card {
  padding: 18px 20px;
  border: 1px solid rgba(84,85,69,.10);
  border-radius: 15px;
  background: rgba(255,253,248,.82);
  box-shadow: var(--shadow);
}
.attendance-summary-card span,
.attendance-summary-card strong { display: block; }
.attendance-summary-card span { margin-bottom: 6px; color: var(--ink-soft); font-size: 11px; }
.attendance-summary-card strong { font-size: 21px; font-variant-numeric: tabular-nums lining-nums; }
.employee-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.employee-panel { padding-bottom: 24px; }
.employee-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 0 24px; }
.employee-card { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #faf7f0; }
.employee-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.employee-card-name { display: flex; gap: 11px; align-items: center; }
.employee-avatar { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 42px; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #285f50, #4f8b77); font-size: 17px; font-weight: 800; }
.employee-card h4 { margin: 0; font: 750 16px/1.3 var(--font-system); }
.employee-card h4 small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 10px; font-weight: 500; }
.employment-pill { padding: 4px 8px; border-radius: 999px; color: #28634f; background: #dcece5; font-size: 9px; font-weight: 800; white-space: nowrap; }
.employment-pill.departed { color: #8c4b40; background: #f1dfdb; }
.employment-pill.pending { color: #86621f; background: #f2e5c2; }
.employee-card-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 15px; }
.employee-card-details > div { padding: 9px 10px; border-radius: 10px; background: #fffdf8; }
.employee-card-details span, .employee-card-details strong { display: block; }
.employee-card-details span { margin-bottom: 4px; color: var(--ink-soft); font-size: 9px; }
.employee-card-details strong { overflow-wrap: anywhere; font-size: 11px; line-height: 1.5; }
.employee-card-note { margin: 10px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.55; }
.employee-card-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.employee-dialog-card { width: min(760px, 100%); max-height: 92vh; overflow: auto; text-align: left; }
.employee-dialog-card > h3, .employee-dialog-card > p, .employee-dialog-card > .dialog-icon { text-align: center; }
.employee-dialog-icon { color: #245f50; background: #dcebe5; }
.employee-dialog-card form { padding: 0; }
.employee-form-name { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 13px; padding: 12px 14px; border-radius: 11px; background: #f2eee6; }
.employee-form-name span { color: var(--ink-soft); font-size: 11px; }
.employee-form-name strong { font-size: 15px; }
.employee-date-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.employee-pay-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.employee-dialog-card .field small { color: var(--ink-soft); font-size: 11px; line-height: 1.6; }
.employee-impact-warning { padding: 12px; border-radius: 10px; color: #8d493b; background: #f4e2dc; }
#employee-change-details { margin-top: 16px; font-size: 12px; line-height: 1.65; }
#employee-change-details .table-wrap { padding: 0; }
#employee-change-details table { min-width: 480px; }
.attendance-monthly-panel { margin-top: 18px; }
.panel-subtitle { margin: 6px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.attendance-calc-preview { margin: 1px 0 14px; padding: 11px 12px; border: 1px solid #d9e5df; border-radius: 10px; color: #315d50; background: #edf5f1; font-size: 11px; line-height: 1.55; }
.payroll-table { min-width: 1120px; }
.payroll-settlement-header { margin-bottom: 16px; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.payroll-settlement-header h3 { margin: 4px 0 0; font: 750 22px/1.25 var(--font-system); }
.payroll-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.payroll-settlement-state { min-width: 150px; text-align: right; }
.payroll-settlement-state strong, .payroll-settlement-state small { display: block; }
.payroll-settlement-state strong { color: #7d662f; font-size: 11px; }
.payroll-settlement-state small { margin-top: 3px; color: var(--ink-soft); font-size: 9px; }
.payroll-settlement-state.confirmed strong { color: #28654f; }
.payroll-metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.payroll-final-card { color: #fff; border-color: transparent; background: linear-gradient(135deg, #1f5a49, #3e806b); }
.payroll-final-card span { color: rgba(255,255,255,.76); }
.payroll-final-card strong { color: #fff; }
.payroll-settlement-table { min-width: 1130px; }
.payroll-settlement-table td small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 9px; line-height: 1.45; }
.payroll-pay-type { width: fit-content; padding: 2px 6px; border-radius: 999px; color: #43695d !important; background: #e3eee9; }
.payroll-adjustment.positive { color: #267058; }
.payroll-adjustment.negative { color: #a05243; }
.payroll-final-pay { color: #215e4b; font-size: 13px; }
.payroll-settlement-note { margin: 0 23px 22px; padding: 11px 13px; border-radius: 10px; color: #6e735f; background: #f3ecd8; font-size: 10px; line-height: 1.6; }
.performance-toggle { border: 1px solid #d8c99d; border-radius: 8px; padding: 6px 8px; color: #7b6427; background: #f7efd7; font-size: 10px; white-space: nowrap; }
.performance-toggle.confirmed { border-color: #a9c9bb; color: #28634f; background: #e3f0ea; }
.deduction-cell { color: #a15445; white-space: nowrap; }
.payroll-total { color: #245f4d; font-size: 13px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 18px; }
.panel { border: 1px solid rgba(84,85,69,.11); border-radius: var(--radius); background: rgba(255,253,248,.88); box-shadow: var(--shadow); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 21px 23px 14px; }
.panel-heading h3 { margin: 4px 0 0; font: 700 18px/1.25 var(--font-system); }
.legend { display: flex; gap: 15px; color: var(--ink-soft); font-size: 10px; }
.legend span { display: flex; gap: 5px; align-items: center; }
.legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.legend-income { background: var(--green-2); }
.legend-expense { background: #d18a73; }

.bar-chart { min-height: 220px; padding: 20px 23px 22px; display: flex; align-items: flex-end; gap: 8px; overflow-x: auto; }
.chart-day { min-width: 36px; height: 185px; flex: 1; display: grid; grid-template-rows: 1fr 20px; gap: 6px; text-align: center; color: #829089; font-size: 9px; }
.chart-bars { height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; border-bottom: 1px solid #ded7cc; }
.bar { width: 10px; min-height: 2px; border-radius: 4px 4px 1px 1px; transition: height .35s ease; }
.bar.income { background: var(--green-2); }
.bar.expense { background: #d18a73; }
.empty-state { width: 100%; min-height: 150px; display: grid; place-items: center; color: #87958f; text-align: center; font-size: 13px; }

.category-list { padding: 9px 23px 24px; display: grid; gap: 17px; }
.category-row { display: grid; gap: 7px; }
.category-top { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.category-top strong { font-family: var(--font-system); }
.progress { height: 7px; overflow: hidden; border-radius: 10px; background: #e9e3d9; }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d4a650, #edc975); }
.recent-panel { margin-top: 18px; }

.report-header { margin-bottom: 16px; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.report-header h3 { margin: 4px 0 0; font: 750 22px/1.25 var(--font-system); }
.report-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.month-closing-state { min-width: 140px; text-align: right; }
.month-closing-state strong, .month-closing-state small { display: block; }
.month-closing-state strong { color: #52655e; font-size: 11px; }
.month-closing-state small { margin-top: 3px; color: var(--ink-soft); font-size: 9px; }
.month-closing-state.closed strong { color: #8a6421; }
.report-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.report-metric-card { padding: 19px; border: 1px solid rgba(84,85,69,.10); border-radius: 16px; background: rgba(255,253,248,.88); box-shadow: var(--shadow); }
.report-metric-card > span, .report-metric-card > strong, .report-metric-card > small { display: block; }
.report-metric-card > span { color: var(--ink-soft); font-size: 11px; }
.report-metric-card > strong { margin: 7px 0 8px; font: 760 24px/1.15 var(--font-system); font-variant-numeric: tabular-nums lining-nums; }
.report-metric-card > small { color: #7b8b85; font-size: 10px; }
.report-metric-card > .report-delta { display: inline-flex; width: fit-content; align-items: center; gap: 4px; margin-bottom: 8px; padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 750; }
.report-delta.good { color: #25644f; background: #dfeee7; }
.report-delta.warning { color: #9a4c3d; background: #f3dfdb; }
.report-delta.neutral { color: #6b736f; background: #ebe8e1; }
.report-content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.report-panel { min-width: 0; }
.report-insight-panel { grid-column: 1 / -1; }
.report-breakdown { display: grid; gap: 13px; padding: 5px 23px 24px; }
.report-breakdown-row { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(130px, 1.4fr) auto; align-items: center; gap: 13px; }
.report-breakdown-row strong, .report-breakdown-row small { display: block; }
.report-breakdown-row strong { font-size: 12px; }
.report-breakdown-row small { margin-top: 3px; color: var(--ink-soft); font-size: 9px; }
.report-breakdown-bar { width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 999px; background: #e9e3d9; appearance: none; -webkit-appearance: none; }
.report-breakdown-bar::-webkit-progress-bar { border-radius: inherit; background: #e9e3d9; }
.report-breakdown-bar::-webkit-progress-value { border-radius: inherit; background: linear-gradient(90deg, #236251, #76a995); }
.report-breakdown-bar::-moz-progress-bar { border-radius: inherit; background: linear-gradient(90deg, #236251, #76a995); }
.report-breakdown.expense .report-breakdown-bar::-webkit-progress-value { background: linear-gradient(90deg, #d18a73, #e2b59f); }
.report-breakdown.expense .report-breakdown-bar::-moz-progress-bar { background: linear-gradient(90deg, #d18a73, #e2b59f); }
.report-breakdown-amount { min-width: 90px; text-align: right; font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums lining-nums; }
.report-insights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 5px 23px 24px; }
.report-insight { padding: 15px 16px; border-radius: 13px; color: #315d50; background: #e7f1ec; }
.report-insight.warning { color: #8e4c40; background: #f4e3de; }
.report-insight.info { color: #755c27; background: #f5ecd4; }
.report-insight strong, .report-insight span { display: block; }
.report-insight strong { margin-bottom: 5px; font-size: 12px; }
.report-insight span { font-size: 10px; line-height: 1.55; }

.content-grid.form-layout { display: grid; grid-template-columns: minmax(285px, .65fr) minmax(560px, 1.6fr); gap: 18px; align-items: start; }
.form-panel { position: sticky; top: 18px; }
form { padding: 2px 23px 22px; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field > span { color: #4c625b; font-size: 11px; font-weight: 750; }
.field b { color: var(--red); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid #ded7cb; border-radius: 10px; padding: 10px 11px; outline: none; color: var(--ink); background: #fffefa; transition: .15s ease;
}
.field input, .field select { min-height: 42px; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #6b998b; box-shadow: 0 0 0 3px rgba(56,115,96,.10); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.money-input { position: relative; }
.money-input > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #7e8e88; font-family: var(--font-system); }
.money-input input { padding-left: 29px; font: 750 20px/1 var(--font-system); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }
.form-tip { margin: 0 23px 22px; padding: 11px 12px; border-radius: 10px; color: #6e735f; background: #f3ecd8; font-size: 11px; line-height: 1.6; }
.hidden { display: none !important; }

.records-panel { min-width: 0; }
.records-heading { align-items: flex-end; }
.record-filters { display: flex; align-items: center; gap: 13px; }
.switch-label { display: flex; align-items: center; gap: 6px; color: #65756f; font-size: 11px; white-space: nowrap; }
.switch-label input { accent-color: var(--green); }
.table-wrap { width: 100%; overflow-x: auto; padding: 0 12px 14px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: #7f8c87; font-size: 10px; letter-spacing: .04em; text-align: left; font-weight: 800; padding: 11px; border-bottom: 1px solid var(--line); }
td { padding: 13px 11px; border-bottom: 1px solid #eee9e1; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(241,236,225,.48); }
.align-right { text-align: right; }
.amount-cell { text-align: right; font-family: var(--font-system); font-weight: 750; white-space: nowrap; }
.muted { color: #89958f; }
.status-pill { display: inline-block; padding: 4px 7px; border-radius: 20px; font-size: 9px; font-weight: 800; }
.status-pill.active { color: #29634f; background: #dfeee7; }
.status-pill.voided { color: #8d5c53; background: #eee2de; }
.type-pill { display: inline-block; padding: 4px 7px; border-radius: 20px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.type-pill.expense { color: #8d5145; background: #f2e1dc; }
.type-pill.refund { color: #24624d; background: #dceee6; }
.attendance-pill { display: inline-block; padding: 4px 7px; border-radius: 20px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.attendance-pill.normal { color: #29634f; background: #dfeee7; }
.attendance-pill.leave { color: #7f642a; background: #f4e9c9; }
.attendance-pill.rest { color: #526a75; background: #e0e9ed; }
.attendance-pill.absent { color: #924b3f; background: #f2dfda; }
.attendance-exception { color: #a05645; font-weight: 700; white-space: nowrap; }
.attendance-clock { white-space: nowrap; }
.refund-row .amount-cell { color: #247052; }
.icon-button.refund:hover { color: white; background: var(--green-2); }
.voided-row { opacity: .58; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.icon-button { border: 0; border-radius: 7px; padding: 6px 8px; color: #526a62; background: transparent; font-size: 10px; }
.icon-button:hover { background: #eae5dc; }
.icon-button.void:hover { color: white; background: var(--red); }

.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.data-card { padding: 25px; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.data-card > .button, .data-card > .stack-actions { grid-column: 2; justify-self: start; }
.data-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: #23604f; background: #dbece5; font-size: 22px; }
.data-icon.backup { color: #8a6423; background: #f3e6c2; }
.data-icon.status { color: #277555; background: #dceee6; font-size: 15px; }
.system-status-card { grid-column: 1 / -1; grid-template-columns: auto minmax(0, 1fr) auto; }
.system-status-card > .button { grid-column: 3; grid-row: 1; align-self: center; }
.sync-record-grid { grid-column: 2 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.sync-record-grid span { padding: 10px 12px; border-radius: 10px; color: var(--ink-soft); background: #f2eee6; font-size: 10px; }
.sync-record-grid strong { display: block; margin-top: 4px; color: var(--ink); font-size: 15px; }
.system-status-card.offline .data-icon.status { color: #a64d3d; background: #f3dfdb; }
.data-card h3 { margin: 5px 0 8px; font: 700 19px var(--font-system); }
.data-card p { margin: 0; color: var(--ink-soft); line-height: 1.65; font-size: 12px; }
.data-card .backup-status { margin-top: 8px; color: #277555; font-weight: 700; }
.data-card .backup-status.error { color: var(--red); }
.backup-restore-area { margin-top: 14px; }
.backup-file-drop { min-height: auto; padding: 10px 12px; font-size: 11px; }
#backup-preview-status { margin-top: 6px; font-size: 11px; }
#backup-preview-status.success { color: #277555; font-weight: 700; }
#backup-preview-status.error { color: var(--red); font-weight: 700; }
#backup-restore-start { margin-top: 10px; }
.stack-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.safety-note { grid-column: 1 / -1; padding: 24px; }
.safety-note h3 { margin: 0 0 10px; font: 700 18px var(--font-system); }
.safety-note ul { margin: 0; padding-left: 20px; color: var(--ink-soft); line-height: 1.9; font-size: 12px; }
.safety-note code { padding: 2px 5px; border-radius: 4px; color: #355c50; background: #e6ede9; }
.read-only-mode form button[type="submit"],
.read-only-mode [data-action="quick-revenue"],
.read-only-mode [data-action="quick-expense"],
.read-only-mode #edit-invested-capital,
.read-only-mode .row-actions,
.read-only-mode #create-backup,
.read-only-mode .backup-restore-area,
.read-only-mode #open-attendance-import,
.read-only-mode .form-panel { display: none !important; }
.read-only-mode .content-grid.form-layout { grid-template-columns: 1fr; }
.read-only-mode .performance-toggle { pointer-events: none; cursor: default; }
.read-only-mode #toggle-month-closing,
.read-only-mode #toggle-payroll-settlement,
.read-only-mode .payroll-adjust-button,
.read-only-mode .employee-edit-button { display: none !important; }

.month-closed .form-panel,
.month-closed .row-actions,
.month-closed #open-attendance-import,
.month-closed [data-action="quick-revenue"],
.month-closed [data-action="quick-expense"] { display: none !important; }
.month-closed #toggle-payroll-settlement,
.month-closed .payroll-adjust-button { display: none !important; }
.month-closed .content-grid.form-layout { grid-template-columns: 1fr; }
.month-closed .performance-toggle { pointer-events: none; cursor: default; opacity: .72; }
.payroll-confirmed #page-attendance .form-panel,
.payroll-confirmed #page-attendance .row-actions,
.payroll-confirmed #open-attendance-import { display: none !important; }
.payroll-confirmed #page-attendance .content-grid.form-layout { grid-template-columns: 1fr; }
.payroll-confirmed #page-attendance .performance-toggle { pointer-events: none; cursor: default; opacity: .72; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-card { padding-bottom: 24px; }
.settings-overview-card, .settings-review-card, .settings-audit-card, .settings-maintenance-note { grid-column: 1 / -1; }
.settings-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; padding: 0 25px; }
.settings-facts > div { padding: 15px 16px; border: 1px solid var(--line); border-radius: 13px; background: #faf7f0; }
.settings-facts span, .settings-facts strong { display: block; }
.settings-facts span { margin-bottom: 6px; color: var(--ink-soft); font-size: 10px; }
.settings-facts strong { color: var(--ink); font-size: 13px; line-height: 1.5; }
.settings-chip-list { display: flex; flex-wrap: wrap; gap: 9px; padding: 0 25px; }
.settings-chip-list > span { min-width: 126px; padding: 11px 13px; border-radius: 11px; color: #245f50; background: #e5f0eb; font-size: 12px; font-weight: 750; }
.settings-chip-list small { display: block; margin-top: 4px; color: #668079; font-size: 10px; font-weight: 500; }
.settings-security-card > .button { margin: 15px 25px 0; }
.settings-security-note { display: grid; gap: 4px; margin: 0 25px; padding: 14px 16px; border-radius: 12px; color: #77561f; background: #f7edd2; }
.settings-security-note strong { font-size: 12px; }
.settings-security-note span { font-size: 11px; line-height: 1.55; }
.settings-maintenance-note { padding-bottom: 24px; }
.settings-review-heading { align-items: center; }
.settings-review-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 0 25px; }
.settings-review-metrics > div { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #faf7f0; }
.settings-review-metrics span, .settings-review-metrics strong, .settings-review-metrics small { display: block; }
.settings-review-metrics span { color: var(--ink-soft); font-size: 10px; }
.settings-review-metrics strong { margin: 5px 0 3px; color: var(--ink); font-size: 20px; font-variant-numeric: tabular-nums lining-nums; }
.settings-review-metrics small { color: #718079; font-size: 10px; line-height: 1.45; }
.settings-loading { grid-column: 1 / -1; padding: 16px; border-radius: 12px; color: var(--ink-soft); background: #f2eee6; font-size: 12px; }
.settings-loading.error { color: var(--red); background: #f3dfdb; }
.settings-review-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 16px 25px 0; }
.review-check { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: white; text-align: left; }
.review-check[data-review-page] { cursor: pointer; }
.review-check[data-review-page]:hover { border-color: #8fb1a4; background: #f7fbf8; }
.review-check-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: #28664f; background: #dceee6; font-weight: 850; }
.review-check.warning .review-check-icon { color: #9b4c3e; background: #f3dfdb; }
.review-check.info .review-check-icon { color: #81601e; background: #f5e8c5; }
.review-check strong, .review-check small { display: block; }
.review-check strong { font-size: 12px; }
.review-check small { margin-top: 4px; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
.review-check-arrow { color: #65847a; font-size: 16px; }
.settings-audit-table-wrap { max-height: 420px; }
.audit-action { display: inline-block; padding: 3px 7px; border-radius: 999px; color: #28664f; background: #dceee6; font-size: 10px; font-weight: 750; white-space: nowrap; }
.audit-action.void { color: #9b4c3e; background: #f3dfdb; }

.toast-region { position: fixed; top: 19px; right: 24px; z-index: 100; display: grid; gap: 8px; }
.toast { min-width: 240px; max-width: 360px; padding: 12px 14px; color: white; background: #214b40; border-radius: 11px; box-shadow: 0 13px 35px rgba(25,56,48,.25); font-size: 12px; animation: toast-in .2s ease; }
.toast.error { background: #a64d3d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-5px); } }

.dialog-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(14,35,30,.48); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; }
.dialog-card { width: min(390px, 100%); padding: 27px; border-radius: 18px; background: var(--paper); box-shadow: 0 25px 65px rgba(0,0,0,.25); text-align: center; }
.dialog-icon { width: 43px; height: 43px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; color: #9f493b; background: #f3ded8; font-weight: 900; }
.dialog-card h3 { margin: 0 0 8px; font: 700 19px var(--font-system); }

.hero-card h3,
.metric-card strong,
.category-top strong,
.money-input input,
.amount-cell {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: .01em;
}
.dialog-card p { margin: 0; color: var(--ink-soft); line-height: 1.6; font-size: 12px; }
.restore-dialog-card { width: min(510px, 100%); }
.restore-dialog-icon { color: #9f493b; background: #f3ded8; }
.month-closing-dialog-icon { color: #7b5e20; background: #f3e6c2; }
.payroll-dialog-icon { color: #235f4d; background: #dcece5; }
.payroll-adjustment-dialog-card { width: min(500px, 100%); }
.payroll-adjustment-tip { margin: 0 0 14px; }
.restore-summary { display: grid; gap: 5px; margin-top: 17px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #faf7f0; text-align: left; }
.restore-summary strong { color: var(--ink); font-size: 12px; overflow-wrap: anywhere; }
.restore-summary span { color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.restore-dialog-card form { padding: 0; }
.restore-confirm-field { margin-top: 16px; text-align: left; }
.capital-dialog-card { text-align: left; }
.capital-dialog-card h3, .capital-dialog-card > p { text-align: center; }
.capital-dialog-icon { color: #7b561d; background: #f3e6c2; }
.capital-field { margin-top: 20px; }
.capital-dialog-card form { padding: 0; }
.monthly-summary-dialog-card { width: min(760px, 100%); max-height: 90vh; overflow: auto; }
.monthly-summary-icon { color: #28617a; background: #dcebf1; }
.monthly-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 20px; text-align: left; }
.monthly-summary-grid > div { padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #faf7f0; }
.monthly-summary-grid span, .monthly-summary-grid strong { display: block; }
.monthly-summary-grid span { margin-bottom: 6px; color: var(--ink-soft); font-size: 11px; }
.monthly-summary-grid strong { color: var(--ink); font: 750 21px/1.2 var(--font-system); font-variant-numeric: tabular-nums lining-nums; }
.revenue-channel-summary { grid-column: 1 / -1; margin-top: 4px; text-align: left; }
.revenue-channel-summary h4 { margin: 4px 0 9px; font: 750 14px var(--font-system); }
.revenue-channel-summary-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(170px, 1.2fr) auto; align-items: center; gap: 12px; padding: 11px 12px; border-top: 1px solid var(--line); }
.revenue-channel-summary-row strong, .revenue-channel-summary-row small { display: block; }
.revenue-channel-summary-row strong { font-size: 13px; }
.revenue-channel-summary-row small { margin-top: 3px; color: var(--ink-soft); font-size: 10px; }
.revenue-type-pill { display: inline-block; padding: 3px 7px; border-radius: 999px; color: #536e65; background: #e5eee9; font-size: 10px; font-weight: 750; white-space: nowrap; }
.dialog-actions { display: flex; justify-content: center; gap: 9px; margin-top: 21px; }
.attendance-import-card { width: min(900px, 100%); max-height: 90vh; overflow: auto; text-align: left; }
.attendance-import-card > h3, .attendance-import-card > p, .attendance-import-card > .dialog-icon { text-align: center; }
.attendance-import-icon { color: #245f50; background: #dcebe5; }
.file-drop { display: grid; place-items: center; margin-top: 18px; padding: 22px; border: 1.5px dashed #9fb5ad; border-radius: 14px; color: #245f50; background: #f4f8f5; cursor: pointer; font-weight: 700; }
.file-drop input { margin-top: 10px; width: 100%; font-weight: 400; }
.import-status { margin: 12px 0; padding: 10px 12px; border-radius: 10px; color: var(--ink-soft); background: #f2eee6; font-size: 12px; }
.import-preview-wrap { max-height: 48vh; border: 1px solid var(--line); border-radius: 12px; }
.attendance-time-pair { min-width: 154px; line-height: 1.55; }
.attendance-time-pair small { display: block; color: var(--ink-soft); white-space: nowrap; }
.attendance-time-pair strong { display: block; color: var(--ink); white-space: nowrap; }
.supplement-pill, .source-pill { display: inline-block; margin-top: 4px; padding: 2px 6px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.supplement-pill { color: #23644f; background: #dceee6; }
.source-pill { color: #6c5425; background: #f3e8c8; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .main-content { padding-left: 24px; padding-right: 24px; }
  .hero-card { grid-template-columns: 1fr 1fr; }
  .hero-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .content-grid.form-layout { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .report-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-insights { grid-template-columns: 1fr; }
  .attendance-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .employee-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .employee-card-grid { grid-template-columns: 1fr; }
  .form-panel { position: static; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .revenue-channel-summary-row { grid-template-columns: 1fr auto; }
  .revenue-channel-summary-row .text-button { grid-column: 1 / -1; justify-self: start; padding: 3px 0; }
  .sidebar { position: fixed; left: -260px; width: 248px; transition: left .2s ease; box-shadow: 12px 0 40px rgba(0,0,0,.25); }
  .sidebar.open { left: 0; }
  .main-content { padding: 0 15px 35px; }
  .topbar { min-height: 78px; margin-bottom: 16px; }
  .mobile-menu { display: block; }
  .topbar > div:nth-child(2) { flex: 1; }
  .topbar h2 { font-size: 20px; }
  .topbar-actions .button { display: none; }
  .month-control span { display: none; }
  .month-control input, .month-control select { width: 132px; }
  .hero-card { grid-template-columns: 1fr; padding: 24px; gap: 23px; }
  .hero-card h3 { font-size: 38px; }
  .hero-split { padding: 0; border-left: 0; grid-template-columns: 1fr 1fr; }
  .hero-actions { grid-column: auto; }
  .metric-grid { grid-template-columns: 1fr; gap: 10px; }
  .report-header { align-items: flex-start; }
  .report-header-actions { align-items: flex-end; flex-direction: column; }
  .month-closing-state { text-align: right; }
  .report-print-button { display: none; }
  .report-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .report-metric-card { padding: 15px; }
  .report-metric-card > strong { font-size: 19px; }
  .report-content-grid { grid-template-columns: 1fr; }
  .report-insight-panel { grid-column: auto; }
  .report-breakdown-row { grid-template-columns: minmax(105px, 1fr) auto; }
  .report-breakdown-bar { grid-column: 1 / -1; grid-row: 2; }
  .report-breakdown-amount { min-width: 0; }
  .attendance-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .employee-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .employee-card-grid { padding-left: 12px; padding-right: 12px; }
  .employee-date-row, .employee-pay-grid { grid-template-columns: 1fr; }
  .payroll-settlement-header { align-items: flex-start; }
  .payroll-header-actions { align-items: flex-end; flex-direction: column; }
  .payroll-settlement-state { text-align: right; }
  .payroll-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .payroll-final-card { grid-column: 1 / -1; }
  .attendance-summary-card { padding: 14px 15px; }
  .attendance-summary-card strong { font-size: 17px; }
  .metric-card { padding: 15px 17px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .bar-chart { min-height: 190px; }
  .chart-day { min-width: 30px; height: 160px; }
  .data-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-overview-card, .settings-review-card, .settings-audit-card, .settings-maintenance-note { grid-column: auto; }
  .settings-facts { grid-template-columns: 1fr; padding-left: 17px; padding-right: 17px; }
  .settings-review-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 17px; padding-right: 17px; }
  .settings-review-checks { grid-template-columns: 1fr; padding-left: 17px; padding-right: 17px; }
  .settings-chip-list { padding-left: 17px; padding-right: 17px; }
  .settings-security-note { margin-left: 17px; margin-right: 17px; }
  .settings-security-card > .button { margin-left: 17px; margin-right: 17px; }
  .safety-note { grid-column: auto; }
  .data-card { grid-template-columns: auto 1fr; }
  .system-status-card { grid-template-columns: auto 1fr; }
  .system-status-card > .button, .sync-record-grid { grid-column: 1 / -1; }
  .system-status-card > .button { grid-row: auto; }
  .sync-record-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .records-heading { align-items: flex-start; flex-direction: column; }
  .record-filters { width: 100%; justify-content: space-between; }
  .record-filters { flex-wrap: wrap; }
  .panel-heading { padding-left: 17px; padding-right: 17px; }
  form { padding-left: 17px; padding-right: 17px; }
  .table-wrap { padding-left: 7px; padding-right: 7px; }
  th, td { padding-left: 8px; padding-right: 8px; }
  .toast-region { left: 14px; right: 14px; top: 10px; }
  .toast { width: 100%; max-width: none; }
  .monthly-summary-grid { grid-template-columns: 1fr; }
  .month-lock-banner { margin-top: -3px; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .sidebar, .topbar, .toast-region, .report-print-button, #toggle-month-closing, #toggle-payroll-settlement, #print-payroll, #export-payroll-page, .month-lock-banner, .payroll-adjust-button { display: none !important; }
  .app-shell { display: block; }
  .main-content { padding: 0; }
  .page { display: none !important; }
  #page-reports.active { display: block !important; }
  #page-payroll.active { display: block !important; }
  .panel, .report-metric-card { box-shadow: none; background: #fff; break-inside: avoid; }
  .report-content-grid { grid-template-columns: 1fr 1fr; }
  .report-insight-panel { grid-column: 1 / -1; }
  .report-insights { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .payroll-metric-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .payroll-settlement-table { min-width: 0; font-size: 9px; }
  .payroll-settlement-table th, .payroll-settlement-table td { padding: 6px 5px; }
}
:root { --payment-success: #23764b; }
.payroll-payment-panel { margin-top: 22px; }
.payroll-payment-panel h4 { margin: 24px 0 12px; }
.payroll-payment-totals { font-weight: 650; font-variant-numeric: tabular-nums; }
.payroll-payment-panel td small { display: block; color: var(--payment-success); margin-top: 5px; }
.payment-status { display: inline-block; padding: 5px 9px; border-radius: 8px; background: #f2ede5; color: #675b4a; white-space: nowrap; }
.payment-status.paid { background: #e8f3eb; color: var(--payment-success); }
#payroll-payment-dialog select { max-width: 100%; }
@media print { .payroll-payment-panel button { display: none !important; } }
