/* AllIn Mini Democracy — palette-aware styles
   Uses theme CSS variables:
   --theme-palette-color-1: #a0876e (accent)
   --theme-palette-color-2: #5c544d (dark panel)
   --theme-palette-color-3: #3f4245 (muted text)
   --theme-palette-color-4: #020404 (text)
   --theme-palette-color-5: #eaeaec (border/muted bg)
   --theme-palette-color-6: #f4f4f5 (soft bg)
   --theme-palette-color-7: #ffffff (white)
*/

:root{
  --dem-accent: var(--theme-palette-color-1);
  --dem-text: var(--theme-palette-color-4);
  --dem-subtext: var(--theme-palette-color-3);
  --dem-border: var(--theme-palette-color-5);
  --dem-panel: var(--theme-palette-color-7);
  --dem-panel-dark: var(--theme-palette-color-2);
  --dem-chip: var(--theme-palette-color-6);
}

.dem-card{
  border: 1px solid var(--dem-border);
  border-radius: 18px;
  padding: 18px 20px;
  background: var(--dem-panel);
  box-shadow: 0 12px 40px rgba(0,0,0,.06);
  margin: 18px 0;
  color: var(--dem-text);
}
.dem-card--dark{
  background: var(--dem-panel-dark);
  border-color: rgba(0,0,0,.08);
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  color: var(--theme-palette-color-7);
}
.dem-title{
  font-size: 20px; margin: 0 0 12px;
  color: var(--dem-text);
}
.dem-card--dark .dem-title{ color: var(--theme-palette-color-7); }

.dem-subtitle{
  font-size: 16px; margin: 0 0 10px; color: var(--dem-subtext);
}
.dem-card--dark .dem-subtitle{ color: #efefef; opacity: .9; }

.dem-grid{
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: auto 48px;
  gap: 16px;
}

.dem-kpi{
  display:flex; flex-direction:column; align-items:flex-start; justify-content:center;
  padding:8px 12px; background: var(--dem-chip); border-radius:14px;
}
.dem-card--dark .dem-kpi{ background: rgba(255,255,255,.06); }
.dem-kpi-value{ font-size: 44px; font-weight:800; line-height:1; }
.dem-kpi-sub{ font-size:12px; color: var(--dem-subtext); margin-top:6px; }
.dem-card--dark .dem-kpi-sub{ color: #ddd; opacity:.8; }
.dem-kpi-meta{ font-size:12px; color:#8b8f96; margin-top:4px; }
.dem-card--dark .dem-kpi-meta{ color:#cfcfcf; opacity:.8; }

.dem-trend{
  background: var(--theme-palette-color-7);
  border:1px solid var(--dem-border);
  border-radius:14px; padding:8px;
}
.dem-card--dark .dem-trend{
  background: transparent; border-color: rgba(255,255,255,.12);
}

.dem-spark{
  background: var(--theme-palette-color-7);
  border:1px dashed var(--dem-border);
  border-radius:10px; padding:6px; grid-column:1 / span 2;
}
.dem-card--dark .dem-spark{ background: transparent; border-color: rgba(255,255,255,.12); }

.dem-flex{ display:flex; gap:24px; flex-wrap:wrap; }
.dem-list{ flex:1 1 320px; min-width:280px; }

.dem-row{
  display:grid;
  grid-template-columns: 1fr 1fr 35px;
  align-items:center; gap:10px; padding:6px 0;
}
/* .dem-row-title b{ } */
.dem-row-title em{ color:#9ca3af; font-style:normal; margin-left:6px; }
.dem-card--dark .dem-row-title em{ color:#d1d5db; opacity:.8; }

.dem-bar{
  position:relative; height:8px; background:var(--dem-border);
  border-radius:6px; overflow:hidden;
}
.dem-card--dark .dem-bar{ background: rgba(255,255,255,.12); }
.dem-bar span{
  position:absolute; inset:0 auto 0 0; height:100%; border-radius:6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--dem-accent) 55%, white), var(--dem-accent));
}
.dem-delta{ text-align:right; font-weight:700; }
.dem-delta.pos{ color:#16a34a; }  /* keep clarity for change sign */
.dem-delta.neg{ color:#dc2626; }

@media (max-width: 640px){
  .dem-grid{ grid-template-columns: 1fr; grid-template-rows: auto auto 48px; }
}
/* --- Groups (homepage) --- */
.dem-groups--grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:20px;
}
.dem-group{
  background: var(--theme-palette-color-7);
  border: 1px solid var(--dem-border);
  border-radius: 14px;
  padding: 14px;
}
.dem-card--dark .dem-group{
  background: transparent;
  border-color: rgba(255,255,255,.12);
}

.dem-group-head{
  display:flex; align-items:baseline; justify-content:space-between;
  margin-bottom: 10px;
}
.dem-group-label{
  font-weight: 700; color: var(--dem-text);
}
.dem-card--dark .dem-group-label{ color: var(--theme-palette-color-7); }
.dem-group-meta{
  font-size: 12px; color: var(--dem-subtext);
}
.dem-card--dark .dem-group-meta{ color:#d1d5db; opacity:.85; }

.dem-group-body .dem-row{ padding:6px 0; }
.dem-group .dem-delta{ text-align:right; color: var(--dem-text); }

@media (max-width: 1024px){
  .dem-groups--grid{ grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 640px){
  .dem-groups--grid{ grid-template-columns: 1fr; }
}
