:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-blue: #eef6ff;
  --text: #111827;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --ink: #172033;
  --ink-2: #1f2a44;
  --blue: #2563eb;
  --cyan: #0e7490;
  --green: #15803d;
  --red: #a6402f;
  --gold: #c99122;
  --green-soft: #eaf7ef;
  --gold-soft: #fff4d6;
  --red-soft: #fff1ed;
  --blue-soft: #eaf2ff;
  --cyan-soft: #e8f7fb;
  --panel-pad: 18px;
  --shadow: 0 18px 46px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 26px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 32rem),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 42%, #eef2f7 100%);
  color: var(--text);
  font-family: "Noto Sans Thai", "Segoe UI", Tahoma, Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  outline-color: rgba(37, 99, 235, 0.38);
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: linear-gradient(180deg, #111827 0%, #172033 60%, #111827 100%);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 26px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.brand-mark img {
  width: 38px;
  height: 42px;
  object-fit: contain;
  display: block;
}

.brand strong {
  display: block;
  font-size: 16px;
  letter-spacing: 0;
}

.brand span {
  display: block;
  color: #b8c2d1;
  font-size: 12px;
  line-height: 1.45;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.mobile-nav-toggle {
  display: none;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #d7deea;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: #c7d7ff;
  font-size: 11px;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.nav-item.is-active .nav-icon {
  background: var(--blue);
  color: #ffffff;
}

.main {
  min-width: 0;
  padding: 26px 32px 44px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 12px;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-chip {
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.user-chip span,
.user-chip strong {
  display: block;
  line-height: 1.2;
}

.user-chip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.user-chip strong {
  max-width: 180px;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.eyebrow,
.section-kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

h1 {
  font-size: 28px;
  line-height: 1.24;
  color: var(--ink);
}

h2 {
  font-size: 18px;
  line-height: 1.35;
  color: var(--ink);
}

h3 {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.page-title p:last-child,
.panel-head p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 4px;
}

.dashboard-control-strip {
  position: sticky;
  top: 12px;
  z-index: 70;
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid rgba(203, 213, 225, 0.72);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.92);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(16px);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  max-width: none;
}

.section-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 1px 1px 2px;
  scrollbar-width: none;
}

.section-tabs::-webkit-scrollbar {
  display: none;
}

.section-tab {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.section-tab:hover,
.section-tab.is-active {
  border-color: #b6c7f4;
  background: var(--blue-soft);
  color: var(--blue);
}

.toolbar select,
.toolbar input,
.search,
.chat-form input {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  padding: 0 11px;
  min-width: 136px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.toolbar select:disabled,
.toolbar input:disabled {
  color: var(--muted-2);
  background: #f8fafc;
}

.search {
  min-width: 280px;
}

.button {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 13px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.button:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.58;
  cursor: wait;
  transform: none;
}

.button-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.button-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.button-danger {
  border-color: #f0c9c3;
  background: #fff5f3;
  color: var(--red);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(167, 19, 32, 0.08), transparent 36rem),
    linear-gradient(180deg, #f8fbff 0%, #eef2f7 100%);
}

.login-shell {
  width: min(100% - 32px, 460px);
  padding: 44px 0;
}

.login-panel {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 28px;
}

.login-logo {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.login-logo img {
  width: 40px;
  height: 42px;
  object-fit: contain;
}

.login-brand p,
.login-brand strong {
  display: block;
}

.login-brand p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-brand strong {
  color: var(--ink);
  font-size: 16px;
}

.login-heading {
  margin-bottom: 22px;
}

.login-heading h1 {
  margin-bottom: 6px;
}

.login-heading p:last-child {
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.login-form input:focus {
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.login-submit {
  width: 100%;
  height: 44px;
  margin-top: 8px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #f2d28d;
  border-radius: 8px;
  background: #fff9ea;
  color: #755111;
  font-size: 13px;
  line-height: 1.55;
}

.notice-success {
  border-color: #b7e4c6;
  background: #edf8f1;
  color: #166534;
}

.notice-warning {
  border-color: #f2d28d;
  background: #fff9ea;
  color: #755111;
}

.notice-error {
  border-color: #ffc9bf;
  background: var(--red-soft);
  color: #9f2d20;
}

.executive-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-card {
  min-width: 0;
  padding: 16px 17px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--blue), var(--cyan));
}

.summary-card-primary::before {
  background: linear-gradient(180deg, var(--red), var(--gold));
}

.summary-card-primary {
  grid-column: span 2;
  background:
    linear-gradient(135deg, rgba(166, 64, 47, 0.07), rgba(201, 145, 34, 0.08) 46%, rgba(255, 255, 255, 0.96) 78%),
    #ffffff;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: clamp(20px, 1.9vw, 28px);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.summary-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.data-type-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.data-type-strip span {
  min-width: 0;
  border: 1px solid #dbe7f8;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
}

.data-type-strip {
  margin-top: -2px;
}

.data-type-strip span {
  flex: 1 1 220px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.social-summary {
  display: grid;
  gap: 12px;
  margin: -2px 0 14px;
  padding: 13px;
  border: 1px solid #dbe7f8;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(255, 255, 255, 0.94) 54%),
    #ffffff;
}

.social-summary.is-pending {
  border-color: #f2d28d;
  background:
    linear-gradient(135deg, rgba(201, 145, 34, 0.08), rgba(255, 255, 255, 0.96) 60%),
    #ffffff;
}

.social-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.social-summary-head span,
.social-summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.social-summary-head strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.social-summary-head b {
  min-height: 30px;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  white-space: nowrap;
}

.social-summary.is-pending .social-summary-head b {
  background: var(--gold-soft);
  color: #7a520f;
}

.social-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.social-summary-grid > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
}

.social-summary-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.social-summary p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.channel-jump-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.channel-jump-list a {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.channel-jump-list a:hover {
  border-color: #b6c7f4;
  background: var(--blue-soft);
}

.channel-panel {
  margin-bottom: 14px;
}

.channel-placeholder {
  background:
    linear-gradient(135deg, rgba(100, 116, 139, 0.05), rgba(255, 255, 255, 0.94) 58%),
    rgba(255, 255, 255, 0.92);
}

.channel-placeholder .data-note {
  margin-top: 0;
  border-style: dashed;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.88fr);
  gap: 14px;
  margin-bottom: 14px;
}

.layout {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.layout-brief {
  grid-template-columns: minmax(520px, 1.1fr) minmax(360px, 0.9fr);
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi,
.panel {
  min-width: 0;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.panel {
  padding: var(--panel-pad);
}

.kpi {
  padding: 16px;
  min-height: 136px;
  position: relative;
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--blue), var(--cyan));
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(24px, 2vw, 31px);
  line-height: 1.1;
  color: var(--ink);
}

.kpi-primary {
  border-color: #cfe0ff;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 116, 144, 0.06) 48%, rgba(255, 255, 255, 0.96) 78%),
    #ffffff;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  margin-top: 9px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #dbe4ef;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
}

.kpi-trend.is-up {
  border-color: #bbebc9;
  background: var(--green-soft);
  color: var(--green);
}

.kpi-trend.is-down {
  border-color: #ffd2c8;
  background: var(--red-soft);
  color: #9f2d20;
}

.kpi-trend.is-flat,
.kpi-trend.is-neutral {
  border-color: #dbe4ef;
  background: #f1f5f9;
  color: #64748b;
}

.kpi small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.45;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.insight-panel {
  box-shadow: var(--shadow);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.06), transparent 42%),
    rgba(255, 255, 255, 0.95);
}

.home-search-panel {
  align-self: stretch;
  display: grid;
  align-content: start;
}

.home-search-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-search-grid h3 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 13px;
}

.home-search-detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin-top: 12px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.home-search-detail-link:hover {
  border-color: #b6c7f4;
  background: var(--blue-soft);
}

.compact-explainer,
.mini-table-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.compact-explainer {
  padding: 9px 10px;
  border: 1px solid #dbe7f8;
  border-radius: 8px;
  background: #f8fbff;
}

.mini-table-note {
  margin: -4px 0 10px;
}

.compact-rank-list {
  display: grid;
  gap: 8px;
}

.rank-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) max-content;
  align-items: start;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.rank-row > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #e9f0ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.rank-row div {
  min-width: 0;
}

.rank-row strong,
.rank-row a {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.rank-row a:hover {
  color: var(--blue);
  text-decoration: underline;
}

.rank-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.rank-row b {
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rank-load-more {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #cbd8ee;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--blue);
  cursor: pointer;
  font-weight: 900;
  text-align: center;
}

.rank-load-more:hover {
  border-color: #9db6ed;
  background: #eef5ff;
}

.rank-load-more small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.table-more {
  margin-top: 10px;
}

.article-panel {
  margin-top: 14px;
}

#brief,
#traffic,
#searchInsight,
#social,
#websiteChannel,
#facebookChannel,
#instagramChannel,
#youtubeChannel,
#xChannel,
#tiktokChannel,
#visitors,
#reports,
#settings {
  scroll-margin-top: 138px;
}

.insight-panel .insight-cards {
  display: none;
}

.insight-note {
  border-left: 4px solid var(--blue);
  background: #f8fbff;
}

.insight-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.insight-card {
  min-height: 144px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface);
  display: grid;
  align-content: start;
  gap: 7px;
  position: relative;
  overflow: hidden;
}

.insight-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--blue);
}

.insight-card.cyan::before {
  background: var(--cyan);
}

.insight-card.red::before {
  background: var(--red);
}

.insight-card.gold::before {
  background: var(--gold);
}

.insight-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.insight-card strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.3;
}

.insight-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.skeleton-line {
  min-height: 128px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f1f5f9, #ffffff, #eef2f7);
  background-size: 200% 100%;
  animation: pulse 1.3s ease-in-out infinite;
}

.monthly-hint {
  display: grid;
  gap: 3px;
  margin: -2px 0 14px;
  padding: 12px 14px;
  border: 1px solid #d4def0;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fbff 0%, #ffffff 54%, #f5f0e8 100%);
}

.monthly-hint strong {
  color: var(--ink);
  font-size: 14px;
}

.monthly-hint span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.ai-brief-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
  overflow: hidden;
}

.ai-brief-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.ai-brief-head strong {
  color: var(--ink);
}

.ai-brief-head span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.ai-brief-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-toggle {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #cbd8ee;
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.mini-toggle:hover {
  background: var(--blue-soft);
  border-color: #b6c7f4;
}

.ai-brief {
  white-space: pre-line;
  line-height: 1.72;
  font-size: 14px;
  color: #243145;
  padding: 12px;
  max-height: 210px;
  overflow: auto;
  transition: max-height 0.2s ease;
}

.ai-brief:not(.is-expanded):not(.loading) {
  -webkit-mask-image: linear-gradient(180deg, #000 78%, rgba(0, 0, 0, 0.12));
  mask-image: linear-gradient(180deg, #000 78%, rgba(0, 0, 0, 0.12));
}

.ai-brief.is-expanded {
  max-height: 620px;
}

.ai-brief-hint {
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-brief.is-expanded + .ai-brief-hint {
  display: none;
}

.loading {
  color: var(--muted);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(260px, 1fr) auto;
  min-height: 520px;
}

.question-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.scope-notice {
  margin: -4px 0 12px;
  padding: 10px 12px;
  border: 1px solid #b9d4ff;
  border-radius: 8px;
  background: var(--blue-soft);
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
}

.question-chip {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.question-chip:hover {
  border-color: #b6c7f4;
  background: var(--blue-soft);
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 260px;
  max-height: 410px;
  overflow: auto;
  padding: 4px 2px 12px;
}

.chat-message {
  max-width: 92%;
  border-radius: 8px;
  padding: 10px 11px;
  line-height: 1.55;
  font-size: 13px;
}

.chat-message span {
  display: block;
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 3px;
  color: var(--muted);
}

.chat-message p {
  white-space: pre-line;
}

.chat-message.is-ai {
  justify-self: start;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.chat-message.is-user {
  justify-self: end;
  background: var(--ink);
  color: #fff;
}

.chat-message.is-user span {
  color: #cbd5e1;
}

.chat-message.is-loading {
  color: var(--muted);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.chat-form input {
  min-width: 0;
}

.chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  pointer-events: none;
}

.chat-toggle,
.chat-window {
  pointer-events: auto;
}

.chat-toggle {
  display: grid;
  grid-template-columns: 48px minmax(0, auto);
  align-items: center;
  gap: 11px;
  min-width: 214px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 999px;
  padding: 8px 16px 8px 8px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.92), rgba(14, 165, 233, 0.9)),
    #172033;
  color: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
  cursor: pointer;
}

.chat-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.28);
}

.chat-toggle-logo,
.chat-title-logo {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
}

.chat-toggle-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.chat-toggle-logo img,
.chat-title-logo img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.chat-toggle-text {
  display: grid;
  gap: 1px;
  text-align: left;
}

.chat-toggle-text strong {
  font-size: 15px;
  line-height: 1.2;
}

.chat-toggle-text small {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  line-height: 1.25;
}

.chat-widget.is-collapsed .chat-window {
  display: none;
}

.chat-widget:not(.is-collapsed) .chat-toggle {
  display: none;
}

.chat-window {
  width: min(452px, calc(100vw - 32px));
  height: min(690px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.65);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.24), transparent 18rem),
    linear-gradient(180deg, #172033 0%, #111827 55%, #0d111b 100%);
  color: #f8fafc;
  box-shadow: 0 28px 72px rgba(15, 23, 42, 0.34);
}

.chat-widget.is-expanded .chat-window {
  width: min(860px, calc(100vw - 48px));
  height: min(760px, calc(100vh - 48px));
}

.chat-window-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-title-logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  flex: 0 0 auto;
}

.chat-title strong,
.chat-title span {
  display: block;
}

.chat-title strong {
  font-size: 17px;
  line-height: 1.25;
}

.chat-title span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  line-height: 1.35;
}

.chat-window-actions {
  display: flex;
  gap: 7px;
}

.chat-icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.chat-icon-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.chat-window-intro {
  display: grid;
  gap: 7px;
  margin: 16px 18px 12px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.chat-window-intro strong {
  color: #ffffff;
  font-size: 14px;
  line-height: 1.55;
}

.chat-window-intro span {
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.55;
}

.chat-window .scope-notice {
  margin: 12px 18px 10px;
  padding: 8px 10px;
  border-color: rgba(96, 165, 250, 0.38);
  background: rgba(37, 99, 235, 0.16);
  color: #dbeafe;
  font-size: 11px;
  line-height: 1.45;
}

.chat-suggestions {
  margin: 0 18px 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
}

.chat-suggestions summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 13px;
  cursor: pointer;
  list-style: none;
}

.chat-suggestions summary::-webkit-details-marker {
  display: none;
}

.chat-suggestions summary::after {
  content: "+";
  display: grid;
  grid-column: 2;
  grid-row: 1 / span 2;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.chat-suggestions[open] summary::after {
  content: "−";
}

.chat-suggestions summary span,
.chat-suggestions summary small {
  display: block;
  grid-column: 1;
  min-width: 0;
}

.chat-suggestions summary span {
  color: #f8fafc;
  font-size: 13px;
  font-weight: 900;
}

.chat-suggestions summary small {
  margin-top: 2px;
  overflow: hidden;
  color: #cbd5e1;
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-suggestions .chat-window-intro {
  margin: 0;
  padding: 11px 13px 6px;
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 0;
  background: transparent;
}

.chat-suggestions .chat-window-intro strong {
  font-size: 13px;
}

.chat-suggestions .chat-window-intro span {
  font-size: 11px;
}

.chat-window .question-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0 14px 14px;
}

.chat-window .question-chip {
  min-height: 42px;
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.09);
  color: #e5e7eb;
  text-align: left;
  line-height: 1.35;
}

.chat-window .question-chip:hover {
  border-color: rgba(125, 211, 252, 0.6);
  background: rgba(14, 165, 233, 0.18);
}

.chat-window .chat-messages {
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 0 18px 16px;
}

.chat-window .chat-message {
  max-width: 90%;
  border-radius: 14px;
  padding: 11px 13px;
  font-size: 13px;
}

.chat-window .chat-message.is-ai {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #f8fafc;
}

.chat-window .chat-message.is-user {
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  color: #ffffff;
}

.chat-window .chat-message span {
  color: #93c5fd;
}

.chat-window .chat-message.is-user span {
  color: rgba(255, 255, 255, 0.74);
}

.chat-window .chat-form {
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
  margin: 0 18px 18px;
  padding: 9px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.chat-window .chat-form input {
  height: 46px;
  border: 0;
  background: transparent;
  color: #ffffff;
  padding: 0 7px;
}

.chat-window .chat-form input::placeholder {
  color: #94a3b8;
}

.chat-send {
  width: 48px;
  height: 46px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  color: #ffffff;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.chat-send:hover {
  filter: brightness(1.06);
}

.chart {
  min-height: 280px;
}

.chart svg {
  width: 100%;
  height: 280px;
  display: block;
}

.chart-insight {
  margin-top: 12px;
  border: 1px solid #d8e4f4;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 116, 144, 0.06)),
    var(--surface);
  overflow: hidden;
}

.chart-insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(216, 228, 244, 0.9);
}

.chart-insight-head strong {
  color: var(--ink);
  font-size: 14px;
}

.chart-insight-head span {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.chart-insight-body {
  display: grid;
  gap: 7px;
  padding: 10px 12px 12px;
}

.chart-insight-body p {
  color: #43536a;
  font-size: 13px;
  line-height: 1.6;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.legend-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 5px;
}

.legend-users {
  background: var(--cyan);
}

.legend-views {
  background: var(--blue);
}

.axis-label {
  fill: #7b8798;
  font-size: 11px;
}

.signal-list,
.bar-list,
.campaign-list,
.channel-list {
  display: grid;
  gap: 10px;
}

.faq-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.faq-block h3 {
  color: var(--ink);
  margin-bottom: 10px;
}

.faq-list {
  display: grid;
  gap: 8px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
  overflow: hidden;
}

.faq-item summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  list-style-position: inside;
}

.faq-item p {
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-line;
}

.signal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.signal-row strong {
  color: var(--ink);
}

.signal-row p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 3px;
}

.signal-row > span {
  color: var(--blue);
  font-weight: 900;
  white-space: nowrap;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) 84px;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

.bar-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bar-track {
  height: 10px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  border-radius: inherit;
}

.split-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.visitor-grid {
  grid-template-columns: minmax(320px, 0.84fr) minmax(460px, 1.16fr);
}

.search-console-panel {
  grid-column: 1 / -1;
}

.detail-panel {
  margin-bottom: 14px;
}

.detail-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  margin: -3px -3px 14px;
  padding: 10px 12px;
  border: 1px solid #dbe7f8;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fbff, #eef6ff);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.detail-summary::-webkit-details-marker {
  display: none;
}

.detail-panel:not([open]) .detail-summary {
  margin-bottom: -3px;
}

.detail-summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue);
  font-size: 20px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px var(--border);
}

.detail-panel[open] .detail-summary::after {
  content: "-";
}

.search-console-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.search-console-summary > div {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
  min-width: 0;
}

.search-console-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-console-summary strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 20px;
}

.search-console-grid {
  display: block;
}

.search-console-grid h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.tab-button,
.sort-toolbar button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.tab-button {
  padding: 7px 12px;
}

.tab-button.is-active,
.sort-toolbar button.is-active {
  border-color: #b6c7f4;
  background: var(--blue-soft);
  color: var(--blue);
}

.search-tab-panel[hidden] {
  display: none;
}

.search-tab-panel {
  margin-top: 0;
}

.sort-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
}

.sort-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.sort-toolbar button {
  padding: 6px 10px;
}

.sort-toolbar button.is-active::after {
  content: " ↓";
}

.sort-toolbar button.is-active[data-sort-dir="asc"]::after {
  content: " ↑";
}

.search-console-wide {
  grid-column: 1 / -1;
}

.geo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.compact-bars {
  gap: 8px;
}

.compact-bar-row {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) minmax(120px, 1.5fr) 72px;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.compact-bar-row:last-child {
  border-bottom: 0;
}

.compact-bar-row strong,
.detail-row strong:first-child {
  color: var(--ink);
}

.compact-bar-row small,
.detail-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin-top: 2px;
}

.detail-row {
  align-items: flex-start;
}

.detail-row > span {
  min-width: 0;
}

.data-note {
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #fbfdff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.compare-panel {
  margin-bottom: 14px;
}

.compact-table table {
  min-width: 680px;
}

.compare-table table {
  min-width: 920px;
}

.compare-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  background: var(--surface-soft);
  color: var(--ink);
}

.compare-badge.up {
  background: #eaf7ef;
  color: #166534;
}

.compare-badge.down {
  background: var(--red-soft);
  color: #9f2d20;
}

.compare-badge.flat,
.compare-badge.muted {
  background: #f1f5f9;
  color: var(--muted);
}

.table-warning {
  display: block;
  margin-top: 5px;
  color: #9f2d20;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.is-muted-row {
  color: var(--muted-2);
  background: rgba(248, 250, 252, 0.62);
}

.mini-row,
.channel-row,
.campaign-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
}

.mini-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mini-row:last-child,
.channel-row:last-child,
.campaign-row:last-child {
  border-bottom: 0;
}

.channel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.campaign-row strong:last-child,
.mini-row strong {
  color: var(--ink);
  white-space: nowrap;
}

.mini-row strong {
  text-align: right;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 800;
  background: var(--surface-soft);
}

td.numeric,
.numeric {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.content-title {
  display: grid;
  gap: 3px;
}

.content-title a {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.content-title a:hover {
  color: var(--blue);
}

.content-title small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.platform {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: #334155;
  font-weight: 800;
}

.score {
  display: inline-flex;
  min-width: 46px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--gold-soft);
  color: #7a520f;
  font-weight: 900;
}

.recommendations {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 12px;
  line-height: 1.65;
}

.report-box {
  display: grid;
  gap: 12px;
}

.report-line {
  padding: 12px;
  border-left: 4px solid var(--red);
  background: #fffdfa;
  border-radius: 0 8px 8px 0;
  line-height: 1.6;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

#settings {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
  padding: 12px;
}

#settings .panel-head {
  margin-bottom: 10px;
}

#settings .panel-head h2 {
  font-size: 17px;
}

#settings .panel-head p {
  font-size: 12px;
}

.settings-grid div {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.settings-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
}

.settings-grid strong {
  display: block;
  margin-top: 4px;
  word-break: break-word;
  color: #334155;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 800;
}

.settings-summary {
  margin: 0;
  min-height: 42px;
  background: #f8fbff;
  color: #475569;
  font-size: 13px;
}

.settings-panel:not([open]) .settings-summary {
  margin-bottom: 0;
}

.member-admin {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.member-form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr 1fr auto;
  align-items: end;
  gap: 10px;
}

.member-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.member-form span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.member-form input,
.member-form select,
.member-table input,
.member-table select {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

.member-status {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.member-status[data-tone="success"] {
  color: var(--green);
}

.member-status[data-tone="error"] {
  color: var(--red);
}

.member-table-wrap {
  margin-top: 8px;
}

.member-table {
  min-width: 860px;
}

.member-table td strong,
.member-table td small {
  display: block;
}

.member-table td small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.member-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

@keyframes pulse {
  0% {
    background-position: 0 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

@media (max-width: 1240px) {
  .hero-grid,
  .layout-brief {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: 460px;
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar {
    display: grid;
  }

  .toolbar {
    justify-content: flex-start;
    max-width: none;
  }

  .two-column,
  .visitor-grid,
  .kpi-grid,
  .executive-summary,
  .settings-grid,
  .social-summary-grid,
  .insight-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell,
  .main,
  .topbar,
  .layout,
  .hero-grid,
  .kpi-grid,
  .panel,
  .table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .main {
    padding: 18px 14px 32px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .member-form {
    grid-template-columns: 1fr;
  }

  .user-chip {
    min-width: 0;
    flex: 1;
  }

  .dashboard-control-strip {
    top: 94px;
    padding: 9px;
  }

  .section-tabs {
    gap: 6px;
  }

  .section-tab {
    min-height: 32px;
    padding: 6px 9px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 80;
    padding: 12px;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand-mark img {
    width: 30px;
    height: 34px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand span {
    font-size: 11px;
  }

  .mobile-nav-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    text-align: left;
    cursor: pointer;
  }

  .mobile-nav-toggle span,
  .mobile-nav-toggle strong {
    display: block;
    min-width: 0;
  }

  .mobile-nav-toggle span {
    color: #b8c2d1;
    font-size: 11px;
    font-weight: 800;
  }

  .mobile-nav-toggle strong {
    overflow: hidden;
    color: #ffffff;
    font-size: 15px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-toggle::after {
    content: "+";
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
  }

  .sidebar.is-open .mobile-nav-toggle::after {
    content: "-";
  }

  .sidebar:not(.is-open) .nav-list {
    display: none;
  }

  .sidebar.is-open .nav-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    padding-top: 2px;
  }

  .nav-list,
  .hero-grid,
    .layout-brief,
    .two-column,
    .visitor-grid,
    .home-search-grid,
    .executive-summary,
    .kpi-grid,
    .settings-grid,
    .social-summary-grid,
    .split-list,
    .geo-grid,
    .insight-cards {
    grid-template-columns: 1fr;
  }

  .search-console-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar,
  .toolbar select,
  .toolbar input,
  .button,
  .search {
    width: 100%;
  }

  .summary-card-primary {
    grid-column: auto;
  }

  #brief,
  #traffic,
  #searchInsight,
  #social,
  #websiteChannel,
  #facebookChannel,
  #instagramChannel,
  #youtubeChannel,
  #xChannel,
  #tiktokChannel,
  #visitors,
  #reports,
  #settings {
    scroll-margin-top: 178px;
  }

  .panel-head {
    display: grid;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .compact-bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .table-wrap {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .table-wrap table {
    width: max-content;
    max-width: none;
    min-width: 640px;
  }

  .compact-table table {
    min-width: 600px;
  }

  .compare-table table {
    min-width: 760px;
  }

  .signal-row {
    grid-template-columns: 1fr;
  }

  .chart-legend {
    justify-content: flex-start;
  }

  .chart-insight-head {
    display: grid;
  }

  .chart-insight-head span {
    justify-self: start;
  }

  .chat-widget {
    right: 10px;
    bottom: 10px;
  }

  .chat-toggle {
    min-width: 0;
    grid-template-columns: 46px;
    padding: 7px;
  }

  .chat-toggle-text {
    display: none;
  }

  .chat-window,
  .chat-widget.is-expanded .chat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    border-radius: 16px;
  }

  .chat-window-head {
    padding: 14px;
  }

  .chat-title span {
    display: none;
  }

  .chat-window-intro,
  .chat-window .scope-notice,
  .chat-suggestions,
  .chat-window .chat-form {
    margin-left: 12px;
    margin-right: 12px;
  }

  .chat-suggestions summary {
    min-height: 44px;
    padding: 9px 11px;
  }

  .chat-suggestions summary small {
    display: none;
  }

  .chat-suggestions summary::after {
    grid-row: 1;
  }

  .chat-window .question-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-left: 12px;
    padding-right: 12px;
    gap: 7px;
  }

  .chat-window .question-chip {
    min-height: 38px;
    padding: 8px 9px;
    font-size: 12px;
  }

  .chat-window .chat-messages {
    padding-left: 12px;
    padding-right: 12px;
  }

  .chat-window .chat-message {
    max-width: 94%;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .toolbar,
  .dashboard-control-strip,
  .chat-panel,
  .chat-widget,
  #settings,
  #social,
  #websiteChannel,
  #facebookChannel,
  .channel-placeholder-grid,
  #campaign {
    display: none;
  }

  .app-shell,
  .hero-grid,
  .layout-brief,
  .two-column,
  .kpi-grid {
    display: block;
  }

  .main {
    padding: 0;
  }

  .panel,
  .kpi {
    box-shadow: none;
    break-inside: avoid;
    margin-bottom: 10px;
  }
}
