:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #20242a;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #176b5d;
  --accent-dark: #115246;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 56px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-decoration: none;
}

header nav.tabs {
  display: flex;
  gap: 4px;
  align-items: stretch;
  align-self: stretch;
  margin-left: 8px;
  flex: 1;
}

header nav.tabs a {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
}

header nav.tabs a:hover {
  color: var(--accent);
}

header nav.tabs a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

header nav.account {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

nav a,
a {
  color: var(--accent);
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

h2 {
  margin: 24px 0 12px;
  font-size: 17px;
}

.panel,
.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.narrow {
  max-width: 900px;
  margin: 0 auto;
}

.login-panel {
  width: min(420px, 100%);
  margin: 12vh auto 0;
}

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

.toolbar form,
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

input,
select,
textarea,
button,
.button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  background: #fff;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
}

.secondary {
  background: #fff;
  color: var(--accent);
  border-color: var(--line);
}

.secondary:hover {
  background: #f2f6f5;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 600;
}

form label + label,
.login-panel button {
  margin-top: 14px;
}

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

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

.record-form {
  display: grid;
  gap: 10px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

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

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

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

.num {
  text-align: right;
}

.empty,
.muted {
  color: var(--muted);
}

.alert {
  padding: 10px 12px;
  background: #fff0ee;
  border: 1px solid #f4b8b0;
  border-radius: 6px;
  color: var(--danger);
}

.alert.info {
  background: #eef5ff;
  border-color: #b8d3f5;
  color: #1849a9;
}

.status {
  display: inline-flex;
  min-width: 72px;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: #edf2f7;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.status.sent {
  background: #e7f6ef;
  color: #067647;
}

.status.ready {
  background: #fff7dc;
  color: #8a6100;
}

.status.failed,
.status.cancelled,
.status.lost {
  background: #fff0ee;
  color: var(--danger);
}

.status.shipped {
  background: #e1ecff;
  color: #1849a9;
}

.status.delivered {
  background: #e7f6ef;
  color: #067647;
}

.status.returned {
  background: #fff7dc;
  color: #8a6100;
}

.inline-form {
  display: inline-flex;
  margin-top: 8px;
  margin-right: 8px;
}

.inline-form button.danger {
  background: #fff;
  border-color: #f4b8b0;
  color: var(--danger);
}

.inline-form button.danger:hover {
  background: #fff0ee;
}

.picker {
  margin-top: 6px;
  margin-bottom: 6px;
}

/* ----- 使い方 (help) page ----- */

.help-hero {
  background: linear-gradient(135deg, var(--accent) 0%, #0e3d33 100%);
  color: #fff;
  padding: 28px 32px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.help-hero h1 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 26px;
  letter-spacing: 0.05em;
}

.help-hero p {
  margin: 0;
  font-size: 15px;
  opacity: 0.9;
}

.help-hero strong {
  color: #fff7dc;
}

.help-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.help-tab-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 18px 18px 16px;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.help-tab-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(20, 30, 40, 0.08);
}

.help-tab-card .badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.help-tab-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--text);
}

.help-tab-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.help-flow {
  background: #fff7dc;
  border: 1px solid #f1d77a;
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 24px;
}

.help-flow h2 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #8a6100;
}

.help-flow .step-list {
  margin: 0;
  padding-left: 22px;
  color: #5b4400;
}

.help-flow .step-list li {
  margin: 4px 0;
}

.help-flow .step-list em {
  font-style: normal;
  background: rgba(138, 97, 0, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
}

.help-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px 24px;
  margin-bottom: 16px;
}

.help-section > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 17px;
}

.help-section .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.help-section ol,
.help-section ul {
  padding-left: 22px;
  margin: 8px 0;
}

.help-section ol li,
.help-section ul li {
  margin: 4px 0;
}

.help-section ul.bare {
  list-style: none;
  padding-left: 0;
}

.help-section ul.bare li {
  padding: 4px 0;
}

.help-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0;
}

.help-card {
  background: #f6f7f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.help-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--accent);
}

.help-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.help-table th,
.help-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  font-size: 14px;
}

.help-table th {
  width: 180px;
  color: var(--accent);
  font-weight: 700;
  background: #f6fbf9;
}

.kbd {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.chip {
  display: inline-block;
  background: #edf2f7;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #344054;
  margin: 0 2px;
}

.chip.status.shipped {
  background: #e1ecff;
  color: #1849a9;
}

.chip.status.delivered {
  background: #e7f6ef;
  color: #067647;
}

.chip.status.returned {
  background: #fff7dc;
  color: #8a6100;
}

.chip.status.lost {
  background: #fff0ee;
  color: var(--danger);
}

.note {
  background: #eef5ff;
  border-left: 3px solid #b8d3f5;
  padding: 10px 14px;
  margin: 10px 0;
  color: #1849a9;
  font-size: 13px;
  border-radius: 4px;
}

.tree {
  background: #20242a;
  color: #e6edf3;
  padding: 14px 18px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  overflow-x: auto;
}

.help-section code {
  background: #f6f7f9;
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}

@media (max-width: 720px) {
  .help-tabs,
  .help-cards {
    grid-template-columns: 1fr;
  }
  .help-table th {
    width: 110px;
  }
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

dl {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 8px 12px;
  margin: 0;
}

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

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.memo {
  white-space: pre-wrap;
}

pre {
  overflow: auto;
  white-space: pre-wrap;
}

@media (max-width: 720px) {
  header,
  .toolbar,
  .toolbar form {
    align-items: stretch;
    flex-direction: column;
  }

  .grid2,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 13px;
  }
}

/* 情報マスターのフォーム: fieldset区切りと役員/担当者の行入力 */
.entity-form fieldset {
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  padding: 12px 14px 14px;
  margin: 6px 0;
}
.entity-form legend {
  font-weight: 700;
  color: #344054;
  padding: 0 6px;
}
.entity-form .row-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
}
.entity-form .row-inputs input {
  flex: 1 1 120px;
  min-width: 0;
}
