:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #667085;
  --line: #d9e0ea;
  --blue: #2563eb;
  --cyan: #0891b2;
  --green: #0f9f6e;
  --amber: #b7791f;
  --red: #b42318;
  --navy: #13233f;
  --soft-blue: #e7f0ff;
  --soft-green: #e8f7f1;
  --soft-amber: #fff4df;
  --soft-red: #fff0ed;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
  letter-spacing: 0;
}

body.auth-locked {
  min-height: 100vh;
  overflow: hidden;
}

.demo-login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.2), transparent 36%),
    linear-gradient(145deg, #0f1d35, #172b4d);
}

.demo-login[hidden] {
  display: none;
}

.demo-login-card {
  width: min(100%, 460px);
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(2, 8, 23, 0.35);
}

.demo-login-brand {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 12px;
  background: #2563eb;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.demo-login-card h1 {
  margin: 0;
  color: var(--navy);
  font-size: 28px;
}

.demo-login-lead {
  margin: 10px 0 24px;
  color: var(--muted);
}

.demo-login-form {
  display: grid;
  gap: 16px;
}

.demo-login-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.demo-login-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.demo-login-form input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(37, 99, 235, 0.15);
}

.demo-login-error {
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.demo-credentials {
  display: grid;
  gap: 5px;
  margin-top: 22px;
  padding: 13px 14px;
  border-radius: 8px;
  background: var(--soft-blue);
  color: var(--navy);
  font-size: 13px;
}

.demo-credentials span {
  color: var(--blue);
  font-weight: 800;
}

.demo-login-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell[hidden] {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: var(--navy);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #3b82f6;
  font-weight: 800;
}

.brand-label,
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-label {
  color: #b9c8e3;
}

.brand h1,
.topbar h2,
.section-heading h3,
.panel h3,
.flow-step h4 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.nav-item {
  display: block;
  padding: 11px 12px;
  border-radius: 8px;
  color: #dbe7ff;
  text-decoration: none;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.source-box {
  position: absolute;
  right: 18px;
  bottom: 24px;
  left: 18px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.source-box span {
  display: block;
  margin-bottom: 6px;
  color: #b9c8e3;
  font-size: 12px;
}

.source-box strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.demo-user-chip {
  display: grid;
  gap: 1px;
  padding: 7px 11px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: var(--soft-blue);
  color: var(--navy);
  line-height: 1.2;
}

.demo-user-chip span {
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
}

.demo-user-chip strong {
  font-size: 13px;
}

.logout-button {
  min-height: 40px;
}

.topbar h2 {
  max-width: 780px;
  font-size: 28px;
  line-height: 1.25;
}

.month-pill,
.status-chip {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.section {
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.05);
}

.section-heading,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h3,
.panel h3 {
  font-size: 19px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi {
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f9fbff);
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi strong {
  display: block;
  margin-top: 12px;
  font-size: 27px;
  line-height: 1;
}

.kpi em {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.05);
}

.panel-header span {
  color: var(--muted);
  font-weight: 700;
}

.attention-list {
  display: grid;
  gap: 10px;
}

.attention-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tag.confirm {
  background: var(--soft-amber);
  color: var(--amber);
}

.tag.add {
  background: var(--soft-green);
  color: var(--green);
}

.tag.change {
  background: var(--soft-blue);
  color: var(--blue);
}

.attention-item strong {
  display: block;
  margin-bottom: 4px;
}

.attention-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.mini-bars {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.bar-fill.carry {
  background: var(--amber);
}

.bar-fill.none {
  background: #98a2b3;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

input[type="search"] {
  width: min(320px, 100%);
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.segmented {
  display: inline-flex;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.seg {
  min-width: 58px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.seg.active {
  background: var(--navy);
  color: #fff;
}

.ghost-button,
.primary-button,
.demo-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.primary-button {
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
}

.demo-button {
  border: 1px solid #0f9f6e;
  background: #0f9f6e;
  color: #fff;
}

.month-control {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.month-control input {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.monthly-section {
  border-color: #bfdbfe;
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.workflow-strip article {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.workflow-strip .step-badge,
.inline-step {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
}

.workflow-strip .step-badge {
  grid-row: span 2;
}

.step-1 .step-badge,
.inline-step.step-1 {
  background: #2563eb;
}

.step-2 .step-badge,
.inline-step.step-2 {
  background: #0891b2;
}

.step-3 .step-badge,
.inline-step.step-3 {
  background: #7c3aed;
}

.step-4 .step-badge,
.inline-step.step-4 {
  background: #f97316;
}

.step-5 .step-badge,
.inline-step.step-5 {
  background: #0f9f6e;
}

.step-6 .step-badge,
.inline-step.step-6 {
  background: #dc2626;
}

.inline-step.step-7,
.inline-step.step-8 {
  background: #0f766e;
  color: #fff;
}

.inline-step {
  display: inline-grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-right: 8px;
  font-size: 15px;
  vertical-align: middle;
}

.label-title,
.panel-header h3,
.entry-form h4,
.table-title h3 {
  display: flex;
  align-items: center;
  gap: 0;
}

.workflow-strip strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.workflow-strip em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.staff-focus-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
}

.staff-focus-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.staff-focus-panel label:first-child {
  grid-column: span 1;
}

.staff-focus-panel label:nth-child(2) {
  grid-column: span 1;
}

.staff-focus-panel label:nth-child(3) {
  grid-column: span 3;
}

.label-title {
  color: var(--muted);
}

.staff-focus-panel select {
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.staff-focus-panel article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.staff-focus-panel span,
.selected-staff-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.staff-focus-panel strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.monthly-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.monthly-card {
  min-height: 120px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.monthly-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.monthly-card strong {
  display: block;
  margin-top: 10px;
  font-size: 25px;
}

.monthly-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.monthly-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  margin-bottom: 16px;
}

.entry-flow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
  align-items: start;
}

.entry-flow-card {
  display: block;
  min-width: 0;
  margin: 0;
}

.entry-flow-card .monthly-action-accordion > summary {
  grid-template-columns: 1fr;
  align-content: start;
}

.entry-flow-card .action-subtotal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 9px;
  background: #eff6ff;
}

.entry-flow-card .action-subtotal strong {
  font-size: 21px;
}

.entry-card-guide {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.regular-review-body {
  display: grid;
  gap: 12px;
  margin: 0 12px 12px;
  padding: 14px 4px 4px;
  border-top: 1px solid var(--line);
}

.calculation-preview {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--ink);
}

.calculation-preview strong { font-size: 18px; }
.calculation-preview em { color: var(--muted); font-size: 11px; font-style: normal; }

.entry-workspace {
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
}

.monthly-row-block {
  display: block;
}

.monthly-row-block > .entry-form,
.monthly-row-block > .panel {
  width: 100%;
}

.compact-help {
  width: fit-content;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.compact-help summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
}

.compact-help p {
  margin: 7px 0 0;
}

.selected-total-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1.7fr) repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
  padding: 14px;
  border: 2px solid #93c5fd;
  border-radius: 10px;
  background: #eff6ff;
}

.selected-total-panel > div {
  display: grid;
  gap: 5px;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
}

.selected-total-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.selected-total-panel strong {
  color: var(--ink);
  font-size: 17px;
}

.selected-total-panel .selected-total-grand {
  background: #0f172a;
}

.selected-total-panel .selected-total-grand span,
.selected-total-panel .selected-total-grand strong {
  color: #fff;
}

.rules-accordion > summary {
  list-style: none;
}

.rules-accordion > summary::-webkit-details-marker {
  display: none;
}

.accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.accordion-summary::after {
  content: "開く ＋";
  padding: 8px 12px;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.rules-accordion[open] .accordion-summary::after {
  content: "閉じる −";
}

.accordion-toolbar {
  margin: 18px 0 12px;
}

.payment-list-table {
  min-width: 760px;
}

.payment-list-table td {
  padding-top: 10px;
  padding-bottom: 10px;
}

.payment-amount {
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
}

.payment-bills {
  color: var(--muted);
  font-size: 12px;
}

.month-close-flow {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
}

.month-close-flow strong,
.month-close-flow span {
  padding: 8px;
  border-radius: 7px;
}

.month-close-flow span {
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  line-height: 1.5;
}

.mf-export-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid #b7dfd3;
  border-radius: 12px;
  background: #f1fbf7;
}

.mf-export-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.mf-export-panel p.error {
  color: #b42318;
  font-weight: 800;
}

.mf-export-panel p.ready {
  color: #087a5b;
  font-weight: 800;
}

.mf-export-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.mf-export-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.monthly-action-accordion {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.monthly-action-accordion > summary {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}

.monthly-action-accordion > summary::-webkit-details-marker,
.totals-accordion > summary::-webkit-details-marker {
  display: none;
}

.action-subtotal {
  color: var(--muted);
  font-size: 12px;
}

.action-subtotal strong {
  display: inline-block;
  margin-left: 6px;
  color: var(--ink);
  font-size: 17px;
}

.action-open-label {
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.monthly-action-accordion .entry-form {
  margin: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.totals-accordion {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.totals-accordion > summary {
  padding: 16px;
}

.totals-accordion[open] .accordion-summary::after {
  content: "閉じる −";
}

.totals-accordion .monthly-panel {
  border: 0;
  border-radius: 0;
}

.monthly-panel {
  min-height: 100%;
}

.regular-review-panel {
  max-height: 520px;
  overflow: auto;
}

.regular-review-panel select {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.regular-review-list {
  display: grid;
  gap: 10px;
}

.regular-review-summary,
.operation-notes {
  display: grid;
  gap: 10px;
}

.regular-review-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.regular-review-summary span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.regular-review-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, auto);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.regular-review-item strong {
  display: block;
  margin-top: 8px;
}

.regular-review-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.review-radios,
.radio-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.review-radios legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.review-radios label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.review-radios input {
  margin: 0;
}

.staff-total-list {
  display: grid;
  gap: 10px;
}

.staff-total-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.staff-total-item strong {
  display: block;
  margin-bottom: 4px;
}

.staff-total-item span {
  color: var(--muted);
  font-size: 12px;
}

.staff-total-item em {
  color: var(--blue);
  font-size: 18px;
  font-style: normal;
  font-weight: 900;
}

.monthly-table {
  margin-top: 8px;
}

.table-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcff;
}

.table-title h3 {
  margin: 0;
  font-size: 18px;
}

.table-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

.entry-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.entry-form h4 {
  margin: 0 0 4px;
  font-size: 17px;
}

.entry-form label,
.entry-form legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.entry-form input,
.entry-form select,
.entry-form textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

.entry-form fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.entry-form .radio-grid {
  background: #fff;
}

.entry-form .check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 700;
}

.entry-form .check input {
  width: auto;
  margin: 0;
}

.selected-staff-note {
  margin: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.selected-staff-note strong {
  color: var(--ink);
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.operation-notes p {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.operation-notes strong {
  color: var(--ink);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td:nth-child(3),
td:nth-child(5),
td:nth-child(6) {
  white-space: nowrap;
}

.status {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status.normal {
  background: #eef2f7;
  color: var(--muted);
}

.status.pending {
  background: var(--soft-amber);
  color: var(--amber);
}

.status.added {
  background: var(--soft-green);
  color: var(--green);
}

.status.changed {
  background: var(--soft-blue);
  color: var(--blue);
}

.payment-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.payment-card {
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.payment-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.payment-card h4 {
  min-width: 0;
  margin: 0;
  font-size: 15px;
}

.payment-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 24px;
}

.payment-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.flow-step {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.flow-step span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue);
  font-weight: 900;
}

.flow-step h4 {
  font-size: 16px;
}

.flow-step p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.master-section {
  border: 1px solid #cbd9f3;
  background: linear-gradient(180deg, #f7faff 0, #fff 190px);
}

.master-status {
  background: var(--soft-amber);
  color: var(--amber);
}

.master-status.ready {
  background: var(--soft-green);
  color: var(--green);
}

.master-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
  padding: 15px 18px;
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #eef4ff;
}

.master-notice p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.master-notice > span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.master-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.master-kpis article {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.master-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.master-kpis strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.master-kpis small {
  margin-left: 3px;
  color: var(--muted);
  font-size: 12px;
}

.master-tabs {
  display: flex;
  gap: 4px;
  margin-top: 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.master-operation-rules {
  margin: 14px 0;
  border: 1px solid #b7dfd3;
  border-radius: 12px;
  background: #f1fbf7;
}

.master-operation-rules > summary {
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 900;
}

.master-rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 16px 12px;
}

.master-rule-grid p {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
}

.master-rule-grid span,
.master-rule-note {
  color: var(--muted);
  font-size: 12px;
}

.master-rule-note {
  margin: 0 16px 14px;
  padding: 10px;
  border-left: 4px solid var(--green);
  background: #fff;
  font-weight: 800;
}

.check-complete-label {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.master-tab {
  flex: 0 0 auto;
  padding: 10px 13px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.master-tab.active {
  border-bottom-color: var(--blue);
  color: var(--blue);
}

.master-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
}

.master-toolbar input {
  min-width: 260px;
}

.master-toolbar span {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.master-table-wrap {
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.master-table-wrap thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.confirmation-form {
  display: grid;
  gap: 16px;
}

.confirmation-summary,
.confirmation-warning,
.confirmation-group-heading,
.confirmation-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.confirmation-summary {
  padding: 18px;
  border-radius: 10px;
  background: #eef4ff;
}

.confirmation-summary h4,
.confirmation-group-heading h4 {
  margin: 0;
}

.confirmation-summary p:not(.eyebrow) {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.confirmation-summary > strong {
  color: var(--blue);
  font-size: 28px;
  white-space: nowrap;
}

.confirmation-summary small {
  display: block;
  font-size: 11px;
  text-align: right;
}

.confirmation-warning {
  padding: 13px 16px;
  border-left: 4px solid var(--red);
  background: var(--soft-red);
  color: var(--red);
}

.confirmation-warning span {
  font-size: 12px;
}

.confirmation-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.confirmation-group-heading {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fd;
}

.confirmation-group-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.confirmation-group-heading span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.confirmation-group-heading em {
  color: var(--amber);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.confirmation-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.confirmation-item {
  padding: 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.confirmation-choices {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.confirmation-choice,
.confirmation-note {
  font-size: 12px;
}

.confirmation-note {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  color: var(--muted);
}

.confirmation-staff-list article {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto auto minmax(180px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.confirmation-staff-list article:last-child {
  border-bottom: 0;
}

.confirmation-staff-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.confirmation-staff-list label {
  font-size: 12px;
  white-space: nowrap;
}

.confirmation-save-bar {
  position: sticky;
  bottom: 12px;
  padding: 14px 16px;
  border: 1px solid #b9c9e8;
  border-radius: 10px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 24px rgba(29, 55, 100, .14);
}

.confirmation-save-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.confirmation-save-bar > div {
  display: flex;
  gap: 10px;
}

.master-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft-red);
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.master-badge.pass {
  background: var(--soft-green);
  color: var(--green);
}

.master-badge.waiting {
  background: var(--soft-amber);
  color: var(--amber);
}

.master-badge.rejected {
  background: var(--soft-red);
  color: var(--red);
}

.table-action {
  padding: 6px 10px;
  border: 1px solid #b9c9e8;
  border-radius: 6px;
  background: #f2f6ff;
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.master-detail {
  margin-top: 20px;
  padding: 20px;
  border: 2px solid #b9c9e8;
  border-radius: 10px;
  background: #f9fbff;
}

.detail-heading,
.approval-actions,
.request-summary,
.audit-list article > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-heading h4 {
  margin: 0;
  font-size: 20px;
}

.detail-heading small {
  color: var(--muted);
  font-size: 12px;
}

.workflow-guide {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.workflow-guide span {
  padding: 10px;
  border-radius: 6px;
  background: #e9edf5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.workflow-guide span.active {
  background: var(--soft-blue);
  color: var(--blue);
}

.master-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.master-change-form,
.approval-panel,
.audit-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.master-change-form h5,
.approval-panel h5,
.audit-panel h5 {
  margin: 0 0 12px;
  font-size: 16px;
}

.master-change-form > label,
.approval-panel > label,
.compact-form-grid label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.compact-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}

.master-change-form button[type="submit"] {
  width: 100%;
  margin-top: 16px;
}

.master-change-form button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.request-summary {
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 6px;
  background: var(--soft-amber);
}

.request-summary small {
  width: 100%;
  color: var(--muted);
}

.comparison-table {
  max-height: 310px;
}

.comparison-table .changed-row {
  background: #fff8e8;
}

.comparison-table th:first-child {
  white-space: nowrap;
}

.danger-button {
  padding: 9px 14px;
  border: 1px solid #f3b7ad;
  border-radius: 6px;
  background: var(--soft-red);
  color: var(--red);
  font-weight: 800;
  cursor: pointer;
}

.empty-approval {
  padding: 28px 16px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
}

.empty-approval p {
  margin: 8px 0 0;
  font-size: 13px;
}

.audit-panel {
  margin-top: 16px;
}

.audit-list {
  display: grid;
  gap: 8px;
}

.audit-list article {
  padding: 12px;
  border-left: 3px solid #c7d5ee;
  background: #f8faff;
}

.audit-list article strong {
  margin-right: auto;
}

.audit-list article p,
.audit-list article small {
  display: block;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.empty-cell {
  padding: 32px !important;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1120px) {
  .kpi-grid,
  .master-kpis,
  .monthly-grid,
  .workflow-strip,
  .staff-focus-panel,
  .payment-grid,
  .flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split,
  .monthly-workspace,
  .master-detail-grid {
    grid-template-columns: 1fr;
  }

  .entry-layout {
    grid-template-columns: 1fr;
  }

  .regular-review-item {
    grid-template-columns: 1fr;
  }

  .staff-focus-panel label,
  .staff-focus-panel label:first-child,
  .staff-focus-panel label:nth-child(2),
  .staff-focus-panel label:nth-child(3) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .demo-login-card {
    padding: 26px 22px;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .source-box {
    position: static;
    margin-top: 18px;
  }

  .content {
    padding: 18px;
  }

  .topbar,
  .section-heading {
    display: block;
  }

  .topbar h2 {
    font-size: 23px;
  }

  .month-pill,
  .status-chip,
  .toolbar {
    margin-top: 12px;
  }

  .kpi-grid,
  .master-kpis,
  .monthly-grid,
  .workflow-strip,
  .staff-focus-panel,
  .payment-grid,
  .flow {
    grid-template-columns: 1fr;
  }

  .regular-review-summary {
    grid-template-columns: 1fr;
  }

  .workflow-guide,
  .compact-form-grid {
    grid-template-columns: 1fr;
  }

  .master-notice,
  .master-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .master-toolbar input {
    min-width: 0;
  }

  .master-toolbar span {
    margin-left: 0;
  }
}
.content {
  display: flex;
  flex-direction: column;
}

.topbar { order: 0; }
#monthly { order: 1; }
#overview { order: 2; }
#overview + .split { order: 3; }
#rules { order: 4; }
#payments { order: 5; }
#master { order: 6; }

.incentive-workspace {
  align-items: stretch;
}

#incentiveInputFields:not([hidden]) {
  display: contents;
}

.permission-notice {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 14px 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7fafc;
}

.monthly-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 20px;
}

.monthly-progress article,
.owner-staff-list button {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.monthly-progress span,
.monthly-progress em,
.owner-staff-list span {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: .82rem;
}

.owner-staff-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.owner-staff-list button {
  text-align: left;
  cursor: pointer;
}

.staff-total-item .total-breakdown {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.complete-irregular {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .confirmation-summary,
  .confirmation-warning,
  .confirmation-save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .confirmation-items {
    grid-template-columns: 1fr;
  }

  .confirmation-staff-list article {
    grid-template-columns: 1fr 1fr;
  }

  .confirmation-staff-list article > div,
  .confirmation-staff-list article > input {
    grid-column: 1 / -1;
  }

  .confirmation-save-bar button {
    width: 100%;
  }

  .confirmation-save-bar > div {
    flex-direction: column;
  }

  .master-rule-grid {
    grid-template-columns: 1fr;
  }

  .selected-total-panel {
    grid-template-columns: 1fr 1fr;
  }

  .monthly-progress { grid-template-columns: 1fr; }

  .entry-flow-grid { grid-template-columns: 1fr; }

  .selected-total-panel > div:first-child,
  .selected-total-panel .selected-total-grand {
    grid-column: 1 / -1;
  }

  .month-close-flow {
    grid-template-columns: 1fr;
  }

  .mf-export-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .mf-export-actions,
  .mf-export-actions button {
    width: 100%;
  }

  .monthly-action-accordion > summary {
    grid-template-columns: 1fr;
  }
}
