:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #e4e7ec;
  --teal: #00a99d;
  --rose: #ff5c7a;
  --amber: #f59e0b;
  --blue: #3874ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.9), rgba(17, 24, 39, 0.78)),
    radial-gradient(circle at 28% 24%, rgba(0, 169, 157, 0.24), transparent 34%),
    #111827;
  padding: 24px;
}

.login-screen.is-hidden {
  display: none;
}

.login-panel {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  padding: 28px;
}

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

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

.login-brand span,
.login-copy p,
.login-note,
.login-config-warning span {
  color: var(--muted);
}

.login-copy h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.1;
}

.login-copy p {
  margin: 0 0 22px;
}

.google-signin-slot {
  min-height: 44px;
}

.login-config-warning {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #fedf89;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
}

.login-config-warning strong,
.login-config-warning span {
  display: block;
  font-size: 13px;
}

.login-config-warning code {
  color: #7c2d12;
  font-size: 12px;
}

.login-note {
  margin: 18px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.app-shell.is-locked {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
  overflow: hidden;
}

.brand {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--ink), #2d3748);
  color: #fff;
  display: grid;
  place-items: center;
}

.brand strong {
  display: block;
  font-size: 14px;
}

.brand span,
.nav-label,
.nav-section,
.profile-meta,
.metric-card p,
.metric-card span,
td span {
  color: var(--muted);
}

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

.nav {
  padding: 14px 10px;
  flex: 1;
}

.nav-section {
  padding: 12px 10px 8px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
}

.nav button {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0 12px;
  color: #344054;
  cursor: pointer;
  margin-bottom: 3px;
}

.nav button:hover,
.nav button.active {
  background: #111827;
  color: #fff;
}

.nav button i {
  width: 18px;
}

.sidebar-footer {
  border-top: 1px solid var(--line);
  padding: 14px;
}

.workspace-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fafb;
}

.main {
  min-width: 0;
}

.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-left,
.topbar-right,
.quick-actions,
.filters,
.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.primary-button,
.ghost-button {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
}

.icon-button {
  width: 36px;
  padding: 0;
}

.primary-button {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

.ghost-button:hover,
.icon-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.12);
}

.user-menu-wrap {
  position: relative;
}

.user-menu {
  position: absolute;
  right: 0;
  top: 44px;
  width: 220px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(17, 24, 39, 0.14);
  display: none;
  padding: 6px;
}

.user-menu.open {
  display: block;
}

.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  background: #eef2f6;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
}

.user-menu button:hover {
  background: #f2f4f7;
}

.content {
  padding: 24px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.page-heading h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.page-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.tabs {
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.tabs button {
  border: 0;
  background: transparent;
  padding: 0 4px 12px;
  margin-right: 18px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tabs button.active {
  color: var(--ink);
  border-color: var(--ink);
  font-weight: 700;
}

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

.metric-card,
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card {
  padding: 16px;
  display: flex;
  gap: 14px;
  min-height: 126px;
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.metric-teal {
  background: #e6f8f6;
  color: var(--teal);
}

.metric-ink {
  background: #eef2f6;
  color: var(--ink);
}

.metric-rose {
  background: #fff0f3;
  color: var(--rose);
}

.metric-amber {
  background: #fff7e6;
  color: var(--amber);
}

.metric-card p,
.metric-card span {
  margin: 0;
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin: 5px 0 6px;
  font-size: 26px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.85fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  min-width: 0;
}

.panel-header {
  height: 58px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.panel-header h2 {
  font-size: 15px;
  margin: 0;
}

.panel-header span {
  color: var(--muted);
  font-size: 12px;
}

.chart-body {
  padding: 16px;
}

.trend-chart svg {
  width: 100%;
  min-height: 240px;
}

.trend-chart text {
  fill: #667085;
  font-size: 12px;
}

.audience {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
  align-items: center;
}

.audience-total {
  font-weight: 800;
  font-size: 18px;
  fill: var(--ink);
}

.audience-caption {
  font-size: 10px;
  fill: var(--muted);
}

.audience-list {
  display: grid;
  gap: 10px;
}

.audience-list span {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.audience-list i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.activity {
  list-style: none;
  padding: 4px 16px 16px;
  margin: 0;
}

.activity li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #f2f4f7;
  color: #344054;
  font-size: 13px;
}

.activity span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef2f6;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--muted);
}

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

.filters {
  flex-wrap: wrap;
}

.searchbox {
  height: 36px;
  min-width: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: #fff;
}

.searchbox input,
.filters select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.filters select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 30px 0 10px;
  background: #fff;
}

.table-scroll {
  overflow-x: auto;
}

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

th {
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #f9fafb;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

td {
  font-size: 13px;
}

td strong,
td span {
  display: block;
}

tbody tr:hover {
  background: #f7fbfb;
}

.status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-success {
  background: #e7f8f4;
  color: #027a70;
}

.status-info {
  background: #eef4ff;
  color: #175cd3;
}

.status-warning {
  background: #fff7e6;
  color: #b54708;
}

.status-neutral {
  background: #f2f4f7;
  color: #475467;
}

.sidebar-collapsed .app-shell {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar-collapsed .brand-copy,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-section,
.sidebar-collapsed .sidebar-footer {
  display: none;
}

.sidebar-collapsed .brand {
  justify-content: center;
  padding: 0;
}

.sidebar-collapsed .nav button {
  justify-content: center;
  padding: 0;
}

@media (max-width: 1100px) {
  .metric-grid,
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-grid .panel:first-child {
    grid-column: 1 / -1;
  }
}

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

  .sidebar {
    display: none;
  }

  .topbar,
  .content {
    padding-left: 14px;
    padding-right: 14px;
  }

  .page-heading,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
    height: auto;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .metric-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    flex-wrap: wrap;
  }
}
