:root {
  color-scheme: light;
  font-family: "Yu Gothic", "Meiryo", system-ui, sans-serif;
  background: #edf7fa;
  color: #18324a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding-bottom: 96px;
  background: #edf7fa;
}

.app-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border-radius: 0;
  background: #24899b;
  color: #ffffff;
  padding: 14px 24px;
  box-shadow: 0 12px 28px rgba(36, 137, 155, 0.16);
}

.eyebrow {
  margin: 0 0 4px;
  color: #d9eef3;
  font-size: 12px;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.view-nav,
.primary-actions,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.view-nav {
  border: 1px solid #b8dce5;
  border-radius: 6px;
  background: #d7eef3;
  padding: 8px;
}

.login-screen {
  min-height: 360px;
  display: grid;
  place-items: start center;
  padding: 42px 16px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid #b8dce5;
  background: #ffffff;
  padding: 24px;
  box-shadow: 0 12px 28px rgba(36, 137, 155, 0.14);
}

.login-panel h2 {
  margin-bottom: 18px;
  color: #18324a;
  font-size: 24px;
}

.login-panel label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: #18324a;
  font-size: 13px;
  font-weight: 700;
}

.login-panel input {
  min-height: 40px;
  border: 1px solid #b7cbd3;
  padding: 8px 10px;
  font: inherit;
}

.login-panel button {
  width: 100%;
  min-height: 42px;
  margin-top: 4px;
}

button {
  min-height: 34px;
  border: 1px solid #2a9fb3;
  border-radius: 6px;
  background: linear-gradient(180deg, #38b6c9 0%, #258da1 100%);
  color: #ffffff;
  padding: 7px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

button:hover {
  border-color: #207f92;
  background: linear-gradient(180deg, #31a9bc 0%, #207f92 100%);
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.2);
  transform: translateY(-1px);
}

button:active {
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.24);
  transform: translateY(0);
}

button:disabled {
  border-color: #c7d7dd;
  background: #dbe8ec;
  color: #617680;
  cursor: not-allowed;
}

.ghost-button {
  background: #ffffff;
  color: #1c6f82;
  border-color: #d7edf3;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.ghost-button:hover {
  background: #eef9fc;
  border-color: #b9dfe8;
  color: #155d6f;
}

.sheet-heading {
  display: grid;
  grid-template-columns: 1.1fr 0.75fr 0.85fr 1fr;
  align-items: start;
  gap: 10px;
  margin-bottom: 12px;
}

.sheet-credit {
  margin: 8px 2px 0;
  color: #7b8794;
  font-size: 11px;
  text-align: right;
}

.read-field,
.month-field {
  min-height: 58px;
  border: 1px solid #b7cbd3;
  background: #ffffff;
  display: grid;
  gap: 4px;
  padding: 8px 10px;
}

.read-field span,
.month-field {
  color: #52606d;
  font-size: 12px;
  font-weight: 700;
}

.read-field strong {
  color: #1f2933;
  font-size: 18px;
}

.month-actions {
  display: grid;
  gap: 10px;
}

.month-actions > .primary-actions {
  flex-wrap: nowrap;
  height: 50px;
  align-items: center;
  justify-content: flex-end;
}

.month-actions > .primary-actions button {
  min-width: 58px;
}

.right-summary {
  display: grid;
  gap: 10px;
}

.sheet-heading > .read-field,
.sheet-heading .month-field,
.right-summary > .status-field {
  height: 74px;
  min-height: 74px;
}

.right-summary > .summary-panel {
  height: 50px;
}

.month-field input,
.read-field select,
.settings-grid input,
.settings-grid select {
  min-height: 32px;
  border: 1px solid #b7cbd3;
  padding: 4px 8px;
  font: inherit;
  background: #ffffff;
}

.employee-select-field {
  cursor: default;
}

.employee-select-field select {
  width: 100%;
  color: #1f2933;
  font-size: 18px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #2b5360;
  background: #ffffff;
}

.expense-table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
  table-layout: fixed;
  background: #ffffff;
}

.expense-table th,
.expense-table td {
  border: 1px solid #2b5360;
  padding: 0;
  height: 42px;
}

.expense-table th {
  background: #d6eef4;
  color: #18324a;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.expense-table input,
.expense-table select {
  width: 100%;
  height: 40px;
  border: 0;
  padding: 6px 8px;
  font: inherit;
  font-size: 16px;
  background: transparent;
}

.expense-table input:focus,
.expense-table select:focus {
  outline: 2px solid #1fa6bd;
  outline-offset: -2px;
  background: #f2fbfd;
}

.date-col,
.paymentDate-cell {
  width: 100px;
}

.amount-col,
.amount-cell {
  width: 130px;
}

.tax-col,
.taxRate-cell {
  width: 80px;
}

.amount-cell input {
  text-align: right;
}

.description-col {
  width: 300px;
}

.action-col,
.actions {
  width: 116px;
}

.draft-row {
  background: #f8fdfe;
}

.accountTitle-cell {
  vertical-align: top;
}

.account-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border-top: 1px solid #b9e2ea;
  background: #eefbfe;
  color: #155d6a;
  padding: 4px 6px;
  font-size: 11px;
  line-height: 1.35;
}

.account-suggestion[hidden] {
  display: none;
}

.account-suggestion .suggestion-apply-button {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 2px 8px;
  font-size: 11px;
}

.saving-row {
  color: #617680;
}

.saving-row td {
  background: #edf4f7;
}

.actions {
  padding: 3px;
  text-align: center;
  background: #eef7fa;
  white-space: nowrap;
}

.actions button {
  width: auto;
  min-width: 42px;
  min-height: 28px;
  margin: 0 2px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.1;
}

.summary-panel {
  border: 1px solid #2b5360;
  background: #ffffff;
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
}

.summary-panel span,
.summary-panel strong {
  min-height: 42px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.summary-panel span {
  border-right: 1px solid #2b5360;
  background: #d6eef4;
  color: #18324a;
  font-weight: 700;
}

.summary-panel strong {
  font-size: 20px;
}

.status-field {
  min-height: 0;
}

.company-select-field select {
  width: 100%;
  min-width: 220px;
  border: 0;
  background: transparent;
  color: #18324a;
  padding: 0;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
}

.company-select-field select:not(:disabled) {
  cursor: pointer;
}

.company-select-field select:focus {
  outline: 2px solid #1fa6bd;
  outline-offset: 3px;
}

.admin-screen {
  display: block;
}

.admin-workspace {
  display: grid;
  gap: 14px;
}

.admin-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid #8fc5d0;
  border-left: 6px solid #1b8da0;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px 18px;
  box-shadow: 0 10px 24px rgba(20, 116, 134, 0.08);
}

.admin-context-label {
  margin: 0 0 5px;
  color: #59717a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.admin-company-select-label select {
  min-width: min(460px, 58vw);
  min-height: 42px;
  border: 1px solid #8fb8c2;
  border-radius: 6px;
  background: #f8fdfe;
  color: #18324a;
  padding: 7px 40px 7px 11px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
}

.admin-context-summary {
  margin: 7px 0 0;
  color: #52606d;
  font-size: 13px;
}

.portal-management-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid #147486;
  border-radius: 6px;
  background: #e8f7fa;
  color: #155d6a;
  padding: 8px 16px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.portal-management-link:hover {
  background: #d7f0f5;
}

.portal-management-link.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid #9fc8d1;
  padding: 0 4px;
}

.admin-tabs button {
  min-height: 44px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: #52606d;
  padding: 9px 18px;
  box-shadow: none;
  white-space: nowrap;
}

.admin-tabs button:hover {
  border-color: #c7dce3;
  background: #eef8fb;
  color: #18324a;
  box-shadow: none;
  transform: none;
}

.admin-tabs button.is-active {
  border-color: #9fc8d1;
  background: #ffffff;
  color: #147486;
  box-shadow: 0 -3px 0 #1b8da0 inset;
}

.admin-tab-panels,
.admin-tab-panel {
  min-width: 0;
}

.admin-tab-panel {
  display: grid;
  gap: 14px;
}

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

.settings-section {
  border: 1px solid #c7dce3;
  background: #ffffff;
  padding: 0;
  box-shadow: 0 10px 24px rgba(20, 116, 134, 0.08);
}

.admin-tab-panel > .settings-section {
  padding: 18px;
}

.settings-section h2 {
  margin: 0;
}

.settings-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.source-of-truth-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: #e1f4f7;
  color: #176a78;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.portal-management-note {
  border-left: 4px solid #4ba7b7;
  background: #f2fbfd;
  color: #40545c;
  margin: 12px 0;
  padding: 10px 12px;
  line-height: 1.6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.settings-section-toggle {
  position: relative;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-bottom: 1px solid #d8e8ed;
  border-radius: 0;
  background: #f8fdfe;
  color: #18324a;
  padding: 12px 42px 12px 14px;
  text-align: left;
  box-shadow: none;
}

.settings-section-toggle:hover {
  border-color: #d8e8ed;
  background: #eef8fb;
  color: #18324a;
  box-shadow: none;
  transform: none;
}

.settings-section-toggle::after {
  content: "∨";
  position: absolute;
  right: 16px;
  top: 50%;
  color: #6d8791;
  transform: translateY(-50%);
}

.settings-section.is-collapsed .settings-section-toggle {
  border-bottom: 0;
}

.settings-section.is-collapsed .settings-section-toggle::after {
  content: "〉";
}

.settings-section-body {
  padding: 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.compact-grid {
  grid-template-columns: minmax(150px, 260px);
}

.settings-grid label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}

.settings-section .admin-actions {
  margin-top: 8px;
}

.api-diagnostics-actions {
  margin-bottom: 12px;
}

.account-issue-actions {
  margin: 0 0 10px;
}

.company-management-layout {
  display: grid;
  gap: 14px;
}

.company-switch-grid {
  grid-template-columns: minmax(220px, 360px);
  margin-bottom: 14px;
}

.admin-target-grid {
  grid-template-columns: minmax(220px, 360px);
  margin-bottom: 12px;
}

.company-create-panel,
.company-list-panel {
  border: 1px solid #d8e8ed;
  background: #f8fdfe;
  padding: 12px;
}

.company-create-grid {
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 240px);
}

.company-create-actions {
  margin-bottom: 0;
}

.company-table select {
  min-width: 160px;
  min-height: 30px;
  border: 1px solid #b7cbd3;
  padding: 3px 6px;
  font: inherit;
}

.current-company-row {
  background: #eef8fb;
}

.current-company-badge,
.current-target-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 8px;
  border-radius: 999px;
  background: #d6eef4;
  color: #126b7f;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.export-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.85fr);
  gap: 14px;
  margin-top: 12px;
}

.export-panel {
  border-top: 1px solid #d8e8ed;
  background: #f8fdfe;
  padding: 12px 0 0;
}

.export-panel h3 {
  margin: 0 12px 10px;
  color: #18324a;
  font-size: 15px;
}

.export-panel .settings-grid,
.export-panel .admin-actions,
.export-panel .section-summary {
  margin-right: 12px;
  margin-left: 12px;
}

.export-format-grid {
  grid-template-columns: minmax(160px, 220px) minmax(180px, 1fr) minmax(180px, 1fr);
}

.export-target-grid {
  grid-template-columns: minmax(160px, 220px) minmax(180px, 1fr);
}

.export-subject-actions,
.export-run-actions {
  margin-bottom: 12px;
}

.export-action-panel {
  margin-top: 14px;
}

.export-run-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.export-run-actions button {
  min-width: 150px;
}

.export-condition-summary {
  min-height: 20px;
}

.totals-preview {
  margin-top: 16px;
  border-top: 1px solid #d8e8ed;
  padding-top: 14px;
}

.totals-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.totals-preview-header h3 {
  margin: 0;
}

.totals-preview-table .numeric-cell {
  text-align: right;
}

.section-summary {
  margin: 0 0 10px;
  color: #52606d;
  font-size: 13px;
}

.account-master-panel {
  margin-bottom: 18px;
  border: 1px solid #cfe1e7;
  border-radius: 8px;
  background: #f8fdfe;
  padding: 14px;
}

.account-master-panel h3 {
  margin: 0 0 8px;
}

.account-master-import-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.account-master-import-row label {
  display: grid;
  min-width: min(100%, 360px);
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}

.field-note {
  margin: 8px 0 0;
  color: #52606d;
  font-size: 12px;
}

#currentAccountSummary {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 8px;
  color: #1f2933;
  font-weight: 700;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #d6eef4;
  color: #126b7f;
  padding: 3px 10px;
  font-size: 12px;
}

.account-meta {
  grid-column: 1 / -1;
  color: #52606d;
  font-weight: 700;
  line-height: 1.5;
}

.learning-add-grid {
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.2fr) minmax(150px, 1fr) minmax(84px, 110px);
  margin-bottom: 8px;
}

.learning-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 14px 0;
  border-bottom: 1px solid #c7dce3;
}

.learning-tabs button {
  min-height: 38px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #52606d;
  padding: 8px 12px;
  box-shadow: none;
  white-space: nowrap;
}

.learning-tabs button:hover,
.learning-tabs button.is-active {
  border-bottom-color: #1b8da0;
  background: #eef8fb;
  color: #147486;
  box-shadow: none;
  transform: none;
}

[data-learning-panel] {
  min-width: 0;
}

.shared-learning-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  font-weight: 700;
}

.shared-learning-toggle input {
  width: 18px;
  height: 18px;
}

.shared-rule-table,
.category-mapping-table,
.shared-rule-review-table {
  margin-top: 14px;
}

.common-category-admin-panel,
.shared-operation-settings {
  margin: 12px 0 16px;
  border: 1px solid #c7dce3;
  background: #f8fdfe;
  padding: 12px;
}

.common-category-admin-panel h3,
.shared-operation-settings h3 {
  margin: 0 0 10px;
  color: #18324a;
}

.common-category-add-grid {
  grid-template-columns: minmax(150px, 0.7fr) minmax(180px, 1fr) minmax(260px, 1.5fr);
}

.shared-threshold-grid {
  grid-template-columns: repeat(3, minmax(130px, 190px));
  margin-bottom: 10px;
}

.shared-pilot-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  align-items: start;
  gap: 14px;
}

.shared-pilot-grid label {
  align-content: start;
  min-width: 0;
}

.shared-pilot-grid input,
.shared-pilot-grid select {
  width: 100%;
}

.shared-pilot-grid select[multiple] {
  height: 132px;
  min-height: 132px;
}

.shared-pilot-grid small {
  color: #617680;
  font-weight: 400;
  line-height: 1.5;
}

.shared-operation-actions {
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #d8e8ed;
}

.category-mapping-table input {
  min-width: 180px;
}

.learning-add-actions {
  margin-bottom: 12px;
}

.learning-filter-grid {
  grid-template-columns: minmax(240px, 420px) auto;
  align-items: end;
  margin: 10px 0;
}

.learning-filter-actions {
  align-items: end;
}

.learning-filter-actions button {
  min-height: 32px;
  height: 32px;
  padding: 3px 14px;
  line-height: 1;
}

.credential-table-wrap {
  overflow: auto;
  margin-bottom: 10px;
}

.credential-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.credential-table th,
.credential-table td {
  border: 1px solid #d8e8ed;
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}

.credential-table th {
  background: #e5f5f8;
  color: #18324a;
  font-weight: 700;
}

.credential-table .retired-row {
  color: #617680;
  background: #f6fbfc;
}

.credential-table .retired-row td {
  border-color: #d8e8ed;
}

.credential-table input[type="date"] {
  min-height: 30px;
  border: 1px solid #b7cbd3;
  padding: 3px 6px;
  font: inherit;
}

.credential-table input[type="text"] {
  width: 100%;
  min-width: 120px;
  min-height: 30px;
  border: 1px solid #b7cbd3;
  padding: 3px 6px;
  font: inherit;
}

/* ユーザー管理テーブル */
#userManagementSection .credential-table th,
#userManagementSection .credential-table td {
  padding: 5px 7px;
}

#userManagementSection .credential-table th:nth-child(1),
#userManagementSection .credential-table td:nth-child(1) { min-width: 110px; }

#userManagementSection .credential-table th:nth-child(2),
#userManagementSection .credential-table td:nth-child(2) { min-width: 90px; }

#userManagementSection .credential-table th:nth-child(3),
#userManagementSection .credential-table td:nth-child(3) { min-width: 180px; }

#userManagementSection .credential-table th:nth-child(4),
#userManagementSection .credential-table td:nth-child(4) { min-width: 70px; }

#userManagementSection .credential-table th:nth-child(5),
#userManagementSection .credential-table td:nth-child(5) { min-width: 200px; }

#userManagementSection .row-actions button {
  padding: 4px 8px;
  font-size: 12px;
  min-height: 28px;
}

#userManagementSection .credential-table input[type="text"],
#userManagementSection .credential-table input[type="email"] {
  min-width: 0;
  width: 100%;
}

#userManagementSection .credential-table select {
  min-width: 0;
  width: 100%;
}

.editing-row {
  background: #f0fbff;
}

.editing-row td {
  border-color: #7bc5d6;
}

#learningManagementSection .credential-table {
  min-width: 0;
  table-layout: fixed;
}

#learningManagementSection .credential-table th,
#learningManagementSection .credential-table td {
  padding: 5px 6px;
}

#learningManagementSection .credential-table th:nth-child(1),
#learningManagementSection .credential-table td:nth-child(1) {
  width: 18%;
}

#learningManagementSection .credential-table th:nth-child(2),
#learningManagementSection .credential-table td:nth-child(2) {
  width: 18%;
}

#learningManagementSection .credential-table th:nth-child(3),
#learningManagementSection .credential-table td:nth-child(3) {
  width: 19%;
}

#learningManagementSection .credential-table th:nth-child(4),
#learningManagementSection .credential-table td:nth-child(4) {
  width: 74px;
}

#learningManagementSection .credential-table th:nth-child(5),
#learningManagementSection .credential-table td:nth-child(5) {
  width: 76px;
  text-align: right;
}

#learningManagementSection .credential-table th:nth-child(6),
#learningManagementSection .credential-table td:nth-child(6) {
  width: 100px;
}

#learningManagementSection .credential-table th:nth-child(7),
#learningManagementSection .credential-table td:nth-child(7) {
  width: 92px;
}

#learningManagementSection .credential-table input[type="text"] {
  min-width: 0;
}

#learningManagementSection .credential-table select {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  border: 1px solid #b7cbd3;
  padding: 3px 6px;
  font: inherit;
}

#learningManagementSection .row-actions {
  gap: 4px;
}

#learningManagementSection .row-actions button {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 12px;
}

#learningManagementSection .learning-highlight-row td {
  background: #fff7cc;
  box-shadow: inset 0 0 0 2px #d97706;
}

.audit-json-cell {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.78rem;
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.row-actions button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 10px;
}

.secondary-action-button {
  border-color: #8bbfc9;
  background: #ffffff;
  color: #126b7f;
  box-shadow: none;
}

.secondary-action-button:hover {
  border-color: #0f5e70;
  background: #e7f5f8;
}

.danger-action-button {
  border-color: #9b1c1c;
  background: linear-gradient(180deg, #c94a2c 0%, #9b1c1c 100%);
}

.danger-action-button:hover {
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
}

.confirm-dialog {
  width: min(680px, calc(100vw - 36px));
  border: 1px solid #8bbfc9;
  padding: 0;
  color: #18324a;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
}

.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.confirm-dialog form {
  display: grid;
  gap: 18px;
  padding: 24px 28px;
}

.confirm-dialog h2 {
  font-size: 24px;
}

.confirm-dialog p {
  margin: 0;
  white-space: pre-line;
  font-size: 18px;
  line-height: 1.8;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.confirm-dialog-actions button {
  min-width: 108px;
  min-height: 42px;
  font-size: 16px;
}

.permission-summary {
  margin: 12px 0 0;
  color: #52606d;
}

.notice {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  width: min(760px, calc(100vw - 32px));
  min-height: 56px;
  margin: 0;
  border: 1px solid #9ec5a5;
  border-left: 8px solid #2f855a;
  border-radius: 6px;
  background: #f0fff4;
  color: #22543d;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.55;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  transform: translateX(-50%);
}

.notice:empty {
  display: none;
}

.notice.is-error {
  border-color: #f5b7b1;
  border-left-color: #c0392b;
  background: #fff5f5;
  color: #9b1c1c;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 14px;
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .sheet-heading,
  .settings-grid,
  .admin-dashboard {
    grid-template-columns: 1fr;
  }

  .export-settings-layout,
  .export-format-grid,
  .export-target-grid {
    grid-template-columns: 1fr;
  }

  .totals-preview-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-context-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-company-select-label select {
    width: 100%;
    min-width: 0;
  }

  .portal-management-link {
    width: 100%;
  }

  .shared-pilot-grid {
    grid-template-columns: 1fr;
  }

  .shared-operation-actions button {
    width: 100%;
  }

  h1 {
    font-size: 24px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 8mm;
  }

  :root,
  body {
    background: #ffffff;
    color: #111827;
  }

  body {
    padding-bottom: 0;
  }

  .app-shell {
    max-width: none;
    padding: 0;
  }

  .no-print,
  .notice,
  .actions {
    display: none !important;
  }

  #expenseView::before {
    content: "経費精算書";
    display: block;
    margin: 0 0 5mm;
    padding-bottom: 2mm;
    border-bottom: 2px solid #111827;
    font-size: 18pt;
    font-weight: 700;
    text-align: center;
  }

  .sheet-heading {
    display: grid;
    grid-template-columns: 1.3fr 1fr 0.8fr 1fr;
    align-items: end;
    gap: 3mm;
    margin-bottom: 5mm;
  }

  .month-actions {
    display: block;
  }

  .read-field,
  .month-field {
    width: 100%;
    min-height: auto;
    border: 0;
    border-bottom: 1px solid #555555;
    padding: 0 0 1.5mm;
    background: #ffffff;
  }

  .read-field span,
  .month-field {
    color: #111827;
    font-size: 8pt;
    font-weight: 700;
  }

  .sheet-heading > .read-field span,
  .month-field {
    font-size: 0;
  }

  .read-field strong {
    color: #000000;
    font-size: 11pt;
    line-height: 1.25;
  }

  .month-field input {
    width: 100%;
    min-height: 0;
    border: 0;
    padding: 0;
    color: #000000;
    font-size: 11pt;
    font-weight: 700;
    -webkit-text-fill-color: #000000;
  }

  .read-field select {
    width: 100%;
    min-height: 0;
    border: 0;
    padding: 0;
    color: #000000;
    font-size: 11pt;
    font-weight: 700;
    appearance: none;
    -webkit-text-fill-color: #000000;
  }

  .right-summary {
    display: block;
    gap: 2mm;
  }

  .right-summary > .status-field {
    display: none !important;
  }

  .sheet-heading > .read-field,
  .sheet-heading .month-field,
  .right-summary > .summary-panel {
    height: auto;
    min-height: auto;
  }

  .right-summary > .summary-panel {
    height: auto;
  }

  .summary-panel {
    border: 1px solid #555555;
    grid-template-columns: 15mm 1fr;
  }

  .summary-panel span,
  .summary-panel strong {
    min-height: 12mm;
    padding: 1.5mm 2mm;
    color: #000000;
    font-size: 9pt;
  }

  .summary-panel strong {
    font-size: 11pt;
    font-weight: 700;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: #ffffff;
  }

  .expense-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 8pt;
    line-height: 1.25;
  }

  .expense-table thead {
    display: table-header-group;
  }

  .expense-table tbody {
    display: table-row-group;
  }

  .expense-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .expense-table th,
  .expense-table td {
    height: auto;
    min-height: 8mm;
    border: 1px solid #444444;
    vertical-align: top;
  }

  .expense-table th {
    background: #e5e7eb !important;
    color: #000000;
    padding: 1.5mm 1mm;
    font-size: 8pt;
    font-weight: 700;
    text-align: center;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .expense-table input,
  .expense-table select {
    width: 100%;
    border: 0;
    padding: 1.5mm 1mm;
    height: auto;
    min-height: 8mm;
    font-size: 8pt;
    line-height: 1.25;
    color: #000000;
    opacity: 1;
    -webkit-text-fill-color: #000000;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .expense-table th:last-child,
  .expense-table td:last-child {
    display: none;
  }

  .date-col,
  .paymentDate-cell {
    width: 10%;
  }

  .expense-table th:nth-child(2),
  .paymentTo-cell {
    width: 16%;
  }

  .expense-table th:nth-child(3),
  .paymentContent-cell {
    width: 17%;
  }

  .expense-table th:nth-child(4),
  .accountTitle-cell {
    width: 15%;
  }

  .amount-col,
  .amount-cell {
    width: 12%;
  }

  .tax-col,
  .taxRate-cell {
    width: 8%;
  }

  .description-col,
  .description-cell {
    width: 22%;
  }

  .amount-cell input {
    text-align: right;
  }
}
