:root {
  --text: #000000;
  --text-muted: #626264;
  --white: #ffffff;
  --page: #f2f3f7;
  --standard: #f8f8fb;
  --control: #f1f1f4;
  --blue-1200: #000060;
  --blue-900: #0017c1;
  --blue-600: #3460fb;
  --blue-400: #7096f8;
  --blue-200: #c5d7fb;
  --blue-50: #d9e6ff;
  --yellow-800: #a58000;
  --yellow-600: #d2a400;
  --green: #197a4b;
  --red: #ce0000;
  --red-600: #fe3939;
  --gray-800: #333333;
  --gray-200: #cccccc;
  --gray-100: #e6e6e8;
  --gray-50: #f2f2f2;
  --shadow: 0 10px 30px rgba(0, 23, 193, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 1080px;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Sans", Meiryo, Arial, sans-serif;
  font-size: 13px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

/* ログイン画面 */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #eef2fb, #ffffff);
  padding: 24px;
}

.login-card {
  width: min(400px, 100%);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  gap: 14px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-brand svg {
  width: 38px;
  height: 38px;
}

.login-name {
  font-size: 20px;
  font-weight: 800;
  color: #10283f;
  line-height: 1;
}

.login-name b {
  color: #176b87;
}

.login-tag {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.login-h {
  font-size: 18px;
  margin: 6px 0 2px;
  color: #10283f;
}

.login-field {
  display: grid;
  gap: 5px;
}

.login-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-800);
}

.login-err {
  display: none;
  color: var(--red);
  font-size: 12px;
  background: #ffe6e6;
  border: 1px solid #ffb7b7;
  border-radius: 6px;
  padding: 8px 10px;
}

.login-note {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
  line-height: 1.6;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-row {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: block;
  flex: 0 0 auto;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.logo-field {
  fill: #0f2f4a;
}

.logo-track,
.logo-flow {
  fill: none;
  stroke: #f8fbff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logo-flow {
  stroke: #4fd1a1;
}

.logo-node {
  fill: #4fd1a1;
  stroke: #f8fbff;
  stroke-width: 1.4;
}

.brand-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  color: #10283f;
}

.brand-title span {
  color: #176b87;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.session-box {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 11px;
}

.role-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--control);
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
}

.role-pill.online {
  background: #e8f6ee;
  color: #116b3a;
  border-color: #b7e2c8;
}

.role-pill.offline {
  background: #fff4e5;
  color: #8a4b00;
  border-color: #f0d2a2;
}

.nav-tabs {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 18px 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--gray-800);
  padding: 8px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  min-height: 34px;
}

.nav-tab:hover {
  background: var(--blue-50);
  color: var(--blue-900);
}

.nav-tab.active {
  background: var(--blue-900);
  border-color: var(--blue-900);
  color: var(--white);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px;
}

.breadcrumb {
  color: var(--text-muted);
  font-size: 11px;
  margin-bottom: 10px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.page-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.page-note {
  color: var(--text-muted);
  margin: 5px 0 0;
  font-size: 12px;
}

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

.grid {
  display: grid;
  gap: 12px;
}

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

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

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.cols-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.section,
.card,
.kpi-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

.section {
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.section-head {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.section-note {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.section-body {
  padding: 14px;
}

.kpi-card {
  padding: 13px;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-card.highlight {
  background: var(--blue-900);
  color: var(--white);
  border-color: var(--blue-900);
}

.kpi-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.highlight .kpi-label,
.highlight .kpi-sub {
  color: rgba(255, 255, 255, 0.82);
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 8px;
  white-space: nowrap;
}

.kpi-sub {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 8px;
}

.negative {
  color: var(--red);
}

.positive {
  color: var(--blue-600);
}

.success {
  color: var(--green);
}

.warning {
  color: var(--yellow-800);
}

.btn {
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-800);
  border-radius: 6px;
  padding: 8px 10px;
  min-height: 34px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn:hover {
  border-color: var(--blue-600);
  color: var(--blue-900);
}

.btn.primary {
  background: var(--blue-900);
  color: var(--white);
  border-color: var(--blue-900);
}

.btn.danger {
  border-color: var(--red);
  color: var(--red);
}

.btn.ghost {
  background: transparent;
}

.icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--gray-200);
  background: var(--white);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  min-height: 36px;
}

.textarea {
  min-height: 84px;
  resize: vertical;
}

.field {
  display: grid;
  gap: 5px;
}

.field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-800);
}

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

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

.quote-line {
  display: grid;
  grid-template-columns: 1fr 88px 92px 40px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

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

.filter-chip {
  border: 1px solid var(--gray-200);
  background: var(--control);
  color: var(--gray-800);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
}

.filter-chip.active {
  background: var(--blue-900);
  color: var(--white);
  border-color: var(--blue-900);
}

.table-wrap {
  overflow: hidden;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

th,
td {
  text-align: left;
  padding: 10px 11px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--standard);
  white-space: nowrap;
}

td {
  font-size: 12px;
}

tr:nth-child(even) td {
  background: #fbfbfd;
}

tr.clickable:hover td {
  background: var(--blue-50);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--gray-200);
  color: var(--gray-800);
  background: var(--control);
  white-space: nowrap;
}

.badge.success {
  background: #e7f4ed;
  color: var(--green);
  border-color: #bbdfcb;
}

.badge.warning {
  background: #fff7d6;
  color: var(--yellow-800);
  border-color: #edd97c;
}

.badge.error {
  background: #ffe6e6;
  color: var(--red);
  border-color: #ffb7b7;
}

.badge.positive {
  background: var(--blue-50);
  color: var(--blue-900);
  border-color: var(--blue-200);
}

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

.customer-card {
  padding: 13px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.customer-card:hover {
  border-color: var(--blue-600);
  transform: translateY(-1px);
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.card-meta {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.6;
}

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

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 8px;
}

.metric-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.progress {
  width: 100%;
  height: 8px;
  background: var(--control);
  border-radius: 999px;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--blue-600);
}

.chart-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.chart-legend .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}

.chart-legend .swatch.actual {
  background: var(--blue-900);
}

.chart-legend .swatch.forecast {
  background: repeating-linear-gradient(
    45deg,
    var(--blue-200),
    var(--blue-200) 3px,
    #ffffff 3px,
    #ffffff 6px
  );
  border: 1px dashed var(--blue-400);
}

.bar-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  height: 170px;
  padding: 12px 4px 0;
}

.bar-item {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  height: 100%;
}

.bar {
  width: 100%;
  max-width: 44px;
  background: var(--blue-200);
  border-radius: 5px 5px 0 0;
  min-height: 14px;
}

.bar.primary {
  background: var(--blue-900);
}

.bar.forecast {
  background: repeating-linear-gradient(
    45deg,
    var(--blue-200),
    var(--blue-200) 4px,
    #ffffff 4px,
    #ffffff 8px
  );
  border: 1px dashed var(--blue-400);
}

.bar-label {
  font-size: 11px;
  color: var(--text-muted);
}

.bar-label.forecast {
  color: var(--blue-600);
  font-weight: 600;
}

.two-pane {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 12px;
}

.invoice-preview {
  border: 1px solid var(--gray-200);
  background: #fff;
  border-radius: 8px;
  padding: 18px;
}

.invoice-preview h3 {
  margin: 0 0 14px;
  text-align: center;
  font-size: 20px;
}

.invoice-preview .row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
}

.modal {
  width: min(780px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--white);
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.modal-head,
.modal-foot {
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-head {
  border-bottom: 1px solid var(--gray-200);
}

.modal-foot {
  border-top: 1px solid var(--gray-200);
  justify-content: flex-end;
}

.modal-body {
  padding: 14px;
}

.modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.toast {
  position: fixed;
  top: 90px;
  right: 22px;
  z-index: 200;
  background: var(--blue-1200);
  color: var(--white);
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  min-width: 260px;
  font-size: 12px;
  font-weight: 600;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  background: var(--standard);
  border: 1px dashed var(--gray-200);
  border-radius: 8px;
}

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

.subsidy-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px;
}

.subsidy-card strong {
  font-size: 13px;
}

.readiness-card {
  border: 1px solid var(--gray-200);
  background: var(--white);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.readiness-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.readiness-head h3 {
  margin: 4px 0 0;
  font-size: 20px;
}

.readiness-head strong {
  font-size: 22px;
  color: var(--blue-900);
}

.readiness-bar {
  height: 10px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}

.readiness-bar span {
  display: block;
  height: 100%;
  background: var(--green);
}

.demo-script {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  line-height: 1.45;
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}

.check-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  flex: 0 0 auto;
  margin-top: 1px;
}

.check-dot::after {
  content: "";
  display: block;
  width: 7px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
  margin: 4px 0 0 4px;
}

.small {
  font-size: 11px;
  color: var(--text-muted);
}

.pay-url {
  display: inline-block;
  max-width: 100%;
  word-break: break-all;
  overflow-wrap: anywhere;
  color: var(--blue-900);
  font-size: 12px;
  line-height: 1.5;
}

.mail-body {
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
  width: 100%;
  max-width: 560px;
  max-height: 220px;
  overflow-x: hidden;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.7;
  color: var(--gray-800);
  background: var(--standard);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 10px 12px;
}

.right {
  text-align: right;
}

.nowrap {
  white-space: nowrap;
}

.split-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

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

.flow-step {
  min-height: 78px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--standard);
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.flow-step span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-900);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
}

.flow-step strong {
  font-size: 12px;
  line-height: 1.35;
}

/* 画面の帳票プレビューをそのまま印刷/PDF保存したときに、ナビ等を除いて綺麗に出力する */
@media print {
  @page {
    margin: 14mm;
  }
  html,
  body {
    min-width: 0;
    background: #ffffff;
  }
  .topbar,
  .nav-tabs,
  .breadcrumb,
  .toolbar,
  .filter-bar,
  .split-actions,
  .toast,
  .modal-backdrop,
  .btn {
    display: none !important;
  }
  .page {
    max-width: none;
    margin: 0;
    padding: 0;
  }
  .section,
  .card,
  .invoice-preview {
    box-shadow: none !important;
    break-inside: avoid;
  }
}
