:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-alt: #eef4f7;
  --ink: #1d2530;
  --muted: #687483;
  --line: #d9e1ea;
  --brand: #136f63;
  --brand-2: #2b7fbf;
  --accent: #c76a31;
  --danger: #b84242;
  --shadow: 0 14px 34px rgba(22, 34, 46, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Noto Sans SC", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  background: #14202a;
  color: #f5fbff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

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

.brand strong,
.brand span,
.account-box span,
.account-box small {
  display: block;
}

.brand span,
.account-box span,
.account-box small {
  color: #aac0cf;
  font-size: 12px;
  margin-top: 3px;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
  color: #dce9f2;
  background: transparent;
}

.nav-item.active,
.nav-item:hover {
  background: #223343;
  color: #fff;
}

.account-box {
  margin-top: auto;
  border: 1px solid #2c4354;
  border-radius: 8px;
  padding: 14px;
  background: #192b38;
}

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

.topbar {
  min-height: 74px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 5px;
  font-size: 28px;
}

h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

p,
small {
  color: var(--muted);
}

.topbar-actions,
.file-row,
.toolbar,
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions,
.panel-head {
  justify-content: space-between;
}

.primary-btn,
.ghost-btn,
.text-btn,
.icon-btn {
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
}

.primary-btn {
  background: var(--brand);
  color: #fff;
}

.primary-btn:disabled {
  background: #9fb3ad;
  cursor: not-allowed;
}

.ghost-btn,
.icon-btn {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.text-btn {
  background: transparent;
  color: var(--brand-2);
  padding: 0 4px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel,
.workflow article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span,
.metric small,
.metric strong {
  display: block;
}

.metric strong {
  font-size: 30px;
  margin: 8px 0 4px;
}

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

.workflow article {
  padding: 18px;
}

.workflow b {
  color: var(--accent);
  font-size: 13px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 18px;
}

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

.compact-item,
.history-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.compact-item {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.compact-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.badge {
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--surface-alt);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.badge.fail {
  color: var(--danger);
  background: #fdeaea;
}

.brochure {
  display: grid;
  grid-template-columns: 42% 1fr;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.brochure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brochure-body {
  padding: 20px;
  background: #fff;
}

.brochure-body span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

dl {
  display: grid;
  gap: 10px;
}

dl div {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 10px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 700;
}

select,
input[type="search"],
.company-form input {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 11px;
  color: var(--ink);
}

.dropzone {
  min-height: 210px;
  border: 2px dashed #a7bac7;
  background: #f8fbfd;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  padding: 28px;
}

.dropzone input {
  display: none;
}

.dropzone strong,
.dropzone span {
  display: block;
}

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

.file-row {
  margin-top: 12px;
  flex-wrap: wrap;
}

#selectedFiles {
  flex: 1;
  color: var(--muted);
}

.progress-wrap {
  height: 10px;
  border-radius: 99px;
  overflow: hidden;
  background: #e4ebf1;
  margin-top: 14px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 0.25s ease;
}

.paper-mock {
  min-height: 350px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 16px;
}

.paper-mock span {
  color: var(--brand-2);
  font-weight: 800;
  font-size: 12px;
}

.paper-mock div {
  height: 44px;
  border-radius: 6px;
  background: #edf2f6;
}

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

.field-card {
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 12px;
}

.field-card span {
  color: var(--muted);
  font-size: 12px;
  display: block;
}

.field-card strong {
  display: block;
  margin-top: 5px;
}

.toolbar {
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.toolbar input {
  flex: 1;
  min-width: 240px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

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

.row-title {
  font-weight: 800;
}

.row-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.mini-btn {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  min-height: 30px;
  padding: 0 9px;
}

.editor-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 280px;
  gap: 14px;
}

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

.control-grid label,
.company-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.section-buttons {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.section-buttons button {
  min-height: 44px;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0 12px;
}

.section-buttons button.active {
  border-color: var(--brand);
  background: #eef8f5;
}

.field-editor {
  display: grid;
  gap: 10px;
}

.edit-row {
  display: grid;
  grid-template-columns: 32px 130px 1fr;
  gap: 8px;
  align-items: center;
}

.edit-row input[type="text"] {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.output-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.output-panel label {
  display: flex;
  gap: 8px;
}

.confirm {
  color: var(--muted);
  font-size: 13px;
}

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

.plan-status div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-alt);
}

.plan-status span,
.plan-status strong {
  display: block;
}

.plan-status span {
  color: var(--muted);
  margin-bottom: 5px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  background: #16242f;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .editor-grid,
  .split-layout,
  .metric-grid,
  .workflow {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-list,
  .field-grid,
  .control-grid,
  .company-form,
  .plan-status {
    grid-template-columns: 1fr;
  }

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

  .brochure img {
    height: 180px;
  }
}
