/* =========================================================================================
   ケイタスポータル AI査定 — 見た目。業務 API の画面（apps/ai-assessment/public/styles.css @ fab394f9、
   sha256 ec8e3e8a7f50d0dc95fd1920fdfe815937dd6334e70e6d34967222e7ea0bd9a5）を gen-portal-assets.mjs で .ai-scope の中だけに効くよう機械的に変換したもの。
   ポータル全体の色・文字（styles.css の :root / body）は上書きしない（:root / * / html / body の規則は外した）。
   ========================================================================================= */
.ai-scope { --danger-bg: #fdecea; }
.ai-scope a { color: var(--green-800); }
.ai-scope code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
.ai-scope [hidden] { display: none !important; }
.ai-scope .ai-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px clamp(16px, 3vw, 32px);
  background: var(--green-900); color: #fff;
}
.ai-scope .ai-header__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ai-scope .ai-header__mark {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--gold-500); color: var(--green-900); font-family: var(--font-serif); font-weight: 700; font-size: 20px; flex: none;
}
.ai-scope .ai-header__title { margin: 0; font-family: var(--font-serif); font-size: 18px; letter-spacing: 0.06em; }
.ai-scope .ai-header__sub { margin: 0; font-size: 11.5px; opacity: 0.8; }
.ai-scope .ai-header__user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-scope .ai-header__user .admin-btn { color: var(--green-900); }
.ai-scope .env-badge { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--gold-100); color: var(--gold-700); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; }
.ai-scope .ai-nav { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); background: transparent; }
.ai-scope .ai-main { max-width: var(--maxw); margin: 0 auto; padding: 18px clamp(16px, 3vw, 32px) 64px; }
.ai-scope .admin-tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.ai-scope .admin-tab {
  border: 0; background: none; padding: 11px 16px; font-family: inherit; font-size: 14.5px; font-weight: 700;
  color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; text-decoration: none;
}
.ai-scope .admin-tab.is-active { color: var(--green-900); border-bottom-color: var(--gold-500); }
.ai-scope .admin-tab:hover { color: var(--green-800); }
.ai-scope .admin-h2 { font-family: var(--font-serif); font-size: 21px; color: var(--green-900); margin: 4px 0 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ai-scope .admin-note { font-size: 13px; color: var(--muted); line-height: 1.8; margin: 0 0 16px; }
.ai-scope .admin-who { font-size: 13px; color: var(--muted); margin: 0 0 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-scope .admin-who strong { color: var(--green-800); }
.ai-scope .admin-form {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  padding: clamp(16px, 2.4vw, 24px); margin-bottom: 18px;
}
.ai-scope .admin-form.compact { padding: 14px; box-shadow: none; background: var(--ivory-50); margin: 10px 0; }
.ai-scope .admin-field { display: block; margin-bottom: 12px; min-width: 0; }
.ai-scope .admin-field > span { display: block; font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.ai-scope .admin-field em { font-style: normal; font-size: 11px; color: var(--gold-700); margin-left: 6px; }
.ai-scope .admin-form input[type="text"], .ai-scope .admin-form input[type="email"], .ai-scope .admin-form input[type="password"], .ai-scope .admin-form input[type="number"], .ai-scope .admin-form input[type="date"], .ai-scope .admin-form input[type="time"], .ai-scope .admin-form select, .ai-scope .admin-form textarea {
  width: 100%; padding: 10px 12px; font-family: inherit; font-size: 14.5px; color: var(--text);
  background: #fdfaf3; border: 1px solid var(--line); border-radius: 10px; resize: vertical; min-width: 0;
}
.ai-scope .admin-form input:focus, .ai-scope .admin-form select:focus, .ai-scope .admin-form textarea:focus {
  outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(200, 146, 40, 0.15); background: #fff;
}
.ai-scope .admin-form input:disabled, .ai-scope .admin-form select:disabled, .ai-scope .admin-form textarea:disabled { opacity: 0.7; cursor: not-allowed; }
.ai-scope .admin-form-actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; align-items: center; }
.ai-scope .admin-form-msg { font-size: 13px; margin: 8px 0 0; min-height: 1.2em; }
.ai-scope .admin-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--green-900);
  background: #fff; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.ai-scope .admin-btn:hover { background: var(--green-50); }
.ai-scope .admin-btn--primary { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.ai-scope .admin-btn--primary:hover { background: var(--green-900); }
.ai-scope .admin-btn--sm { padding: 6px 12px; font-size: 12.5px; }
.ai-scope .admin-btn--danger { color: var(--danger); border-color: rgba(179, 38, 30, 0.35); }
.ai-scope .admin-btn--danger:hover { background: var(--danger-bg); }
.ai-scope .admin-btn:disabled, .ai-scope .admin-btn[aria-disabled="true"] { background: #e9ece9; color: #8a948e; border-color: #d5dbd7; cursor: not-allowed; }
.ai-scope .admin-list { display: flex; flex-direction: column; gap: 10px; }
.ai-scope .admin-empty { font-size: 14px; color: var(--muted); padding: 10px 2px; margin: 0; }
.ai-scope .admin-card { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; }
.ai-scope .admin-card__body { min-width: 0; }
.ai-scope .admin-card__body h3 { margin: 0 0 5px; font-size: 15.5px; color: var(--green-900); }
.ai-scope .admin-card__actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.ai-scope .grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ai-scope .panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 16px; margin-bottom: 16px; min-width: 0; }
.ai-scope .panel__h { font-family: var(--font-serif); font-size: 16px; color: var(--green-900); margin: 0 0 10px; cursor: default; }
.ai-scope details.panel > summary { cursor: pointer; list-style: revert; }
.ai-scope .panel__sub { font-size: 13.5px; color: var(--green-800); margin: 12px 0 6px; }
.ai-scope .row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ai-scope .filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 12px; }
.ai-scope .filters .admin-form-actions { grid-column: 1 / -1; }
.ai-scope .stats { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.ai-scope .stats--sub { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ai-scope .stat { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: inherit; box-shadow: var(--shadow-sm); min-width: 0; }
.ai-scope a.stat:hover { border-color: var(--gold-500); }
.ai-scope .stat__label { font-size: 12px; color: var(--muted); font-weight: 700; }
.ai-scope .stat__value { font-family: var(--font-serif); font-size: 24px; color: var(--green-900); line-height: 1.2; }
.ai-scope .case__head { margin-bottom: 10px; }
.ai-scope .queue-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.ai-scope .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ai-scope .send-box { margin: 12px 0; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; background: var(--green-50); }
.ai-scope .send-box p { margin: 6px 0 0; }
.ai-scope .kv { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); gap: 6px 12px; margin: 0 0 8px; font-size: 14px; }
.ai-scope .kv dt { color: var(--muted); font-size: 12.5px; }
.ai-scope .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ai-scope .kv.small { font-size: 13px; }
.ai-scope .amount { font-family: var(--font-serif); font-size: 18px; color: var(--green-900); }
.ai-scope .table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ai-scope .table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ai-scope .table th, .ai-scope .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.ai-scope .table td { white-space: normal; min-width: 80px; }
.ai-scope .table th { background: var(--green-100); color: var(--green-900); font-size: 12px; position: sticky; top: 0; }
.ai-scope .table .num { text-align: right; white-space: nowrap; }
.ai-scope .table.small { font-size: 12.5px; }
.ai-scope .table.audit code { display: block; max-width: 360px; white-space: pre-wrap; }
.ai-scope .plain { list-style: none; padding: 0; margin: 0; }
.ai-scope .plain li { padding: 3px 0; }
.ai-scope .chat { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ai-scope .chat__item { max-width: 92%; padding: 9px 12px; border-radius: 14px; background: var(--ivory-100); border: 1px solid var(--line); }
.ai-scope .chat__item--out { align-self: flex-end; background: var(--green-100); }
.ai-scope .chat__meta { font-size: 11px; color: var(--muted); }
.ai-scope .chat__text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.ai-scope .chat__att { font-size: 11.5px; color: var(--green-700); }
.ai-scope .reply { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--ivory-50); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-family: inherit; font-size: 14px; }
.ai-scope .timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.ai-scope .timeline li { border-left: 3px solid var(--gold-500); padding-left: 10px; }
.ai-scope .audit-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ai-scope .audit-item { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--green-700); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; overflow-wrap: anywhere; }
.ai-scope .audit-item__head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.ai-scope .audit-changes { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.ai-scope .audit-key { display: inline-block; min-width: 7em; color: var(--muted); }
.ai-scope .audit-new { color: var(--green-800); font-weight: 700; }
.ai-scope .badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; font-family: var(--font-sans); background: var(--green-100); color: var(--green-900); white-space: nowrap; }
.ai-scope .badge--draft { background: #e8f0fb; color: #1f4f8a; }
.ai-scope .badge--researching { background: #eef0ff; color: #3b3f9a; }
.ai-scope .badge--ready_for_review { background: var(--gold-100); color: var(--gold-700); }
.ai-scope .badge--approved { background: #e3f4ea; color: #1b6b3d; }
.ai-scope .badge--sent { background: var(--green-800); color: #fff; }
.ai-scope .badge--needs_info { background: #fff0e0; color: #9a4b00; }
.ai-scope .badge--rejected, .ai-scope .badge--cancelled { background: #f1f1f1; color: #555; }
.ai-scope .pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; margin: 2px 2px 2px 0; }
.ai-scope .pill--ok { background: #e3f4ea; color: #1b6b3d; }
.ai-scope .pill--warn { background: var(--gold-100); color: var(--gold-700); }
.ai-scope .pill--bad { background: var(--danger-bg); color: var(--danger); }
.ai-scope .notice { border-radius: 12px; padding: 11px 14px; margin: 0 0 12px; border: 1px solid var(--line); background: #fff; }
.ai-scope .notice strong { display: block; font-size: 14px; }
.ai-scope .notice p { margin: 4px 0 0; font-size: 13px; }
.ai-scope .notice--forbidden { border-color: rgba(179, 38, 30, 0.35); background: var(--danger-bg); }
.ai-scope .notice--conflict { border-color: rgba(215, 154, 27, 0.5); background: var(--gold-100); }
.ai-scope .notice--unavailable { border-color: rgba(101, 113, 106, 0.4); background: #f1f3f1; }
.ai-scope .notice--auth, .ai-scope .notice--invalid, .ai-scope .notice--notfound { border-color: rgba(31, 79, 138, 0.3); background: #eef4fc; }
.ai-scope .notice--info { border-color: rgba(31, 79, 138, 0.3); background: #eef4fc; }
.ai-scope .notice--ok { border-color: rgba(27, 107, 61, 0.35); background: #e3f4ea; }
.ai-scope .emergency { padding: 12px; border-radius: 12px; border: 2px solid var(--line); margin-bottom: 14px; }
.ai-scope .emergency.is-on { border-color: var(--danger); background: var(--danger-bg); }
.ai-scope .check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; margin: 0 14px 8px 0; }
.ai-scope .check--big { font-size: 15px; font-weight: 700; }
.ai-scope .days { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 0 0 12px; }
.ai-scope .days legend { font-size: 12.5px; font-weight: 700; padding: 0 4px; }
.ai-scope .muted { color: var(--muted); }
.ai-scope .small { font-size: 12.5px; }
.ai-scope .warn { color: var(--gold-700); }
.ai-scope .loading { color: var(--muted); font-size: 14px; }
.ai-scope .login { max-width: 460px; margin: 6vh auto 0; }
.ai-scope .action-msg:empty { display: none; }
@media (max-width: 1100px) {
.ai-scope .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
.ai-scope .grid2 { grid-template-columns: minmax(0, 1fr); }
.ai-scope .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
.ai-scope .stats, .ai-scope .stats--sub { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ai-scope .row3, .ai-scope .filters { grid-template-columns: minmax(0, 1fr); }
.ai-scope .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.ai-scope .kv dd { margin-bottom: 6px; }
.ai-scope .admin-tab { padding: 9px 10px; font-size: 13.5px; }
.ai-scope .ai-header__sub { display: none; }
.ai-scope .chat__item { max-width: 100%; }
}
/* ---- ポータル版の追加（業務 app の濃い緑のヘッダーの代わりに、ポータルのヘッダーの下へ置く帯） ---- */
.ai-scope .ai-bar { max-width: var(--maxw); margin: 18px auto 0; padding: 0 clamp(16px, 3vw, 32px); display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ai-scope .ai-bar .admin-note { margin-bottom: 8px; }
.ai-scope .ai-header__user { color: var(--green-900); }
