.template-demo {
  --template-accent: #111111;
  --template-active-accent: var(--template-accent);
  --template-screen-bg: #f5f7fa;
  --template-card-bg: #ffffff;
  --template-border: #d7e0e9;
  --template-text: #20334a;
  --template-muted: #8291a2;
  --template-radius: 8px;
  display: flex;
  height: 440px;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--template-border);
  border-radius: calc(var(--template-radius) + 2px);
  background: var(--template-screen-bg);
}

.template-demo[data-surface="paper"] {
  --template-screen-bg: #fffaf0;
  --template-card-bg: #fffef8;
  --template-border: #e2d7c5;
}

.template-demo[data-surface="soft-gray"] {
  --template-screen-bg: #edf3fa;
  --template-card-bg: #ffffff;
  --template-border: #cbd8e7;
}

.template-demo[data-variant="developer"] {
  --template-active-accent: #8eb5f2;
  --template-screen-bg: #101b2e;
  --template-card-bg: #1a2a43;
  --template-border: #30435f;
  --template-text: #f4f7fb;
  --template-muted: #9aabc1;
}

.template-demo[data-variant="ops"] {
  --template-active-accent: #2454d6;
  --template-screen-bg: #edf4ff;
  --template-card-bg: #ffffff;
  --template-border: #d2deee;
  --template-radius: 13px;
}

.template-demo[data-variant="finance"] {
  --template-active-accent: #0f766e;
  --template-screen-bg: #effcf6;
  --template-card-bg: #ffffff;
  --template-border: #cce7db;
  --template-radius: 9px;
}

.template-demo[data-variant="retail"] {
  --template-active-accent: #e11d48;
  --template-screen-bg: #fff1f4;
  --template-card-bg: #ffffff;
  --template-border: #f0cbd5;
  --template-radius: 16px;
}

.template-demo[data-variant="health"] {
  --template-active-accent: #16a34a;
  --template-screen-bg: #effcf4;
  --template-card-bg: #ffffff;
  --template-border: #cce8d7;
  --template-radius: 16px;
}

.template-demo[data-variant="content"] {
  --template-active-accent: #7c3aed;
  --template-screen-bg: #faf5ff;
  --template-card-bg: #ffffff;
  --template-border: #e3d3fa;
  --template-radius: 13px;
}

.template-demo[data-variant="project"] {
  --template-active-accent: #f97316;
  --template-screen-bg: #fff7ed;
  --template-card-bg: #ffffff;
  --template-border: #f2d4b6;
  --template-radius: 10px;
}

.template-demo[data-variant="campus"] {
  --template-active-accent: #0284c7;
  --template-screen-bg: #effaff;
  --template-card-bg: #ffffff;
  --template-border: #c8e4ef;
  --template-radius: 12px;
}

.template-demo[data-variant="travel"] {
  --template-active-accent: #0f766e;
  --template-screen-bg: #f0fdfa;
  --template-card-bg: #ffffff;
  --template-border: #bce5dc;
  --template-radius: 18px;
}

.template-demo[data-variant="food"] {
  --template-active-accent: #ea580c;
  --template-screen-bg: #fff7ed;
  --template-card-bg: #ffffff;
  --template-border: #fed7aa;
  --template-radius: 20px;
}

.template-demo[data-variant="smart-home"] {
  --template-active-accent: #38bdf8;
  --template-screen-bg: #0b1628;
  --template-card-bg: #142642;
  --template-border: #29476a;
  --template-text: #eff8ff;
  --template-muted: #8da8c5;
  --template-radius: 14px;
}

.template-demo[data-variant="music"] {
  --template-active-accent: #c084fc;
  --template-screen-bg: #151021;
  --template-card-bg: #24183b;
  --template-border: #4c3271;
  --template-text: #fbf7ff;
  --template-muted: #b6a5ce;
  --template-radius: 22px;
}

.template-demo[data-variant="events"] {
  --template-active-accent: #d97706;
  --template-screen-bg: #fffbeb;
  --template-card-bg: #ffffff;
  --template-border: #f4d28d;
  --template-radius: 8px;
}

.template-demo[data-variant="community"] {
  --template-active-accent: #0891b2;
  --template-screen-bg: #ecfeff;
  --template-card-bg: #ffffff;
  --template-border: #b7e6ed;
  --template-radius: 16px;
}

.template-demo[data-shadow="subtle"] {
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
}

.template-app-stage {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}

.template-phone {
  position: relative;
  width: min(190px, calc(100% - 24px));
  height: auto;
  aspect-ratio: 9 / 19.5;
  flex: 0 0 auto;
  border: 4px solid #0f1724;
  border-radius: 29px;
  background: #0f1724;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.2);
}

.template-phone-notch {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 50%;
  width: 56px;
  height: 12px;
  border-radius: 0 0 9px 9px;
  background: #0f1724;
  transform: translateX(-50%);
}

.template-phone-screen {
  position: absolute;
  inset: 4px;
  display: grid;
  grid-template-rows: 22px 34px minmax(0, 1fr) 42px;
  height: auto;
  overflow: hidden;
  border-radius: 24px;
  background: var(--template-screen-bg);
  color: var(--template-text);
}

.template-phone-statusbar,
.template-phone-header,
.template-phone-tabbar,
.template-phone-brand,
.template-phone-statusbar > div,
.template-phone-section-head,
.template-phone-list > div {
  display: flex;
  align-items: center;
}

.template-phone-statusbar {
  justify-content: flex-end;
  gap: 5px;
  padding: 5px 10px 0;
  color: var(--template-muted);
}

.template-phone-statusbar > div {
  gap: 3px;
}

.template-phone-statusbar i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--template-active-accent);
}

.template-phone-header {
  justify-content: space-between;
  gap: 8px;
  padding: 0 11px;
  border-bottom: 1px solid var(--template-border);
  background: var(--template-card-bg);
}

.template-phone-brand {
  min-width: 0;
  gap: 6px;
}

.template-phone-logo {
  display: block;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border-radius: calc(var(--template-radius) - 2px);
  background: var(--template-active-accent);
}

.template-phone-brand strong,
.template-phone-more {
  overflow: hidden;
  color: var(--template-text);
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-phone-more {
  color: var(--template-muted);
  font-size: 12px;
  letter-spacing: 1px;
}

.template-phone-content {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow: hidden;
  padding: 10px 10px 8px;
}

.template-phone-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
}

.template-phone-title span {
  overflow: hidden;
  color: var(--template-muted);
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-phone-title strong {
  color: var(--template-text);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.1;
}

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

.template-phone-kpis article {
  display: grid;
  min-width: 0;
  gap: 2px;
  border: 1px solid var(--template-border);
  border-radius: var(--template-radius);
  background: var(--template-card-bg);
  padding: 5px;
}

.template-phone-kpis article span,
.template-phone-kpis article i {
  overflow: hidden;
  color: var(--template-muted);
  font-size: 8px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-phone-kpis article strong {
  overflow: hidden;
  color: var(--template-text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-phone-kpis article i {
  color: #16824d;
}

.template-phone-kpis article i.muted {
  color: var(--template-muted);
}

.template-phone-section-head {
  justify-content: space-between;
  gap: 6px;
  margin-top: 1px;
}

.template-phone-section-head strong {
  color: var(--template-text);
  font-size: 9px;
}

.template-phone-section-head span {
  color: var(--template-muted);
  font-size: 8px;
}

.template-phone-chart {
  position: relative;
  height: 58px;
  overflow: hidden;
  border: 1px solid var(--template-border);
  border-radius: var(--template-radius);
  background:
    linear-gradient(rgba(157, 174, 193, 0.18) 1px, transparent 1px) 0 13px / 100% 13px,
    var(--template-card-bg);
}

.template-phone-line,
.template-phone-area {
  display: none;
  width: 100%;
  height: 100%;
  color: var(--template-active-accent);
}

.template-phone-line polyline,
.template-phone-area polyline {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.template-phone-area path {
  fill: currentColor;
  opacity: 0.18;
}

.template-demo[data-chart="line"] .template-phone-line,
.template-demo[data-chart="area"] .template-phone-area {
  display: block;
}

.template-phone-bars {
  display: none;
  height: 100%;
  align-items: end;
  justify-content: space-around;
  padding: 8px 12px 5px;
}

.template-demo[data-chart="bar"] .template-phone-bars {
  display: flex;
}

.template-phone-bars i {
  display: block;
  width: 8%;
  min-height: 12px;
  border-radius: 4px 4px 1px 1px;
  background: var(--template-active-accent);
}

.template-phone-bars i:nth-child(1) { height: 42%; }
.template-phone-bars i:nth-child(2) { height: 68%; }
.template-phone-bars i:nth-child(3) { height: 52%; }
.template-phone-bars i:nth-child(4) { height: 86%; }
.template-phone-bars i:nth-child(5) { height: 61%; }
.template-phone-bars i:nth-child(6) { height: 74%; }
.template-phone-bars i:nth-child(7) { height: 92%; }

