:root { --green: #06c755; --bg: #f0f2f5; --sidebar: #1f2933; --text: #333; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "Hiragino Sans", "Meiryo", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

#login { display: flex; align-items: center; justify-content: center; height: 100vh; }
#login .card { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.1); width: 320px; text-align: center; }
#login h1 { color: var(--green); font-size: 1.4rem; }

#app { display: none; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 200px; background: var(--sidebar); color: #cbd2d9; flex-shrink: 0; }
.sidebar .logo { padding: 18px 16px; font-weight: bold; color: #fff; font-size: 1.05rem; border-bottom: 1px solid #333f4c; }
.sidebar .logo span { color: var(--green); }
.sidebar a { display: block; padding: 11px 16px; color: inherit; text-decoration: none; }
.sidebar a:hover { background: #323f4b; }
.sidebar a.active { background: var(--green); color: #fff; }
.main { flex: 1; padding: 24px; max-width: 1100px; }
h2 { margin-top: 0; }

.cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stat { background: #fff; border-radius: 10px; padding: 16px 24px; min-width: 140px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.stat .num { font-size: 1.8rem; font-weight: bold; color: var(--green); }
.stat .lbl { color: #777; font-size: .85rem; }

.panel { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eee; vertical-align: middle; }
th { color: #777; font-weight: normal; font-size: .85rem; }
tr:hover td { background: #fafcfa; }

button, .btn { background: var(--green); color: #fff; border: none; border-radius: 6px; padding: 8px 14px; cursor: pointer; font-size: .9rem; }
button.sec { background: #e4e7eb; color: #333; }
button.danger { background: #e02424; }
button.small { padding: 4px 10px; font-size: .8rem; }
button:disabled { opacity: .5; cursor: default; }

input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=time], select, textarea {
  padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: .9rem; font-family: inherit;
}
textarea { width: 100%; min-height: 70px; }
label.f { display: block; margin: 10px 0 4px; font-weight: bold; font-size: .85rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tag-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; color: #fff; font-size: .78rem; margin: 1px; }
.muted { color: #999; font-size: .85rem; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bars .bar { flex: 1; background: var(--green); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars .bar:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 2px 6px; border-radius: 4px; white-space: nowrap; font-size: .75rem; }

.chat { display: flex; gap: 16px; height: calc(100vh - 50px); }
.chat .list { width: 260px; background: #fff; border-radius: 10px; overflow-y: auto; flex-shrink: 0; }
.chat .list .item { padding: 12px; border-bottom: 1px solid #eee; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.chat .list .item.active { background: #e6f9ee; }
.chat .list img, .avatar { width: 36px; height: 36px; border-radius: 50%; background: #ddd; object-fit: cover; }
.chat .win { flex: 1; background: #fff; border-radius: 10px; display: flex; flex-direction: column; overflow: hidden; }
.chat .win .whead { padding: 10px 14px; border-bottom: 1px solid #eee; font-weight: bold; display: flex; gap: 10px; align-items: center; background: #fff; }
.chat .msgs { flex: 1; overflow-y: auto; padding: 16px; background: #7494c0; }
.msg-row { display: flex; align-items: flex-end; gap: 6px; margin-bottom: 10px; }
.msg-row.out { flex-direction: row-reverse; }
.bubble { max-width: 62%; padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; font-size: .92rem; line-height: 1.5; }
.bubble.in { background: #fff; border-top-left-radius: 4px; }
.bubble.out { background: #8de055; color: #111; border-top-right-radius: 4px; }
.msg-time { font-size: .68rem; color: #e8eef7; flex-shrink: 0; text-align: right; }
.msg-time .src { display: block; opacity: .8; }
.date-pill { text-align: center; margin: 12px 0; }
.date-pill span { background: rgba(0,0,0,.25); color: #fff; border-radius: 999px; padding: 3px 12px; font-size: .75rem; }
.chat .side { width: 280px; background: #fff; border-radius: 10px; padding: 14px; overflow-y: auto; flex-shrink: 0; }
.chat .side h4 { margin: 14px 0 6px; font-size: .85rem; color: #555; border-bottom: 1px solid #eee; padding-bottom: 4px; }
.chat .side h4:first-child { margin-top: 0; }
.resp-box { background: #f7f9f8; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: .85rem; }
.resp-box .qa { margin: 2px 0; }
.resp-box .q { color: #777; }
.chat .input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #eee; }
.chat .input textarea { flex: 1; min-height: 44px; }
.unread-badge { background: #e02424; color: #fff; border-radius: 999px; padding: 1px 7px; font-size: .72rem; }

.step-box { border: 1px solid #ddd; border-radius: 8px; padding: 14px; margin-bottom: 12px; background: #fafafa; }
.step-box .head { font-weight: bold; margin-bottom: 8px; display: flex; justify-content: space-between; }
.msg-item { display: flex; gap: 8px; margin-bottom: 6px; align-items: flex-start; }
.msg-item textarea { flex: 1; min-height: 44px; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 10; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 860px; max-width: 100%; }
.modal h3 { margin-top: 0; }

.toast { position: fixed; bottom: 24px; right: 24px; background: #333; color: #fff; padding: 12px 20px; border-radius: 8px; z-index: 20; }
