:root {
  --bg: #2a2e38;
  --bg-2: #232833;
  --panel: #353a46;
  --panel-2: #3d4352;
  --line: #4e5668;
  --text: #f3f4f6;
  --muted: #b8bec8;
  --label: #c0c6d0;
  --blue: #9ec5ff;
  --blue-bg: #243552;
  --blue-line: #5a8fd4;
  --purple: #d4b8ff;
  --purple-bg: #32284a;
  --purple-line: #8b6fc0;
  --green: #8fdfab;
  --green-bg: #243a2c;
  --green-line: #4a9a62;
  --gold: #e8d9a0;
  --gold-bg: #3a3424;
  --gold-line: #a09050;
  --danger: #ffb4b4;
  --danger-bg: #4a2a2e;
  --ok: #b8f0c8;
  --ok-bg: #243a2c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(45, 93, 179, 0.22), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
button, .btn {
  background: var(--panel-2);
  border: 1px solid #6d768a;
  color: var(--text);
  border-radius: 9px;
  min-height: 38px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}
button.primary, .btn.primary {
  background: linear-gradient(180deg, #3a6ec4, #2d5db3);
  border-color: #7aabee;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset;
}
button.danger, .btn.danger { background: #6b3038; border-color: #c46a74; }
button:hover, .btn:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.45; cursor: default; filter: none; }
input[type="checkbox"], input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  accent-color: #5b9cff;
  flex: none;
}
input, select, textarea {
  width: 100%;
  background: #2c313c;
  border: 1px solid #5c6578;
  border-radius: 9px;
  min-height: 40px;
  padding: 8px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'><path fill='%23c0c6d0' d='M3 5h8L7 10z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #5b9cff;
  box-shadow: 0 0 0 3px rgba(91, 156, 255, 0.28);
}
label.field { display: block; margin: 0 0 14px; }
.k {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label);
  margin-bottom: 6px;
}

.shell { display: flex; min-height: 100vh; }
.nav {
  width: 248px;
  flex: none;
  background: #252933;
  border-right: 1px solid #5c6475;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding: 0 4px;
}
.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  padding: 4px;
}
.brand strong { font-size: 15px; letter-spacing: -0.02em; }
.nav-label {
  margin: 0 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
}
.nav a.item, .nav button.item {
  display: flex;
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  margin: 0 0 8px;
  background: #3d4352;
  border: 1px solid #7a8499;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 12px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.nav a.item:hover, .nav button.item:hover {
  background: #4a5162;
  border-color: #9aa3b5;
  filter: none;
  text-decoration: none;
}
.nav a.item.active, .nav button.item.active {
  background: #2d5db3;
  border-color: #7aabee;
  box-shadow: none;
  text-decoration: none;
}
.nav form { margin: 0; }
.nav hr { border: 0; border-top: 1px solid var(--line); margin: 16px 4px; }
main { flex: 1; min-width: 0; padding: 28px 32px 40px; }
.page { max-width: 1180px; margin: 0 auto; }
.page-title {
  text-align: center;
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.page-sub { text-align: center; color: var(--muted); margin: 6px 0 22px; font-size: 14px; }
.subhead {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin: 4px 0 14px;
}
.category-pick { max-width: 360px; margin: 0 auto 18px; }
.layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 18px; align-items: stretch; }
.panel.output { display: flex; flex-direction: column; }
.panel.output .cards { flex: 1; }
.panel {
  background: rgba(53, 58, 70, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.center-narrow, form.center-narrow { max-width: 460px; margin: 0 auto 18px; }
form.center-narrow {
  background: rgba(53, 58, 70, 0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.banner { border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; line-height: 1.45; }
.banner.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--green-line); }
.banner.warn { background: #3a3424; color: var(--gold); border: 1px solid var(--gold-line); }
.banner.err { background: var(--danger-bg); color: var(--danger); border: 1px solid #c46a74; }
.banner.info { background: #243552; color: var(--blue); border: 1px solid var(--blue-line); }
.cards { display: flex; flex-direction: column; gap: 14px; }
.copy-card {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.copy-card:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28); filter: none; }
.copy-card .text { word-break: break-word; line-height: 1.35; }
.copy-card small {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
  white-space: nowrap;
}
.sku-card { background: var(--blue-bg); border: 1.5px solid var(--blue-line); }
.sku-card .text { color: var(--blue); font-weight: 700; font-size: 20px; letter-spacing: 0.02em; }
.code-card { background: var(--purple-bg); border: 1.5px solid var(--purple-line); }
.code-card .text { color: var(--purple); font-weight: 700; font-size: 18px; }
.name-card { background: var(--green-bg); border: 1.5px solid var(--green-line); }
.name-card .text { color: var(--green); font-weight: 600; }
.desc-card { background: var(--gold-bg); border: 1.5px solid var(--gold-line); }
.desc-card .text { color: var(--gold); }
.pending {
  background: var(--purple-bg);
  border: 1.5px dashed var(--purple-line);
  color: var(--purple);
  border-radius: 12px;
  padding: 14px 16px;
  font-style: italic;
  font-size: 13px;
}
.breakdown {
  background: #2a2e38;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px 6px;
}
.breakdown-row { display: flex; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.chip {
  background: #2c3648;
  color: var(--blue);
  border: 1px solid var(--blue-line);
  border-radius: 6px;
  padding: 2px 8px;
  font-family: Consolas, "SF Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}
button.save { width: 100%; margin-top: 16px; min-height: 44px; }
.extras, .choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.extras label, .choices label, .checks label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  background: #2c313c;
  border: 1px solid #555e70;
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 40px;
}
.extras label:has(input:checked),
.choices label:has(input:checked),
.checks label:has(input:checked) {
  background: #243552;
  border-color: #5a8fd4;
}
.extras input, .choices input, .checks input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin-top: 1px;
  accent-color: #5b9cff;
  flex: none;
}
.fit {
  display: flex;
  gap: 16px;
  background: #2c313c;
  border: 1px solid #555e70;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 8px;
  font-size: 13px;
}
.fit b { display: block; color: var(--label); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 2px; }
.contents-note {
  background: #353a46;
  border: 1px solid #6b7385;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 8px;
}
.contents-note-label {
  font-weight: 700;
  color: var(--label);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.contents-note-body, .contents-note-list {
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.45;
}
.contents-note-body { white-space: pre-wrap; }
.contents-note-list { margin: 0; padding-left: 18px; }
.contents-note-list li { margin: 0 0 2px; }
textarea.note { min-height: 180px; }
.row, .filters { display: flex; gap: 8px; align-items: center; }
.filters { margin-bottom: 14px; }
.filters select { max-width: 190px; }
.grow { flex: 1; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 16px;
  padding: 5px;
  background: #252933;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.tabs a, .tabs .btn { text-decoration: none; border-color: transparent; background: transparent; box-shadow: none; }
.tabs a.primary, .tabs .btn.primary { background: #2d5db3; border-color: #5a8fd4; }
h2 { font-size: 18px; margin: 18px 0 8px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  background: #2c313c;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
th, td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: middle; text-align: left; }
tr:last-child td { border-bottom: 0; }
th { color: var(--label); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; background: #323743; }
td input, td select { min-height: 34px; background: #252933; }
.history details {
  background: rgba(53, 58, 70, 0.92);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 8px 0;
  overflow: hidden;
}
.history summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
}
.history summary::-webkit-details-marker { display: none; }
.history summary { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.history summary::after { content: "▾"; color: var(--muted); flex: none; }
.history details[open] summary { border-bottom: 1px solid var(--line); }
.history details[open] summary::after { content: "▴"; }
.detail-body { padding: 12px 16px 16px; }
.muted { color: var(--muted); }
.footer { text-align: center; color: #9aa3b2; font-size: 11px; letter-spacing: 0.04em; margin-top: 40px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.result { margin-top: 8px; }
.result h2 { margin-top: 0; }
ul { margin: 8px 0 0; padding-left: 18px; }
li { margin: 4px 0; }

@media (max-width: 1100px) {
  .layout, .filters, .extras, .choices { grid-template-columns: 1fr; }
  .filters { display: grid; }
  .filters select { max-width: none; }
}

@media (max-width: 720px) {
  .shell { display: block; }
  .nav {
    width: auto;
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid #5c6475;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow: visible;
    align-items: center;
    padding: 12px;
  }
  .nav a.item, .nav button.item { width: auto; white-space: nowrap; margin: 0; }
  .nav hr, .brand span, .nav-label { display: none; }
  .brand { margin: 0; }
  .nav form { margin: 0; }
  main { padding: 18px 14px 32px; }
}
