@charset "utf-8";

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

a {
  color: #1d4ed8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: 92%;
  max-width: 1280px;
  margin: 0 auto;
}

.header {
  background: linear-gradient(135deg, #0f172a, #1d4ed8);
  color: #fff;
  padding: 28px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.header h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.header p {
  margin: 0;
  opacity: 0.95;
}

.top-actions {
  margin-top: 16px;
}

.top-actions a {
  display: inline-block;
  margin-right: 12px;
  margin-bottom: 8px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  border-radius: 10px;
}

.main {
  padding: 28px 0 60px;
}

.card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  padding: 24px;
  margin-bottom: 24px;
}

.card h2 {
  margin-top: 0;
  font-size: 24px;
  color: #0f172a;
}

.lead {
  font-size: 16px;
  line-height: 1.8;
  color: #475569;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 18px;
}

.form-group {
  flex: 1 1 300px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 16px;
}

button,
.btn {
  display: inline-block;
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  background: #1d4ed8;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

button:hover,
.btn:hover {
  opacity: 0.92;
  text-decoration: none;
}

.btn-sub {
  background: #334155;
}

.btn-green {
  background: #059669;
}

.btn-orange {
  background: #ea580c;
}

.note {
  margin-top: 12px;
  font-size: 14px;
  color: #64748b;
}

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

.stat-box {
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border: 1px solid #dbeafe;
  border-radius: 16px;
  padding: 18px;
}

.stat-box .label {
  font-size: 14px;
  color: #475569;
}

.stat-box .value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: bold;
  color: #0f172a;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  background: #eff6ff;
  color: #1e3a8a;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
}

.badge-ok {
  background: #dcfce7;
  color: #166534;
}

.badge-warn {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.footer {
  padding: 30px 0 60px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

ul.clean {
  padding-left: 20px;
  line-height: 1.9;
}

.small {
  font-size: 13px;
  color: #64748b;
}

/* ===== ツリー全体 ===== */
.tree-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.tree-toolbar button {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: #1d4ed8;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}

.tree-toolbar button.sub {
  background: #334155;
}

.tree-toolbar button.green {
  background: #059669;
}

.tree-box {
  background: linear-gradient(180deg, #fbfdff, #f8fbff);
  border: 1px solid #dbeafe;
  border-radius: 16px;
  padding: 18px;
  overflow-x: auto;
}

.tree-root,
.tree-root ul {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.tree-root ul {
  margin-left: 18px;
  padding-left: 18px;
  border-left: 2px solid #dbeafe;
}

.tree-node {
  margin: 8px 0;
}

.tree-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  line-height: 1.8;
  padding: 8px 10px;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.tree-line:hover {
  background: #f8fafc;
}

.tree-node.level-0 > .tree-line {
  background: #eff6ff;
}

.tree-node.level-1 > .tree-line {
  background: #f8fbff;
}

.tree-node.level-2 > .tree-line,
.tree-node.level-3 > .tree-line,
.tree-node.level-4 > .tree-line,
.tree-node.level-5 > .tree-line {
  background: #fcfdff;
}

.tree-toggle {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e3a8a;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: bold;
}

.tree-toggle.empty {
  background: #e5e7eb;
  color: #64748b;
  cursor: default;
}

.tree-name {
  font-weight: bold;
  color: #0f172a;
}

.tree-url {
  color: #1d4ed8;
  word-break: break-all;
}

.tree-meta {
  font-size: 12px;
  color: #475569;
  background: #eff6ff;
  padding: 4px 8px;
  border-radius: 999px;
}

.tree-status {
  font-size: 12px;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 999px;
}

.tree-status.ok {
  background: #dcfce7;
  color: #166534;
}

.tree-status.warn {
  background: #fef3c7;
  color: #92400e;
}

.tree-status.danger {
  background: #fee2e2;
  color: #991b1b;
}

.tree-issue {
  font-size: 12px;
  color: #991b1b;
  background: #fee2e2;
  padding: 4px 8px;
  border-radius: 999px;
}

.tree-line.is-ok {
  border-left: 5px solid #16a34a;
}

.tree-line.is-warn {
  border-left: 5px solid #f59e0b;
}

.tree-line.is-danger {
  border-left: 5px solid #dc2626;
}

.tree-children.collapsed {
  display: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0 0;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #475569;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.legend-green {
  background: #16a34a;
}

.legend-yellow {
  background: #f59e0b;
}

.legend-red {
  background: #dc2626;
}

@media (max-width: 768px) {
  .header h1 {
    font-size: 24px;
  }

  .tree-line {
    flex-direction: column;
    align-items: flex-start;
  }

  .tree-toolbar {
    flex-direction: column;
  }

  .tree-toolbar button {
    width: 100%;
  }
}
