/* =========================================================
   Voice Gear LLM Bridge — admin mock 共通スタイル
   設計方針:
   - ivr-log-storage の deep navy + blue accent を踏襲
   - aurora グラデ・偶数行・glass card 不透明度を **白寄せ**
   - ダークモード実装禁止（仕様書 §4.1）
   ========================================================= */

:root {
  --font-sans: "LINE Seed JP", system-ui, -apple-system, sans-serif;

  /* navy ink scale */
  --ink-900: #0a1e3f;
  --ink-800: #122c54;
  --ink-700: #1e3a6b;
  --ink-600: #3a558a;
  --ink-500: #5b7aa8;
  --ink-400: #8aa0c5;
  --ink-300: #b4c4dc;
  --ink-200: #dce5f2;
  --ink-100: #eef2f9;
  --ink-50:  #f6f9ff;

  /* blue accent */
  --blue-800: #1e40af;
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-300: #93c5fd;
  --blue-100: #dbeafe;
  --blue-50:  #eff6ff;

  /* status */
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-100: #dcfce7;
  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;
  --rose-600:  #e11d48;
  --rose-500:  #f43f5e;
  --rose-100:  #ffe4e6;

  /* surface — ivr-log-storage より白寄せ */
  --glass: rgba(255, 255, 255, 0.86);          /* 0.72 -> 0.86 */
  --glass-strong: rgba(255, 255, 255, 0.94);
  --glass-border: rgba(255, 255, 255, 0.78);   /* 0.65 -> 0.78 */
  --row-even: #f1f6ff;                         /* 偶数行を pale blue 寄せ（dbeafe より淡く） */
  --row-hover: #e3edff;

  --shadow-sm: 0 1px 2px rgba(30, 58, 107, 0.05);
  --shadow-md: 0 4px 16px rgba(30, 58, 107, 0.07), 0 2px 4px rgba(30, 58, 107, 0.03);
  --shadow-lg: 0 24px 48px -12px rgba(30, 58, 107, 0.22), 0 4px 16px rgba(30, 58, 107, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--ink-900);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  background: #f8fbff; /* ivr の #f4f8ff から白寄せ */
}

/* aurora — 全体的に opacity を下げ、白寄せ */
body::before {
  content: "";
  position: fixed;
  inset: -10%;
  background:
    radial-gradient(at 20% 15%, rgba(96, 165, 250, 0.20) 0, transparent 55%),
    radial-gradient(at 85% 10%, rgba(59, 130, 246, 0.14) 0, transparent 50%),
    radial-gradient(at 50% 85%, rgba(147, 197, 253, 0.22) 0, transparent 60%),
    linear-gradient(180deg, #f8fbff 0%, #f0f6ff 40%, #ffffff 100%);
  z-index: -2;
  animation: drift 24s ease-in-out infinite alternate;
}

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-2.5%, 1.8%, 0) scale(1.05); }
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(30, 58, 107, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 58, 107, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  z-index: -1;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* =========================================================
   レイアウト: sidebar + main
   ========================================================= */

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--ink-200);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  z-index: 10;
}

.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid var(--ink-200);
}

.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
  box-shadow:
    0 8px 22px rgba(37, 99, 235, 0.32),
    inset 0 1px 0 rgba(255,255,255,0.45);
  position: relative;
  flex-shrink: 0;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 7px;
  border: 1.5px solid rgba(255,255,255,0.7);
  border-right-color: transparent;
  border-bottom-color: transparent;
}

.brand-sub {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--blue-600);
  margin: 0 0 2px;
}
.brand-title {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
  color: var(--ink-900);
}

.nav-section-title {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-400);
  padding: 4px 10px;
  margin: 6px 0 2px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background .15s, color .15s;
}
.nav a:hover {
  background: var(--blue-50);
  color: var(--blue-700);
}
.nav a.active {
  background: var(--blue-600);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}
.nav a.active .nav-icon { color: #fff; }
.nav a.admin-only {
  border-left: 2px solid var(--amber-500);
}

.nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--ink-500);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--ink-200);
  font-size: 12px;
  color: var(--ink-500);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-footer .me {
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a6b 0%, #5b7aa8 100%);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  flex-shrink: 0;
}
.me-name { font-weight: 800; color: var(--ink-900); font-size: 12px; line-height: 1.2; }
.me-role { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.me-role.admin { color: var(--amber-600); }
.me-role.tenant-admin { color: var(--blue-600); }
.me-role.tenant-viewer { color: var(--ink-500); }

.btn-logout-sb {
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  background: transparent;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
.btn-logout-sb:hover {
  background: #fff;
  color: var(--blue-600);
  border-color: var(--blue-400);
}

/* main */
.main {
  padding: 32px 36px 64px;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 24px;
  flex-wrap: wrap;
}
.page-title {
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.page-sub {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue-600);
  margin: 0;
}
.crumbs {
  font-size: 12px;
  color: var(--ink-500);
  margin: 4px 0 6px;
}
.crumbs a { color: var(--blue-600); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* tenant selector pill (admin only) */
.tenant-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  color: var(--ink-700);
  backdrop-filter: blur(10px);
}
.tenant-pill select {
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  color: var(--blue-700);
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
}

/* =========================================================
   card / panel
   ========================================================= */
.card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}
.card + .card { margin-top: 18px; }
.card-pad { padding: 22px 24px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--ink-200);
  gap: 12px;
  flex-wrap: wrap;
}
.card-title {
  font-size: 14px;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.02em;
  color: var(--ink-900);
}
.card-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin: 2px 0 0;
}

/* dashboard grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  padding: 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.kpi-value .unit { font-size: 13px; font-weight: 700; color: var(--ink-500); margin-left: 4px; }
.kpi-trend { font-size: 11px; font-weight: 700; }
.kpi-trend.up { color: var(--green-600); }
.kpi-trend.down { color: var(--rose-600); }
.kpi-trend.neutral { color: var(--ink-500); }

/* =========================================================
   field / form
   ========================================================= */
.field { margin-bottom: 14px; }
.field-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.field-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.field-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

.field label,
.label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 6px;
}

.input,
.field input[type=text],
.field input[type=password],
.field input[type=email],
.field input[type=number],
.field input[type=date],
.field input[type=datetime-local],
.field select,
.field textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-900);
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--ink-200);
  border-radius: 9px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea {
  height: auto;
  min-height: 92px;
  padding: 10px 12px;
  line-height: 1.55;
  font-size: 13px;
  resize: vertical;
}
.field textarea.code,
textarea.code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-800);
  background: #fbfdff;
  border-color: var(--ink-200);
}
.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue-500);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}
.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background: var(--ink-100);
  color: var(--ink-500);
  cursor: not-allowed;
}

.help {
  font-size: 11px;
  color: var(--ink-500);
  margin: 4px 2px 0;
  line-height: 1.5;
}

.kbd {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--ink-700);
}

/* =========================================================
   button
   ========================================================= */
.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  height: 38px;
  padding: 0 16px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
  color: #fff;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.24);
}
.btn-primary:hover { box-shadow: 0 10px 22px rgba(37, 99, 235, 0.32); }
.btn-secondary {
  background: rgba(255,255,255,0.92);
  color: var(--ink-700);
  border-color: var(--ink-200);
}
.btn-secondary:hover { background: #fff; border-color: var(--blue-400); color: var(--blue-700); }
.btn-ghost {
  background: transparent;
  color: var(--ink-600);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--blue-50); color: var(--blue-700); }
.btn-danger {
  background: #fff;
  color: var(--rose-600);
  border-color: var(--rose-100);
}
.btn-danger:hover { background: var(--rose-100); border-color: var(--rose-500); }
.btn-warn {
  background: var(--amber-100);
  color: var(--amber-600);
  border-color: var(--amber-100);
}
.btn-warn:hover { background: #fef3c7; border-color: var(--amber-500); color: #b45309; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 10px; font-size: 11px; border-radius: 7px; gap: 5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.2);
  box-shadow: none;
}

/* viewer 限定の disabled tooltip 風 */
.btn-locked {
  position: relative;
}
.btn-locked::after {
  content: "閲覧専用ロール";
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  box-shadow: var(--shadow-sm);
}
.btn-locked:hover::after { opacity: 1; }

/* =========================================================
   table
   ========================================================= */
.table-wrap {
  overflow: auto;
  padding: 4px;
}
table.t {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
table.t thead th {
  text-align: left;
  padding: 13px 16px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-500);
  background: transparent;
  border-bottom: 1px solid var(--ink-200);
  white-space: nowrap;
}
table.t tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--ink-100);
  vertical-align: middle;
  color: var(--ink-800);
}
table.t tbody tr:nth-child(even) td { background: var(--row-even); }
table.t tbody tr:hover td,
table.t tbody tr:hover:nth-child(even) td { background: var(--row-hover); }
table.t tbody tr.clickable { cursor: pointer; }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; }
table.t .id-mono {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--ink-700);
}
table.t .row-actions {
  display: inline-flex; gap: 6px;
}

/* =========================================================
   badge / chip
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.ok        { background: var(--green-100); color: #15803d; border-color: #bbf7d0; }
.badge.recovered { background: #fef3c7;          color: #b45309; border-color: #fde68a; }
.badge.failed    { background: var(--rose-100);  color: #be123c; border-color: #fecdd3; }
.badge.info      { background: var(--blue-50);   color: var(--blue-700); border-color: var(--blue-100); }
.badge.muted     { background: var(--ink-100);   color: var(--ink-700); border-color: var(--ink-200); }
.badge.warn      { background: #fef3c7;          color: #b45309; border-color: #fde68a; }
.badge.role-admin        { background: #fef3c7; color: var(--amber-600); border-color: #fde68a; }
.badge.role-tenant-admin { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-100); }
.badge.role-tenant-viewer { background: var(--ink-100); color: var(--ink-600); border-color: var(--ink-200); }

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.dot.ok { background: var(--green-500); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.dot.warn { background: var(--amber-500); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.dot.fail { background: var(--rose-500); box-shadow: 0 0 0 3px rgba(244,63,94,.18); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue-700);
}

/* =========================================================
   filter strip / toolbar
   ========================================================= */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar .grow { flex: 1 1 240px; }
.search-input {
  position: relative;
}
.search-input input {
  padding-left: 36px;
}
.search-input svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--ink-400);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.filter-grid .field { margin: 0; }

/* =========================================================
   tabs (page-internal)
   ========================================================= */
.tabs {
  display: inline-flex;
  background: var(--glass-strong);
  border: 1px solid var(--ink-200);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}
.tabs button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-500);
  background: transparent;
  border: none;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tabs button.active {
  background: var(--blue-600);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}

/* sub tabs (text-only underline) */
.subtabs {
  display: flex;
  border-bottom: 1px solid var(--ink-200);
  gap: 4px;
}
.subtabs button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--ink-500);
}
.subtabs button.active {
  color: var(--blue-700);
  border-bottom-color: var(--blue-600);
}
.subtabs button:hover:not(.active) { color: var(--ink-700); }

/* =========================================================
   modal
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 63, 0.36);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal.lg { max-width: 880px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--ink-200);
}
.modal-title { font-size: 15px; font-weight: 800; margin: 0; }
.modal-body { padding: 20px 22px; overflow: auto; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--ink-200);
  display: flex; justify-content: flex-end; gap: 10px;
}
.icon-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--ink-400);
  cursor: pointer;
  line-height: 1;
}

/* =========================================================
   util
   ========================================================= */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.flex-end { display: flex; justify-content: flex-end; gap: 10px; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-14 { gap: 14px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--ink-500); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.divider {
  height: 1px;
  background: var(--ink-200);
  margin: 18px 0;
}

.kv {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 10px 18px;
  font-size: 13px;
}
.kv dt {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-500);
  align-self: start;
  padding-top: 4px;
}
.kv dd { margin: 0; color: var(--ink-900); word-break: break-word; }

/* placeholder chips (動的パラメータ / spreadsheet) */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--blue-100);
  color: var(--blue-700);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.chip:hover { background: var(--blue-50); border-color: var(--blue-400); }
.chip.amber {
  border-color: #fde68a;
  color: var(--amber-600);
}
.chip.amber:hover { background: var(--amber-100); border-color: var(--amber-500); }

/* code block (read-only) */
.code-block {
  background: #f8fafc;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-800);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 360px;
}

/* simple bar chart */
.bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 96px;
  gap: 12px;
  align-items: center;
  padding: 6px 4px;
  font-size: 12px;
}
.bar-row .lbl { color: var(--ink-700); font-weight: 700; }
.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--ink-100);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa 0%, #2563eb 100%);
  border-radius: 999px;
}
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-700); }

/* timeline (sync history etc.) */
.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: "";
  position: absolute;
  top: 4px; bottom: 4px; left: 5px;
  width: 2px;
  background: var(--ink-200);
}
.timeline .tl-item {
  position: relative;
  padding: 10px 0 14px 14px;
  font-size: 13px;
}
.timeline .tl-item::before {
  content: "";
  position: absolute;
  top: 14px; left: -13px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--blue-500);
  box-shadow: 0 0 0 3px var(--blue-50);
}
.timeline .tl-item.fail::before { background: var(--rose-500); box-shadow: 0 0 0 3px var(--rose-100); }
.timeline .tl-time { font-size: 11px; color: var(--ink-500); font-weight: 700; }
.timeline .tl-title { font-weight: 700; margin: 2px 0; }

/* alert */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
}
.alert.info { background: var(--blue-50); border: 1px solid var(--blue-100); color: var(--blue-700); }
.alert.warn { background: #fef3c7; border: 1px solid #fde68a; color: #b45309; }
.alert.danger { background: var(--rose-100); border: 1px solid #fecdd3; color: #be123c; }
.alert .icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.alert.info .icon { background: var(--blue-600); color: #fff; }
.alert.warn .icon { background: var(--amber-500); color: #fff; }
.alert.danger .icon { background: var(--rose-500); color: #fff; }

/* viewer banner */
.viewer-banner {
  margin-bottom: 16px;
}

/* version chips */
.gen-list { display: flex; flex-direction: column; gap: 6px; }
.gen-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  font-size: 12.5px;
}
.gen-row.current {
  border-color: var(--blue-400);
  background: var(--blue-50);
}
.gen-row .gen-meta { display: flex; align-items: center; gap: 10px; }
.gen-row .gen-no {
  font-family: ui-monospace, monospace;
  font-weight: 800;
  color: var(--blue-700);
  background: #fff;
  border: 1px solid var(--blue-100);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 11px;
}


.json-tree {
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-800);
  background: #fbfdff;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  padding: 12px 16px;
}
.json-tree .k { color: var(--blue-700); }
.json-tree .s { color: #15803d; }
.json-tree .n { color: #b45309; }
.json-tree .b { color: #be123c; }

/* segmented control */
.seg {
  display: inline-flex;
  border: 1px solid var(--ink-200);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}
.seg button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  background: transparent;
  border: none;
  color: var(--ink-600);
  cursor: pointer;
  border-right: 1px solid var(--ink-200);
}
.seg button:last-child { border-right: none; }
.seg button.active {
  background: var(--blue-600);
  color: #fff;
}

/* diff view */
.diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.diff-col {
  background: #fbfdff;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 340px;
  overflow: auto;
}
.diff-col.before { background: #fff8f8; border-color: #fecdd3; }
.diff-col.after  { background: #f0fdf4; border-color: #bbf7d0; }
.diff-head {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.diff-col.before .diff-head { color: #be123c; }
.diff-col.after  .diff-head { color: #15803d; }

/* pager */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 6px 4px;
  font-size: 12px;
  color: var(--ink-500);
}
.pager .pages { display: flex; gap: 6px; }
.pager .pages button {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--ink-200);
  background: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-700);
  cursor: pointer;
}
.pager .pages button.active { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.pager .pages button:disabled { opacity: 0.45; cursor: not-allowed; }

/* tiny helpers for usage page */
.legend {
  display: inline-flex; gap: 14px; flex-wrap: wrap;
  font-size: 11px; color: var(--ink-600); font-weight: 700;
}
.legend .sw {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}
.spark {
  display: flex; align-items: flex-end;
  gap: 3px;
  height: 90px;
  padding: 8px 4px 0;
}
.spark .b {
  width: 10px;
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
  border-radius: 3px 3px 0 0;
  opacity: 0.92;
}
.spark .b.alt { background: linear-gradient(180deg, #93c5fd 0%, #3b82f6 100%); }
