/* AI employee management console — light theme, reuses line-setup.css vars. */
.ad-cols { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.ad-list { flex: 1 1 280px; max-width: 360px; }
.ad-detail { flex: 2 1 420px; }

.ad-list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ad-list-head h2 { margin: 0; }

.ad-emps { display: flex; flex-direction: column; gap: 8px; }
.ad-emp {
  text-align: left; width: 100%; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.ad-emp:hover { border-color: var(--accent); }
.ad-emp.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(16,182,103,.15); }
.ad-emp-row { display: flex; align-items: center; gap: 8px; }
.ad-emp-sub { font-size: 12px; margin-top: 2px; }
.ad-add { display: inline-block; margin-top: 12px; }
.ad-empty, .ad-emp-meta { font-size: 13px; }

.ad-tag { font-size: 11px; background: #e3f6ea; color: #0a8a4a; border-radius: 999px; padding: 1px 8px; }
.ad-tag.warn { background: #fbf6e3; color: #8a6a1c; }
.ad-tag.busy { background: #e3f6ea; color: #0a8a4a; }
.ad-tag.idle { background: var(--card2); color: var(--muted); }

.ad-emp-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ad-reset-row { display: flex; align-items: center; gap: 10px; margin: -2px 0 14px; flex-wrap: wrap; }
.ad-reset-row .ghost { border-color: #e7b7ad; color: var(--err); }
.ad-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--card2); }
.ad-emp-name { font-weight: 700; font-size: 16px; }

.ad-instruct textarea {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); resize: vertical;
}
.ad-instruct-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.ad-instruct-row .primary { margin-left: auto; }
.ad-out {
  margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-size: 13px; white-space: pre-wrap; word-break: break-word; background: #f6faf8;
}
.ad-out.ok { border-color: #bfe6cf; }
.ad-out.err { border-color: #e7b7ad; background: #fbeeeb; color: var(--err); }

.ad-activity { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.ad-ev { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.ad-ev-top { display: flex; align-items: center; gap: 8px; }
.ad-ev-badge { font-size: 11px; background: var(--card2); color: var(--muted); border-radius: 999px; padding: 1px 8px; }
.ad-ev-badge.warn { background: #fbf6e3; color: #8a6a1c; }
.ad-ev-time { margin-left: auto; font-size: 12px; }
.ad-ev-text { margin-top: 4px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.ad-ev-src { margin-top: 2px; font-size: 11px; }

.ad-config { display: flex; flex-direction: column; gap: 10px; }
.ad-config label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.ad-config input, .ad-config textarea {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font: inherit; color: var(--text); background: var(--bg); resize: vertical;
}
.ad-tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 6px; }
.ad-tool { flex-direction: row !important; align-items: center; gap: 6px; color: var(--text) !important; font-size: 13px; }
.ad-tool input { width: auto !important; }
.ad-config-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.ad-config-row .primary { margin-left: auto; }
.ad-config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ad-subhead { margin: 18px 0 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.ad-save-row { margin-top: 16px; }

.ad-directives { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.ad-directive { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--card); }
.ad-directive-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.ad-dir-title { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; color: var(--text); background: var(--bg); }
.ad-dir-del { flex: 0 0 auto; padding: 4px 10px; }
.ad-dir-body { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; color: var(--text); background: var(--bg); resize: vertical; }
/* talk-script / template rows (listRow): title fills the head, body is full-width like 経歴 */
.li-title { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; color: var(--text); background: var(--bg); }
.li-body { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; color: var(--text); background: var(--bg); resize: vertical; }

/* brand */
.ad-brand { display: flex; align-items: center; gap: 12px; }
.ad-brand-logo { height: 44px; width: auto; }

/* 連絡先 (contacts) */
.ad-contacts-body { display: block !important; }
.ad-contacts { display: flex; flex-direction: column; gap: 10px; }
.ad-contact { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--card); }
.ad-contact-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ad-c-name { flex: 1; min-width: 160px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; color: var(--text); background: var(--bg); }
.ad-c-id { font-size: 12px; }
.ad-c-emps { margin: 4px 0 6px; }
.ad-c-rules { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; color: var(--text); background: var(--bg); resize: vertical; }
.ad-c-msg { font-size: 12px; }

/* 職務 (duties) */
.ad-duties { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.ad-duty { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--card); display: flex; flex-direction: column; gap: 6px; }
.ad-duty-title, .ad-duty-instr, .ad-duty-sched, .ad-duty-trigger {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; color: var(--text); background: var(--bg); }
.ad-duty-instr { resize: vertical; }
.ad-duty-trig { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ad-duty-sched { flex: 1; min-width: 140px; }
.ad-duty-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ad-duty-act .primary, .ad-duty-act .ghost { padding: 5px 12px; font-size: 13px; }
.ad-duty-msg { font-size: 12px; }
.ad-duty-runs { display: flex; flex-direction: column; gap: 3px; }
.ad-run { font-size: 12px; color: var(--muted); }
.ad-run.err { color: var(--err); }

/* 道具箱 */
.ad-toolbox { margin-bottom: 16px; }
.ad-toolbox > summary { cursor: pointer; font-weight: 700; }
.ad-tb-body { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.ad-conn-list { display: flex; flex-direction: column; gap: 8px; }
.ad-conn { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.ad-conn-act { display: flex; gap: 6px; flex: 0 0 auto; }
.ad-conn-act .ghost { padding: 4px 10px; font-size: 12px; }
.ad-conn-add h4 { margin: 0 0 8px; }
.ad-conn-fields { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.ad-conn-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.ad-conn-fields input, .ad-conn-add select, #connName {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit;
  color: var(--text); background: var(--bg); width: 100%; box-sizing: border-box; }
.ad-mini { font-size: 12px; margin: 8px 0 2px; }

@media (max-width: 640px) { .ad-list { max-width: none; } .ad-tools-grid, .ad-config-grid, .ad-tb-body { grid-template-columns: 1fr; } }

/* ===================== OA-style layout (v2) ===================== */
body.oa { margin: 0; background: #f7faf8; color: var(--text); }
.oa-gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.oa-gate .card { width: 340px; text-align: center; }
.oa-gate-logo { height: 48px; margin-bottom: 12px; }

.oa-top { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; padding: 0 18px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.oa-top-left { display: flex; align-items: center; gap: 16px; }
.oa-top-logo { height: 48px; width: auto; }
.oa-avatar-sm { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: var(--card2); }
.oa-switch { position: relative; display: flex; align-items: center; gap: 8px; }
.oa-switch-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; font: inherit; color: var(--text); padding: 4px 6px; border-radius: 8px; }
.oa-switch-btn:hover { background: var(--card2); }
.oa-caret { color: var(--muted); font-size: 12px; }
.oa-oaid { font-size: 12px; }
.oa-menu { position: absolute; top: 44px; left: 0; width: 240px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 28px rgba(20,40,30,.14); padding: 8px; z-index: 60; }
.oa-menu-h { font-size: 12px; color: var(--muted); padding: 6px 8px; }
.oa-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0;
  cursor: pointer; font: inherit; color: var(--text); padding: 8px; border-radius: 8px; }
.oa-menu-item:hover { background: var(--card2); }
.oa-menu-item.active { background: #e3f6ea; }
.oa-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: auto; }
.oa-menu-all { display: flex; justify-content: space-between; width: 100%; background: none; border: 0; border-top: 1px solid var(--line);
  cursor: pointer; font: inherit; color: var(--accent); padding: 10px 8px 4px; margin-top: 4px; }

.oa-tabs { display: flex; gap: 4px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 18px; }
.oa-tabs a { padding: 12px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-size: 14px; }
.oa-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

.oa-body { display: flex; align-items: flex-start; min-height: calc(100vh - 64px); }
.oa-side { width: 220px; flex: 0 0 220px; background: #fff; border-right: 1px solid var(--line); padding: 14px 8px; min-height: calc(100vh - 64px); }
.oa-nav-group { font-size: 12px; color: var(--muted); padding: 12px 12px 4px; }
.oa-side-item { display: block; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 14px; text-decoration: none; }
.oa-side-item:hover { background: var(--card2); }
.oa-side-item.active { background: #e3f6ea; color: #0a8a4a; font-weight: 700; }
.oa-main { flex: 1; padding: 22px 28px; max-width: 920px; }
.oa-main h1 { margin: 0 0 16px; }
.oa-panel { }
.oa-soon { color: var(--muted); }

/* account list */
.al-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.al-head input { width: 240px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--bg); color: var(--text); }
.al-table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.al-row { display: grid; grid-template-columns: 2fr 120px 100px 80px; gap: 10px; align-items: center; width: 100%;
  text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; font: inherit; color: var(--text); padding: 12px 14px; }
.al-row:last-child { border-bottom: 0; }
.al-row:hover { background: #f6faf8; }
.al-th { background: #eef4f0; color: var(--muted); font-size: 13px; cursor: default; }
.al-th:hover { background: #eef4f0; }
.al-name { display: flex; align-items: center; gap: 8px; }
.al-empty { padding: 20px; }

.ad-reset-btn { margin-left: auto; border-color: #e7b7ad; color: var(--err); }

/* 記憶リセット（2段階確認・活動記録内） */
.ad-reset-zone { margin-top: 22px; padding-top: 8px; }
.ad-reset-btn { border-color: #e7b7ad; color: var(--err); }
.ad-reset-warn { border: 1px solid #e7b7ad; background: #fbeeeb; color: var(--err); border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 13px; }
.ad-reset-go { background: var(--err); }

/* 連絡先テーブル (LINE-OA風) */
.ct-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.ct-toolbar select, .ct-toolbar input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--bg); color: var(--text); }
.ct-row { display: grid; grid-template-columns: 1.6fr 1.6fr 1fr 70px 90px 130px; gap: 10px; align-items: center;
  border-bottom: 1px solid var(--line); padding: 10px 12px; font-size: 13px; }
.ct-row:last-child { border-bottom: 0; }
.ct-th { background: #eef4f0; color: var(--muted); font-weight: 700; }
.ct-tags-cell { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ct-tag { display: inline-flex; align-items: center; gap: 4px; background: #e3f6ea; color: #0a8a4a; border-radius: 999px; padding: 2px 8px; font-size: 12px; }
.ct-tag button { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; font-size: 12px; }
.ct-addtag { background: none; border: 1px dashed var(--line); border-radius: 999px; padding: 2px 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.ct-perm details summary { cursor: pointer; color: var(--accent); }
.ct-perm-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.ct-perm-item { font-size: 12px; color: var(--text); display: flex; align-items: center; gap: 6px; }
.ct-ops { display: flex; gap: 6px; }
.ct-ops .ghost, .ct-ops a { padding: 4px 10px; font-size: 12px; text-decoration: none; }
.ct-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ctd-tagadd { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font: inherit; background: var(--bg); color: var(--text); min-width: 140px; }

/* 連絡先一覧のチャットボタン（LINE-OA風 緑） */
.ct-chat { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; font-size: 12px;
  border: 1px solid #06c755; color: #06c755; background: #fff; border-radius: 6px; text-decoration: none; white-space: nowrap; }
.ct-chat:hover { background: #06c755; color: #fff; }

/* ログイン / 設定メニュー / モーダル */
.oa-gate-title { margin: 6px 0 10px; }
.oa-gate .gate-msg { min-height: 1.2em; color: var(--err); }
.oa-gate .gate-alt { margin-top: 12px; font-size: 13px; }
.oa-gate #tokenBox { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 10px; }

.oa-settings { position: relative; }
.oa-menu-right { left: auto; right: 0; }

.oa-modal { position: fixed; inset: 0; background: rgba(20,30,25,.42); display: flex; align-items: center; justify-content: center; z-index: 100; }
.oa-modal-card { background: #fff; border-radius: 14px; padding: 20px; width: 380px; max-width: calc(100vw - 32px); box-shadow: 0 16px 48px rgba(20,40,30,.22); }
.oa-modal-card h3 { margin: 0 0 10px; }
.oa-modal-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.oa-modal-card input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--bg); color: var(--text); }
