:root {
  --orange: #FF6900;
  --orange-dark: #E55A00;
  --orange-light: #FFF1E6;
  --navy: #003388;
  --navy-dark: #002566;
  --navy-light: #E6EBF5;
  --text: #1A1F2E;
  --text-soft: #5C6770;
  --line: #E2E6EA;
  --bg: #FFFFFF;
  --bg-soft: #F7F9FB;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Noto Sans JP', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-soft);
}

.adm-header {
  background: var(--navy);
  color: #fff;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--orange);
}
.adm-brand { display: flex; align-items: center; gap: 14px; }
.adm-logo {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.adm-brand h1 { margin: 0; font-size: 17px; font-weight: 700; }
.adm-brand p { margin: 0; font-size: 11px; opacity: 0.85; }
.adm-actions button {
  background: var(--orange);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.adm-actions button:hover { background: var(--orange-dark); }

.adm-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 32px 64px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: 8px;
  padding: 16px;
}
.kpi-label {
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 500;
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}
.kpi-sub {
  font-size: 10px;
  color: var(--text-soft);
  margin-top: 2px;
}

.row { display: grid; gap: 16px; margin-bottom: 16px; }
.row.two-col { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) {
  .row.two-col { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  border-left: 4px solid var(--orange);
  padding-left: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th {
  text-align: left;
  background: var(--bg-soft);
  color: var(--navy);
  padding: 8px 10px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }

.role-tag, .intent-tag, .status-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.role-user { background: var(--orange-light); color: var(--orange-dark); }
.role-assistant { background: var(--navy-light); color: var(--navy); }
.intent-tag {
  background: #F0F2F5;
  color: var(--text-soft);
}
.status-open {
  background: #FFE5DA;
  color: #C44400;
}

.cell-text {
  max-width: 480px;
  white-space: pre-line;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.cell-text-short {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--text-soft);
  font-size: 12px;
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: 6px;
  margin-top: 8px;
}

/* hidden 属性は display を全て無効化する（display:flex 等の上書き対策） */
[hidden] { display: none !important; }

.error-banner {
  background: #FFE5DA;
  color: #8A2A00;
  border-left: 4px solid #C44400;
  padding: 12px 18px;
  margin: 16px 32px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  border-radius: 6px;
}
.error-banner .error-icon {
  background: #C44400;
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.error-banner button {
  background: transparent;
  border: 1px solid #C44400;
  color: #8A2A00;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.error-banner button:last-child {
  border: none;
  font-size: 18px;
  padding: 0 8px;
}
#error-msg { flex: 1; }

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.search-form input,
.search-form select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  background: #fff;
}
.search-form input { flex: 1; min-width: 180px; }
.search-form button {
  background: var(--orange);
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}
.search-form .btn-secondary {
  background: var(--navy);
}
.search-form button:hover { opacity: 0.9; }

.search-meta {
  font-size: 11px;
  color: var(--text-soft);
  margin-bottom: 8px;
  min-height: 16px;
}

.cache-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.cache-stat {
  background: var(--bg-soft);
  padding: 10px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.cache-stat span { font-size: 11px; color: var(--text-soft); }
.cache-stat strong { font-size: 18px; color: var(--navy); }

.btn-secondary {
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--navy-dark); }

.adapter-on { color: #2E7D32; font-weight: 700; }
.adapter-off { color: var(--text-soft); }

.skeleton-row td {
  background: linear-gradient(90deg, var(--bg-soft) 25%, #EEF1F4 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  height: 16px;
  color: transparent;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Section warning (per-section non-fatal error) */
.section-warn {
  background: #FFF5E6;
  border: 1px solid #FFB266;
  color: #8A4A00;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 11px;
  margin-bottom: 10px;
}

/* Inline header hint */
.card-hint {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-soft);
  margin-left: 8px;
  border-left: none;
  padding-left: 0;
}

/* Cost card highlight */
.kpi-cost-card { border-left-color: #2E7D32; }
.kpi-cost-card .kpi-value { color: #2E7D32; }

/* Trends inline SVG bar chart */
.trends-chart {
  margin-bottom: 12px;
  background: #FAFBFC;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}
.trends-chart svg { display: block; }

/* Job distribution percentage bars */
.bar-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 140px;
}
.bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-soft);
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-dark));
  border-radius: 3px;
}
.bar-label {
  font-size: 10px;
  color: var(--text-soft);
  width: 28px;
  text-align: right;
}

/* Feature cards (adapters reframed as Phase 2 extensions) */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.feature-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  position: relative;
}
.feature-card.feature-on {
  background: #F1F8E9;
  border-color: #AED581;
}
.feature-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.feature-head strong {
  font-size: 12px;
  color: var(--navy);
}
.feature-status {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--navy-light);
  color: var(--navy);
  font-weight: 700;
}
.feature-on .feature-status {
  background: #2E7D32;
  color: #fff;
}
.feature-desc {
  font-size: 11px;
  color: var(--text-soft);
  line-height: 1.5;
}


/* Notify config form */
.notify-form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 13px; font-weight: 600; color: #333; }
.form-row label strong { color: #c33; margin-left: 4px; font-size: 11px; }
.form-row input, .form-row select {
  padding: 8px 10px; border: 1px solid #d0d0d0; border-radius: 4px;
  font-size: 14px; background: #fff;
}
.form-row input:focus, .form-row select:focus {
  outline: none; border-color: #4a7bbf; box-shadow: 0 0 0 2px rgba(74,123,191,0.15);
}
.form-row small { color: #666; font-size: 11px; }
.form-row-half input { max-width: 120px; }
.nf-block {
  border: 1px solid #e0e0e0; border-radius: 6px;
  padding: 14px 16px; margin: 0; display: flex; flex-direction: column; gap: 12px;
}
.nf-block legend { font-size: 13px; font-weight: 700; padding: 0 6px; color: #444; }
.notify-actions { display: flex; align-items: center; gap: 12px; }
.nf-status { font-size: 13px; }
.nf-status.nf-ok { color: #2E7D32; }
.nf-status.nf-err { color: #c33; }

