/* ─────────────────────────── 管理コンソール */
html, body { height: 100%; }
body { background: var(--navy-950); color: #dfe5ee; overflow: hidden; }

.shell { display: flex; height: 100vh; }

/* sidebar */
.side {
  flex: none; width: 224px; display: flex; flex-direction: column;
  background: var(--navy-900); border-right: 1px solid var(--line-dark);
}
.side-brand {
  display: flex; align-items: center; gap: 8px;
  padding: 20px 18px 18px; font-weight: 900; font-size: 17px; color: #f0ecdf;
}
.side-brand .spark { color: var(--gold); }
.env-chip { margin-left: auto; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; padding: 2px 7px; border-radius: 3px; background: rgba(201, 163, 79, 0.16); color: var(--gold-soft); }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 6px; font-size: 13.5px; font-weight: 700; color: #9aa7ba;
}
.side-nav a span { font-size: 15px; }
.side-nav a.on { background: var(--navy-700); color: #f0ecdf; }
.side-nav a:hover:not(.on) { background: rgba(255, 255, 255, 0.04); }
.side-foot { margin-top: auto; padding: 16px; border-top: 1px solid var(--line-dark); }
.side-note { font-size: 10.5px; color: #6d7a8e; line-height: 1.7; }
.side-user { display: flex; align-items: center; gap: 9px; margin-top: 12px; font-size: 12px; color: #c3ccd9; }
.side-user .ava { width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: var(--navy-950); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* main */
.main { flex: 1; overflow-y: auto; padding: 30px 36px 60px; }
.main::-webkit-scrollbar { width: 9px; }
.main::-webkit-scrollbar-thumb { background: var(--navy-600); border-radius: 5px; }

.view-head { margin-bottom: 22px; }
.view-head h1 { font-size: 22px; font-weight: 900; color: #f0ecdf; }
.view-head p { margin-top: 6px; font-size: 13px; color: #8fa0b6; max-width: 60em; }
.crumb { font-size: 12px; color: #8fa0b6; margin-bottom: 14px; display: inline-block; }
.crumb:hover { color: var(--gold-soft); }

/* agent cards */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.agent-card {
  background: var(--navy-900); border: 1px solid var(--line-dark); border-radius: 10px;
  padding: 20px 20px 16px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.2s, transform 0.2s;
}
.agent-card:hover { border-color: rgba(201, 163, 79, 0.45); transform: translateY(-2px); }
.ac-top { display: flex; align-items: center; gap: 10px; }
.ac-icon { width: 40px; height: 40px; border-radius: 9px; background: var(--navy-700); display: flex; align-items: center; justify-content: center; font-size: 19px; flex: none; }
.ac-name { font-size: 15.5px; font-weight: 900; color: #f0ecdf; }
.ac-ind { font-size: 11px; color: var(--gold-soft); }
.ac-status { margin-left: auto; font-size: 10.5px; color: var(--teal); white-space: nowrap; }
.ac-desc { font-size: 12.5px; color: #97a3b6; line-height: 1.75; min-height: 3.4em; }
.ac-meta { display: flex; gap: 14px; font-size: 11px; color: #6d7a8e; font-family: var(--font-mono); }
.ac-meta b { color: #9aa7ba; font-weight: 500; }
.ac-btns { display: flex; gap: 8px; margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 6px; font-size: 12.5px; font-weight: 700;
  border: 1px solid transparent; transition: all 0.15s;
}
.btn-gold { background: var(--gold); color: var(--navy-950); }
.btn-gold:hover { background: var(--gold-soft); }
.btn-ghost { border-color: var(--line-dark); color: #c3ccd9; background: none; }
.btn-ghost:hover { border-color: rgba(201, 163, 79, 0.5); color: var(--gold-soft); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* agent detail */
.detail-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.detail-head .ac-icon { width: 52px; height: 52px; font-size: 25px; }
.detail-head h1 { font-size: 24px; font-weight: 900; color: #f0ecdf; }
.detail-head .sub { font-size: 12px; color: #8fa0b6; margin-top: 3px; }
.detail-head .spacer { flex: 1; }
.sec {
  background: var(--navy-900); border: 1px solid var(--line-dark); border-radius: 10px;
  padding: 20px 22px; margin-bottom: 16px;
}
.sec h2 { font-size: 13px; font-weight: 900; color: var(--gold-soft); letter-spacing: 0.06em; margin-bottom: 13px; }
.sec h2 .hint { font-weight: 500; color: #6d7a8e; font-size: 11px; margin-left: 10px; letter-spacing: 0; }
.sec p.lead { font-size: 13px; color: #b7c0cf; line-height: 1.9; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 11.5px; padding: 5px 12px; border-radius: 999px;
  background: var(--navy-800); border: 1px solid var(--line-dark); color: #b7c0cf;
}
.chip.sys { border-color: rgba(61, 90, 128, 0.8); color: #9fc0e8; }
.skill-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 9px; }
.skill {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--navy-800); border: 1px solid var(--line-dark); border-radius: 7px; padding: 11px 13px;
}
.skill .ic { font-size: 15px; flex: none; }
.skill b { display: block; font-size: 12.5px; color: #eee9dc; }
.skill span { font-size: 11px; color: #8fa0b6; line-height: 1.6; }
.guard-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.guard-list li {
  font-size: 12.5px; color: #e8c98f; line-height: 1.7;
  background: rgba(217, 154, 61, 0.08); border: 1px solid rgba(217, 154, 61, 0.28);
  border-radius: 7px; padding: 9px 13px;
}
.guard-list li::before { content: "🛡️ "; }

/* rules */
.rule-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--navy-800); border: 1px solid rgba(201, 163, 79, 0.3); border-radius: 8px;
  padding: 14px 16px; margin-bottom: 10px;
}
.rule-row .rr-info { flex: 1; min-width: 220px; }
.rule-row .rr-label { font-size: 13.5px; font-weight: 700; color: #f0ecdf; }
.rule-row .rr-desc { font-size: 11.5px; color: #8fa0b6; margin-top: 3px; line-height: 1.6; }
.rule-row input {
  width: 110px; text-align: right; font-family: var(--font-mono); font-size: 14px;
  padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line-dark);
  background: var(--navy-950); color: var(--gold-soft);
}
.rule-row input:focus { outline: 2px solid rgba(201, 163, 79, 0.5); }
.rule-row .unit { font-size: 12px; color: #8fa0b6; }
.rule-effect {
  font-size: 11.5px; color: #7fd0c4; background: rgba(47, 158, 143, 0.07);
  border: 1px dashed rgba(47, 158, 143, 0.35); border-radius: 7px; padding: 9px 13px; line-height: 1.7;
}
.rule-none { font-size: 12.5px; color: #8fa0b6; }

/* insights */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--navy-900); border: 1px solid var(--line-dark); border-radius: 10px; padding: 18px 20px;
}
.kpi .k-label { font-size: 11px; color: #8fa0b6; letter-spacing: 0.04em; }
.kpi .k-value { font-size: 30px; font-weight: 900; color: #f0ecdf; margin-top: 6px; }
.kpi .k-value small { font-size: 13px; color: #8fa0b6; font-weight: 500; }
.kpi.gold .k-value { color: var(--gold-soft); }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; }
.bar-row .b-label { width: 130px; color: #b7c0cf; flex: none; }
.bar-row .b-track { flex: 1; height: 9px; border-radius: 5px; background: var(--navy-800); overflow: hidden; }
.bar-row .b-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.bar-row .b-num { width: 34px; text-align: right; color: #8fa0b6; font-family: var(--font-mono); font-size: 11px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { text-align: left; font-size: 10.5px; color: #6d7a8e; letter-spacing: 0.06em; padding: 8px 10px; border-bottom: 1px solid var(--line-dark); }
.tbl td { padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: #c3ccd9; vertical-align: top; }
.tbl .mono { font-family: var(--font-mono); font-size: 11px; color: #9aa7ba; }
.scn-chip { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 3px; margin-right: 6px; white-space: nowrap; }
.scn-trade { background: rgba(201, 163, 79, 0.15); color: var(--gold-soft); }
.scn-insurance { background: rgba(61, 90, 128, 0.4); color: #9fc0e8; }
.scn-ec { background: rgba(47, 158, 143, 0.15); color: #7fd0c4; }
.scn-manufacturing { background: rgba(194, 94, 94, 0.16); color: #e0a3a3; }
.st { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: 10px; font-weight: 700; }
.st-new { background: rgba(217, 154, 61, 0.15); color: #e8c98f; }
.st-doing { background: rgba(61, 90, 128, 0.4); color: #9fc0e8; }
.st-done { background: rgba(47, 158, 143, 0.15); color: #7fd0c4; }

/* templates */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tpl {
  background: var(--navy-900); border: 1px dashed var(--line-dark); border-radius: 10px; padding: 18px 18px 15px;
}
.tpl:hover { border-color: rgba(201, 163, 79, 0.4); }
.tpl .t-top { display: flex; align-items: center; gap: 9px; }
.tpl .t-ic { font-size: 19px; }
.tpl b { font-size: 14px; color: #eee9dc; }
.tpl .t-ind { font-size: 10.5px; color: var(--gold-soft); margin-left: auto; }
.tpl p { font-size: 11.5px; color: #8fa0b6; line-height: 1.7; margin: 9px 0 11px; }
.tpl .chip-row .chip { font-size: 10.5px; padding: 3px 10px; }
.tpl .btn { margin-top: 12px; width: 100%; font-size: 11.5px; padding: 8px; }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--navy-700); border: 1px solid rgba(201, 163, 79, 0.5); color: #f0ecdf;
  font-size: 13px; font-weight: 700; padding: 12px 22px; border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); z-index: 100;
  animation: toast-in 0.25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 860px) {
  body { overflow: auto; }
  .shell { flex-direction: column; height: auto; }
  .side { width: 100%; flex-direction: row; align-items: center; }
  .side-nav { flex-direction: row; margin-left: auto; }
  .side-foot { display: none; }
  .main { padding: 20px 16px 40px; }
}
