/* SellerClub AI — console styles. Brand: blue #3BA3E8 · amber #F5B82E · orange #E8832A · charcoal #3F3F3F */
:root {
  --blue: #3BA3E8; --blue-dark: #2A86C4; --blue-soft: #EAF5FD;
  --amber: #F5B82E; --orange: #E8832A; --orange-soft: #FDF1E6;
  --ink: #3F3F3F; --ink-2: #6B6F76; --ink-3: #9AA0A6;
  --line: #E6E9ED; --bg: #F6F8FA; --card: #FFFFFF;
  --green: #2E9E6B; --green-soft: #E7F6EE; --red: #D64545; --red-soft: #FCEBEB;
  --radius: 12px; --font: "Nunito", -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--blue-dark); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 800; margin: 0 0 14px; }
h3 { font-size: 14px; font-weight: 700; margin: 18px 0 8px; color: var(--ink-2); }
code { background: #F0F2F5; padding: 2px 6px; border-radius: 6px; font-size: 13px; }
code.block { display: block; padding: 8px 10px; margin: 6px 0; word-break: break-all; }
pre.snippet { background: #2B2F36; color: #E8ECF1; padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; font-size: 13px; }
pre.error-detail { background: var(--red-soft); color: var(--red); padding: 12px; border-radius: 8px; white-space: pre-wrap; font-size: 13px; }
.muted { color: var(--ink-2); } .small { font-size: 13px; } .center { text-align: center; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; } .inline { display: inline; } .err-text { color: var(--red); }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 236px; flex: 0 0 236px; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.side-logo img { height: 30px; display: block; margin: 4px 8px 10px; }
.side-tenant { font-weight: 700; font-size: 13px; color: var(--ink-2); padding: 0 8px 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--ink); font-weight: 600; }
.side-nav a:hover { background: var(--bg); text-decoration: none; }
.side-nav a.active { background: var(--blue-soft); color: var(--blue-dark); }
.side-nav .ic { width: 18px; text-align: center; opacity: .7; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.side-user { display: flex; gap: 10px; align-items: center; padding: 4px 6px 8px; }
.side-user .name { font-weight: 700; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--amber); color: #fff; font-weight: 800; display: grid; place-items: center; }
.main { flex: 1; padding: 28px 32px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; }

/* ---------- cards / forms ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }
label { display: block; font-weight: 700; font-size: 13px; margin: 14px 0 6px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,163,232,.18); }
input[type=color] { width: 60px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
input:disabled, select:disabled { background: var(--bg); color: var(--ink-2); }
textarea { resize: vertical; }
.hint { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.actions { margin-top: 18px; }
.btn { display: inline-block; font: inherit; font-weight: 700; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.block { display: block; width: 100%; margin-top: 18px; text-align: center; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--blue-dark); font: inherit; font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-form input, .row-form select { width: auto; flex: 1; min-width: 160px; }
.flash { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; font-weight: 600; }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.err { background: var(--red-soft); color: var(--red); }
.empty { text-align: center; padding: 32px; color: var(--ink-2); }
.empty.tall { height: 100%; display: grid; place-items: center; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td input, .table td select { padding: 6px 8px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #EEF0F3; color: var(--ink-2); }
.pill.connected, .pill.human { background: var(--green-soft); color: var(--green); }
.pill.pending, .pill.waiting_human { background: var(--orange-soft); color: var(--orange); }
.pill.error, .pill.disabled { background: var(--red-soft); color: var(--red); }
.pill.ai { background: var(--blue-soft); color: var(--blue-dark); }
.pill.lang { background: #FFF6DF; color: #9A6B00; text-transform: uppercase; }
.steps { padding-left: 20px; } .steps li { margin-bottom: 10px; }
.guide { background: #FFFBF1; border-color: #F5E4B8; }
ul.plain { list-style: none; padding: 0; } ul.plain li { padding: 6px 0; }
.kb-list { list-style: none; padding: 0; margin: 0; }
.kb-list li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { background: var(--blue-soft); color: var(--blue-dark); padding: 5px 10px; border-radius: 999px; font-weight: 700; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.chip .x { background: none; border: 0; cursor: pointer; color: var(--blue-dark); font-size: 15px; padding: 0 2px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; color: var(--ink); }
a.stat:hover { border-color: var(--blue); text-decoration: none; }
.stat-num { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.stat-num .unit { font-size: 18px; color: var(--ink-3); }
.stat-label { font-size: 13px; color: var(--ink-2); margin-top: 8px; font-weight: 600; }
.stat.waiting { border-left: 4px solid var(--orange); }
.stat.waiting .stat-num { color: var(--orange); }

/* ---------- auth ---------- */
.auth-body { background: linear-gradient(180deg, #F3F9FE 0%, #F6F8FA 60%); }
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 60px 20px; }
.auth-logo img { height: 36px; display: block; margin: 0 auto 28px; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px 32px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-foot { text-align: center; color: var(--ink-3); font-size: 13px; margin-top: 24px; }
.or { text-align: center; color: var(--ink-3); margin: 16px 0 0; font-size: 13px; }
.code-input { font-size: 30px; letter-spacing: .5em; text-align: center; font-weight: 800; }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 320px 1fr 300px; height: calc(100vh - 56px); margin: -28px -32px; border-top: 1px solid var(--line); background: #fff; }
.inbox-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.inbox-filters { display: flex; gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); }
.inbox-filters select { padding: 7px 8px; font-size: 13px; }
.conv-list { overflow-y: auto; flex: 1; }
.conv { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.conv.st-ai { background: #F3F4F6; }
.conv.st-waiting { background: var(--red-soft); }
.conv.st-unread { background: var(--orange-soft); }
.conv.st-idle { background: var(--blue-soft); }
.conv.st-open { background: var(--green-soft); }
.conv.st-closed { background: #fff; opacity: .65; }
.conv:hover { filter: brightness(.97); }
.conv.active { box-shadow: inset 3px 0 0 var(--blue); }
.conv .who { font-weight: 800; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.conv .when { font-size: 12px; color: var(--ink-3); }
.conv .last { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); display: inline-block; }
.conv .meta { grid-column: 1 / -1; display: flex; gap: 6px; }
.inbox-chat { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; background: #fff; border-bottom: 1px solid var(--line); }
.chat-title { font-weight: 800; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.chat-actions { display: flex; gap: 6px; } .chat-actions .btn { padding: 6px 12px; font-size: 13px; }
.summary { background: #FFF6DF; color: #6E4D00; font-size: 13px; padding: 10px 18px; border-bottom: 1px solid #F5E4B8; }
.summary strong { color: #9A6B00; }
.messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 72%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45; position: relative; }
.msg.customer { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.ai { align-self: flex-end; background: var(--blue-soft); border-bottom-right-radius: 4px; }
.msg.agent { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.msg.system { align-self: center; background: transparent; color: var(--ink-3); font-size: 12px; max-width: 90%; text-align: center; }
.msg .orig { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(0,0,0,.15); font-size: 12px; opacity: .75; }
.msg.agent .orig { border-top-color: rgba(255,255,255,.4); }
.msg .tag { font-size: 11px; opacity: .65; margin-top: 4px; display: block; }
.msg-products { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.msg-products .mp { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 13px; color: var(--ink); text-decoration: none; }
.msg-products .mp:hover { border-color: var(--blue); }
.msg-products .mp img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; }
.composer { background: #fff; border-top: 1px solid var(--line); padding: 12px 18px; }
.composer textarea { border-radius: 10px; }
.composer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.policy-warn { background: var(--red-soft); color: var(--red); padding: 10px 18px; font-size: 13px; font-weight: 600; }
.policy-warn .btn { margin-left: 10px; padding: 4px 10px; font-size: 12px; }
.inbox-side { border-left: 1px solid var(--line); padding: 16px; overflow-y: auto; font-size: 14px; }
.inbox-side h3 { margin-top: 6px; }
.side-block { background: var(--bg); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.side-block dl { margin: 0; } .side-block dt { font-size: 11px; color: var(--ink-3); font-weight: 700; margin-top: 8px; } .side-block dd { margin: 0; }
@media (max-width: 1100px) { .inbox { grid-template-columns: 280px 1fr; } .inbox-side { display: none; } }
@media (max-width: 800px) { .shell { flex-direction: column; } .side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; } .side-nav { display: flex; gap: 4px; } .side-foot { margin: 0 0 0 auto; border: 0; } .main { padding: 16px; } .inbox { margin: -16px; grid-template-columns: 1fr; height: auto; } }
