:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: #1f2925;
  background: #f2f5ef;
  --ink: #1f2925;
  --muted: #68736e;
  --line: #dfe5dc;
  --paper: #fffef9;
  --green: #245b45;
  --green-soft: #e1eee6;
  --ochre: #b87535;
  --danger: #a5483f;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; padding: 28px; }
.loading-card, .login-card {
  max-width: 460px; margin: 12vh auto; background: var(--paper);
  border: 1px solid var(--line); border-radius: 24px; padding: 32px;
  box-shadow: 0 20px 60px rgba(35, 58, 46, .09);
}

.login-zalo {
  display: block;
  margin: 24px 0;
  text-align: center;
  text-decoration: none;
}
.eyebrow { color: var(--ochre); letter-spacing: .12em; text-transform: uppercase; font-size: 12px; font-weight: 750; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: Georgia, serif; font-size: clamp(32px, 5vw, 54px); line-height: 1; margin-bottom: 14px; }
.muted { color: var(--muted); }
.login-list { display: grid; gap: 10px; margin-top: 26px; }
.login-user { border: 1px solid var(--line); background: white; border-radius: 14px; padding: 14px 16px; text-align: left; }
.login-user:hover { border-color: var(--green); background: var(--green-soft); }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--green); color: white; font-family: Georgia, serif; font-size: 24px; }
.brand strong, .brand span { display: block; }
.brand span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.select, .search { border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 10px 12px; color: var(--ink); }
.ghost { border: 1px solid var(--line); background: transparent; border-radius: 12px; padding: 10px 14px; }

.hero { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 24px; }
.hero h1 { margin-bottom: 8px; }
.account-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.account-tab { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 9px 14px; }
.account-tab.active { background: var(--green); border-color: var(--green); color: white; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; font-family: Georgia, serif; font-size: 30px; margin-top: 8px; }

.content-grid { display: grid; grid-template-columns: minmax(420px, .9fr) minmax(420px, 1.1fr); gap: 18px; min-height: 580px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.panel-header { padding: 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-header h2 { font-size: 17px; margin: 0; }
.policy-editor { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.policy-editor label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.policy-editor .check { display: flex; align-items: center; min-height: 41px; color: var(--ink); }
.primary { border: 1px solid var(--green); background: var(--green); color: white; border-radius: 12px; padding: 10px 14px; }
.primary:hover { filter: brightness(1.08); }
.notice { color: var(--green); font-size: 12px; font-weight: 700; align-self: center; }
.conversation-list { max-height: 680px; overflow: auto; }
.conversation { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 8px; border: 0; border-bottom: 1px solid var(--line); padding: 15px 18px; background: transparent; text-align: left; }
.conversation:hover, .conversation.active { background: #f1f6f1; }
.conversation-name { font-weight: 680; }
.conversation-meta { color: var(--muted); font-size: 12px; margin-top: 5px; }
.pill { align-self: start; border-radius: 999px; padding: 4px 8px; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 750; letter-spacing: .04em; }
.pill.excluded { background: #f5e4e1; color: var(--danger); }
.message-list { padding: 18px; max-height: 680px; overflow: auto; display: flex; flex-direction: column-reverse; gap: 10px; }
.message { max-width: 78%; padding: 11px 13px; border-radius: 15px 15px 15px 4px; background: #edf1ea; align-self: flex-start; }
.message.out { align-self: flex-end; background: var(--green); color: white; border-radius: 15px 15px 4px 15px; }
.sender { font-size: 11px; font-weight: 750; opacity: .72; margin-bottom: 5px; }
.message-content { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.empty { padding: 60px 24px; text-align: center; color: var(--muted); }
.error { color: var(--danger); }

@media (max-width: 900px) {
  .app-shell { padding: 16px; }
  .topbar, .hero { align-items: flex-start; flex-direction: column; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
}
