/* Vietfarm Connect. Bố cục: thanh trên, thanh mục bên trái, ba cột: danh sách khách · tin thật với khách · Sếp và Bé. */
:root {
  --bg: #eef4ef; --surface: #ffffff; --sunk: #e2ebe4; --soft: #f0f4f1;
  --ink: #17251c; --muted: #56675b; --line: #cddacf;
  --accent: #1f6b45; --accent-soft: #d9eede; --accent-line: #b9d9c4;
  --gold: #8a5506; --gold-soft: #fbf0d9; --gold-line: #a8690c;
  --danger: #8f1d17; --danger-soft: #fbe9e7;
  --font: "Be Vietnam Pro", Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.6; }
:focus-visible { outline: 3px solid var(--gold-line); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.boot { padding: 48px 20px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Nút */
.btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #ffffff; }
.btn.block { width: 100%; }
.btn.quiet { font-weight: 500; }

/* Cửa vào: đặt mật khẩu lần đầu, đăng nhập */
.door { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.door-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.brand { font-weight: 600; font-size: 20px; color: var(--accent); }
.door-card h1 { font-size: 22px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 14px; font-weight: 600; }
.field input { height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.error { padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.error:empty { display: none; }

/* Khung ứng dụng */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.bell { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--gold-line); background: var(--gold-soft); color: var(--gold); font-size: 14px; font-weight: 600; }
.shell { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; padding: 14px 20px 24px; max-width: 1480px; margin: 0 auto; }
.nav { flex: 1 1 150px; display: flex; flex-direction: column; gap: 4px; }
.nav button { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 44px; padding: 4px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; font-weight: 600; }
.nav button[aria-current="page"] { background: var(--accent); color: #ffffff; }
.nav button .small { font-weight: 400; }
.cols { flex: 999 1 560px; min-width: 0; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; }
.col { min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.col-list { flex: 0.6 1 270px; }
.col-thread { flex: 3 1 420px; }
.col-be { flex: 1 1 300px; }
.col h2 { font-size: 16px; font-weight: 600; }

/* Cột 1: danh sách khách */
.lanes { display: flex; flex-wrap: wrap; gap: 6px; }
.lane { min-height: 40px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; }
.lane[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #ffffff; }
.cards { display: flex; flex-direction: column; gap: 8px; }
.card { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); text-align: left; }
.card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.card .row { display: flex; align-items: center; gap: 8px; }
.card .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .time { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.card .preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; }
.cc { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 20px; padding: 0 5px; border-radius: 5px; background: var(--ink); color: #ffffff; font-size: 11px; font-weight: 600; }
.chip { align-self: flex-start; padding: 1px 8px; border-radius: 10px; background: var(--gold-soft); color: var(--gold); font-size: 12px; font-weight: 600; }
.empty { padding: 14px; border-radius: 10px; background: var(--soft); color: var(--muted); font-size: 14px; }

/* Cột 2: tin thật với khách */
.thread-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.thread-head h2 { font-size: 17px; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.steps li { padding: 3px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; }
.steps li.done { border-color: var(--accent-soft); background: var(--accent-soft); color: var(--ink); }
.steps li.now { border-color: var(--accent); background: var(--accent); color: #ffffff; }
.msgs { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 12px; border-radius: 10px; background: var(--bg); }
.msg { max-width: 86%; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px; overflow-wrap: anywhere; }
.msg.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.msg.out { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.msg .head { font-size: 12px; font-weight: 600; color: var(--muted); }
.msg.out .head { color: var(--accent); }
.msg .body { white-space: pre-wrap; }
.msg .vi { padding-top: 4px; border-top: 1px dashed var(--line); font-size: 14px; color: var(--muted); white-space: pre-wrap; }
.msg .tag { align-self: flex-start; padding: 1px 8px; border-radius: 6px; background: var(--surface); font-size: 12px; font-weight: 600; }
.sys { align-self: center; max-width: 92%; text-align: center; font-size: 12px; color: var(--muted); }
.composer { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; border: 2px solid var(--accent); }
.composer h3 { font-size: 15px; font-weight: 600; }

/* Cột 3: Sếp và Bé, tình trạng hệ thống */
.parts { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.parts li { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--soft); font-size: 14px; }
.parts .state { flex: 0 0 auto; padding: 0 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--sunk); color: var(--ink); }
.parts li.on .state { background: var(--accent); color: #ffffff; }
.parts .label { font-weight: 600; }
.parts .note { margin-left: auto; text-align: right; color: var(--muted); font-size: 13px; }
.be-box { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 10px; background: var(--gold-soft); }
.be-box h3 { font-size: 15px; font-weight: 600; }

@media (max-width: 720px) {
  .top, .shell { padding-left: 12px; padding-right: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav button { flex: 1 1 auto; }
  .nav button .small { display: none; }
  .msgs { max-height: none; }
}
