:root {
  color-scheme: light;
  --canvas: #f3f6f7;
  --surface: #ffffff;
  --surface-subtle: #edf2f4;
  --surface-strong: #18262d;
  --text: #172126;
  --text-muted: #62717a;
  --text-on-strong: #f7fbfc;
  --line: #d9e1e4;
  --line-strong: #c7d1d5;
  --accent: #1387c9;
  --accent-strong: #086ca5;
  --accent-soft: #e7f4fb;
  --green: #16845c;
  --green-soft: #e5f5ee;
  --amber: #a9650a;
  --amber-soft: #fff3dc;
  --red: #c43c4b;
  --red-soft: #fdebed;
  --shadow-low: 0 2px 8px rgb(26 43 51 / 8%);
  --shadow-high: 0 18px 48px rgb(18 34 42 / 20%);
  --radius: 8px;
  --content-width: 760px;
  --bottom-nav-height: 70px;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #10171b;
  --surface: #172126;
  --surface-subtle: #202d33;
  --surface-strong: #0b1114;
  --text: #f1f6f7;
  --text-muted: #9eabb1;
  --text-on-strong: #f7fbfc;
  --line: #2c3a40;
  --line-strong: #3b4b52;
  --accent: #4cb4e8;
  --accent-strong: #78c9ef;
  --accent-soft: #173a4b;
  --green: #59c99a;
  --green-soft: #173d30;
  --amber: #efb45a;
  --amber-soft: #47351c;
  --red: #f07782;
  --red-soft: #48262b;
  --shadow-low: 0 2px 8px rgb(0 0 0 / 20%);
  --shadow-high: 0 18px 48px rgb(0 0 0 / 42%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 280px;
  background: var(--canvas);
  scrollbar-color: var(--line-strong) transparent;
}

body {
  min-width: 280px;
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  margin: 0;
  overflow-x: hidden;
  background: var(--tg-theme-bg-color, var(--canvas));
  color: var(--tg-theme-text-color, var(--text));
  font-family: inherit;
  font-size: 15px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

body.sheet-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button,
[role="button"] {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  stroke-width: 2;
}

.app-shell {
  width: min(var(--content-width), 100%);
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  margin: 0 auto;
  padding:
    calc(14px + var(--tg-content-safe-area-inset-top, 0px))
    max(16px, var(--tg-content-safe-area-inset-right, 0px))
    calc(var(--bottom-nav-height) + 34px + var(--tg-content-safe-area-inset-bottom, 0px))
    max(16px, var(--tg-content-safe-area-inset-left, 0px));
}

.app-header {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand > div {
  display: grid;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.brand-name {
  font-size: 16px;
  line-height: 1.2;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.connection-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  content: "";
}

.connection-status.is-connected::before {
  background: var(--green);
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-subtle);
  color: var(--text);
}

.bot-picker {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.section-label,
.overline {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  text-transform: uppercase;
}

.section-label {
  padding-left: 2px;
}

.segmented-control {
  display: grid;
  min-height: 46px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.segmented-control button {
  display: inline-flex;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 10px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segmented-control button.active {
  background: var(--surface);
  box-shadow: var(--shadow-low);
  color: var(--text);
}

.segmented-control button.active svg {
  color: var(--accent);
}

.app-content {
  min-width: 0;
}

.view {
  animation: view-in 180ms ease-out;
}

.bot-overview {
  display: grid;
  min-height: 132px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--surface-strong) 90%, white);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text-on-strong);
}

.bot-overview__identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.bot-overview__icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 9%);
  color: #7ed6ff;
}

.bot-overview__icon.is-command-bot {
  color: #77d8b2;
}

.bot-overview .overline {
  margin-bottom: 3px;
  color: rgb(247 251 252 / 62%);
}

.bot-overview h1,
.view-heading h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
}

.bot-description {
  max-width: 470px;
  margin: 5px 0 0;
  color: rgb(247 251 252 / 72%);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.command-metric {
  display: grid;
  min-width: 66px;
  justify-items: end;
  padding-left: 16px;
  border-left: 1px solid rgb(255 255 255 / 16%);
}

.command-metric strong {
  font-size: 28px;
  line-height: 1;
}

.command-metric span {
  margin-top: 5px;
  color: rgb(247 251 252 / 62%);
  font-size: 11px;
}

.command-tools {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  gap: 10px;
  margin: 0 -16px 4px;
  padding: 14px 16px 10px;
  background: color-mix(in srgb, var(--tg-theme-bg-color, var(--canvas)) 94%, transparent);
  backdrop-filter: blur(14px);
}

.search-field {
  display: grid;
  min-height: 48px;
  grid-template-columns: 22px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  padding: 0 7px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-low);
  color: var(--text-muted);
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.search-field input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-field input::placeholder {
  color: color-mix(in srgb, var(--text-muted) 82%, transparent);
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  cursor: pointer;
}

.search-clear svg {
  width: 17px;
  height: 17px;
}

.category-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 1px 0 3px;
  scrollbar-width: none;
}

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

.category-tabs button {
  display: inline-flex;
  min-height: 34px;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.category-tabs button span {
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 10px;
}

.category-tabs button svg {
  width: 14px;
  height: 14px;
}

.category-tabs button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.category-tabs button.active span {
  background: var(--accent);
  color: #ffffff;
}

.section-heading {
  display: flex;
  min-height: 52px;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0 10px;
}

.section-heading--compact {
  min-height: auto;
  margin: 0 0 10px;
}

.section-heading h2 {
  margin: 2px 0 0;
  font-size: 17px;
  line-height: 1.25;
}

.results-count {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 12px;
}

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

.command-row {
  display: grid;
  min-width: 0;
  min-height: 76px;
  grid-template-columns: 52px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 11px;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-low);
  transition: border-color 140ms ease, transform 140ms ease;
}

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

.command-icon {
  position: relative;
  overflow: hidden;
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.command-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.command-icon__badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: rgb(8 16 20 / 72%);
  color: #ffffff;
}

.command-icon__badge svg {
  width: 11px;
  height: 11px;
}

.command-icon[data-tone="green"] {
  background: var(--green-soft);
  color: var(--green);
}

.command-icon[data-tone="amber"] {
  background: var(--amber-soft);
  color: var(--amber);
}

.command-icon[data-tone="red"] {
  background: var(--red-soft);
  color: var(--red);
}

.command-summary {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 4px 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.command-name-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.command-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-badge {
  display: inline-flex;
  min-height: 20px;
  flex: 0 0 auto;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.command-summary p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}

.run-command {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  cursor: pointer;
}

.run-command:hover {
  background: var(--accent);
  color: #ffffff;
}

.run-command svg {
  width: 18px;
  height: 18px;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 32px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}

.empty-state > div {
  display: grid;
  max-width: 330px;
  justify-items: center;
}

.empty-state__icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.empty-state strong {
  color: var(--text);
  font-size: 15px;
}

.empty-state p {
  margin: 5px 0 0;
  font-size: 13px;
}

.view-heading {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin: 4px 0 24px;
}

.view-heading__icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green);
}

.view-heading .overline {
  margin: 1px 0 2px;
}

.view-heading p:last-child {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

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

.shortcut-button {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 82px;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-low);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.shortcut-button:hover {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--surface) 90%, var(--surface-subtle));
}

.shortcut-button__icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.shortcut-button:nth-child(3) .shortcut-button__icon,
.shortcut-button:nth-child(4) .shortcut-button__icon {
  background: var(--green-soft);
  color: var(--green);
}

.shortcut-button > span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.shortcut-button strong,
.shortcut-button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shortcut-button strong {
  font-size: 13px;
}

.shortcut-button small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
}

.shortcut-button__arrow {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.admin-manager {
  margin-top: 26px;
}

.admin-mode-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.admin-mode-tabs button {
  display: inline-flex;
  min-width: 0;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-mode-tabs button svg {
  width: 16px;
  height: 16px;
}

.admin-mode-tabs button.active {
  background: var(--surface);
  box-shadow: var(--shadow-low);
  color: var(--text);
}

.admin-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-low);
}

.admin-form {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.form-heading h3 {
  margin: 0;
  font-size: 16px;
}

.form-heading p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: var(--canvas);
  color: var(--text);
  font-weight: 400;
}

.field input {
  height: 46px;
  padding: 0 12px;
}

.field textarea {
  min-height: 112px;
  padding: 11px 12px;
  resize: vertical;
}

.field select {
  height: 46px;
  padding: 0 38px 0 12px;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%) right 17px center / 6px 6px no-repeat,
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%) right 11px center / 6px 6px no-repeat,
    var(--canvas);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.field input::placeholder,
.field textarea::placeholder {
  color: color-mix(in srgb, var(--text-muted) 78%, transparent);
}

.field small {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
}

.input-prefix {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--text-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 15px;
}

.input-prefix > span {
  display: grid;
  height: 28px;
  place-items: center;
  border-right: 1px solid var(--line);
}

.input-prefix input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.input-prefix:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.input-prefix:focus-within input {
  box-shadow: none;
}

.primary-button,
.danger-button {
  display: inline-flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--tg-theme-button-color, var(--accent));
  color: var(--tg-theme-button-text-color, #ffffff);
  cursor: pointer;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button--green {
  background: var(--green);
  color: #ffffff;
}

.danger-button {
  background: var(--red);
  color: #ffffff;
}

.danger-button:hover {
  background: color-mix(in srgb, var(--red) 84%, black);
}

.danger-notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--red) 25%, var(--line));
  border-radius: var(--radius);
  background: var(--red-soft);
  color: var(--red);
  font-size: 11px;
}

.danger-notice svg {
  width: 17px;
  height: 17px;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  width: min(var(--content-width), 100%);
  min-height: calc(var(--bottom-nav-height) + var(--tg-content-safe-area-inset-bottom, 0px));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 auto;
  padding:
    7px
    max(16px, var(--tg-content-safe-area-inset-right, 0px))
    calc(7px + var(--tg-content-safe-area-inset-bottom, 0px))
    max(16px, var(--tg-content-safe-area-inset-left, 0px));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 -8px 24px rgb(24 38 45 / 7%);
  backdrop-filter: blur(18px);
}

.bottom-nav.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.bottom-nav button {
  display: grid;
  min-width: 0;
  min-height: 54px;
  place-items: center;
  align-content: center;
  gap: 3px;
  padding: 5px 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.bottom-nav button svg {
  width: 21px;
  height: 21px;
}

.bottom-nav button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.sheet-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  background: rgb(8 16 20 / 58%);
  animation: fade-in 160ms ease-out;
}

.bottom-sheet {
  position: fixed;
  z-index: 60;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(620px, 100%);
  max-height: min(82vh, 680px);
  margin: 0 auto;
  padding:
    10px
    max(18px, var(--tg-content-safe-area-inset-right, 0px))
    calc(18px + var(--tg-content-safe-area-inset-bottom, 0px))
    max(18px, var(--tg-content-safe-area-inset-left, 0px));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-high);
  animation: sheet-in 210ms ease-out;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: var(--line-strong);
}

.sheet-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 11px;
}

.sheet-header h2 {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 20px;
}

.command-category {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sheet-description {
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.sheet-preview {
  display: grid;
  margin: 0 0 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.sheet-preview img,
.sheet-preview video {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #000000;
}

.sheet-preview audio {
  width: calc(100% - 24px);
  margin: 12px;
}

.sheet-preview__text {
  margin: 0;
  padding: 14px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  white-space: pre-wrap;
}

.command-details {
  display: grid;
  margin: 0;
  border-top: 1px solid var(--line);
}

.command-details > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.command-details dt {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
}

.command-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  text-align: right;
}

.sheet-execute {
  margin-top: 18px;
}

.toast {
  position: fixed;
  z-index: 80;
  right: 16px;
  bottom: calc(var(--bottom-nav-height) + 16px + var(--tg-content-safe-area-inset-bottom, 0px));
  left: 16px;
  display: flex;
  width: fit-content;
  max-width: min(520px, calc(100% - 32px));
  min-height: 48px;
  align-items: center;
  gap: 9px;
  margin: 0 auto;
  padding: 10px 13px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: var(--radius);
  background: #18262d;
  box-shadow: var(--shadow-high);
  color: #f7fbfc;
  font-size: 12px;
  animation: toast-in 180ms ease-out;
}

.toast svg {
  width: 18px;
  height: 18px;
  color: #77d8b2;
}

noscript {
  display: block;
  margin: 24px auto;
  color: var(--text-muted);
  text-align: center;
}

@media (min-width: 760px) {
  body {
    padding: 16px 0;
  }

  .app-shell {
    min-height: calc(100vh - 32px);
    min-height: calc(var(--tg-viewport-stable-height, 100dvh) - 32px);
    border: 1px solid var(--line);
    background: var(--tg-theme-bg-color, var(--canvas));
  }

  .bottom-nav {
    bottom: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .toast {
    bottom: calc(var(--bottom-nav-height) + 32px);
  }
}

@media (max-width: 540px) {
  .bot-overview {
    min-height: 148px;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .command-metric {
    display: flex;
    min-width: 0;
    align-items: baseline;
    justify-items: start;
    gap: 6px;
    padding: 12px 0 0;
    border-top: 1px solid rgb(255 255 255 / 16%);
    border-left: 0;
  }

  .command-metric strong {
    font-size: 22px;
  }

  .command-metric span {
    margin-top: 0;
  }

  .admin-shortcuts {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .command-tools {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .bot-overview {
    padding: 15px;
  }

  .bot-overview__icon {
    display: none;
  }

  .segmented-control button {
    gap: 5px;
    font-size: 12px;
  }

  .segmented-control button svg {
    width: 17px;
    height: 17px;
  }

  .command-row {
    grid-template-columns: 42px minmax(0, 1fr) 38px;
    gap: 8px;
    padding-left: 9px;
  }

  .command-icon,
  .run-command {
    width: 38px;
    height: 38px;
  }

  .admin-mode-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-mode-tabs button {
    gap: 4px;
    padding: 5px;
    font-size: 11px;
  }

  .admin-form {
    padding: 14px;
  }

  .command-details > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .command-details dd {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
