:root {
  --bg: #060a14;
  --screen: #10182a;
  --screen-2: #131d31;
  --card: rgba(33, 41, 64, 0.88);
  --card-edge: rgba(181, 193, 232, 0.16);
  --text: #f5f7ff;
  --muted: #96a3c2;
  --muted-2: #7280a3;
  --green: #7ff0b9;
  --cyan: #66e5da;
  --violet: #a98bff;
  --blue: #84a9ff;
  --red: #ff8181;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: #000;
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.phone-stage {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 18px 10px 28px;
  background: radial-gradient(circle at 50% -5%, rgba(55, 76, 128, 0.22), transparent 34%), #02050c;
}
.iphone-shell {
  width: 100%;
  max-width: 610px;
}
.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 12px 0;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
}
.statusbar-right {
  font-size: 15px;
  letter-spacing: 0.04em;
}
.carrier-row {
  padding: 2px 12px 10px;
  font-size: 12px;
  color: #f3f5fb;
}
.app-surface {
  background: linear-gradient(180deg, #0c1323 0%, #0b1220 100%);
  border-radius: 38px;
  padding: 14px 10px 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 24px 64px rgba(0,0,0,0.45);
}
.miniapp-header {
  display: grid;
  grid-template-columns: 90px 1fr 44px;
  align-items: center;
  gap: 8px;
}
.miniapp-close {
  font-size: 18px;
  color: #f0f2fa;
}
.miniapp-center {
  text-align: center;
}
.miniapp-center h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.08;
  font-weight: 700;
}
.miniapp-subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.miniapp-menu {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.035);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.top-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.top-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 0;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.025);
}
.top-pill.ok { color: #9bf0b7; border-color: rgba(74, 222, 128, 0.3); background: rgba(34,197,94,.07); }
.top-pill.warn { color: #fde68a; border-color: rgba(250, 204, 21, 0.28); background: rgba(250,204,21,.08); }
.top-pill.danger { color: #fca5a5; border-color: rgba(248, 113, 113, 0.28); background: rgba(248,113,113,.08); }
.top-pill.wide { justify-content: flex-start; text-align: left; }
.glass-card {
  background: linear-gradient(180deg, rgba(39, 48, 73, 0.88), rgba(27, 35, 55, 0.94));
  border: 1px solid rgba(181, 193, 232, 0.13);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 10px 26px rgba(0,0,0,.2);
}
.limit-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.limit-card {
  padding: 14px 14px 12px;
  min-height: 183px;
}
.limit-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.limit-provider-row,
.agent-name-row,
.agent-mini-head,
.legend-main {
  display: flex;
  align-items: center;
}
.limit-provider-row { gap: 10px; }
.dot, .small-online {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.dot.green, .small-online.green { background: var(--green); box-shadow: 0 0 10px rgba(127,240,185,.7); }
.dot.cyan { background: var(--cyan); box-shadow: 0 0 10px rgba(102,229,218,.7); }
.dot.violet { background: var(--violet); box-shadow: 0 0 10px rgba(169,139,255,.7); }
.dot.red { background: var(--red); box-shadow: 0 0 10px rgba(255,129,129,.7); }
.limit-provider {
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.limit-extra {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.25;
  color: rgba(219,231,255,0.66);
  overflow-wrap: anywhere;
}
.limit-reset,
.limit-week-label,
.limit-week-row,
.progress-scale,
.agent-mini-age,
.agent-mini-model,
.agent-mini-host,
.chart-subtitle,
.legend-src,
.cron-job-meta,
.cron-next {
  color: var(--muted);
}
.limit-reset {
  margin-top: 4px;
  font-size: 12px;
}
.limit-percent {
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
}
.limit-percent.ok { color: var(--green); }
.limit-percent.limit { color: var(--violet); }
.limit-percent.reauthorize { color: var(--red); }
.progress-track {
  margin-top: 12px;
  height: 11px;
  border-radius: 999px;
  background: #141c2d;
  overflow: hidden;
}
.progress-track.secondary { margin-top: 8px; }
.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b492ff 0%, #8f77ff 100%);
}
.progress-fill.ok { background: linear-gradient(90deg, #70e7b5 0%, #56ead3 100%); }
.progress-fill.limit { background: linear-gradient(90deg, #58ebd9 0%, #8af0de 100%); }
.progress-fill.reauthorize { background: linear-gradient(90deg, #ff8a8a 0%, #ffb36d 100%); }
.progress-fill.secondary { background: linear-gradient(90deg, #5eead4 0%, #77f1c8 100%); }
.progress-scale {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  font-size: 11px;
}
.progress-scale span:last-child { text-align: right; }
.limit-week-label {
  margin-top: 16px;
  padding-top: 11px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
}
.limit-week-row {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.section-title {
  margin: 18px 4px 10px;
  font-size: 22px;
  line-height: 1.06;
  font-weight: 780;
  letter-spacing: -0.02em;
}
.section-title.inside { margin: 0 0 10px; }
.agents-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.agent-mini-card {
  padding: 14px;
  min-height: 155px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.065);
}
.agent-mini-head {
  align-items: flex-start;
  gap: 10px;
}
.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 20px rgba(0,0,0,.18);
}
.agent-avatar.violet { background: linear-gradient(135deg, #e9a4ff, #9d8cff); }
.agent-avatar.green { background: linear-gradient(135deg, #95f7c0, #72dfec); }
.agent-avatar.cyan { background: linear-gradient(135deg, #88ecff, #8ea8ff); }
.agent-avatar.blue { background: linear-gradient(135deg, #8db2ff, #8a8eff); }
.agent-head-copy { min-width: 0; }
.agent-name-row { gap: 6px; min-width: 0; }
.agent-mini-name {
  min-width: 0;
  font-size: 14px;
  line-height: 1.18;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.agent-mini-age {
  margin-top: 2px;
  font-size: 12px;
}
.agent-mini-model,
.agent-mini-host {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.agent-mini-tokens {
  margin-top: 10px;
  color: #74e9d6;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.chart-card {
  margin-top: 16px;
  padding: 16px 14px 14px;
}
.chart-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.chart-title {
  font-size: 19px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.chart-subtitle {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.3;
}
.chart-filter {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  color: #e9ecf7;
  background: rgba(255,255,255,0.03);
}
.chart-layout {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 14px;
  align-items: stretch;
}
.chart-left {
  position: relative;
  min-height: 210px;
  padding-left: 38px;
  padding-right: 8px;
  padding-top: 10px;
  padding-bottom: 28px;
}
.chart-gridline {
  position: absolute;
  left: 38px;
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.08);
}
.chart-g1 { top: 24px; }
.chart-g2 { top: 68px; }
.chart-g3 { top: 112px; }
.chart-g4 { top: 156px; }
.chart-ylabels {
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 24px;
  width: 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}
.chart-bars {
  position: relative;
  z-index: 1;
  height: 150px;
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 8px 8px 0;
}
.chart-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  width: 18px;
}
.chart-bar-stack {
  position: relative;
  width: 16px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chart-bar-main,
.chart-bar-accent {
  position: absolute;
  bottom: 0;
  width: 12px;
  border-radius: 7px 7px 0 0;
}
.chart-bar-accent {
  width: 12px;
  opacity: 0.95;
  filter: saturate(1.1);
}
.chart-xlab {
  margin-top: 8px;
  font-size: 10px;
  color: transparent;
}
.chart-xlabels {
  display: flex;
  justify-content: space-between;
  margin-left: 6px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}
.chart-legend {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.legend-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.legend-main { gap: 9px; }
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex: 0 0 auto;
}
.legend-name {
  font-size: 14px;
  color: #edf1fa;
}
.legend-src {
  margin-top: 2px;
  font-size: 12px;
}
.legend-value {
  font-size: 14px;
  font-weight: 700;
  color: #eef2fb;
}
.legend-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 12px;
  margin-top: 4px;
  font-size: 14px;
}
.cron-card {
  margin-top: 16px;
  padding: 16px 14px 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}
.cron-list {
  margin-top: 6px;
}
.cron-row {
  display: grid;
  grid-template-columns: 70px 1fr 94px 92px;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.cron-row:first-child { border-top: 0; }
.cron-time {
  font-size: 13px;
  color: var(--muted);
}
.cron-job-title {
  font-size: 14px;
  line-height: 1.25;
  font-weight: 700;
  color: #f3f6fd;
  overflow-wrap: anywhere;
}
.cron-job-meta {
  margin-top: 3px;
  font-size: 12px;
}
.cron-badge {
  text-align: center;
  border-radius: 10px;
  padding: 8px 8px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.12);
}
.cron-badge.active {
  color: #9cf1b8;
  border-color: rgba(74, 222, 128, 0.28);
  background: rgba(34,197,94,.08);
}
.cron-badge.paused {
  color: #f7d46c;
  background: rgba(245,158,11,.08);
}
.cron-next {
  text-align: right;
  font-size: 13px;
}
.accounts-card {
  margin-top: 14px;
  padding: 16px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}
.accounts-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.accounts-head > div:first-child,
.chart-card-head > div:first-child,
.cron-copy,
.legend-main > div {
  min-width: 0;
}
.accounts-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.mini-stat {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #dbe7ff;
  background: rgba(255,255,255,0.06);
}
.mini-stat.ok { background: rgba(52, 211, 153, 0.16); color: #86efac; }
.mini-stat.warn { background: rgba(250, 204, 21, 0.16); color: #fde68a; }
.mini-stat.danger { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
.mini-stat.neutral { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
.account-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-row {
  border-radius: 20px;
  padding: 12px 12px 11px;
  background: linear-gradient(180deg, rgba(255,255,255,0.038), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.028);
}
.account-row-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.account-name {
  font-size: 14px;
  font-weight: 700;
  color: #f8fbff;
  letter-spacing: -0.01em;
}
.account-extra {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
  color: rgba(219,231,255,0.66);
  word-break: break-all;
}
.account-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
  text-align: right;
  color: rgba(219,231,255,0.9);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.07);
  max-width: 132px;
}
.account-metrics {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.metric-chip {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  color: rgba(219,231,255,0.84);
  background: rgba(255,255,255,0.045);
}
.metric-chip.primary {
  background: rgba(94,234,212,0.11);
  color: #c8fff3;
}
.metric-chip.subtle {
  color: rgba(219,231,255,0.72);
}
@media (max-width: 640px) {
  .phone-stage { padding: 0; }
  .iphone-shell { max-width: 100%; }
  .statusbar, .carrier-row { padding-left: 16px; padding-right: 16px; }
  .app-surface { border-radius: 32px 32px 0 0; min-height: calc(100vh - 38px); padding: 14px 9px 18px; }
  .miniapp-header { grid-template-columns: 72px 1fr 36px; gap: 6px; }
  .miniapp-close { font-size: 16px; }
  .miniapp-center h1 { font-size: 20px; }
  .miniapp-subtitle { font-size: 11px; }
  .limit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .limit-card { padding: 12px 12px 11px; min-height: 174px; }
  .agents-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-layout { grid-template-columns: 1fr; }
  .chart-card-head { align-items: flex-start; }
  .cron-row { grid-template-columns: 58px minmax(0,1fr); gap: 8px; }
  .cron-badge { justify-self: start; }
  .cron-next { text-align: left; }
}
@media (max-width: 560px) {
  .top-pills { gap: 5px; }
  .top-pill { min-height: 27px; padding: 0 9px; font-size: 10px; }
  .limit-card { min-height: 170px; }
  .limit-provider { font-size: 14px; }
  .limit-percent { font-size: 15px; }
  .progress-scale { font-size: 10px; }
  .section-title { font-size: 20px; }
  .agent-mini-card { min-height: 142px; padding: 11px; }
  .chart-title { font-size: 18px; }
  .chart-filter { padding: 5px 8px; font-size: 11px; }
  .accounts-head { flex-direction: column; }
  .accounts-stats { justify-content: flex-start; }
  .account-row { padding: 11px 11px 10px; }
  .account-status { max-width: 100%; }
}
@media (max-width: 420px) {
  .app-surface { padding: 13px 8px 16px; }
  .miniapp-header { grid-template-columns: 64px 1fr 32px; }
  .miniapp-center h1 { font-size: 18px; }
  .top-pill.wide { width: 100%; }
  .limit-grid,
  .agents-grid { grid-template-columns: 1fr; }
  .limit-card,
  .agent-mini-card { min-height: auto; }
  .chart-card,
  .accounts-card,
  .cron-card { padding-left: 12px; padding-right: 12px; }
  .chart-bars { gap: 7px; }
  .chart-xlabels { font-size: 10px; }
  .account-row-main { flex-direction: column; align-items: flex-start; gap: 8px; }
  .account-status { text-align: left; }
}
