:root {
  /* JIANCHA Brand Colors */
  --brand-black: #181818;
  --brand-tan: #AD9C82;
  --brand-gray: #525252;
  --brand-cream: #EBE9E6;
  --brand-white: #FFFFFF;

  /* Derived */
  --bg: #EBE9E6;
  --bg-soft: #f4f2ee;
  --card: #FFFFFF;
  --border: #d8d3ca;
  --border-soft: #e7e2d9;
  --text: #181818;
  --text-2: #2a2a2a;
  --text-muted: #525252;
  --text-dim: #8a8378;
  --accent: #AD9C82;
  --accent-dark: #8c7d66;
  --accent-soft: rgba(173,156,130,0.12);

  /* Status colors — muted to harmonize */
  --green: #4a7c59;
  --green-dark: #3a6448;
  --green-soft: rgba(74,124,89,0.12);
  --orange: #b8814a;
  --orange-dark: #9a6936;
  --orange-soft: rgba(184,129,74,0.12);
  --red: #a23939;
  --red-dark: #832929;
  --red-soft: rgba(162,57,57,0.12);

  --shadow-sm: 0 1px 2px rgba(24,24,24,0.04);
  --shadow-md: 0 4px 12px rgba(24,24,24,0.06);
  --shadow-lg: 0 12px 36px rgba(24,24,24,0.08);
  --shadow-xl: 0 25px 60px rgba(24,24,24,0.18);
}

* { font-family: 'Sarabun', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif; }
html, body { background: var(--bg); color: var(--text); }
body {
  background: var(--bg);
  min-height: 100vh;
}

/* ===== Header ===== */
.executive-header {
  background: var(--brand-black);
  border-bottom: 1px solid var(--brand-black);
  box-shadow: 0 2px 16px rgba(24,24,24,0.12);
  position: sticky;
  top: 0;
  z-index: 40;
}
.executive-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 60%, rgba(173,156,130,0.06));
  pointer-events: none;
}
.executive-header > div { position: relative; z-index: 1; }
.logo-circle {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--brand-tan);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-black); font-weight: 800; font-size: 0.95rem;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 12px rgba(173,156,130,0.3);
  font-family: 'Inter', system-ui;
}
.pulse-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-tan);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(173,156,130,0.6);
  animation: pulse 2s infinite;
}
.pulse-dot.refreshing {
  background: #d4a86a;
  box-shadow: 0 0 0 0 rgba(212,168,106,0.6);
  animation: pulse-amber 1s infinite;
}
.refresh-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(173,156,130,0.25);
  color: var(--brand-tan);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  font-family: 'Inter', system-ui;
}
.refresh-btn:hover { background: var(--brand-tan); color: var(--brand-black); transform: rotate(180deg); transition: transform 0.4s, background 0.15s, color 0.15s; }
.refresh-btn:active { transform: scale(0.95); }
#refreshIcon.spinning { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(173,156,130,0.6); }
  70% { box-shadow: 0 0 0 8px rgba(173,156,130,0); }
  100% { box-shadow: 0 0 0 0 rgba(173,156,130,0); }
}
@keyframes pulse-amber {
  0% { box-shadow: 0 0 0 0 rgba(212,168,106,0.6); }
  70% { box-shadow: 0 0 0 8px rgba(212,168,106,0); }
  100% { box-shadow: 0 0 0 0 rgba(212,168,106,0); }
}

/* ===== Navigation Tabs ===== */
.nav-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  border: 1px solid rgba(173,156,130,0.2);
}
.nav-tab {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(235,233,230,0.65);
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-tab:hover { color: var(--brand-tan); }
.nav-tab.active {
  background: var(--brand-tan);
  color: var(--brand-black);
  box-shadow: 0 2px 6px rgba(173,156,130,0.3);
}

/* ===== Leaderboard with Snippets ===== */
.leaderboard-row.detailed {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  padding: 0.85rem;
  border: 1px solid var(--border-soft);
  margin-bottom: 0.5rem;
  border-radius: 0.7rem;
}
.leaderboard-row.detailed:hover { background: var(--bg-soft); }
.leaderboard-row-head { display: flex; align-items: center; gap: 0.85rem; }
.leaderboard-snippet {
  background: var(--bg-soft);
  border-left: 3px solid var(--border);
  padding: 0.55rem 0.75rem;
  border-radius: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.45;
  margin-left: 40px;
}
.leaderboard-snippet.positive { border-left-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.leaderboard-snippet.negative { border-left-color: var(--red); background: var(--red-soft); color: var(--red-dark); }
.leaderboard-snippet-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  opacity: 0.85;
}
.leaderboard-snippet-stars { letter-spacing: 1px; color: #fbbf24; }
.leaderboard-snippet-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 500;
}

/* ===== User Menu ===== */
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.7rem 0.4rem 0.4rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(173,156,130,0.25);
  border-radius: 999px;
  cursor: pointer;
  color: var(--brand-white);
  transition: all 0.15s;
}
.user-btn:hover { background: rgba(173,156,130,0.15); border-color: var(--brand-tan); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand-tan);
  color: var(--brand-black);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
  font-family: 'Inter', system-ui;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.user-name { font-size: 0.78rem; font-weight: 600; }
.user-role { font-size: 0.65rem; color: var(--brand-tan); opacity: 0.85; margin-top: 1px; }
.user-caret { font-size: 0.65rem; color: var(--brand-tan); margin-left: 0.15rem; }
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--brand-white);
  border-radius: 0.75rem;
  box-shadow: 0 12px 40px rgba(24,24,24,0.18);
  border: 1px solid var(--border);
  padding: 0.4rem;
  z-index: 50;
}
.user-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.85rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 0.45rem;
  text-decoration: none;
  font-family: inherit;
}
.user-dropdown-item:hover { background: var(--bg-soft); }

/* Header text colors override */
.executive-header h1 { color: var(--brand-white); }
.executive-header p { color: var(--brand-tan) !important; opacity: 0.85; }
.executive-header .text-emerald-400 { color: var(--brand-tan) !important; }

/* ===== Hero Banner ===== */
.hero-banner {
  background: var(--brand-black);
  border-radius: 1.25rem;
  padding: 2rem 2.5rem;
  color: var(--brand-white);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -30%; right: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(173,156,130,0.15), transparent 60%);
  pointer-events: none;
}
.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
}
.hero-eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--brand-tan);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.hero-rating-row { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 1rem; }
.hero-rating {
  font-family: 'Inter', system-ui;
  font-size: 4.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--brand-white);
  line-height: 1;
}
.hero-rating-max {
  font-size: 1.4rem;
  color: rgba(235,233,230,0.5);
  font-family: 'Inter', system-ui;
  font-weight: 500;
}
.hero-rating-star {
  font-size: 2rem;
  color: var(--brand-tan);
  filter: drop-shadow(0 2px 8px rgba(173,156,130,0.4));
}
.hero-trend { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.trend-pill {
  display: inline-flex;
  padding: 0.3rem 0.85rem;
  background: rgba(173,156,130,0.15);
  border: 1px solid rgba(173,156,130,0.3);
  color: var(--brand-tan);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.hero-distribution { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.hero-dist-item { display: flex; align-items: center; gap: 0.5rem; }
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot-green  { background: var(--green); }
.dot-orange { background: var(--orange); }
.dot-red    { background: var(--red); }
.dist-num { font-weight: 700; color: var(--brand-white); font-family: 'Inter', system-ui; font-size: 1rem; }
.dist-label { color: rgba(235,233,230,0.65); font-size: 0.8rem; }

/* ===== KPI Cards ===== */
.kpi-card {
  background: var(--card);
  border-radius: 1rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand-tan);
}
.kpi-blue::before    { background: var(--brand-tan); }
.kpi-purple::before  { background: var(--brand-gray); }
.kpi-emerald::before { background: var(--green); }
.kpi-amber::before   { background: var(--orange); }

.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; }
.kpi-icon {
  font-size: 1.1rem;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--bg-soft);
}
.kpi-blue .kpi-icon    { background: var(--accent-soft); }
.kpi-purple .kpi-icon  { background: rgba(82,82,82,0.08); }
.kpi-emerald .kpi-icon { background: var(--green-soft); }
.kpi-amber .kpi-icon   { background: var(--orange-soft); }

.kpi-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 0.15rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-family: 'Inter', system-ui;
}
.kpi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ===== Insight Cards ===== */
.insight-card {
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.insight-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.insight-title { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.insight-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}
.insight-badge-green  { color: var(--green-dark); background: var(--green-soft); }
.insight-badge-orange { color: var(--orange-dark); background: var(--orange-soft); }
.insight-badge-blue   { color: var(--accent-dark); background: var(--accent-soft); }

.leaderboard { padding: 0.5rem; }
.leaderboard-row {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.65rem;
  cursor: pointer;
  transition: background 0.15s;
}
.leaderboard-row:hover { background: var(--bg-soft); }
.leaderboard-rank {
  font-weight: 800;
  font-size: 0.95rem;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-family: 'Inter', system-ui;
  flex-shrink: 0;
}
.rank-1 { background: var(--brand-tan); color: var(--brand-black); box-shadow: 0 2px 8px rgba(173,156,130,0.4); }
.rank-2 { background: var(--brand-gray); color: var(--brand-white); }
.rank-3 { background: var(--brand-black); color: var(--brand-tan); }
.rank-other { background: var(--bg-soft); color: var(--text-muted); }

.leaderboard-name { flex: 1; font-weight: 600; font-size: 0.825rem; color: var(--text); line-height: 1.3; min-width: 0; }
.leaderboard-meta { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }
.leaderboard-rating { font-weight: 700; font-size: 0.85rem; font-family: 'Inter', system-ui; flex-shrink: 0; }

/* ===== Priority Queue (card layout) ===== */
.priority-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 1.25rem 1.25rem;
}
.pcard {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 0.85rem;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.pcard:hover { box-shadow: var(--shadow-sm); border-color: var(--border); }
.pcard-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.85rem;
  align-items: center;
}
.pcard-branch { min-width: 0; }
.pcard-rating, .pcard-action { flex-shrink: 0; }
.pcard-comment { }
.pcard-comment-empty { padding: 0.75rem; color: var(--text-dim); font-style: italic; font-size: 0.85rem; text-align: center; background: white; border-radius: 0.5rem; border: 1px dashed var(--border); }
.pcard-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
}
.pcard-field { display: flex; flex-direction: column; gap: 0.3rem; }
.pcard-field-wide { grid-column: 1 / -1; }
.pcard-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}
.priority-empty { padding: 2.5rem; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

@media (max-width: 768px) {
  .pcard-head { grid-template-columns: auto 1fr auto; }
  .pcard-action { grid-column: 1 / -1; justify-self: stretch; }
  .pcard-action button { width: 100%; }
  .pcard-fields { grid-template-columns: 1fr; }
}

.priority-table-wrap { overflow-x: auto; }
.priority-table { width: 100%; border-collapse: collapse; }
.priority-table th {
  text-align: left;
  padding: 0.7rem 1rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border-soft);
}
.priority-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.85rem;
  vertical-align: middle;
}
.priority-table tr:last-child td { border-bottom: none; }
.priority-rank {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  font-family: 'Inter', system-ui;
  background: var(--brand-black);
  color: var(--brand-white);
}
.priority-rank.urgent { background: var(--red); }
.priority-rank.high { background: var(--orange); }
.priority-branch { font-weight: 600; line-height: 1.3; max-width: 280px; }
.priority-branch-meta { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.priority-select, .priority-input {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  font-size: 0.8rem;
  background: white;
  color: var(--text);
  font-family: inherit;
  width: 100%;
  min-width: 130px;
}
.priority-input { min-width: 180px; }
.priority-select:focus, .priority-input:focus {
  outline: none;
  border-color: var(--brand-tan);
  box-shadow: 0 0 0 2px rgba(173,156,130,0.15);
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}
.status-pending { background: var(--red-soft); color: var(--red-dark); }
.status-in_progress { background: var(--orange-soft); color: var(--orange-dark); }
.status-done { background: var(--green-soft); color: var(--green-dark); }

.comment-snippet {
  background: var(--bg-soft);
  border-left: 3px solid var(--border);
  padding: 0.5rem 0.7rem;
  border-radius: 0.45rem;
  font-size: 0.78rem;
}
.comment-snippet.low { border-left-color: var(--red); background: var(--red-soft); }
.comment-meta-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 2px; }
.comment-author { font-weight: 700; color: var(--text); font-size: 0.78rem; }
.comment-stars { color: #fbbf24; letter-spacing: 1.5px; font-size: 0.8rem; flex-shrink: 0; }
.comment-time { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.comment-text {
  color: var(--text-2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.comment-snippet.low .comment-text { color: var(--red-dark); }

/* ===== Confirm button (Priority Queue) ===== */
.confirm-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--brand-black);
  color: var(--brand-white);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.confirm-btn:hover { background: var(--brand-gray); transform: translateY(-1px); }
.confirm-btn:active { transform: translateY(0); }
.confirm-btn.confirmed {
  background: var(--green-soft);
  color: var(--green-dark);
  border: 1px solid var(--green);
}
.confirm-btn.confirmed:hover { background: var(--green); color: white; }

.submit-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--accent-dark);
  color: var(--brand-white);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.submit-btn:hover:not(:disabled) { background: var(--brand-tan); transform: translateY(-1px); color: var(--brand-black); }
.submit-btn.disabled, .submit-btn:disabled {
  background: var(--bg);
  color: var(--text-dim);
  cursor: not-allowed;
  border: 1px dashed var(--border);
}
.submit-btn.done {
  background: var(--green-soft);
  color: var(--green-dark);
  border: 1px solid var(--green);
  cursor: default;
}

.priority-textarea {
  resize: vertical;
  min-height: 50px;
  font-family: inherit;
  line-height: 1.4;
}
.priority-textarea[readonly] {
  background: var(--bg-soft);
  color: var(--text-muted);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--brand-black);
  color: var(--brand-white);
  padding: 0.85rem 1.5rem;
  border-radius: 0.7rem;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(24,24,24,0.25);
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red-dark); }

/* ===== Daily Activity ===== */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.18rem 0.6rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.live-pill .pulse-dot { background: var(--accent-dark); }
.daily-activity { padding: 0.5rem 0.5rem 1rem; }
.daily-day {
  border-bottom: 1px solid var(--border-soft);
  padding: 1rem 1rem 0.85rem;
}
.daily-day:last-child { border-bottom: none; }
.daily-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}
.daily-day-title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.daily-day-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.daily-day-date { font-size: 0.75rem; color: var(--text-muted); }
.daily-day-stats { display: flex; align-items: center; gap: 0.85rem; font-size: 0.78rem; }
.daily-stat-item { display: flex; align-items: center; gap: 4px; font-weight: 600; color: var(--text-2); }
.daily-stat-item .dot { width: 8px; height: 8px; }
.daily-day-empty { padding: 0.5rem 0; color: var(--text-dim); font-size: 0.82rem; font-style: italic; }
.daily-review {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 0.85rem;
  padding: 0.6rem 0.7rem;
  border-radius: 0.55rem;
  background: var(--bg-soft);
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  align-items: start;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid var(--border);
}
.daily-review:hover { background: var(--bg); }
.daily-review.low { border-left-color: var(--red); background: var(--red-soft); }
.daily-review.high { border-left-color: var(--green); background: var(--green-soft); }
.daily-review-time { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; font-family: 'Inter', system-ui; }
.daily-review-body { min-width: 0; }
.daily-review-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 3px;
  flex-wrap: wrap;
  align-items: center;
}
.daily-review-author { font-weight: 700; color: var(--text); font-size: 0.78rem; }
.daily-review-branch { font-size: 0.7rem; color: var(--accent-dark); font-weight: 600; }
.daily-review-stars { color: #fbbf24; letter-spacing: 1px; font-size: 0.78rem; }
.daily-review-text {
  color: var(--text-2);
  font-size: 0.78rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.daily-review.low .daily-review-text { color: var(--red-dark); }
.daily-review-rating {
  font-weight: 700;
  font-family: 'Inter', system-ui;
  font-size: 0.85rem;
}
@media (max-width: 640px) {
  .daily-review { grid-template-columns: 1fr; gap: 0.4rem; }
  .daily-review-time { font-size: 0.7rem; }
}

/* ===== Topics List ===== */
.topics-list { padding: 1rem 1.5rem 1.5rem; display: flex; flex-direction: column; gap: 0.85rem; }
.topic-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px;
  align-items: center;
  gap: 1rem;
}
.topic-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.topic-name span:first-child { font-size: 1.1rem; }
.topic-bar-track {
  height: 12px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.topic-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, var(--brand-tan), var(--accent-dark));
}
.topic-pct {
  text-align: right;
  font-weight: 700;
  font-family: 'Inter', system-ui;
  color: var(--text);
  font-size: 0.95rem;
}
.topic-pct-sub { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; font-family: 'Sarabun', sans-serif; }

@media (max-width: 640px) {
  .topic-row { grid-template-columns: 1fr; gap: 0.4rem; }
  .topic-pct { text-align: left; }
}

.region-list { padding: 0.5rem 1rem 1rem; }
.region-row { padding: 0.6rem 0; border-bottom: 1px solid var(--border-soft); }
.region-row:last-child { border-bottom: none; }
.region-row-top { display: flex; justify-content: space-between; margin-bottom: 0.35rem; }
.region-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.region-count { font-size: 0.7rem; color: var(--text-muted); margin-left: 0.4rem; }
.region-rating { font-weight: 700; font-size: 0.85rem; font-family: 'Inter', system-ui; }
.region-bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.region-bar-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }

/* ===== Filter Bar ===== */
.filter-bar {
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 88px;
  z-index: 30;
}
.filter-bar-inner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.filter-bar-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.85rem; color: var(--text-2); }
.filter-input {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  font-size: 0.825rem;
  background: var(--brand-white);
  color: var(--text);
  transition: all 0.15s;
}
.filter-input:focus {
  outline: none;
  border-color: var(--brand-tan);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.filter-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.55rem;
  font-size: 0.825rem;
  background: var(--brand-black);
  color: var(--brand-white);
  border: 1px solid var(--brand-black);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}
.filter-btn:hover { background: var(--brand-gray); border-color: var(--brand-gray); }

/* ===== Zone Sections ===== */
.zone-section {
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.zone-header {
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--brand-white);
  gap: 1rem;
  flex-wrap: wrap;
}
.zone-header-left { display: flex; align-items: center; gap: 0.85rem; }
.zone-header-right { display: flex; align-items: center; gap: 1.25rem; }
.zone-header h2 { font-size: 1.1rem; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
.zone-sub { font-size: 0.72rem; opacity: 0.85; margin-top: 0.15rem; font-weight: 500; }
.zone-icon { font-size: 1.4rem; }
.zone-stat { text-align: right; }
.zone-stat-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.75; font-weight: 600; }
.zone-stat-val { font-family: 'Inter', system-ui; font-weight: 700; font-size: 0.95rem; margin-top: 0.1rem; }

.zone-green  { background: var(--green); }
.zone-orange { background: var(--orange); }
.zone-red    { background: var(--red); }

.zone-count {
  background: rgba(0,0,0,0.18);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  min-width: 56px;
  text-align: center;
  font-family: 'Inter', system-ui;
  border: 1px solid rgba(255,255,255,0.15);
}

/* ===== Branch Cards ===== */
.branch-card {
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--brand-white);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: all 0.18s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.branch-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-tan);
}
.branch-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
}
.branch-card.green::before  { background: var(--green); }
.branch-card.orange::before { background: var(--orange); }
.branch-card.red::before    { background: var(--red); }
.branch-card.gray::before   { background: var(--text-dim); }

.branch-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.35;
  padding-left: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.branch-meta { display: flex; align-items: center; justify-content: space-between; padding-left: 0.4rem; }
.branch-region-pill {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-soft);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 500;
}
.branch-reviews { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.25rem 0.65rem;
  border-radius: 0.5rem;
  font-family: 'Inter', system-ui;
  flex-shrink: 0;
}
.rating-badge.green  { color: var(--green-dark); background: var(--green-soft); }
.rating-badge.orange { color: var(--orange-dark); background: var(--orange-soft); }
.rating-badge.red    { color: var(--red-dark); background: var(--red-soft); }
.rating-badge.gray   { color: var(--text-muted); background: var(--bg-soft); }

.empty-state { padding: 2.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* ===== Trend Chart ===== */
.trend-card {
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid var(--border);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-sm);
}
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24,24,24,0.65);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--brand-white);
  border-radius: 1.25rem;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.2s ease;
}
.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: none;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--border); color: var(--text); }

.review-item {
  padding: 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.85rem;
  background: var(--bg-soft);
  font-size: 0.875rem;
}
.review-stars { color: var(--brand-tan); letter-spacing: 1.5px; font-size: 0.9rem; }

.map-btn {
  display: block;
  text-align: center;
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  background: var(--brand-black);
  color: var(--brand-white);
  border-radius: 0.6rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s;
  text-decoration: none;
}
.map-btn:hover { background: var(--brand-gray); transform: translateY(-1px); box-shadow: var(--shadow-md); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Responsive (Mobile / Tablet) ===== */
@media (max-width: 1024px) {
  main { padding: 1rem !important; }
  .hero-banner { padding: 1.5rem !important; }
  .hero-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .hero-right { display: none; } /* hide donut on tablet */
  .hero-rating { font-size: 3.5rem; }
  .executive-header > div { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
}

@media (max-width: 768px) {
  /* Header */
  .executive-header > div {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .executive-header h1 { font-size: 1rem !important; }
  .executive-header p { font-size: 9px !important; }
  .logo-circle { width: 36px; height: 36px; border-radius: 9px; font-size: 0.85rem; }
  .nav-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    order: 3;
  }
  .nav-tab { font-size: 0.75rem; padding: 0.4rem 0.85rem; }
  .user-info { display: none; }
  .user-btn { padding: 0.3rem; }
  .refresh-btn { width: 34px; height: 34px; font-size: 1rem; }

  /* Hero */
  .hero-banner { padding: 1.25rem !important; border-radius: 0.85rem; }
  .hero-rating { font-size: 2.75rem; }
  .hero-rating-max { font-size: 1rem; }
  .hero-rating-star { font-size: 1.4rem; }
  .hero-distribution { gap: 0.85rem; }
  .dist-num { font-size: 0.9rem; }
  .dist-label { font-size: 0.72rem; }

  /* KPI */
  .kpi-card { padding: 0.85rem 0.95rem; }
  .kpi-value { font-size: 1.5rem; }
  .kpi-icon { width: 30px; height: 30px; font-size: 0.95rem; }

  /* Filter */
  .filter-bar-inner { gap: 0.5rem; }
  .filter-bar-label { width: 100%; font-size: 0.78rem; }
  .filter-input, .filter-btn { font-size: 0.78rem; padding: 0.45rem 0.7rem; flex: 1; min-width: 0; }
  .filter-input.w-44, .filter-input.w-56 { width: 100% !important; }

  /* Zone */
  .zone-header { padding: 0.85rem 1rem; }
  .zone-header h2 { font-size: 0.95rem; }
  .zone-header-right { gap: 0.6rem; }
  .zone-stat-val { font-size: 0.85rem; }
  .zone-stat-label { font-size: 0.55rem; }
  .zone-count { padding: 0.3rem 0.7rem; font-size: 0.85rem; min-width: 44px; }

  /* Branch cards */
  .branch-card { padding: 0.7rem 0.85rem; }
  .branch-name { font-size: 0.8rem; }

  /* Insight cards (Top/Bottom + Topics) */
  .insight-header { padding: 0.85rem 1rem; }
  .insight-title { font-size: 0.9rem; }
  .leaderboard { padding: 0.4rem; }
  .leaderboard-row.detailed { padding: 0.7rem; }
  .leaderboard-snippet { margin-left: 0; padding: 0.5rem 0.65rem; font-size: 0.72rem; }

  /* Topics */
  .topics-list { padding: 0.85rem 1rem 1.25rem; }
  .topic-row { grid-template-columns: 1fr; gap: 0.35rem; }
  .topic-pct { text-align: left; font-size: 0.85rem; }

  /* Priority Queue */
  .priority-table th, .priority-table td { padding: 0.5rem 0.7rem; font-size: 0.78rem; }
  .priority-branch { max-width: 180px; }
  .priority-select, .priority-input { min-width: 120px; font-size: 0.75rem; padding: 0.35rem 0.5rem; }

  /* Modal */
  .modal-box { border-radius: 0.85rem; max-height: 95vh; }
}

@media (max-width: 480px) {
  .executive-header h1 { font-size: 0.9rem !important; }
  .nav-tab { padding: 0.35rem 0.6rem; font-size: 0.7rem; }
  .nav-tab .text-lg, .nav-tab span { font-size: 0.75rem; }
  .hero-rating { font-size: 2.25rem; }
  .kpi-value { font-size: 1.25rem; }
  .kpi-label { font-size: 0.62rem; }
  .kpi-sub { font-size: 0.65rem; }
}
