:root {
  --bg:#f4f7fb;
  --card:#fff;
  --text:#132033;
  --muted:#5f6b7a;
  --line:#dfe7f1;
  --accent:#1f6fe5;
  --accent2:#0d4fb3;
  --ok:#2e7d32;
  --warn:#ef6c00;
  --danger:#c62828;
  --soft:#eef5ff;
  --soft2:#f8fbff;
  --shadow:0 10px 30px rgba(17,40,74,.08);
}

* { box-sizing:border-box; }

body {
  margin:0;
  font-family: system-ui, -apple-system, "Yu Gothic", "Meiryo", sans-serif;
  color:var(--text);
  background:linear-gradient(180deg,#f6f9fc 0%, #edf3f9 100%);
}

header {
  background:linear-gradient(135deg,var(--accent2),var(--accent));
  color:#fff;
  padding:28px 20px;
}

header .inner { max-width:1200px; margin:0 auto; }
header h1 { margin:0; font-size:28px; line-height:1.35; }
header p { margin:10px 0 0; font-size:14px; opacity:.96; line-height:1.8; }

.wrap { max-width:1200px; margin:22px auto 44px; padding:0 14px; }
.toolGrid { display:grid; grid-template-columns:1fr 1fr; gap:18px; }

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

.card {
  background:var(--card);
  border:1px solid var(--line);
  border-radius:22px;
  box-shadow:var(--shadow);
  overflow:hidden;
}

.hd { padding:20px 20px 0; }
.bd { padding:20px; }
.title { margin:0; font-size:20px; font-weight:800; }
.sub { margin:8px 0 0; color:var(--muted); font-size:13px; line-height:1.8; }
.row { display:grid; grid-template-columns:180px 1fr; gap:12px; align-items:center; margin:12px 0; }

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

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

input,
select {
  width:100%;
  border:1px solid var(--line);
  border-radius:12px;
  padding:11px 13px;
  font-size:14px;
  background:#fff;
  color:var(--text);
}

.btnbar { display:flex; flex-wrap:wrap; gap:10px; margin-top:16px; }

button {
  border:0;
  border-radius:12px;
  padding:11px 15px;
  font-size:14px;
  font-weight:800;
  cursor:pointer;
  background:var(--accent);
  color:#fff;
}

button.secondary {
  background:#eaf2ff;
  color:var(--accent2);
  border:1px solid #cfe0ff;
}

.msg {
  border-radius:14px;
  padding:12px 14px;
  font-size:13px;
  line-height:1.8;
  margin-top:14px;
  border:1px solid transparent;
  white-space:pre-line;
}

.ok { background:#eaf7ec; color:var(--ok); border-color:#cae7cf; }
.warn { background:#fff4e8; color:var(--warn); border-color:#ffd8b1; }
.ng { background:#ffedf0; color:var(--danger); border-color:#ffcdd2; }

.resultBox {
  background:var(--soft2);
  border:1px solid #d8e7ff;
  border-radius:18px;
  padding:16px;
  margin-top:14px;
}

.resultHeader {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}

.resultBox h3 { margin:0; font-size:16px; }

.resultActions {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

.pdfExportButton {
  padding:9px 14px;
  border-radius:999px;
  background:#11345d;
  color:#fff;
  font-size:13px;
}

.pdfExportButton:hover {
  background:#0a2747;
}

.pdfExportHint {
  color:var(--muted);
  font-size:12px;
  line-height:1.7;
}

.kv {
  display:grid;
  grid-template-columns:160px 1fr;
  gap:8px 12px;
  font-size:14px;
  align-items:start;
}

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

.kv dt { color:var(--muted); font-weight:700; }
.kv dd { margin:0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing:.2px; }
.chips { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }

.chip {
  font-size:12px;
  border:1px solid var(--line);
  border-radius:999px;
  padding:7px 10px;
  background:#fff;
}

.note { margin-top:14px; font-size:12px; color:var(--muted); line-height:1.8; }

.summaryGrid {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:10px;
  margin-top:14px;
}

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

  .resultHeader {
    flex-direction:column;
  }

  .resultActions {
    width:100%;
    justify-content:flex-start;
  }
}

.miniStat {
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
}

.miniStat .label { color:var(--muted); font-size:12px; margin-bottom:6px; }
.miniStat .value { font-size:22px; font-weight:800; }
.miniStat .value.small { font-size:20px; }

table {
  width:100%;
  border-collapse:collapse;
  margin-top:14px;
  font-size:13px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  overflow:hidden;
}

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

th { background:#f4f8ff; text-align:left; font-size:12px; color:#3b5270; }
td.num,
th.num { text-align:right; white-space:nowrap; }
tbody tr:last-child td { border-bottom:0; }
.tfoot { margin-top:14px; display:flex; justify-content:flex-end; }

.totalCard {
  min-width:320px;
  background:#11345d;
  color:#fff;
  border-radius:18px;
  padding:16px 18px;
  box-shadow:var(--shadow);
}

.totalCard .label { font-size:12px; opacity:.9; }
.totalCard .value { font-size:30px; font-weight:900; margin-top:4px; }
.totalCard .subv { font-size:12px; opacity:.9; line-height:1.8; margin-top:8px; }

.accordion {
  margin-top:16px;
  border:1px solid #d8e7ff;
  border-radius:18px;
  background:#fff;
  overflow:hidden;
}

.accordion > summary {
  list-style:none;
  cursor:pointer;
  padding:15px 18px;
  font-weight:800;
  color:var(--accent2);
  background:#f4f8ff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.accordion > summary::-webkit-details-marker { display:none; }

.accordion > summary::after {
  content:'+';
  font-size:20px;
  line-height:1;
  color:var(--accent2);
}

.accordion[open] > summary::after { content:'-'; }
.accordionBody { padding:0 16px 16px; }
.accordionHint { color:var(--muted); font-size:12px; font-weight:500; }

.inlineNote {
  margin-top:8px;
  font-size:12px;
  color:var(--muted);
  line-height:1.8;
}

.candidateGroup {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.candidateButton {
  flex:1 1 260px;
  text-align:left;
  background:#fff;
  color:var(--accent2);
  border:1px solid #cfe0ff;
  border-radius:14px;
  padding:12px 14px;
  box-shadow:none;
}

.candidateButton small {
  display:block;
  margin-top:4px;
  color:var(--muted);
  font-weight:600;
  font-size:12px;
}

.candidateButton.active {
  background:#eaf2ff;
  border-color:#9dc0ff;
}

.candidateButton.compatible {
  border-color:#91d3b1;
}

.candidateButton.compatible small {
  color:#1f7a4d;
}

.candidateButton.blocked {
  border-color:#f0c2c2;
}

.candidateButton.blocked small {
  color:#9f3a3a;
}

.candidateButton:disabled {
  cursor:not-allowed;
  background:#f7f9fc;
  color:#97a3b2;
  border-color:#e3e8ef;
}

.section-gap-top { margin-top:18px; }
.msg-spacer { margin-top:14px; }

.glassFormulaNote {
  margin-top:10px;
  font-size:12px;
  color:var(--muted);
  line-height:1.8;
}

.itemDimensionNote {
  margin-top:4px;
  color:#5f6b7a;
  font-size:12px;
}

.itemConditionNote {
  margin-top:4px;
  color:#7c4a06;
  font-size:12px;
  line-height:1.7;
}

body.admin-bar header {
  top:32px;
}

@media (max-width:782px) {
  body.admin-bar header {
    top:46px;
  }
}

.container {
  max-width:1200px;
  margin:0 auto;
  padding:24px 14px 48px;
}

.page-head {
  margin-bottom:18px;
}

.page-kicker {
  color:var(--accent2);
  font-size:12px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.lead {
  margin:10px 0 0;
  color:var(--muted);
  font-size:14px;
  line-height:1.8;
}

.field {
  margin-bottom:16px;
}

.field-label {
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
}

.required {
  color:var(--danger);
  font-size:12px;
  font-weight:800;
}

.col-4,
.col-6 {
  grid-column:span 12;
}

@media (min-width:781px) {
  .grid {
    grid-template-columns:repeat(12, minmax(0, 1fr));
  }

  .col-4 {
    grid-column:span 4;
  }

  .col-6 {
    grid-column:span 6;
  }
}

.radio-group {
  display:flex;
  flex-wrap:wrap;
  gap:12px;
}

.choice {
  display:inline-flex;
  align-items:center;
  gap:8px;
  color:var(--text);
  font-size:14px;
  font-weight:500;
}

.choice input {
  width:auto;
  margin:0;
}

.actions {
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin-top:20px;
}

.button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:0 16px;
  border:1px solid transparent;
  border-radius:12px;
  background:var(--accent);
  color:#fff;
  text-decoration:none;
  font-size:14px;
  font-weight:800;
  cursor:pointer;
}

.button:hover {
  background:var(--accent2);
}

.button.secondary,
.button.ghost {
  background:#eaf2ff;
  color:var(--accent2);
  border-color:#cfe0ff;
}

.button.secondary:hover,
.button.ghost:hover {
  background:#dfeaff;
}

.note-list {
  margin:14px 0 0;
  padding-left:20px;
  color:var(--muted);
  font-size:13px;
  line-height:1.8;
}

.alert {
  margin-bottom:14px;
  padding:12px 14px;
  border:1px solid transparent;
  border-radius:14px;
  font-size:13px;
  line-height:1.8;
}

.alert.error {
  background:#ffedf0;
  border-color:#ffcdd2;
  color:var(--danger);
}

.alert.notice {
  background:#fff4e8;
  border-color:#ffd8b1;
  color:var(--warn);
}

.summary-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:12px;
}

.summary-card {
  padding:14px;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--soft2);
}

.summary-label {
  color:var(--muted);
  font-size:12px;
  margin-bottom:6px;
}

.summary-value {
  font-size:16px;
  font-weight:800;
  line-height:1.5;
  word-break:break-word;
}

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

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

.inline-link {
  color:var(--accent2);
  font-weight:700;
  text-decoration:none;
}

.inline-link:hover {
  text-decoration:underline;
}

.text-strong {
  font-weight:800;
}

.total-bar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-top:16px;
  padding:16px 18px;
  border-radius:18px;
  background:#11345d;
  color:#fff;
}

.total-label {
  font-size:12px;
  opacity:.9;
}

.total-value {
  font-size:28px;
  font-weight:900;
  white-space:nowrap;
}

.form-inline {
  margin:0;
}

.stack-sm > * + * {
  margin-top:8px;
}

@media (max-width:700px) {
  .total-bar {
    flex-direction:column;
    align-items:flex-start;
  }
}
