/* ===== Variables ===== */
:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-hover: #F1F5F9;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-muted: #64748B;
  --accent: #6366F1;
  --connector: #CBD5E1;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Sarabun', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== Header ===== */
.site-header {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: #0F172A;
  white-space: nowrap;
}

.site-header h1 {
  flex: 1;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 13px;
}

.btn-meeting {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-family: 'Sarabun', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(99,102,241,0.4);
}

.btn-meeting:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99,102,241,0.6);
}

.btn-meeting:active { transform: translateY(0); }

/* ===== Org Tree ===== */
#org-tree {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* ===== Level Rows ===== */
.tree-level {
  display: flex;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

/* ===== Connector Lines ===== */
.connector-v {
  width: 2px;
  height: 40px;
  background: var(--connector);
  margin: 0 auto;
}

.connector-h-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.connector-h-line {
  height: 2px;
  background: var(--connector);
  width: 75%;
  max-width: 700px;
}

.connector-branches {
  display: flex;
  justify-content: space-around;
  width: 75%;
  max-width: 700px;
}

.connector-branch {
  width: 2px;
  height: 30px;
  background: var(--connector);
}

/* ===== Agent Card ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 180px;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-color, var(--accent));
  opacity: 0.8;
}

.card-agent {
  cursor: pointer;
}

.card-agent:hover {
  background: var(--surface-hover);
  border-color: var(--card-color, var(--accent));
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card-ceo {
  width: 200px;
  background: linear-gradient(135deg, #EEF2FF, #F8FAFC);
}

/* ===== Avatar ===== */
.avatar-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.avatar-wrap svg {
  width: 100%;
  height: 100%;
}

.card-ceo .avatar-wrap {
  width: 90px;
  height: 90px;
}

/* ===== Card Info ===== */
.card-name {
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  color: var(--text);
}

.card-role {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

.card-ceo .card-name { font-size: 18px; }

/* ===== Specialty Tags ===== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ===== Chat Button ===== */
.btn-chat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--card-color, var(--accent));
  border: 1px solid var(--card-color, var(--accent));
  border-radius: 8px;
  padding: 6px 14px;
  font-family: 'Sarabun', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  justify-content: center;
}

.btn-chat:hover {
  background: var(--card-color, var(--accent));
  color: white;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #FFFFFF;
  border: 1px solid #6366F1;
  color: #0F172A;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 999;
  max-width: 420px;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .tree-level { flex-wrap: wrap; }
  .card { width: 150px; }
  .connector-h-line,
  .connector-branches { width: 90%; }
  .header-inner h1 { display: none; }
}

@media (max-width: 500px) {
  .card { width: 130px; padding: 14px; }
  .avatar-wrap { width: 64px; height: 64px; }
  .card-name { font-size: 14px; }
}
