/* LINE AI BOT 管理画面スタイル */
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", "Hiragino Sans", "Meiryo", sans-serif; background: #f4f6f8; color: #222; font-size: 14px; }
.wrap { display: flex; min-height: 100vh; }

/* サイドバー */
.sidebar { width: 230px; background: #1f2937; color: #e5e7eb; padding: 16px 0; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { font-size: 16px; font-weight: bold; padding: 0 16px 16px; color: #fff; }
.navlink { display: block; padding: 9px 16px; color: #d1d5db; text-decoration: none; }
.navlink:hover { background: #374151; color: #fff; }
.navlink.active { background: #2563eb; color: #fff; }
.navlink.small { font-size: 13px; padding: 7px 16px 7px 24px; }
.acct-head { margin: 16px 12px 4px; padding: 8px 10px; background: #111827; border-radius: 8px; color: #fff; font-weight: bold; font-size: 13px; }
.acct-list-label { margin: 18px 16px 4px; font-size: 11px; color: #9ca3af; }
.tag { font-size: 10px; border-radius: 4px; padding: 2px 6px; margin-left: 6px; font-weight: normal; }
.tag-test { background: #f59e0b; color: #fff; }
.tag-live { background: #10b981; color: #fff; }

/* メイン */
.main { flex: 1; padding: 28px 32px; max-width: 1000px; }
h1 { font-size: 20px; margin: 0 0 6px; }
h2 { font-size: 16px; margin: 28px 0 10px; }
.desc { color: #6b7280; margin: 0 0 18px; }
.flash { background: #d1fae5; border: 1px solid #10b981; color: #065f46; padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; }

/* カード */
.card { background: #fff; border-radius: 12px; padding: 20px 24px; box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 20px; }
.card h2:first-child { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* KPI */
.kpis { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; }
.kpi { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 16px; min-width: 110px; }
.kpi .num { font-size: 22px; font-weight: bold; }
.kpi .label { font-size: 11px; color: #6b7280; }

/* フォーム */
label { display: block; font-weight: bold; margin: 14px 0 4px; font-size: 13px; }
label .hint { font-weight: normal; color: #6b7280; font-size: 12px; margin-left: 6px; }
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 20px; }

/* ボタン */
.btn { display: inline-block; background: #2563eb; color: #fff; border: none; border-radius: 8px; padding: 10px 22px; font-size: 14px; cursor: pointer; text-decoration: none; margin-top: 16px; }
.btn:hover { background: #1d4ed8; }
.btn-sm { padding: 5px 12px; font-size: 12px; margin: 0; border-radius: 6px; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-gray { background: #6b7280; }
.btn-gray:hover { background: #4b5563; }

/* テーブル */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
th { font-size: 12px; color: #6b7280; background: #f9fafb; }
.status-active { color: #059669; font-weight: bold; }
.status-stopped, .status-auto_stopped { color: #d97706; font-weight: bold; }
.status-blocked_by_user { color: #dc2626; font-weight: bold; }

/* 会話ログ */
.chatlog { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 75%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.bubble.user { background: #e5e7eb; align-self: flex-start; }
.bubble.assistant { background: #bbf7d0; align-self: flex-end; }
.bubble.system { background: #fef3c7; align-self: center; font-size: 12px; }
.bubble .meta { font-size: 10px; color: #6b7280; margin-top: 4px; }

.warn { background: #fef3c7; border: 1px solid #f59e0b; color: #92400e; padding: 10px 14px; border-radius: 8px; margin: 10px 0; }

/* 絵文字パレット */
.emoji-btn { margin-top: 4px; }
.emoji-palette { background: #fff; border: 1px solid #d1d5db; border-radius: 10px; padding: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15); display: grid; grid-template-columns: repeat(10, 1fr);
  gap: 2px; max-width: 380px; margin-top: 4px; }
.emoji-item { background: none; border: none; font-size: 20px; padding: 4px; cursor: pointer; border-radius: 6px; }
.emoji-item:hover { background: #eef2ff; }
.code { background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px 10px; font-family: Consolas, monospace; font-size: 13px; word-break: break-all; }
.muted { color: #6b7280; font-size: 12px; }
