:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #fffdf8;
  --ink: #1b1f23;
  --muted: #687078;
  --line: #d8d2c5;
  --teal: #0f766e;
  --teal-dark: #0b5d57;
  --indigo: #334e9e;
  --amber: #a16207;
  --red: #b42318;
  --soft-teal: #e7f4f1;
  --soft-amber: #fff3d6;
  --soft-red: #ffe9e6;
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: #fffaf0;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 16px;
}

.status-pill,
.mini-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-pill[data-tone="busy"] {
  color: var(--indigo);
  border-color: #b8c4ee;
  background: #eef2ff;
}

.status-pill[data-tone="done"] {
  color: var(--teal-dark);
  border-color: #a9d7cf;
  background: var(--soft-teal);
}

.status-pill[data-tone="warn"] {
  color: var(--amber);
  border-color: #eac36f;
  background: var(--soft-amber);
}

.status-pill[data-tone="error"] {
  color: var(--red);
  border-color: #ffc4bd;
  background: var(--soft-red);
}

.app-shell {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 22px 24px 32px;
}

.control-band,
.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.control-band {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 20px;
  align-items: end;
  padding: 18px;
}

.meta-line {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.input-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 160px 108px;
  gap: 12px;
  align-items: end;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

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

input[type="file"],
input[type="month"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c8c0b1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  background: var(--teal);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  background: #ffffff;
  color: var(--teal-dark);
  border-color: #92c9c0;
  padding: 7px 13px;
}

.secondary-button:disabled {
  cursor: not-allowed;
  color: #9aa0a6;
  border-color: var(--line);
  background: #f3f1ec;
}

.button-icon {
  font-size: 13px;
  line-height: 1;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.metric {
  display: grid;
  gap: 4px;
  min-height: 86px;
  padding: 13px 14px;
}

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

.metric strong {
  align-self: end;
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.metric-money strong,
.metric-accent strong {
  font-size: 20px;
}

.metric-warn {
  background: var(--soft-amber);
}

.metric-accent {
  background: var(--soft-teal);
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.panel {
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  max-height: 58vh;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid #ece6da;
  padding: 10px 11px;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbf7ef;
  color: #4c5157;
  font-size: 12px;
}

td {
  font-size: 13px;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.strong {
  font-weight: 700;
}

.empty-cell,
.empty-note {
  color: var(--muted);
  text-align: center;
}

.empty-note {
  margin: 22px 10px;
}

.error-text {
  color: var(--red);
  font-weight: 700;
}

.kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.kind-fx {
  background: #e8ecfb;
  color: var(--indigo);
}

.kind-yen {
  background: var(--soft-teal);
  color: var(--teal-dark);
}

.check-list {
  display: grid;
  gap: 10px;
  max-height: 58vh;
  overflow: auto;
  padding: 14px;
}

.check-item {
  display: grid;
  gap: 9px;
  border: 1px solid #e5c274;
  border-radius: 8px;
  background: #fff9eb;
  padding: 12px;
}

.check-item strong {
  display: block;
  font-size: 13px;
  color: var(--amber);
}

.check-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.check-item dl {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 4px 8px;
  margin: 0;
  font-size: 12px;
}

.check-item dt {
  color: var(--muted);
  font-weight: 700;
}

.check-item dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 920px) {
  .app-header,
  .control-band,
  .input-grid,
  .work-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .app-shell {
    padding: 14px 12px 24px;
  }

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

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  th,
  td {
    padding: 9px 8px;
  }
}
