:root {
  --font-ui: "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Hiragino Kaku Gothic ProN", "Segoe UI", sans-serif;
  --color-bg: #edf4fb;
  --color-surface: #ffffff;
  --color-surface-soft: #f1f7fc;
  --color-surface-tint: #eaf3ff;
  --color-border: #cadbea;
  --color-border-strong: #aebfd3;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-primary: #2563eb;
  --color-primary-strong: #1d4ed8;
  --color-primary-soft: #eff6ff;
  --color-info-soft: #e0f2fe;
  --color-positive: #0f766e;
  --color-negative: #dc2626;
  --color-warning: #d97706;
  --color-warning-soft: #fff7ed;
  --color-error-soft: #fef2f2;
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 14px 34px rgba(30, 64, 175, 0.1);
  --radius-sm: 6px;
  --radius-md: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #e8f2ff 0, var(--color-bg) 260px),
    var(--color-bg);
  color: #1f2937;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.layout {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 160ms ease;
}

.layout.is-sidebar-collapsed {
  grid-template-columns: 48px minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  overflow-x: hidden;
  background: linear-gradient(180deg, #17212b 0%, #1f2f38 58%, #18232c 100%);
  border-right: 1px solid rgba(20, 184, 166, 0.22);
  box-shadow: 10px 0 30px rgba(15, 23, 42, 0.18);
  transition: padding 160ms ease;
}

.app-sidebar.is-collapsed {
  padding-left: 5px;
  padding-right: 5px;
}

.app-sidebar-body {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 0;
  flex: 1 1 auto;
}

.app-brand {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 0 4px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  margin-bottom: 0;
}

.app-brand-copy {
  min-width: 0;
}

.app-brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px 3px 8px 3px;
  background: #2dd4bf;
  color: #102027;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: inset 0 -2px 0 rgba(15, 23, 42, 0.16);
}

.app-brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
  color: #ffffff;
}

.app-brand span {
  display: block;
  color: #a7f3d0;
  font-size: 12px;
  margin-top: 2px;
}

.app-sidebar.is-collapsed .app-brand {
  grid-template-columns: 1fr;
  justify-items: center;
}

.app-sidebar.is-collapsed .app-brand-copy {
  display: none;
}

.sidebar-toggle {
  width: 100%;
  min-height: 34px;
  margin-top: auto;
  justify-content: center;
  gap: 8px;
  border-color: rgba(45, 212, 191, 0.26);
  background: rgba(15, 23, 42, 0.18);
  color: #ffffff;
}

.sidebar-toggle-icon {
  position: relative;
  width: 14px;
  height: 14px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.sidebar-toggle-icon::before {
  content: "";
  position: absolute;
  inset: 4px 0;
  border-top: 2px solid currentColor;
}

.sidebar-account {
  display: grid;
  gap: 3px;
  margin-top: 10px;
  padding: 10px 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  color: #ffffff;
}

.sidebar-company-name,
.sidebar-user-name,
.sidebar-user-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-company-name {
  color: #99f6e4;
  font-size: 11px;
  font-weight: 600;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
}

.sidebar-user-meta {
  color: #cbd5e1;
  font-size: 11px;
}

.sidebar-logout-form {
  margin-top: 6px;
}

.sidebar-logout-button {
  width: 100%;
  min-height: 34px;
  gap: 7px;
  padding: 6px 9px;
  border-color: rgba(45, 212, 191, 0.28);
  background: rgba(15, 23, 42, 0.24);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.sidebar-logout-button:hover:not(:disabled) {
  border-color: rgba(94, 234, 212, 0.62);
  background: rgba(45, 212, 191, 0.13);
  color: #ffffff;
  box-shadow: none;
}

.app-sidebar.is-collapsed .sidebar-account {
  padding-inline: 0;
}

.app-sidebar.is-collapsed .sidebar-logout-button {
  padding-inline: 0;
}

.app-sidebar.is-collapsed .sidebar-toggle {
  padding-left: 0;
  padding-right: 0;
}

.app-sidebar.is-collapsed .sidebar-toggle span:last-child {
  display: none;
}

.app-nav {
  display: grid;
  gap: 6px;
  margin-inline: 0;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-submenu {
  display: grid;
  gap: 2px;
  margin: 0 0 2px 24px;
  padding-left: 7px;
  border-left: 1px solid rgba(45, 212, 191, 0.3);
}

.app-nav .nav-submenu a {
  min-height: 29px;
  padding: 4px 7px;
  border-radius: 5px;
  color: #b7dcd5;
  font-size: 12px;
  font-weight: 600;
}

.app-nav .nav-submenu a.is-active {
  background: rgba(45, 212, 191, 0.14);
  color: #ffffff;
  box-shadow: inset 2px 0 0 #fbbf24;
}

.app-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 38px;
  padding: 8px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: #d6f7f0;
  text-decoration: none;
  font-weight: 600;
}

.app-sidebar.is-collapsed .app-nav a {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.app-nav a:hover {
  background: rgba(45, 212, 191, 0.1);
  border-color: rgba(45, 212, 191, 0.18);
  color: #ffffff;
}

.app-nav a.active {
  background: rgba(236, 253, 245, 0.14);
  border-color: rgba(45, 212, 191, 0.34);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #fbbf24;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.16);
  color: inherit;
  flex: 0 0 auto;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-nav a.active .nav-icon {
  background: #2dd4bf;
  color: #102027;
}

.nav-label {
  min-width: 0;
  white-space: nowrap;
}

.sidebar-year-switcher {
  padding: 9px;
  border: 1px solid rgba(45, 212, 191, 0.38);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.3);
  color: #ffffff;
}

.sidebar-year-switcher label {
  display: grid;
  gap: 6px;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

.sidebar-year-switcher select {
  width: 100%;
  min-height: 42px;
  padding-inline: 10px;
  border-color: rgba(94, 234, 212, 0.62);
  background: rgba(15, 23, 42, 0.48);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
}

.sidebar-year-switcher option {
  color: #0f172a;
}

.app-sidebar.is-collapsed .sidebar-year-switcher label span {
  display: none;
}

.app-sidebar.is-collapsed .sidebar-year-switcher select {
  min-height: 30px;
  padding: 0 2px;
  font-size: 10px;
  text-align: center;
}

.app-sidebar.is-collapsed .sidebar-year-switcher {
  padding: 3px;
}

.app-main {
  min-width: 0;
  padding: 24px;
  overflow: visible;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin-top: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  margin-bottom: 14px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--color-border);
  padding: 8px;
  vertical-align: top;
}

th {
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

button,
.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff, #f1f7fc);
  color: #1e293b;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease, transform 120ms ease;
}

button:hover:not(:disabled),
.action-link:hover {
  border-color: #93c5fd;
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.action-button,
.button-link {
  gap: 7px;
  white-space: nowrap;
}

.action-icon {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  flex: 0 0 auto;
  padding: 3px;
  border-radius: 5px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 1.05em;
  font-weight: 900;
  line-height: 1;
}

.action-icon-svg {
  display: inline-block;
  box-sizing: border-box;
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 1.25rem;
  padding: 1px;
  border-radius: 5px;
  color: #1d4ed8;
}

.button-primary .action-icon,
.button-primary .action-icon-svg {
  color: #ffffff;
}

.action-button-danger .action-icon,
.action-button-danger .action-icon-svg {
  color: #dc2626;
}

.action-button-danger {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
}

.action-button-danger:hover:not(:disabled) {
  border-color: #f87171;
  background: #fef2f2;
  color: #991b1b;
}

input,
select,
textarea {
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--color-text);
  font: inherit;
}

input,
select {
  min-height: 40px;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;
  padding: 0 !important;
  margin: 0;
  accent-color: var(--color-primary);
  flex: 0 0 auto;
  transform: none !important;
  -webkit-transform: none !important;
  vertical-align: middle;
}

.toggle-option input[type="checkbox"],
.check-field input[type="checkbox"],
.table-check-label input[type="checkbox"] {
  margin: 0 !important;
}

input[type="file"] {
  width: auto;
  max-width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

input[type="file"]::file-selector-button {
  min-height: 38px;
  margin-right: 10px;
  padding: 8px 12px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff, #eef6ff);
  color: var(--color-primary-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.file-upload-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.file-upload-button {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff, #eef6ff);
  color: var(--color-primary-strong);
  font-weight: 800;
  overflow: hidden;
  cursor: pointer;
}

.file-upload-button input[type="file"] {
  position: absolute;
  inset: 0;
  min-height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-upload-name {
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

select {
  appearance: none;
  padding: 9px 38px 9px 12px;
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-primary-strong) 50%),
    linear-gradient(135deg, var(--color-primary-strong) 50%, transparent 50%),
    linear-gradient(180deg, #ffffff, #f4f9ff);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 12px) 17px,
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%;
  background-repeat: no-repeat;
  font-weight: 700;
}

textarea {
  padding: 9px 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(37, 99, 235, 0.16);
  border-color: #60a5fa;
}

.filters {
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.settings-toolbar {
  justify-content: flex-start;
}

.settings-toolbar-metrics {
  gap: 10px;
}

.filters label:has(input[type="checkbox"]),
.check-field,
.settings-section .check-field {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.filter-panel.single-line {
  grid-template-columns: minmax(220px, 320px);
}

.settings-form-grid-import {
  grid-template-columns: minmax(220px, 320px) minmax(320px, 1.2fr) minmax(220px, 280px);
}

.settings-form-grid-search,
.settings-form-grid-mapping {
  grid-template-columns: repeat(2, minmax(220px, 1fr)) minmax(180px, auto) minmax(180px, auto);
  align-items: end;
}

.settings-form-grid-pl-create {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.filter-panel label,
.readonly-condition,
.settings-form label,
.modal label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.readonly-condition,
.settings-context-strip {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.readonly-condition strong,
.settings-context-strip strong {
  color: #0f172a;
  font-size: 14px;
}

.settings-context-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.settings-context-strip.is-compact {
  margin-bottom: 10px;
}

.basic-settings-target-year label {
  display: inline-grid;
  grid-template-columns: auto minmax(160px, 220px);
  align-items: center;
  gap: 10px;
}

.basic-settings-target-year select {
  min-height: 32px;
}

.drag-handle {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #dbe7f3;
  border-radius: 6px;
  background: #f8fbff;
  color: #64748b;
  cursor: grab;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  user-select: none;
}

tr:active .drag-handle {
  cursor: grabbing;
}

.settings-table-scroll tr > td {
  transition: background-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.settings-table-scroll tr.is-dragging-row > td {
  background: #dbeafe !important;
  box-shadow: inset 4px 0 0 #2563eb, 0 4px 14px rgba(37, 99, 235, 0.16);
  opacity: 0.72;
}

.settings-table-scroll tr.is-drop-target-row > td {
  background: #eff6ff !important;
  box-shadow: inset 0 2px 0 #2563eb;
}

.settings-table-scroll tr.is-dragging-row .drag-handle,
.settings-table-scroll tr.is-drop-target-row .drag-handle {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
  cursor: grabbing;
}

.yh-sortable-floating {
  display: none !important;
}

.yh-drag-preview {
  position: fixed !important;
  z-index: 10000;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid #93c5fd;
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
  opacity: 0.98;
  pointer-events: none;
}

.yh-drag-preview .master-tree-cell {
  min-width: 0;
}

.editable-master-list .yh-sortable-chosen > .master-parent-row,
.editable-master-list .yh-sortable-chosen.master-child-row {
  background: #dbeafe !important;
}

.editable-master-list .yh-sortable-chosen {
  opacity: 0.18;
}

.editable-master-list .master-tree-group,
.editable-master-list .master-child-row {
  will-change: transform;
}

.editable-master-list .yh-sortable-ghost > .master-parent-row,
.editable-master-list .yh-sortable-ghost.master-child-row {
  background: #eff6ff !important;
  opacity: 0.42;
}

.editable-master-list .yh-sortable-drag > .master-parent-row,
.editable-master-list .yh-sortable-drag.master-child-row {
  background: #ffffff !important;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.22);
}

.yh-drag-preview .drag-handle,
.yh-sortable-chosen .drag-handle,
.yh-sortable-drag .drag-handle {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
  cursor: grabbing;
}

.filter-panel select,
.settings-form input,
.settings-form textarea,
.settings-form select,
.modal input,
.modal select,
table input,
table select {
  padding: 8px;
  width: 100%;
}

table input[type="checkbox"],
table input[type="radio"],
.table-check-input {
  width: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  height: 16px !important;
  max-height: 16px !important;
  min-height: 0;
  padding: 0 !important;
}

.table-check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.settings-form {
  display: grid;
  gap: 12px;
  max-width: 960px;
}

.company-settings-form {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  max-width: none;
  margin-bottom: 0;
}

.company-settings-form .field-wide {
  grid-column: span 2;
}

.company-settings-form .field-company-code {
  grid-column: span 2;
}

.company-settings-form .field-company-name {
  grid-column: span 4;
}

.section-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-form textarea {
  min-height: 96px;
}

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #e0f2fe, #f0f9ff);
  border: 1px solid #7dd3fc;
  border-radius: var(--radius-md);
  color: #075985;
  box-shadow: var(--shadow-sm);
}

.warning-notice {
  background: var(--color-warning-soft);
  border-color: #fed7aa;
  color: #9a3412;
}

.warning-notice::before {
  content: "確認が必要です";
  display: block;
  margin-bottom: 4px;
  color: #9a3412;
  font-size: 12px;
  font-weight: 800;
}

.error-notice {
  background: var(--color-error-soft);
  border-color: #fca5a5;
  color: #991b1b;
}

.error-notice::before {
  content: "エラーが発生しました";
  display: block;
  margin-bottom: 4px;
  color: #991b1b;
  font-size: 12px;
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.connection-status-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

button.connection-status-button {
  cursor: pointer;
}

button.connection-status-button:hover:not(:disabled) {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  transform: none;
}

.connection-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #94a3b8;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.18);
}

.connection-status-button.is-ok {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

button.connection-status-button.is-ok:hover:not(:disabled) {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.connection-status-button.is-ok .connection-status-dot {
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}

.connection-status-button.is-warning {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

button.connection-status-button.is-warning:hover:not(:disabled) {
  border-color: #fcd34d;
  background: #fef3c7;
  color: #92400e;
}

.connection-status-button.is-warning .connection-status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.18);
}

.connection-status-button.is-ng {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

button.connection-status-button.is-ng:hover:not(:disabled) {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}

.connection-status-button.is-ng .connection-status-dot {
  background: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.18);
}

.connection-status-button.is-unset,
.connection-status-button.is-untested,
.connection-status-button.is-unknown {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #475569;
}

button.connection-status-button.is-unset:hover:not(:disabled),
button.connection-status-button.is-untested:hover:not(:disabled),
button.connection-status-button.is-unknown:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
}

.connection-status-button.is-unset .connection-status-dot,
.connection-status-button.is-untested .connection-status-dot,
.connection-status-button.is-unknown .connection-status-dot {
  background: #94a3b8;
}

.modal-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-header-row h3 {
  margin: 2px 0 0;
}

.modal-kicker {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
}

.connection-status-modal {
  width: min(720px, 100%);
}

.connection-status-detail-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
}

.connection-status-detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.connection-status-detail-list > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.connection-status-detail-list dt {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
}

.connection-status-detail-list dd {
  margin: 0;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.7;
}

.budget-input {
  width: clamp(64px, 9ch, 80px);
  max-width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 6px;
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.budget-input::-webkit-outer-spin-button,
.budget-input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

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

.budget-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.link-button {
  display: inline-flex;
  min-height: auto;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--color-primary-strong);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.link-button:hover:not(:disabled) {
  background: transparent;
  box-shadow: none;
  color: #0f766e;
  text-decoration: underline;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: #fff;
  border-radius: 10px;
  width: min(960px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.compact-switch-field {
  justify-content: flex-start;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.selected-row {
  background: var(--color-primary-soft);
}

.settings-section {
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow-md);
  border-top: 3px solid #60a5fa;
  overflow-x: auto;
}

.master-settings-page {
  width: min(100%, 1240px);
  margin-inline: auto;
}

.master-settings-shell {
  width: min(100%, 1420px);
  margin-inline: auto;
}

.master-settings-navigation {
  width: 100%;
  margin-bottom: 18px;
  padding: 0 2px;
}

.master-settings-navigation > h1 {
  margin-bottom: 8px;
}

.master-settings-navigation > h1 + p {
  margin-top: 0;
}

.master-settings-page.is-wide {
  width: min(100%, 1420px);
}

.master-settings-page:has(.integration-systems-section),
.master-settings-page:has(.mapping-settings-section) {
  width: min(100%, 1420px);
}

.master-settings-page > h1 {
  margin-bottom: 8px;
}

.master-settings-page > h1 + p {
  margin-top: 0;
}

.master-settings-page .settings-table-scroll > table {
  width: max-content;
}

.master-settings-page .filter-panel {
  width: fit-content;
  max-width: 100%;
}

.master-settings-page .settings-form-grid-search,
.master-settings-page .settings-form-grid-mapping {
  grid-template-columns: minmax(16em, 23em) minmax(20em, 27em) max-content max-content;
}

.master-settings-page .external-account-import-section {
  padding-block: 14px;
}

.master-settings-page .external-account-import-section > h3 {
  margin-bottom: 6px;
}

.master-settings-page .external-account-import-section > p {
  margin: 0 0 12px;
}

.master-settings-page .external-account-import-fields {
  grid-template-columns: minmax(15em, 20em) minmax(22em, 30em) minmax(15em, 19em) max-content;
  align-items: end;
  gap: 12px 16px;
  width: 100%;
  margin-bottom: 0;
}

.external-account-import-section .file-upload-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.external-account-import-section .file-upload-button {
  gap: 7px;
  flex-direction: row;
  width: max-content;
  min-width: max-content;
  flex: 0 0 auto;
  white-space: nowrap;
}

.external-account-import-section .file-upload-control {
  display: grid;
  grid-template-columns: max-content minmax(8em, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
}

.external-account-import-section .file-upload-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-account-import-section .import-check-field .switch-control {
  min-height: 40px;
}

.external-account-import-section .external-account-import-actions {
  align-items: center;
  flex-wrap: nowrap;
  margin: 0;
}

.master-settings-page .settings-section {
  margin-bottom: 16px;
}

.master-settings-page .filter-panel input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.master-settings-page .filter-panel select,
.master-settings-page .settings-table-scroll table input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.master-settings-page .settings-table-scroll table select {
  width: auto;
  min-inline-size: 20em;
  max-inline-size: 32em;
  field-sizing: content;
}

.master-settings-page .master-field,
.master-settings-page .master-select {
  width: auto;
  min-inline-size: 20em;
  max-inline-size: 32em;
  field-sizing: content;
}

.master-settings-page .master-select {
  min-inline-size: 14em;
  max-inline-size: 28em;
}

.master-settings-page .account-source-table-scroll input[type="number"] {
  min-inline-size: 5.5em;
  max-inline-size: 7em;
  field-sizing: normal;
}

.master-settings-page .settings-table-scroll table select {
  min-inline-size: 14em;
  max-inline-size: 28em;
}

@media (max-width: 1080px) {
  .master-settings-page .filter-panel {
    width: 100%;
  }

  .master-settings-page .settings-form-grid-search,
  .master-settings-page .settings-form-grid-mapping {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .master-settings-page .external-account-import-fields {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .master-settings-page .external-account-import-fields .file-upload-control {
    flex-wrap: wrap;
  }
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-card {
  width: min(100%, 440px);
  padding: 30px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
}

.auth-brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px 4px 9px 4px;
  background: #0f766e;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.auth-card-heading h1 {
  margin-bottom: 8px;
}

.auth-card-heading p,
.development-login-panel > p {
  margin: 0;
  color: var(--color-muted);
}

.auth-status {
  margin-top: 20px;
  padding: 11px 12px;
  border: 1px solid #a7f3d0;
  border-radius: 5px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 13px;
}

.auth-status.is-error {
  border-color: #fecaca;
  background: var(--color-error-soft);
  color: #991b1b;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--color-border);
}

.auth-field {
  display: grid;
  gap: 7px;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
}

.auth-field input {
  width: 100%;
  font-weight: 400;
}

.auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 400;
}

.auth-remember input {
  margin: 0;
}

.development-login-panel {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--color-border);
}

.environment-badge {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 11px;
  font-weight: 600;
}

.development-login-panel dl {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.development-login-panel dl div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
}

.development-login-panel dt {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
}

.development-login-panel dd {
  margin: 0;
  color: var(--color-text);
  font-size: 14px;
}

.auth-submit {
  width: 100%;
  margin-top: 18px;
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #ffffff;
  font-weight: 600;
}

@media (max-width: 520px) {
  .auth-page {
    padding: 18px 12px;
  }

  .auth-card {
    padding: 22px 18px;
  }

  .development-login-panel dl div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.settings-section table th,
.settings-section table td {
  white-space: nowrap;
}

.settings-table-scroll {
  overflow-x: auto;
}

.settings-table-scroll tr.is-inactive-row,
.settings-table-scroll tr[data-active="false"] {
  opacity: 0.62;
}

.settings-table-scroll tr.is-inactive-row > td,
.settings-table-scroll tr[data-active="false"] > td {
  background: #f1f5f9 !important;
  color: #94a3b8;
}

.settings-table-scroll table {
  min-width: 1080px;
}

.integration-systems-table-scroll table {
  min-width: 1080px;
}

.integration-systems-table-scroll {
  overflow-x: visible;
}

.master-settings-page .integration-systems-table-scroll table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.integration-systems-table-scroll th:nth-child(1),
.integration-systems-table-scroll td:nth-child(1) { width: 17%; }
.integration-systems-table-scroll th:nth-child(2),
.integration-systems-table-scroll td:nth-child(2) { width: 14%; }
.integration-systems-table-scroll th:nth-child(3),
.integration-systems-table-scroll td:nth-child(3) { width: 11%; }
.integration-systems-table-scroll th:nth-child(4),
.integration-systems-table-scroll td:nth-child(4) { width: 12%; }
.integration-systems-table-scroll th:nth-child(5),
.integration-systems-table-scroll td:nth-child(5) { width: 10%; }
.integration-systems-table-scroll th:nth-child(6),
.integration-systems-table-scroll td:nth-child(6) { width: 12%; }
.integration-systems-table-scroll th:nth-child(7),
.integration-systems-table-scroll td:nth-child(7) { width: 16%; }

.integration-systems-table-scroll .master-field,
.integration-systems-table-scroll .master-select {
  box-sizing: border-box;
  width: 100% !important;
  min-width: 0 !important;
  min-inline-size: 0 !important;
  max-inline-size: none !important;
  field-sizing: normal;
}

.external-master-table-scroll table {
  min-width: 980px;
  table-layout: auto;
}

.internal-master-table-scroll table {
  min-width: 860px;
  table-layout: fixed;
}

.account-source-table-scroll table {
  min-width: 1180px;
}

.unmapped-table-scroll table {
  min-width: 900px;
}

.integration-systems-table-scroll table select,
.integration-systems-table-scroll table input,
.account-source-table-scroll table select,
.account-source-table-scroll table input {
  min-width: 112px;
}

.external-master-table-scroll table th:first-child,
.external-master-table-scroll table td:first-child,
.internal-master-table-scroll table th:first-child,
.internal-master-table-scroll table td:first-child {
  width: 52px;
  text-align: center;
}

.integration-systems-table-scroll table td:last-child,
.external-master-table-scroll table td:last-child {
  min-width: 160px;
  white-space: normal;
}

.integration-systems-table-scroll table td:last-child button,
.external-master-table-scroll table td:last-child button {
  margin: 2px 2px 2px 0;
}

.mapping-axis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}

.mapping-record-list {
  display: grid;
  gap: 12px;
  width: min(100%, 1180px);
  margin-top: 14px;
}

.mapping-pl-groups {
  display: grid;
  gap: 18px;
  width: min(100%, 1180px);
  margin-top: 14px;
}

.mapping-pl-group {
  display: grid;
  gap: 8px;
}

.mapping-pl-group-header {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-left: 4px solid #2563eb;
  background: #eaf3ff;
  color: #1e3a5f;
}

.mapping-pl-group-header h4 {
  margin: 0;
  font-size: 14px;
}

.mapping-pl-group-header span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.mapping-pl-group .mapping-record-list {
  margin-top: 0;
}

.mapping-record {
  overflow: hidden;
  border: 1px solid #bfd4ec;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 5%);
}

.mapping-record-grid {
  display: grid;
  grid-template-columns:
    var(--mapping-system-select-width, 12rem)
    calc(var(--mapping-external-select-width, 25rem) + 4em + 6px)
    calc(var(--mapping-internal-select-width, 25rem) + 4em + 6px)
    44px;
  align-items: start;
  gap: 16px;
  padding: 14px 16px 12px;
}

.mapping-record-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.mapping-record-axis {
  min-width: 0;
}

.mapping-record-axis h4 {
  margin: 0 0 8px;
  color: #334155;
  font-size: 12px;
}

.mapping-record .master-field,
.mapping-record .master-select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: none;
  font-size: 14px;
}

.mapping-record .mapping-system-select {
  width: var(--mapping-system-select-width, 12rem);
}

.mapping-record .mapping-external-select {
  width: var(--mapping-external-select-width, 25rem);
}

.mapping-record .mapping-internal-select,
.unmapped-table-scroll .mapping-internal-select {
  width: var(--mapping-internal-select-width, 25rem);
  max-width: none;
}

.mapping-record-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 22px;
}

.icon-button {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #bfd0e2;
  border-radius: var(--radius-sm);
  background: #fff;
  color: #334155;
  cursor: pointer;
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.icon-button-danger {
  border-color: #fecaca;
  color: #dc2626;
}

.mapping-axis-grid label {
  display: grid;
  grid-template-columns: 4em minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 40px;
  min-width: 0;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.mapping-axis-grid label span {
  color: #64748b;
}

.mapping-axis-hint {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #d7e3f0;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.mapping-axis-grid .mapping-axis-hint {
  margin-left: 4em;
}

.mapping-notes-field {
  display: grid;
  grid-template-columns: 4em minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 12px 16px 14px;
  border-top: 1px solid #dbe7f3;
  background: #f8fbff;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.mapping-notes-field .master-field {
  width: min(100%, 60rem);
  max-width: none;
}

@media (max-width: 1280px) {
  .integration-systems-table-scroll {
    overflow-x: auto;
  }

  .master-settings-page .integration-systems-table-scroll table {
    min-width: 1080px;
  }

  .mapping-record-grid {
    grid-template-columns: minmax(150px, 12rem) minmax(280px, 1fr) minmax(280px, 1fr) 44px;
  }

  .mapping-record .master-select {
    width: 100%;
  }

  .master-settings-page .external-account-import-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .mapping-record-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
  }

  .mapping-system-cell {
    grid-column: 1 / -2;
    max-width: 20rem;
  }
}

@media (max-width: 720px) {
  .mapping-record-grid {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .mapping-record-axis,
  .mapping-system-cell {
    grid-column: 1;
  }

  .mapping-record-actions {
    grid-column: 2;
    grid-row: 1;
  }
}

.settings-subpanel {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-top: 14px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #f8fbff, #eff6ff);
}

.settings-subpanel h4 {
  margin: 0;
}

.settings-subpanel-meta {
  margin-bottom: 0;
}

.settings-subpanel-editor textarea {
  min-height: 196px;
}

.board-config-panel {
  display: grid;
  gap: 10px;
  max-width: 1040px;
  min-width: 0;
}

.board-config-section {
  overflow: hidden;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  background: #ffffff;
}

.board-config-section h4,
.board-config-section h5 {
  margin: 0;
  padding: 9px 12px;
  border-bottom: 1px solid #dbeafe;
  background: #eff6ff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.board-setting-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border-top: 1px solid #eef2ff;
}

.board-setting-row:first-of-type {
  border-top: 0;
}

.board-setting-label {
  padding-top: 2px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.board-option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.board-check-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.board-check-option:has(input:checked) {
  border-color: #60a5fa;
  background: #eff6ff;
  color: #1d4ed8;
}

@media (max-width: 760px) {
  .board-setting-row {
    grid-template-columns: 1fr;
  }
}

.inline-hint {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
}

.table-action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.table-action-stack button {
  min-height: 34px;
  padding: 7px 10px;
}

.tree-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tree-cell > :last-child {
  min-width: 0;
  flex: 1 1 auto;
}

.external-master-table-scroll th:first-child,
.external-master-table-scroll td:first-child,
.internal-master-table-scroll th:first-child,
.internal-master-table-scroll td:first-child {
  width: 44px;
}

.internal-master-table-scroll th:nth-child(2),
.internal-master-table-scroll td:nth-child(2) {
  width: 52px;
  text-align: center;
}

.external-master-table-scroll th:nth-child(2),
.external-master-table-scroll td:nth-child(2) {
  width: 140px;
}

.external-master-table-scroll th:nth-child(3),
.external-master-table-scroll td:nth-child(3) {
  width: 42%;
}

.internal-master-table-scroll th:nth-child(3),
.internal-master-table-scroll td:nth-child(3) {
  width: 54%;
}

.external-master-table-scroll th:nth-child(4),
.external-master-table-scroll td:nth-child(4),
.external-master-table-scroll th:nth-child(5),
.external-master-table-scroll td:nth-child(5),
.internal-master-table-scroll th:nth-child(4),
.internal-master-table-scroll td:nth-child(4) {
  width: 120px;
}

.external-master-table-scroll th:last-child,
.external-master-table-scroll td:last-child,
.internal-master-table-scroll th:last-child,
.internal-master-table-scroll td:last-child {
  width: 164px;
}

.external-master-table-scroll th:last-child,
.external-master-table-scroll td:last-child {
  width: auto;
  min-width: max-content;
  white-space: nowrap;
}

.external-master-table-scroll .table-action-stack {
  flex-wrap: nowrap;
  width: max-content;
}

.master-tree-table tbody.master-tree-group tr > td {
  transition:
    background-color 120ms ease,
    box-shadow 120ms ease,
    color 120ms ease;
}

.master-tree-table tbody.master-tree-group:nth-of-type(odd) tr.master-parent-row > td {
  background: #ffffff;
}

.master-tree-table tbody.master-tree-group:nth-of-type(even) tr.master-parent-row > td {
  background: #f7fbff;
}

.master-tree-table tbody.master-tree-group + tbody.master-tree-group tr.master-parent-row > td {
  border-top: 1px solid #dbe7f3;
}

.master-tree-table tbody.master-tree-group:nth-of-type(odd) tr.master-child-row > td {
  background: #fbfdff;
  border-bottom-color: #e6edf5;
}

.master-tree-table tbody.master-tree-group:nth-of-type(even) tr.master-child-row > td {
  background: #f3f8fd;
  border-bottom-color: #e6edf5;
}

.master-tree-table tbody.master-tree-group tr.master-child-row:last-child > td {
  border-bottom-color: #dbe7f3;
}

.master-tree-table tbody.master-tree-group:hover tr.master-parent-row > td {
  background: #f1f8ff;
}

.master-tree-table tbody.master-tree-group:hover tr.master-child-row > td {
  background: #f6fbff;
}

.master-tree-table tbody.master-tree-group:hover tr > td:first-child {
  box-shadow: inset 2px 0 0 #bfdbfe;
}

.master-tree-table tbody.master-tree-group:hover .master-tree-count {
  color: #2563eb;
}

.master-tree-table tbody.master-tree-group tr:hover > td {
  background: #eef6ff;
}

.master-tree-table tbody.master-tree-group tr:hover > td:first-child {
  box-shadow: inset 3px 0 0 #2f7dbd;
}

.master-tree-table tbody.master-tree-group tr:hover .master-name-stack strong {
  color: #0f4c81;
}

.master-tree-table tbody.master-tree-group tr:hover .tree-toggle {
  border-color: #60a5fa;
  background: #dbeafe;
}

.master-name-cell {
  white-space: normal !important;
}

.master-secondary-cell {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  white-space: normal !important;
}

.master-tree-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.master-tree-item.is-sub {
  margin-left: 24px;
  padding-left: 12px;
  border-left: 2px solid #dbeafe;
}

.master-name-stack {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.master-name-stack strong {
  overflow-wrap: anywhere;
  color: #0f172a;
  font-weight: 800;
}

.master-name-stack span,
.master-edit-grid label span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.master-tree-count {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.master-edit-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.35fr) minmax(128px, 0.75fr);
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.master-edit-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.master-edit-grid input,
.master-edit-grid select {
  min-width: 0;
}

.tree-spacer {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
}

.tree-toggle-placeholder {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
}

.internal-master-table-scroll {
  max-width: 1180px;
}

.external-master-tree-list {
  min-width: 1080px;
}

.external-master-tree-list .master-tree-list-header,
.external-master-tree-list .master-tree-row {
  grid-template-columns: 44px 52px minmax(130px, 160px) minmax(20em, 1fr) minmax(90px, 120px) minmax(150px, 190px) minmax(120px, 150px);
}

.external-master-tree-list .master-child-row .master-name-cell {
  padding-left: 0;
}

.master-tree-list {
  min-width: 920px;
  position: relative;
  overflow: hidden;
  border: 1px solid #c9dbee;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.master-tree-list-header,
.master-tree-row {
  display: grid;
  grid-template-columns: 44px 52px minmax(20em, 1fr) minmax(14em, 20em) minmax(220px, max-content);
  align-items: center;
}

.master-tree-list-header {
  min-height: 42px;
  border-bottom: 1px solid #c9dbee;
  background: #edf6ff;
  color: #1e3a5f;
  font-size: 12px;
  font-weight: 800;
}

.master-tree-list-header > div,
.master-tree-cell {
  min-width: 0;
  padding: 8px 10px;
}

.master-tree-list-header > div:first-child,
.master-selection-cell,
.master-drag-cell {
  display: grid;
  place-items: center;
}

.master-tree-group + .master-tree-group .master-parent-row {
  border-top: 1px solid #dbe7f3;
}

.master-tree-row {
  min-height: 58px;
  background: #ffffff;
  transition: background-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.master-tree-group:nth-of-type(odd) > .master-parent-row {
  background: #f8fbff;
}

.master-tree-row:hover {
  background: #eef6ff !important;
}

.master-tree-row.is-inactive-row,
.master-tree-row[data-active="false"] {
  background: #f1f5f9 !important;
  color: #94a3b8;
}

.master-tree-row.is-inactive-row .master-name-input,
.master-tree-row[data-active="false"] .master-name-input {
  color: #64748b;
}

.master-child-list {
  border-top: 1px solid #e3edf8;
}

.master-child-row {
  min-height: 52px;
  background: #fbfdff;
}

.master-child-row:nth-child(even) {
  background: #f4f9ff;
}

.master-child-row .master-name-cell {
  padding-left: 0;
}

.master-tree-list .master-name-input {
  flex: 0 1 auto;
  min-inline-size: 20em;
  max-inline-size: 32em;
  inline-size: auto;
  field-sizing: content;
}

.master-tree-list .master-select {
  min-inline-size: 14em;
  max-inline-size: 24em;
  inline-size: auto;
  field-sizing: content;
}

.master-tree-list .master-secondary-cell:empty {
  min-height: 1px;
}

.master-tree-list .inline-action-row {
  flex-wrap: nowrap;
}

.master-tree-list .yh-sortable-ghost > .master-parent-row,
.master-tree-list .yh-sortable-ghost.master-child-row {
  border-top: 2px solid #2563eb;
  border-bottom: 2px solid #2563eb;
}

.master-tree-list .master-tree-group.yh-sortable-drop-before > .master-parent-row,
.master-tree-list .master-child-row.yh-sortable-drop-before {
  box-shadow: inset 0 3px 0 #2563eb;
}

.master-tree-list .master-tree-group.yh-sortable-drop-after > .master-parent-row,
.master-tree-list .master-child-row.yh-sortable-drop-after {
  box-shadow: inset 0 -3px 0 #2563eb;
}

.yh-drag-preview .master-tree-count {
  display: none;
}

.section-switch-link {
  color: var(--color-primary-strong);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.section-switch-link:hover {
  text-decoration: underline;
}

.file-upload-field {
  min-width: 0;
}

.import-check-field {
  align-self: end;
}

.search-toolbar-actions {
  margin-bottom: 0;
}

.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading-row h2,
.section-heading-row h3 {
  margin-bottom: 4px;
}

.subsection-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 12px;
}

.subsection-heading-row h3 {
  margin: 0 0 4px;
}

[data-testid="basic-settings-pl-category-table"] {
  min-width: 1180px;
  table-layout: auto;
}

.pl-aggregate-table {
  min-width: 1040px !important;
  table-layout: auto;
}

.pl-aggregate-table th:nth-child(2),
.pl-aggregate-table td:nth-child(2) {
  min-width: 440px;
  white-space: normal;
}

.compact-number-input {
  width: 88px;
  min-width: 72px;
}

.pl-category-option-list {
  display: flex;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
  min-width: 280px;
}

.pl-category-check-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
}

.pl-category-check-option input {
  flex: 0 0 auto;
}

.company-settings-section {
  background: linear-gradient(180deg, #ffffff, #f0f7ff);
}

.company-settings-section .notice {
  margin-bottom: 14px;
}

.settings-section-table table {
  min-width: 760px;
}

.master-tabs {
  align-items: stretch;
  gap: 10px;
  margin-bottom: 18px;
}

.master-tab {
  position: relative;
  min-height: 46px;
  padding-inline: 16px;
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #ffffff, #eef6ff);
  color: #1e3a8a;
  font-weight: 800;
}

.master-tab.is-active {
  border-color: #1d4ed8;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.24);
}

.master-tab.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -7px;
  height: 4px;
  border-radius: 999px;
  background: #14b8a6;
}

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

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 58%, #ecfeff 100%);
  box-shadow: var(--shadow-md);
}

.page-eyebrow {
  margin: 0 0 6px;
  color: var(--color-primary-strong);
  font-size: 12px;
  font-weight: 800;
}

.page-context-chips,
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.status-chip.is-active {
  border-color: #93c5fd;
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

.status-chip.is-warning {
  border-color: #fcd34d;
  background: #fffbeb;
  color: var(--color-warning);
}

.status-chip.is-locked {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
}

.status-chip.is-compact {
  min-height: 24px;
  padding: 3px 8px;
  font-size: 11px;
  box-shadow: none;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: #334155;
  box-shadow: var(--shadow-sm);
}

.empty-state h2 {
  margin: 0;
}

.empty-state.is-loading {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.budget-actual-page {
  display: grid;
  gap: 14px;
}

.budget-actual-page-header {
  margin-bottom: 0;
}

.budget-actual-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

.toolbar-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #f4f9ff);
  box-shadow: var(--shadow-sm);
  border-top: 3px solid #60a5fa;
}

.budget-actual-filter-details {
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #f4f9ff);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.budget-actual-filter-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 12px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.budget-actual-filter-details > summary::-webkit-details-marker {
  display: none;
}

.budget-actual-filter-details > summary::after {
  content: "開く";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
  font-size: 12px;
  font-weight: 800;
}

.budget-actual-filter-details[open] > summary::after {
  content: "閉じる";
}

.budget-actual-filter-summary {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.budget-actual-filter-content {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(360px, 1.4fr) minmax(260px, 0.8fr);
  gap: 10px;
  padding: 10px;
  border-top: 1px solid #bfdbfe;
}

.budget-actual-filter-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #ffffff;
  color: #1e3a8a;
  white-space: nowrap;
}

.budget-actual-filter-content {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(380px, 1.45fr) minmax(300px, 1fr);
  gap: 12px;
  padding: 12px;
  border-top: 1px solid #dbeafe;
}

.toolbar-card-options {
  border-top-color: #14b8a6;
}

.toolbar-card-aggregates {
  border-top-color: #f59e0b;
}

.toolbar-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.toolbar-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.toolbar-fields label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.toolbar-toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 8px;
}

.toolbar-toggle-grid.is-compact {
  grid-template-columns: repeat(3, minmax(86px, 1fr));
}

.toggle-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.toggle-option input {
  width: 15px;
  height: 15px;
  accent-color: var(--color-primary);
}

.toggle-option span {
  white-space: nowrap;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0;
  flex-wrap: wrap;
}

.button-primary {
  border-color: var(--color-primary);
  background: linear-gradient(180deg, #3b82f6, var(--color-primary-strong));
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.22);
}

.button-primary:hover:not(:disabled) {
  border-color: var(--color-primary-strong);
  background: var(--color-primary-strong);
  color: #ffffff;
}

.button-secondary {
  background: linear-gradient(180deg, #ffffff, #eef6ff);
}

.button-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--color-primary-strong);
  box-shadow: none;
}

.actual-import-action {
  border-color: #99f6e4;
  background: linear-gradient(180deg, #ffffff, #ecfeff);
  color: #0f766e;
}

.budget-actual-status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.budget-actual-status-strip > div {
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #eff6ff);
  box-shadow: var(--shadow-sm);
}

.budget-actual-status-strip span {
  display: block;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
}

.budget-actual-status-strip strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-grid.compact {
  margin-top: 12px;
}

.summary-grid > div {
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #f4f9ff);
  box-shadow: var(--shadow-sm);
}

.summary-grid .summary-wide {
  grid-column: 1 / -1;
}

.dashboard-top-summary {
  grid-template-columns: repeat(6, minmax(140px, 1fr));
}

.dashboard-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
}

.dashboard-action-card {
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #eff6ff);
  color: #0f172a;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.dashboard-action-card:hover {
  transform: translateY(-1px);
  border-color: #60a5fa;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.14);
}

.dashboard-action-card strong {
  color: var(--color-primary-strong);
  font-size: 15px;
}

.dashboard-action-card span {
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
}

.dashboard-summary-card {
  justify-content: start;
  display: grid;
  text-align: left;
  min-height: 80px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #eaf3ff);
  padding: 14px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.dashboard-summary-card:hover {
  transform: translateY(-1px);
  border-color: #60a5fa;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.14);
}

.dashboard-summary-title {
  font-size: 12px;
  color: #0f172a;
  opacity: 0.8;
}

.dashboard-summary-value {
  font-size: 20px;
  font-weight: 800;
  margin-top: 6px;
  color: var(--color-primary-strong);
}

.dashboard-metric {
  display: grid;
  gap: 6px;
  border-top: 3px solid #60a5fa !important;
}

.dashboard-metric-title {
  font-size: 12px;
  color: #0f172a;
  opacity: 0.8;
}

.dashboard-metric-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-primary-strong);
  word-break: break-word;
}

.dashboard-metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.dashboard-metric-trend.is-up {
  background: #dcfce7;
  color: #166534;
}

.dashboard-metric-trend.is-down {
  background: #fee2e2;
  color: #991b1b;
}

.dashboard-trend-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.dashboard-metric-hint {
  font-size: 12px;
}

.dashboard-metric.emphasize {
  border-top-color: #f59e0b !important;
  background: linear-gradient(180deg, #ffffff, #fff7ed);
}

.dashboard-graph-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dashboard-graph-box {
  border: 1px solid #bfdbfe;
  border-top: 3px solid #14b8a6;
  border-radius: var(--radius-md);
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #f0fdfa);
  box-shadow: var(--shadow-sm);
}

.dashboard-graph-box-wide {
  grid-column: 1 / -1;
}

.dashboard-graph-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.dashboard-inline-hint {
  margin: 0 0 12px 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid #dbeafe;
  color: #334155;
  font-size: 13px;
}

.dashboard-chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.dashboard-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-swatch.is-sales {
  background: #2563eb;
}

.legend-swatch.is-gross {
  background: #14b8a6;
}

.dashboard-column-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(38px, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 220px;
  padding: 14px 8px 6px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.36), rgba(255, 255, 255, 0.92));
  border: 1px solid #dbeafe;
  overflow-x: auto;
}

.dashboard-month-group {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  min-width: 38px;
  height: 196px;
}

.dashboard-bar-pair {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
  min-height: 160px;
  border-bottom: 1px solid #cbd5e1;
}

.dashboard-vertical-bar {
  display: block;
  width: 12px;
  min-height: 4px;
  border-radius: 5px 5px 2px 2px;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.14);
}

.dashboard-vertical-bar.is-sales {
  background: linear-gradient(180deg, #60a5fa, #2563eb);
}

.dashboard-vertical-bar.is-gross {
  background: linear-gradient(180deg, #5eead4, #0f766e);
}

.dashboard-month-label {
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.dashboard-trend-table,
.dashboard-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dashboard-trend-table th,
.dashboard-trend-table td,
.dashboard-compare-table th,
.dashboard-compare-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #e5e7eb;
}

.dashboard-trend-table thead th,
.dashboard-compare-table thead th {
  color: #0f172a;
  font-weight: 700;
  opacity: 0.85;
}

.dashboard-trend-table .value-col,
.dashboard-compare-table .value-col {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.variance-col.is-positive {
  color: var(--color-positive);
}

.variance-col.is-negative {
  color: #b91c1c;
}

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

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0f4c81, #60a5fa);
  border-radius: 999px;
}

.plain-list {
  margin: 0;
  padding-left: 20px;
}

.missing-row {
  background: var(--color-warning-soft);
}

.error-row {
  background: var(--color-error-soft);
}

.warning-text {
  color: #b45309;
  font-size: 12px;
  margin-top: 4px;
}

.error-text {
  color: #b91c1c;
  font-size: 12px;
  margin-top: 4px;
}

.sub-row td:first-child {
  background: #fbfdff;
}

.tree-toggle {
  flex: 0 0 24px;
  width: 24px;
  min-width: 24px;
  max-width: 24px;
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  padding: 0;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  color: var(--color-primary-strong);
  box-shadow: none;
  transform: none;
}

.tree-toggle:hover:not(:disabled) {
  box-shadow: none;
  transform: none;
}

.numeric-col {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.nowrap-col {
  white-space: nowrap;
}

.main-screen-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.budget-actual-grid-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.budget-actual-grid-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.budget-actual-grid-panel-header h2 {
  margin: 0;
}

.budget-actual-grid-panel-header span {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
}

.budget-actual-grid-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.budget-actual-grid-actions button {
  min-height: 34px;
  padding: 7px 10px;
}

.budget-actual-grid-actions .button-primary span {
  color: #ffffff;
}

.main-screen-grid {
  min-width: 0;
  max-height: calc(100vh - 300px);
  overflow: auto;
  background: #ffffff;
}

.budget-actual-grid-table {
  table-layout: fixed;
  min-width: 1480px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.budget-actual-grid-table th,
.budget-actual-grid-table td {
  border-right: 1px solid var(--color-border);
}

.budget-actual-grid-table thead th {
  height: 54px;
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border-strong);
  box-shadow: inset 0 -1px 0 var(--color-border);
}

.budget-actual-pl-header {
  width: 240px;
  min-width: 240px;
  background: #eef6ff !important;
}

.budget-actual-pl-cell {
  width: 240px;
  min-width: 240px;
  background: #ffffff;
  box-shadow: 1px 0 0 var(--color-border);
}

.budget-actual-row:hover .budget-actual-pl-cell,
.budget-actual-row:hover .budget-actual-data-cell {
  background: #f8fbff;
}

.budget-actual-row.row-kind-category .budget-actual-pl-cell,
.budget-actual-row.row-kind-subtotal .budget-actual-pl-cell,
.budget-actual-row.row-kind-aggregate .budget-actual-pl-cell {
  background: #f1f5f9;
}

.budget-actual-row.row-kind-subtotal .budget-actual-data-cell,
.budget-actual-row.row-kind-aggregate .budget-actual-data-cell {
  background: #eef6ff;
}

.budget-actual-row.row-kind-subtotal .budget-actual-pl-cell,
.budget-actual-row.row-kind-aggregate .budget-actual-pl-cell {
  background: #e8f2ff;
  border-left: 4px solid #2563eb;
}

.budget-actual-row.row-kind-aggregate .pl-row-name,
.budget-actual-row.row-kind-aggregate .budget-actual-value-line strong {
  color: var(--color-primary-strong);
}

.budget-actual-row.is-editable-row .budget-actual-pl-cell {
  border-left: 3px solid #93c5fd;
}

.budget-actual-grid-panel.is-edit-mode .budget-actual-row.is-editable-row .budget-actual-pl-cell {
  background: #eff6ff;
  border-left-color: var(--color-primary);
}

.budget-actual-grid-panel.is-edit-mode .budget-actual-row.is-editable-row .budget-actual-data-cell:not(.aggregate-col) {
  background: #f8fbff;
}

.budget-actual-grid-panel.is-expanded {
  position: fixed;
  inset: 12px 12px 12px 164px;
  z-index: 50;
  border-radius: 0;
}

.layout.is-sidebar-collapsed .budget-actual-grid-panel.is-expanded {
  left: 56px;
}

.budget-actual-grid-panel.is-expanded .main-screen-grid {
  max-height: calc(100vh - 110px);
}

.pl-row-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
}

.pl-row-name {
  color: #0f172a;
  font-weight: 800;
  word-break: break-word;
}

.row-type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.row-kind-account .row-type-pill,
.row-kind-sub-account .row-type-pill {
  border-color: #bfdbfe;
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

.row-kind-subtotal .row-type-pill,
.row-kind-aggregate .row-type-pill {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

.budget-actual-column-header {
  width: 118px;
  min-width: 118px;
  text-align: center;
  color: #334155;
}

.budget-actual-column-header span {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.budget-actual-column-header small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 10px;
  font-weight: 800;
}

.budget-actual-data-cell {
  width: 118px;
  min-width: 118px;
  background: #ffffff;
  vertical-align: top;
}

.budget-actual-column-header.aggregate-col,
.budget-actual-data-cell.aggregate-col {
  background: #f0f9ff;
}

.budget-actual-data-cell.selected-cell {
  position: relative;
  background: #dbeafe !important;
  box-shadow: inset 0 0 0 2px #2563eb;
}

.budget-actual-cell-stack {
  display: grid;
  gap: 5px;
}

.budget-actual-value-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  min-height: 21px;
  padding: 2px 0;
}

.budget-actual-value-line span {
  color: var(--color-muted);
  font-weight: 700;
}

.budget-actual-value-line strong {
  font-size: 13px;
  text-align: right;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: keep-all;
}

.budget-actual-value-line.is-actual strong {
  color: var(--color-primary-strong);
}

.budget-actual-value-line.is-positive strong {
  color: var(--color-positive);
}

.budget-actual-value-line.is-negative strong {
  color: var(--color-negative);
}

.budget-actual-value-line.is-editing {
  align-items: center;
  gap: 4px;
}

.budget-actual-value-line.is-editing span {
  flex: 0 0 auto;
  color: var(--color-primary-strong);
  font-size: 11px;
}

.budget-actual-value-line.is-editing .budget-input {
  flex: 0 0 68px;
}

.budget-actual-option-panel {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.budget-actual-inline-note {
  margin: 0;
}

.actual-detail-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.45);
}

.actual-detail-pane {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  background: #fff;
  padding: 0;
  width: min(1180px, calc(100vw - 48px));
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.actual-detail-pane-header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.actual-detail-pane-header h2 {
  margin: 2px 0 0;
}

.actual-detail-pane-kicker {
  color: var(--color-primary-strong);
  font-size: 11px;
  font-weight: 800;
}

.actual-detail-empty {
  flex: 1 1 auto;
  display: grid;
  gap: 4px;
  min-height: 150px;
  place-items: center;
  padding: 24px;
  color: var(--color-muted);
  text-align: center;
}

.actual-detail-empty strong {
  color: #334155;
  font-size: 15px;
}

.actual-detail-empty.is-selected {
  min-height: 140px;
  margin: 0 16px 16px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.actual-detail-context {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 12px 16px 10px;
  padding: 9px 12px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
}

.actual-detail-context-target {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.actual-detail-context-target span {
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.actual-detail-context-target strong {
  overflow: hidden;
  color: #1e3a8a;
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actual-detail-context-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.actual-detail-context-summary > span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
}

.actual-detail-context-summary strong {
  color: #1e3a8a;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.actual-detail-create-panel {
  flex: 0 0 auto;
  margin: 0 16px 10px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.actual-detail-create-panel > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 11px;
  color: #334155;
  cursor: pointer;
  list-style: none;
}

.actual-detail-create-panel > summary::-webkit-details-marker {
  display: none;
}

.actual-detail-create-panel > summary::after {
  content: "開く";
  margin-left: auto;
  color: var(--color-primary-strong);
  font-size: 11px;
  font-weight: 600;
}

.actual-detail-create-panel[open] > summary::after {
  content: "閉じる";
}

.actual-detail-create-panel > summary span {
  font-size: 12px;
  font-weight: 600;
}

.actual-detail-create-panel > summary small {
  color: #64748b;
  font-size: 10px;
}

.actual-detail-create-content {
  padding: 11px;
  border-top: 1px solid var(--color-border);
  background: #f8fafc;
}

.actual-detail-form-grid {
  display: grid;
  grid-template-columns: 140px 160px 130px minmax(220px, 1fr);
  gap: 10px;
}

.actual-detail-form-grid label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.actual-detail-form-grid input,
.actual-detail-form-grid select {
  width: 100%;
  min-width: 0;
}

.actual-detail-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.actual-detail-filters {
  flex: 0 0 auto;
  min-width: 0;
  margin: 0 16px 10px;
  padding: 6px 10px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.actual-detail-filters legend {
  padding: 0 5px;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
}

.actual-detail-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: start;
  gap: 8px 10px;
}

.actual-detail-filter-field,
.actual-detail-period-filter {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
}

.actual-detail-filter-field select,
.actual-detail-period-filter select {
  width: 100%;
  min-width: 0;
  height: 31px;
  padding-block: 3px;
  border-color: #b9c9dc;
  background-color: #fff;
  color: #1f2937;
  font-size: 11px;
  font-weight: 600;
}

.actual-detail-filter-field select:disabled,
.actual-detail-period-filter select:disabled {
  background-color: #f1f5f9;
  color: #64748b;
}

.actual-detail-filter-field small {
  color: #64748b;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.25;
}

.actual-detail-multi-filter {
  align-content: start;
}

.actual-detail-multi-select {
  min-width: 0;
  border: 1px solid #b9c9dc;
  border-radius: 4px;
  background: #fff;
  color: #1f2937;
  font-size: 11px;
  font-weight: 600;
}

.actual-detail-multi-select > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 29px;
  padding: 4px 8px;
  cursor: pointer;
  list-style: none;
}

.actual-detail-multi-select > summary::-webkit-details-marker {
  display: none;
}

.actual-detail-multi-select > summary > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actual-detail-multi-select[open] {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.actual-detail-multi-select-chevron {
  width: 7px;
  height: 7px;
  margin-left: auto;
  flex: 0 0 auto;
  border-right: 1.5px solid #64748b;
  border-bottom: 1.5px solid #64748b;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 120ms ease;
}

.actual-detail-multi-select[open] .actual-detail-multi-select-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.actual-detail-multi-select.is-disabled {
  display: flex;
  align-items: center;
  min-height: 31px;
  padding: 4px 8px;
  border-color: #d4dee9;
  background: #f1f5f9;
  color: #64748b;
}

.actual-detail-multi-select-menu {
  display: grid;
  gap: 5px;
  padding: 5px;
  border-top: 1px solid #dbe5ef;
  background: #f8fafc;
}

.actual-detail-multi-select-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
  color: #64748b;
  font-size: 9px;
  font-weight: 600;
}

.actual-detail-multi-select-actions > div {
  display: flex;
  align-items: center;
  gap: 2px;
}

.actual-detail-multi-select-actions button {
  min-height: 22px;
  padding: 2px 5px;
  border: 0;
  background: transparent;
  color: var(--color-primary-strong);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.actual-detail-multi-select-actions button:hover:not(:disabled) {
  text-decoration: underline;
}

.actual-detail-multi-select-actions button:disabled {
  color: #94a3b8;
  cursor: default;
}

.actual-detail-checkbox-list {
  display: grid;
  gap: 1px;
  max-height: 150px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.actual-detail-checkbox-option {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr);
  align-items: start;
  gap: 5px;
  min-width: 0;
  padding: 3px 4px;
  border-radius: 3px;
  color: #334155;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
}

.actual-detail-checkbox-option:hover {
  background: #eaf2fb;
}

.actual-detail-checkbox-option input {
  width: 13px;
  height: 13px;
  margin: 1px 0 0;
  accent-color: var(--color-primary);
}

.actual-detail-checkbox-option input:disabled {
  cursor: not-allowed;
}

.actual-detail-checkbox-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.actual-detail-period-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
}

.actual-detail-period-controls label {
  min-width: 0;
}

.actual-detail-filters .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.actual-detail-list-shell {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  margin: 0 16px 16px;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.actual-detail-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--color-border);
  background: #f8fafc;
}

.actual-detail-list-heading h3 {
  margin: 0;
  color: #1f2937;
  font-size: 13px;
  font-weight: 600;
}

.actual-detail-list-count {
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
}

.actual-detail-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.actual-detail-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.actual-detail-table th,
.actual-detail-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px;
  color: #334155;
  font-size: 12px;
  line-height: 1.4;
  vertical-align: middle;
}

.actual-detail-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #edf3fa;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.actual-detail-table thead th:nth-child(1) { width: 150px; }
.actual-detail-table thead th:nth-child(2) { width: 150px; }
.actual-detail-table thead th:nth-child(3) { width: 135px; }
.actual-detail-table thead th:nth-child(4) { width: 190px; }
.actual-detail-table thead th:nth-child(5) { width: 150px; text-align: right; }
.actual-detail-table thead th:nth-child(7) { width: 126px; text-align: center; }

.actual-detail-table tfoot th,
.actual-detail-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  border-top: 2px solid #93c5fd;
  border-bottom: 0;
  background: #eff6ff;
  box-shadow: 0 -3px 8px rgb(15 23 42 / 8%);
}

.actual-detail-table tfoot th {
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.actual-detail-table tfoot .actual-detail-amount-cell strong {
  color: #1e3a8a;
  font-size: 14px;
  font-weight: 800;
}

.actual-detail-table tbody tr:last-child td {
  border-bottom: 0;
}

.actual-detail-table tbody tr:hover td {
  background: #f8fbff;
}

.actual-detail-table tbody tr.is-editable td {
  background: #fbfdff;
}

.actual-detail-table tbody tr.is-editable:hover td {
  background: #f3f8ff;
}

.actual-detail-empty-row td {
  height: 150px;
  color: #64748b;
  text-align: center;
}

.actual-detail-empty-row strong,
.actual-detail-empty-row span {
  display: block;
}

.actual-detail-empty-row strong {
  margin-bottom: 4px;
  color: #334155;
  font-size: 14px;
}

.actual-detail-empty-row span {
  font-size: 11px;
}

.actual-detail-table-input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 5px 7px;
  border-color: #b9c9dc;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
}

.actual-detail-table-input.is-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.actual-detail-source-cell code {
  display: block;
  max-width: 140px;
  margin-top: 4px;
  overflow: hidden;
  color: #64748b;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actual-detail-date-cell time,
.actual-detail-amount-cell strong {
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.actual-detail-date-cell time {
  display: block;
  white-space: nowrap;
}

.actual-detail-fiscal-month {
  display: block;
  width: max-content;
  margin-bottom: 3px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
}

.actual-detail-amount-cell {
  text-align: right;
}

.actual-detail-amount-cell strong {
  font-size: 13px;
  font-weight: 600;
}

.actual-detail-pl-category-cell,
.actual-detail-account-cell,
.actual-detail-remarks-cell span {
  overflow-wrap: anywhere;
}

.actual-detail-account-cell strong,
.actual-detail-account-cell span,
.actual-detail-amount-note {
  display: block;
}

.actual-detail-account-cell strong {
  color: #1f2937;
  font-size: 12px;
  font-weight: 700;
}

.actual-detail-account-cell span {
  margin-top: 3px;
  color: #475569;
  font-size: 10px;
}

.actual-detail-account-cell span.is-empty {
  color: #94a3b8;
}

.actual-detail-amount-note {
  margin-top: 3px;
  color: #64748b;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.source-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

.source-type-badge.is-csv {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #0369a1;
}

.source-type-badge.is-api {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
}

.source-type-badge.is-manual {
  border-color: #bfdbfe;
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

.source-type-badge.is-adjustment {
  border-color: #fed7aa;
  background: var(--color-warning-soft);
  color: #9a3412;
}

.actual-detail-row-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.actual-detail-row-actions button {
  min-height: 30px;
  padding: 4px 6px;
  font-size: 11px;
}

.actual-detail-readonly {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}

.actual-detail-actions-cell {
  text-align: center;
}

.selected-cell {
  background: var(--color-primary-soft);
}

.budget-actual-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.budget-actual-detail-form {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .layout.is-sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  .app-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-main {
    padding: 18px;
  }

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

  .settings-form-grid-import,
  .settings-form-grid-search,
  .settings-form-grid-mapping,
  .settings-form-grid-pl-create {
    grid-template-columns: 1fr 1fr;
  }

  .company-settings-form {
    grid-template-columns: 1fr 1fr;
  }

  .company-settings-form .field-company-code,
  .company-settings-form .field-company-name {
    grid-column: auto;
  }

  .page-header {
    display: grid;
  }

  .budget-actual-toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

  .budget-actual-status-strip {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-top-summary {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .dashboard-links {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

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

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

  .actual-detail-pane {
    width: 100%;
    border-left: 0;
    border-radius: 0;
  }

  .actual-detail-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actual-detail-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actual-detail-form-grid .is-remarks {
    grid-column: 1 / -1;
  }

  .budget-actual-grid-panel.is-expanded {
    inset: 12px;
  }
}

@media (max-width: 640px) {
  .app-nav,
  .filter-panel,
  .summary-grid,
  .company-settings-form {
    grid-template-columns: 1fr;
  }

  .section-heading-row {
    display: grid;
  }

  .subsection-heading-row {
    display: grid;
    align-items: start;
  }

  .subsection-heading-row button {
    width: max-content;
  }

  .section-heading-actions {
    justify-content: flex-start;
  }

  .company-settings-form .field-wide,
  .company-settings-form .field-company-code,
  .company-settings-form .field-company-name {
    grid-column: auto;
  }

  .budget-actual-option-panel,
  .budget-actual-detail-form,
  .actual-detail-form-grid,
  .budget-actual-status-strip,
  .toolbar-fields,
  .toolbar-toggle-grid,
  .dashboard-graph-area,
  .dashboard-links {
    grid-template-columns: 1fr;
  }

  .dashboard-top-summary {
    grid-template-columns: 1fr 1fr;
  }

  .actual-detail-context {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .actual-detail-context-summary {
    flex-wrap: wrap;
  }

  .actual-detail-list-heading {
    align-items: center;
  }

  .actual-detail-filter-grid {
    grid-template-columns: 1fr;
  }
}

.settings-section-heading-row,
.settings-save-bar,
.inline-action-row,
.modal-footer-actions,
.switch-field,
.switch-control {
  display: flex;
  align-items: center;
}

.settings-section-heading-row {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.settings-section-heading-row h3,
.settings-section-heading-row p {
  margin-top: 0;
}

.settings-save-bar,
.inline-action-row,
.modal-footer-actions {
  gap: 8px;
  flex-wrap: nowrap;
  width: max-content;
}

.switch-field {
  gap: 10px;
  justify-content: space-between;
}

.switch-control {
  position: relative;
  gap: 8px;
  width: max-content;
  white-space: nowrap;
  cursor: pointer;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex: 0 0 38px;
  border: 1px solid #8a99aa;
  border-radius: 11px;
  background: #d6dde5;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.25);
  transition: transform 120ms ease;
}

.switch-control input:checked + .switch-track {
  border-color: #1f6feb;
  background: #1f6feb;
}

.switch-control-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.switch-control-button[aria-checked="true"] .switch-track {
  border-color: #1f6feb;
  background: #1f6feb;
}

.switch-control-button[aria-checked="true"] .switch-track::after {
  transform: translateX(16px);
}

.switch-control-button:focus-visible .switch-track {
  outline: 2px solid #80b7ff;
  outline-offset: 2px;
}

.switch-control input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch-control input:focus-visible + .switch-track {
  outline: 2px solid #80b7ff;
  outline-offset: 2px;
}

.switch-label {
  min-width: 3.5em;
}

.editable-master-table input:not([type]),
.editable-master-table select,
.master-name-input {
  width: 100%;
  min-width: 150px;
}

.connection-settings-modal {
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.integration-system-create-modal {
  width: min(560px, calc(100vw - 32px));
}

.integration-system-template-form {
  display: grid;
  gap: 16px;
}

.integration-system-template-form > label {
  display: grid;
  grid-template-columns: 110px minmax(260px, 1fr);
  align-items: center;
  gap: 12px;
}

.integration-system-template-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--color-border);
  background: #f8fafc;
}

.integration-system-template-summary > div {
  padding: 10px 12px;
}

.integration-system-template-summary dt {
  margin-bottom: 3px;
  color: var(--color-muted);
  font-size: 12px;
}

.integration-system-template-summary dd {
  margin: 0;
}

.connection-message-panel {
  margin: 12px 0 18px;
  padding: 10px 12px;
  border-left: 3px solid #8a99aa;
  background: #f5f7f9;
  overflow-wrap: anywhere;
}

.connection-settings-body {
  display: grid;
  gap: 16px;
}

.modal-footer-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 760px) {
  .settings-section-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .integration-system-template-form > label,
  .integration-system-template-summary {
    grid-template-columns: 1fr;
  }
}

/* Role-based typography: overview, dense lists, and editable settings. */
h1,
h2,
h3 {
  color: #111827;
}

h1 {
  font-size: 22px;
  font-weight: 700;
}

h2 {
  font-size: 17px;
  font-weight: 600;
}

h3 {
  font-size: 15px;
  font-weight: 600;
}

button,
.action-link,
.button-link {
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  color: #1f2937;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
}

select,
input[type="file"]::file-selector-button,
.file-upload-button {
  font-weight: 400;
}

th {
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

td {
  color: #1f2937;
  font-weight: 400;
}

.muted {
  color: #64748b;
  font-size: 13px;
  font-weight: 400;
}

.badge,
.status-chip,
.source-type-badge,
.row-type-pill {
  font-weight: 600;
}

.filter-panel label,
.readonly-condition,
.settings-form label,
.modal label,
.filters label:has(input[type="checkbox"]),
.check-field,
.settings-section .check-field {
  color: #475569;
  font-weight: 600;
}

.readonly-condition strong,
.settings-context-strip strong {
  color: #1f2937;
  font-weight: 500;
}

.app-nav a {
  font-size: 13px;
  font-weight: 600;
}

.app-nav .nav-submenu a {
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-year-switcher label {
  font-weight: 600;
}

.sidebar-year-switcher select {
  font-weight: 600;
}

/* Dashboard: values lead; labels, legends, and chart axes stay quiet. */
.dashboard-page h1 {
  font-size: 24px;
  font-weight: 700;
}

.dashboard-page .settings-section > h2 {
  font-size: 17px;
  font-weight: 600;
}

.dashboard-page .page-eyebrow {
  color: #475569;
  font-weight: 600;
}

.dashboard-summary-title,
.dashboard-metric-title {
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  opacity: 1;
}

.dashboard-summary-value {
  font-size: 21px;
  font-weight: 700;
}

.dashboard-metric-value {
  font-size: 20px;
  font-weight: 700;
}

.dashboard-metric-trend {
  font-size: 12px;
  font-weight: 600;
}

.dashboard-trend-mark {
  font-weight: 600;
}

.dashboard-graph-title strong {
  color: #1f2937;
  font-size: 14px;
  font-weight: 600;
}

.dashboard-graph-title .muted,
.dashboard-inline-hint {
  font-size: 12px;
  font-weight: 400;
}

.dashboard-chart-legend {
  color: #475569;
  font-size: 12px;
  font-weight: 500;
}

.dashboard-axis-labels,
.dashboard-month-label {
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
}

.dashboard-bar-tooltip {
  font-size: 12px;
  font-weight: 400;
}

.dashboard-bar-tooltip strong {
  font-weight: 600;
}

.dashboard-trend-table,
.dashboard-compare-table {
  color: #1f2937;
  font-size: 13px;
  font-weight: 400;
}

.dashboard-trend-table thead th,
.dashboard-compare-table thead th {
  color: #475569;
  font-weight: 600;
  opacity: 1;
}

/* Budget/actual list: regular data, clear headers, strong totals only. */
.budget-actual-page h1 {
  font-size: 22px;
  font-weight: 700;
}

.budget-actual-filter-details > summary {
  font-size: 14px;
  font-weight: 600;
}

.budget-actual-filter-details > summary::after,
.budget-actual-filter-summary,
.toolbar-card-header,
.toolbar-fields label,
.toggle-option {
  font-weight: 600;
}

.budget-actual-page select,
.budget-actual-page input,
.budget-actual-page textarea {
  font-weight: 400;
}

.budget-actual-grid-panel-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.budget-actual-grid-panel-header span {
  font-weight: 400;
}

.budget-actual-grid-table {
  color: #1f2937;
  font-size: 12px;
  font-weight: 400;
}

.budget-actual-column-header span {
  font-size: 12px;
  font-weight: 600;
}

.budget-actual-column-header small {
  font-weight: 600;
}

.pl-row-name {
  color: #1f2937;
  font-weight: 500;
}

.budget-actual-row.row-kind-category .pl-row-name,
.budget-actual-row.row-kind-subtotal .pl-row-name,
.budget-actual-row.row-kind-aggregate .pl-row-name {
  font-weight: 700;
}

.budget-actual-value-line {
  font-size: 11px;
}

.budget-actual-value-line span {
  color: #64748b;
  font-weight: 400;
}

.budget-actual-value-line strong {
  color: #1f2937;
  font-size: 12px;
  font-weight: 500;
}

.budget-actual-value-line.is-actual strong {
  font-weight: 600;
}

.budget-actual-row.row-kind-subtotal .budget-actual-value-line strong,
.budget-actual-row.row-kind-aggregate .budget-actual-value-line strong {
  font-weight: 700;
}

.budget-actual-status-strip span,
.budget-actual-status-strip strong {
  font-weight: 600;
}

.actual-detail-pane-kicker,
.actual-detail-context-target span,
.actual-detail-form-grid label,
.actual-detail-readonly {
  font-weight: 600;
}

.actual-detail-context-target strong,
.actual-detail-context-summary strong,
.actual-detail-amount-cell strong {
  font-weight: 600;
}

/* Settings and import workflows: labels distinguish fields; values remain regular. */
.master-settings-shell,
.settings-page,
.actual-import-page {
  color: #1f2937;
}

.master-settings-shell h1,
.settings-page h1,
.actual-import-page h1 {
  font-size: 22px;
  font-weight: 700;
}

.master-settings-shell h2,
.settings-page h2,
.actual-import-page h2 {
  font-size: 17px;
  font-weight: 600;
}

.master-settings-shell h3,
.settings-page h3,
.actual-import-page h3 {
  font-size: 15px;
  font-weight: 600;
}

.master-settings-shell input,
.master-settings-shell select,
.master-settings-shell textarea,
.settings-page input,
.settings-page select,
.settings-page textarea,
.actual-import-page input,
.actual-import-page select,
.actual-import-page textarea {
  color: #1f2937;
  font-size: 14px;
  font-weight: 400;
}

.master-settings-shell table,
.settings-page table,
.actual-import-page table {
  color: #1f2937;
  font-size: 13px;
  font-weight: 400;
}

.master-settings-shell th,
.settings-page th,
.actual-import-page th {
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.master-settings-shell button,
.settings-page button,
.actual-import-page button,
.master-settings-shell .button-link,
.settings-page .button-link,
.actual-import-page .button-link {
  font-size: 13px;
  font-weight: 600;
}

.master-tab {
  font-size: 13px;
  font-weight: 600;
}

.settings-context-strip,
.master-tree-list-header,
.mapping-record-field,
.mapping-axis-grid label,
.mapping-axis-hint,
.mapping-notes-field,
.board-setting-label,
.master-edit-grid label,
.master-secondary-cell {
  font-weight: 600;
}

.master-name-stack strong {
  color: #1f2937;
  font-weight: 500;
}

.master-name-stack span,
.master-edit-grid label span,
.master-tree-count {
  color: #64748b;
  font-weight: 500;
}

.mapping-record-axis h4,
.mapping-pl-group-header h4 {
  color: #374151;
  font-weight: 600;
}

.mapping-pl-group-header span {
  font-weight: 500;
}

.mapping-record .master-field,
.mapping-record .master-select {
  font-size: 14px;
  font-weight: 400;
}

.switch-label,
.file-upload-name {
  color: #475569;
  font-weight: 400;
}

.section-switch-link,
.page-eyebrow {
  font-weight: 600;
}

.actual-import-page .readonly-condition span,
.actual-import-page .filter-panel label > span:first-child {
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

/* Budget/actual workspace: compact controls and a hierarchy-first PL table. */
.budget-actual-page {
  gap: 10px;
}

.budget-actual-toolbar {
  display: block;
  overflow: hidden;
  border: 1px solid #b9c9dc;
  border-top: 3px solid var(--color-primary);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.budget-actual-toolbar-primary {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px;
}

.budget-actual-toolbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.budget-actual-toolbar-title h1 {
  margin: 0;
  color: #172033;
  font-size: 20px;
  font-weight: 700;
}

.budget-actual-toolbar-status {
  display: flex;
  gap: 5px;
}

.budget-actual-primary-fields {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
  flex-wrap: wrap;
}

.budget-actual-primary-fields > label,
.budget-actual-primary-fields fieldset,
.budget-actual-display-settings fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.budget-actual-primary-fields > label {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.budget-actual-primary-fields label > span,
.budget-actual-primary-fields legend,
.budget-actual-display-settings legend {
  color: #475569;
  font-size: 11px;
  font-weight: 600;
}

.budget-actual-primary-fields select {
  min-height: 34px;
  padding-block: 5px;
  font-size: 13px;
}

.budget-actual-period-range {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) auto minmax(88px, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 205px;
}

.budget-actual-period-range legend,
.budget-actual-hierarchy-control legend {
  grid-column: 1 / -1;
  margin-bottom: 4px;
}

.segmented-control {
  display: inline-flex;
  height: 34px;
  border: 1px solid #b9c9dc;
  border-radius: 5px;
  overflow: hidden;
  background: #f8fafc;
}

.segmented-control button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 66px;
  padding: 5px 9px;
  border: 0;
  border-right: 1px solid #d5dee9;
  border-radius: 0;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
}

.segmented-control button:last-child {
  border-right: 0;
}

.segmented-control button.is-active {
  background: #e8f1ff;
  color: #164e9b;
  box-shadow: inset 0 -2px 0 #2563eb;
}

.segmented-control .action-icon-svg {
  width: 16px;
  height: 16px;
}

.budget-actual-display-details {
  border-top: 1px solid #d7e0ea;
  background: #f8fafc;
}

.budget-actual-display-details > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 12px;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.budget-actual-display-details > summary::-webkit-details-marker {
  display: none;
}

.budget-actual-display-details > summary small {
  color: #64748b;
  font-size: 11px;
  font-weight: 400;
}

.budget-actual-display-details > summary .action-icon-svg {
  width: 16px;
  height: 16px;
}

.budget-actual-display-settings {
  display: grid;
  grid-template-columns: minmax(600px, 1.5fr) minmax(220px, .45fr);
  gap: 24px;
  padding: 8px 12px 10px;
  border-top: 1px solid #e2e8f0;
}

.budget-actual-display-settings fieldset {
  display: grid;
  align-self: start;
  align-content: start;
  gap: 6px;
}

.budget-actual-display-settings .toolbar-toggle-grid {
  display: flex;
  align-items: flex-start;
  align-content: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.budget-actual-display-settings .toolbar-toggle-grid.is-compact {
  gap: 8px;
  flex-wrap: nowrap;
}

.budget-actual-display-settings .toggle-option {
  gap: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 400;
}

.budget-actual-category-option-table-wrap {
  max-height: 230px;
  overflow: auto;
  border: 1px solid #d7e0ea;
  border-radius: 4px;
  background: #fff;
}

.budget-actual-category-option-table {
  width: 100%;
  min-width: 570px;
  border-collapse: collapse;
  table-layout: fixed;
}

.budget-actual-category-option-table th,
.budget-actual-category-option-table td {
  height: 28px;
  padding: 3px 6px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 400;
  text-align: center;
  vertical-align: middle;
}

.budget-actual-category-option-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf3fa;
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
}

.budget-actual-category-option-table th:first-child {
  width: 160px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-actual-category-option-table tbody tr:last-child th,
.budget-actual-category-option-table tbody tr:last-child td {
  border-bottom: 0;
}

.budget-actual-category-option-table tbody tr.is-bulk-setting {
  background: #f8fafc;
}

.budget-actual-category-option-table tbody th {
  font-weight: 500;
}

.budget-actual-category-option-table .table-check-input {
  display: block;
  margin: 0 auto;
}

.budget-actual-category-option-note {
  color: #64748b;
  font-size: 10px;
  line-height: 1.4;
}

.budget-actual-grid-panel {
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.budget-actual-grid-panel-header {
  min-height: 48px;
  padding: 7px 10px;
  background: #fff;
}

.budget-actual-grid-actions {
  gap: 5px;
}

.budget-actual-grid-actions button {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 500;
}

.budget-actual-grid-actions .icon-button {
  width: 32px;
  min-width: 32px;
  padding: 6px;
}

.main-screen-grid {
  max-height: calc(100vh - 230px);
}

.budget-actual-grid-table {
  --budget-actual-month-column-width: 80px;
  --budget-actual-aggregate-column-width: 88px;
  width: max-content;
  min-width: 100%;
  font-size: 12px;
}

.budget-actual-grid-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 44px;
}

.budget-actual-pl-header,
.budget-actual-pl-cell {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 232px;
  min-width: 232px;
  max-width: 232px;
}

.budget-actual-pl-header {
  z-index: 6 !important;
}

.budget-actual-pl-cell {
  padding: 5px 7px;
  vertical-align: top;
}

.budget-actual-column-header,
.budget-actual-data-cell {
  width: var(--budget-actual-month-column-width);
  min-width: var(--budget-actual-month-column-width);
  max-width: var(--budget-actual-month-column-width);
}

.budget-actual-column-header.aggregate-col,
.budget-actual-data-cell.aggregate-col {
  width: var(--budget-actual-aggregate-column-width);
  min-width: var(--budget-actual-aggregate-column-width);
  max-width: var(--budget-actual-aggregate-column-width);
}

.budget-actual-uniform-budget-header,
.budget-actual-uniform-budget-cell {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
}

.budget-actual-uniform-budget-cell {
  background: #f0fdfa;
  vertical-align: middle;
}

.budget-actual-uniform-budget-input {
  display: grid;
  gap: 4px;
}

.budget-actual-uniform-budget-input .budget-input {
  width: 100%;
}

.budget-actual-apply-monthly-budget {
  min-height: 24px;
  padding: 2px 4px;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  background: #ffffff;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.budget-actual-apply-monthly-budget:hover,
.budget-actual-apply-monthly-budget:focus-visible {
  border-color: #2563eb;
  background: #eff6ff;
  outline: none;
}

.budget-actual-uniform-budget-placeholder {
  display: grid;
  min-height: 30px;
  place-items: center;
  color: #94a3b8;
}

.budget-actual-data-cell {
  padding: 5px;
}

.budget-actual-row:not(.row-kind-category) .budget-actual-data-cell {
  padding-top: 5px;
}

.budget-actual-category-spacer {
  min-height: 38px;
  background: #edf3fa;
  border-bottom: 1px solid #c7d4e3;
}

.budget-actual-row.row-kind-category .budget-actual-pl-cell {
  border-left: 4px solid #4b78aa;
  border-bottom: 1px solid #c7d4e3;
  background: #edf3fa;
}

.budget-actual-pl-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 4px;
  align-items: start;
}

.budget-actual-row.row-kind-category .budget-actual-pl-content {
  grid-template-columns: minmax(0, 1fr);
}

.pl-row-title {
  gap: 3px;
  min-height: 18px;
}

.pl-row-toggle,
.pl-row-toggle-spacer,
.pl-row-kind-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 17px;
  width: 17px;
  height: 18px;
}

.pl-row-toggle {
  padding: 2px;
  border: 0;
  background: transparent;
  color: #315f91;
}

.pl-row-toggle:hover {
  background: #dbeafe;
}

.pl-row-toggle .action-icon-svg,
.pl-row-kind-icon .action-icon-svg {
  width: 14px;
  height: 14px;
}

.pl-row-kind-icon {
  color: #64748b;
}

.pl-row-name {
  min-width: 0;
  font-size: 12px;
  line-height: 18px;
}

.budget-actual-metric-legend {
  display: grid;
  gap: 1px;
  justify-items: end;
  margin: 0;
  padding: 0;
  text-align: right;
}

.budget-actual-metric-legend span {
  min-height: 18px;
  color: #64748b;
  font-size: 11px;
  line-height: 18px;
  font-weight: 400;
  white-space: nowrap;
}

.budget-actual-cell-stack {
  gap: 1px;
}

.budget-actual-value-line {
  justify-content: flex-end;
  gap: 3px;
  min-height: 18px;
  padding: 0;
  line-height: 18px;
}

.budget-actual-value-line strong {
  width: 100%;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 18px;
}

.budget-actual-value-line.is-rate strong {
  font-size: 12px;
}

.budget-actual-value-line .link-button {
  width: 100%;
  text-align: right;
}

.budget-actual-value-line.is-editing .budget-input {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  height: 22px;
  padding: 1px 5px;
  text-align: right;
}

.budget-actual-value-line.is-achievement {
  position: relative;
}

.budget-actual-value-line.is-achievement strong {
  flex: 1 1 auto;
  width: 100%;
}

.budget-achievement-status {
  position: absolute;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  min-width: 14px;
  border-radius: 50%;
}

.budget-achievement-status .budget-achievement-icon {
  width: 10px;
  height: 10px;
  stroke-width: 2.5;
}

.budget-actual-value-line.is-achieved strong {
  color: #047857;
}

.budget-actual-value-line.is-achieved .budget-achievement-status {
  background: #d1fae5;
  color: #047857;
}

.budget-actual-value-line.is-not-achieved strong {
  color: #b91c1c;
}

.budget-actual-value-line.is-not-achieved .budget-achievement-status {
  background: #fee2e2;
  color: #b91c1c;
}

@media (max-width: 1100px) {
  .budget-actual-toolbar-primary {
    align-items: start;
    flex-direction: column;
  }

  .budget-actual-primary-fields {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .budget-actual-display-settings {
    grid-template-columns: 1fr;
  }

  .budget-actual-primary-fields {
    display: grid;
    width: 100%;
  }

  .budget-actual-pl-header,
  .budget-actual-pl-cell {
    width: 230px;
    min-width: 230px;
    max-width: 230px;
  }
}

@media (max-width: 760px) {
body {
    font-size: 13px;
  }

  input,
  select,
  textarea,
  .master-settings-shell input,
  .master-settings-shell select,
  .settings-page input,
  .settings-page select,
  .actual-import-page input,
  .actual-import-page select {
    font-size: 14px;
  }
}

/* Dense business forms and stable in-page navigation. */
.master-settings-header {
  width: 100%;
  padding-inline: 2px;
}

.master-settings-navigation {
  position: sticky;
  top: 0;
  z-index: 40;
  margin-bottom: 14px;
  padding: 8px 2px 0;
  border-bottom: 1px solid #cbd5e1;
  background: rgba(248, 250, 252, 0.98);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
}

.master-settings-navigation .master-tabs {
  margin: 0;
}

.master-anchor-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 34px;
  margin-top: 6px;
  overflow-x: auto;
}

.master-anchor-menu a {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  padding: 5px 12px;
  border-bottom: 2px solid transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.master-anchor-menu a:hover,
.master-anchor-menu a.is-active {
  border-bottom-color: #2563eb;
  color: #1d4ed8;
  background: #eff6ff;
}

.master-settings-page .settings-section[id] {
  scroll-margin-top: 112px;
}

.master-settings-shell .settings-section,
.settings-page .settings-section,
.actual-import-page .settings-section {
  padding: 14px;
  border-radius: 4px;
  border-top-width: 2px;
  background: #ffffff;
  box-shadow: none;
}

.master-settings-shell input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.master-settings-shell select,
.settings-page input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.settings-page select,
.actual-import-page input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.actual-import-page select {
  min-height: 34px;
  padding: 5px 9px;
  border-radius: 4px;
  background-color: #ffffff;
  box-shadow: none;
}

.master-settings-shell .settings-table-scroll input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.master-settings-shell .settings-table-scroll select,
.master-settings-shell .master-tree-list input:not([type="checkbox"]):not([type="radio"]),
.master-settings-shell .master-tree-list select {
  min-height: 32px;
  padding-block: 4px;
}

.master-settings-shell button,
.master-settings-shell .action-link,
.master-settings-shell .button-link,
.settings-page button,
.settings-page .action-link,
.actual-import-page button,
.actual-import-page .action-link {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 4px;
  background-image: none;
  box-shadow: none;
}

.master-settings-shell button:hover:not(:disabled),
.master-settings-shell .action-link:hover,
.settings-page button:hover:not(:disabled),
.actual-import-page button:hover:not(:disabled) {
  box-shadow: none;
  transform: none;
}

.master-settings-shell .master-tab {
  min-height: 38px;
  padding-inline: 13px;
  border-radius: 4px 4px 0 0;
}

.master-settings-shell .master-tab.is-active {
  background-color: #1d4ed8;
  box-shadow: none;
}

.master-settings-shell .button-primary,
.settings-page .button-primary,
.actual-import-page .button-primary {
  background-color: #2563eb;
  color: #ffffff;
}

.master-tree-row {
  min-height: 44px;
}

@media (max-width: 760px) {
  .master-settings-navigation {
    margin-inline: -4px;
    padding-inline: 4px;
  }

  .master-settings-shell input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .master-settings-shell select,
  .settings-page input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .settings-page select,
  .actual-import-page input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .actual-import-page select {
    min-height: 40px;
  }
}
