:root{
  --navy:#18345c;
  --blue:#2563eb;
  --sky:#eaf2ff;
  --line:#d8e0ec;
  --bg:#f4f7fb;
  --text:#1f2937;
  --muted:#64748b;
  --red:#dc2626;
  --green:#15803d;
  --yellow:#facc15;
  --gray:#94a3b8;
}

*{box-sizing:border-box}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP",sans-serif;
}

.fwrt-header{
  background:linear-gradient(135deg,#18345c,#24518f);
  color:#fff;
  padding:22px;
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:center;
}

.fwrt-header h1{margin:4px 0;font-size:26px}
.fwrt-header p{margin:0}
.fwrt-kicker{font-size:13px;opacity:.85}

.fwrt-back{
  color:#fff;
  border:1px solid rgba(255,255,255,.55);
  border-radius:999px;
  padding:9px 14px;
  text-decoration:none;
  white-space:nowrap;
}

.fwrt-app{
  max-width:1240px;
  margin:auto;
  padding:16px;
}

/* 2カラムを廃止。全カードを縦並びにする */
.fwrt-grid{
  display:block;
}

.fwrt-left,
.fwrt-right,
.fwrt-wide{
  width:100%;
}

.fwrt-card{
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:0 6px 18px rgba(15,23,42,.06);
  padding:16px;
  margin-bottom:16px;
}

.fwrt-card h2{
  font-size:18px;
  margin:0 0 12px;
  color:var(--navy);
}

.fwrt-row,
.fwrt-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

button,
.fwrt-import{
  background:var(--blue);
  color:#fff;
  border:0;
  border-radius:10px;
  padding:9px 12px;
  font-weight:700;
  cursor:pointer;
}

button.secondary{background:#64748b}
button.danger{background:var(--red)}
button.small{padding:5px 7px;font-size:12px}

select,
input,
textarea{
  border:1px solid var(--line);
  border-radius:10px;
  padding:9px;
  background:#fff;
  color:var(--text);
}

select{min-width:220px}
.fwrt-import input{display:none}

.fwrt-scenario,
.fwrt-result,
.fwrt-answer{
  margin-top:12px;
  background:#f8fafc;
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px;
}

/* 1. シナリオ内に通信許可リクエストを統合した場合の見た目 */
.fwrt-request-inline{
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid var(--line);
}

.fwrt-request-title{
  font-weight:800;
  color:var(--navy);
}

.fwrt-badges{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:8px;
}

.fwrt-badge{
  font-size:12px;
  background:var(--sky);
  color:#1e3a8a;
  padding:4px 8px;
  border-radius:999px;
}

.fwrt-form{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.fwrt-form button{grid-column:1/-1}

.fwrt-check{
  display:flex;
  align-items:center;
  gap:6px;
}

/* ルール表 */
.fwrt-table-wrap{
  overflow:auto;
  border:1px solid var(--line);
  border-radius:12px;
}

table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
  min-width:900px;
}

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

th{
  background:#eff6ff;
  color:#1e3a8a;
  position:sticky;
  top:0;
  z-index:1;
}

tr.disabled{opacity:.45}

.fwrt-rule-action-allow{
  color:var(--green);
  font-weight:800;
}

.fwrt-rule-action-deny{
  color:var(--red);
  font-weight:800;
}

/* ネットワーク図：横つぶれ防止 */
.fwrt-diagram{
  width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  background:#f8fafc;
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px;
}

.fwrt-diagram svg{
  width:100%;
  min-width:760px;
  height:auto;
  display:block;
}

.zone{
  fill:#fff;
  stroke:#cbd5e1;
  stroke-width:1.5;
}

.device{
  fill:#eff6ff;
  stroke:#2563eb;
  stroke-width:1.4;
}

.firewall{
  fill:#fff7ed;
  stroke:#ea580c;
  stroke-width:2;
}

.label{
  font-size:12px;
  fill:#1f2937;
  font-weight:700;
}

.ip{
  font-size:10px;
  fill:#64748b;
}

.path-old{
  stroke:var(--gray);
  stroke-width:3;
  fill:none;
  stroke-dasharray:5 5;
}

.path-allow{
  stroke:var(--green);
  stroke-width:4;
  fill:none;
}

.path-deny{
  stroke:var(--red);
  stroke-width:4;
  fill:none;
}

.path-new{
  stroke:var(--yellow);
  stroke-width:5;
  fill:none;
}

.path-danger{
  stroke:var(--red);
  stroke-width:5;
  fill:none;
  animation:blink 1s infinite;
}

@keyframes blink{
  50%{opacity:.25}
}

.fwrt-legend{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-top:8px;
  font-size:13px;
}

.fwrt-legend b{
  display:inline-block;
  width:18px;
  height:6px;
  border-radius:999px;
  margin-right:5px;
}

.fwrt-legend .ok{background:var(--green)}
.fwrt-legend .deny{background:var(--red)}
.fwrt-legend .warn{background:var(--yellow)}
.fwrt-legend .old{background:var(--gray)}

.fwrt-score{
  font-size:34px;
  font-weight:900;
  color:var(--navy);
}

.fwrt-ok{color:var(--green);font-weight:800}
.fwrt-ng{color:var(--red);font-weight:800}
.fwrt-warn{color:#b45309;font-weight:800}

.fwrt-list{
  margin:8px 0 0;
  padding-left:20px;
}

.fwrt-test-item{
  border-left:5px solid var(--line);
  padding:8px;
  margin:8px 0;
  background:#fff;
  border-radius:8px;
}

.fwrt-test-item.ok{border-color:var(--green)}
.fwrt-test-item.ng{border-color:var(--red)}
.fwrt-test-item.warn{border-color:#f59e0b}

code{
  background:#eef2ff;
  padding:2px 5px;
  border-radius:5px;
}

.fwrt-learn-h{
  font-size:14px;
  color:var(--navy);
  margin:14px 0 6px;
  padding-left:4px;
  border-left:4px solid var(--blue);
}

@media(max-width:860px){
  .fwrt-header{
    display:block;
  }

  .fwrt-back{
    display:inline-block;
    margin-top:12px;
  }

  .fwrt-form{
    grid-template-columns:1fr;
  }

  select{
    min-width:0;
    width:100%;
  }

  .fwrt-row button,
  .fwrt-actions button,
  .fwrt-import{
    width:100%;
  }

  .fwrt-diagram{
    padding:8px;
  }

  .fwrt-diagram svg{
    min-width:720px;
  }
}