:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: #f3f6fb;
  color: #111827;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.08), transparent 24%),
    #f3f6fb;
  color: #111827;
}

a {
  color: #1d4ed8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page {
  width: min(1380px, calc(100vw - 32px));
  margin: 24px auto 40px;
  display: grid;
  gap: 24px;
}

.card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(12px);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(420px, 560px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.workspace-history {
  grid-column: 1 / -1;
}

.workspace-panel {
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toolbar h1,
.section-head h2,
.subsection h3 {
  margin: 0;
}

.toolbar p,
.section-head p {
  margin: 8px 0 0;
}

.section-head {
  display: grid;
  gap: 8px;
}

.form {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.form-grid,
.compact-grid {
  display: grid;
  gap: 14px 16px;
}

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

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

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

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

.field-span-full {
  grid-column: 1 / -1;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 14px;
  color: #0f172a;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
}

button {
  height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

button.secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.form-actions {
  display: flex;
  justify-content: flex-start;
}

.subsection {
  display: grid;
  gap: 14px;
  margin-top: 4px;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
}

.subsection-highlight {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.08));
  border-color: rgba(37, 99, 235, 0.18);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #0f172a;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.flash {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e3a8a;
}

.hint {
  margin: 0;
  font-size: 12px;
  color: #475569;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.result-meta p {
  margin: 0;
}

.notice {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.notice strong,
.notice p {
  margin: 0;
}

.notice p {
  margin-top: 6px;
}

.history-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(0, auto));
  align-items: center;
  gap: 10px 16px;
}

.history-link {
  font-weight: 700;
}

.history-meta {
  font-size: 13px;
  color: #475569;
}

.action-list {
  padding-left: 18px;
}

.action-list li {
  display: list-item;
}

.code-block {
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: #0f172a;
  color: #e2e8f0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.6;
}

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

  .workspace-history {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  .compact-grid-card,
  .compact-grid-customer,
  .form-grid,
  .history-row {
    grid-template-columns: 1fr;
  }

  .field-span-full {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100vw - 16px, 100%);
    margin: 16px auto 24px;
    gap: 16px;
  }

  .card {
    padding: 18px;
    border-radius: 16px;
  }

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

  .form-actions,
  .toolbar form {
    width: 100%;
  }

  button {
    width: 100%;
  }
}
