/* TG Automation — Telegram x Apple glass design system */
:root {
  color-scheme: dark;
  --bg: #050b17;
  --bg-deep: #020711;
  --panel: rgba(14, 25, 43, .72);
  --panel2: rgba(19, 34, 57, .76);
  --glass: rgba(18, 31, 52, .58);
  --glass-heavy: rgba(9, 18, 33, .84);
  --glass-light: rgba(255, 255, 255, .055);
  --line: rgba(197, 221, 255, .14);
  --line-strong: rgba(197, 221, 255, .24);
  --text: #f6f9ff;
  --muted: #a6b6cb;
  --blue: #2aabee;
  --blue-strong: #168bd2;
  --blue-soft: rgba(42, 171, 238, .16);
  --green: #31d57c;
  --amber: #ffb648;
  --red: #ff6474;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --shadow-card: 0 24px 70px rgba(0, 5, 15, .28), inset 0 1px 0 rgba(255, 255, 255, .075);
  --shadow-float: 0 18px 55px rgba(0, 5, 15, .46), inset 0 1px 0 rgba(255, 255, 255, .1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", system-ui, sans-serif;
  font-optical-sizing: auto;
}

* { scrollbar-color: rgba(148, 181, 218, .32) transparent; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(900px 620px at 5% -8%, rgba(42, 171, 238, .20), transparent 62%),
    radial-gradient(760px 560px at 94% 12%, rgba(93, 92, 222, .17), transparent 62%),
    radial-gradient(620px 520px at 52% 96%, rgba(49, 213, 124, .08), transparent 64%),
    linear-gradient(155deg, #07111f 0%, var(--bg) 48%, var(--bg-deep) 100%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(1px);
  pointer-events: none;
}

body::before {
  width: 280px;
  height: 280px;
  left: -110px;
  top: 35%;
  background: rgba(42, 171, 238, .065);
  box-shadow: 0 0 120px 55px rgba(42, 171, 238, .08);
}

body::after {
  width: 240px;
  height: 240px;
  right: -100px;
  bottom: 10%;
  background: rgba(120, 106, 255, .06);
  box-shadow: 0 0 120px 55px rgba(120, 106, 255, .07);
}

::selection { background: rgba(42, 171, 238, .38); color: #fff; }

.skip-link {
  position: fixed;
  z-index: 100;
  left: 20px;
  top: 12px;
  padding: 11px 16px;
  border-radius: 12px;
  color: #fff;
  background: #168bd2;
  box-shadow: var(--shadow-float);
  transform: translateY(-160%);
  transition: transform .2s var(--ease-out);
}

.skip-link:focus { transform: translateY(0); }

.top {
  position: sticky;
  top: 12px;
  width: min(1408px, calc(100% - 32px));
  height: 68px;
  margin: 12px auto 0;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(8, 17, 31, .64);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
  box-shadow: var(--shadow-float);
}

.brand { gap: 11px; }
.brand h1 { font-size: 16px; font-weight: 750; letter-spacing: -.018em; }
.brand p { color: var(--muted); font-size: 11px; letter-spacing: .01em; }

.logo {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 14px;
  background: linear-gradient(145deg, #47c7ff 0%, #168bd2 55%, #2575dc 100%);
  box-shadow: 0 9px 26px rgba(42, 171, 238, .28), inset 0 1px 0 rgba(255, 255, 255, .32);
}

.statusline { gap: 10px; color: var(--muted); font-size: 12px; }
.dot { width: 7px; height: 7px; background: var(--amber); box-shadow: 0 0 0 4px rgba(255, 182, 72, .13), 0 0 16px rgba(255, 182, 72, .4); }
.dot.on { background: var(--green); box-shadow: 0 0 0 4px rgba(49, 213, 124, .13), 0 0 16px rgba(49, 213, 124, .42); }

.tabs {
  position: sticky;
  top: 90px;
  z-index: 19;
  width: min(1408px, calc(100% - 32px));
  margin: 10px auto 0;
  padding: 7px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(8, 17, 31, .57);
  -webkit-backdrop-filter: blur(24px) saturate(165%);
  backdrop-filter: blur(24px) saturate(165%);
  box-shadow: 0 14px 40px rgba(0, 5, 15, .22), inset 0 1px 0 rgba(255, 255, 255, .055);
}

.tab {
  min-height: 44px;
  flex: 1 0 auto;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 12px;
  color: #aebcd0;
  font-size: 13px;
  font-weight: 650;
  transition: color .2s var(--ease-out), background .2s var(--ease-out), box-shadow .2s var(--ease-out), transform .1s ease-out;
}

.tab:hover { color: #fff; background: rgba(255, 255, 255, .065); }
.tab:active { transform: scale(.97); }
.tab[aria-selected="true"] {
  color: #fff;
  border-color: rgba(120, 211, 255, .26);
  background: linear-gradient(145deg, rgba(42, 171, 238, .92), rgba(31, 128, 216, .93));
  box-shadow: 0 8px 22px rgba(42, 171, 238, .22), inset 0 1px 0 rgba(255, 255, 255, .24);
}

.tab .icon { width: 18px; height: 18px; }

main { width: min(1408px, 100%); padding: 42px clamp(16px, 3vw, 38px) 84px; }

.panel { animation: materialize .38s var(--ease-out); transform-origin: 50% 0; }
@keyframes materialize {
  from { opacity: 0; transform: translateY(8px) scale(.995); filter: blur(5px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

.head { align-items: flex-end; margin-bottom: 26px; }
.head > div { max-width: 850px; }
.kicker { margin-bottom: 8px; color: #65c9fb; font-size: 11px; font-weight: 780; letter-spacing: .13em; }
.head h2 { font-size: clamp(27px, 3.1vw, 40px); line-height: 1.08; letter-spacing: -.045em; font-weight: 760; }
.lead { max-width: 780px; margin-top: 9px; color: var(--muted); font-size: 14px; line-height: 1.58; }

.grid { gap: 18px; }

.card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(24, 41, 67, .66), rgba(9, 18, 33, .65));
  -webkit-backdrop-filter: blur(30px) saturate(145%);
  backdrop-filter: blur(30px) saturate(145%);
  box-shadow: var(--shadow-card);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
  pointer-events: none;
}

.cardhead { margin-bottom: 20px; }
.card h3 { font-size: 16px; font-weight: 720; letter-spacing: -.015em; }
.sub { margin-top: 6px; color: var(--muted); line-height: 1.5; }

.metric {
  min-height: 154px;
  padding: 20px;
  isolation: isolate;
  transition: border-color .25s var(--ease-out), transform .25s var(--ease-out), box-shadow .25s var(--ease-out);
}

.metric::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 110px;
  height: 110px;
  right: -34px;
  bottom: -48px;
  border-radius: 50%;
  background: rgba(42, 171, 238, .18);
  filter: blur(22px);
}

.metric:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 28px 72px rgba(0, 6, 18, .36), inset 0 1px 0 rgba(255, 255, 255, .1); }
.metric label { color: #b4c2d6; font-size: 12px; letter-spacing: .015em; }
.metric strong { margin: 14px 0 4px; font-size: 36px; line-height: 1; font-weight: 760; letter-spacing: -.055em; }
.metric small { font-size: 12px; }

.steps { gap: 14px; }
.step {
  padding: 17px;
  border: 1px solid rgba(197, 221, 255, .11);
  border-radius: var(--radius-md);
  background: rgba(5, 13, 25, .47);
}
.step b, .flowitem b {
  background: linear-gradient(145deg, #43bff7, #168bd2);
  box-shadow: 0 7px 20px rgba(42, 171, 238, .22), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.step h4 { margin-top: 15px; font-size: 14px; }
.step p { color: var(--muted); line-height: 1.55; }

.flow { gap: 11px; }
.flowitem {
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding: 14px;
  border-color: rgba(197, 221, 255, .11);
  border-radius: 15px;
  background: rgba(5, 13, 25, .48);
}
.flowitem b { width: 34px; height: 34px; border-radius: 11px; }
.flowitem strong { font-size: 13px; }
.flowitem p { color: var(--muted); line-height: 1.5; }

.field { margin-bottom: 16px; }
label { margin-bottom: 8px; color: #d7e1ee; font-size: 12px; font-weight: 650; letter-spacing: .008em; }
.hint { margin-top: 7px; color: #8fa2ba; }

input, select, textarea {
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid rgba(197, 221, 255, .14);
  border-radius: 13px;
  color: var(--text);
  background: rgba(3, 10, 21, .70);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025), 0 1px 0 rgba(255, 255, 255, .02);
  caret-color: #58c7ff;
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out), box-shadow .2s var(--ease-out);
}

input:hover, select:hover, textarea:hover { border-color: rgba(197, 221, 255, .24); background: rgba(5, 13, 27, .79); }
input:focus, select:focus, textarea:focus {
  border-color: rgba(75, 190, 248, .78);
  background: rgba(4, 12, 25, .92);
  box-shadow: 0 0 0 4px rgba(42, 171, 238, .14), inset 0 1px 0 rgba(255, 255, 255, .04);
}
input::placeholder, textarea::placeholder { color: #687d98; }
input:disabled { color: #9babc0; background: rgba(255, 255, 255, .035); }
textarea { min-height: 104px; }
select option { color: var(--text); background: #0b1729; }
input[type="file"] { padding: 6px 8px; }
input[type="file"]::file-selector-button {
  min-height: 32px;
  margin-right: 10px;
  padding: 7px 11px;
  border: 1px solid rgba(197, 221, 255, .15);
  border-radius: 9px;
  color: #e8f5ff;
  background: rgba(42, 171, 238, .13);
  cursor: pointer;
  transition: background .18s var(--ease-out), border-color .18s var(--ease-out);
}
input[type="file"]::file-selector-button:hover { border-color: rgba(93, 205, 255, .4); background: rgba(42, 171, 238, .2); }

input[type="checkbox"] {
  width: 19px;
  height: 19px;
  min-height: 19px;
  accent-color: var(--blue);
}
.check { min-height: 44px; gap: 10px; }

.btn {
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 13px;
  background: linear-gradient(145deg, #38b8f4, #178bcf);
  box-shadow: 0 9px 24px rgba(42, 171, 238, .21), inset 0 1px 0 rgba(255, 255, 255, .24);
  color: #fff;
  font-size: 13px;
  font-weight: 720;
  transition: filter .2s var(--ease-out), box-shadow .2s var(--ease-out), transform .1s ease-out, opacity .2s ease;
}
.btn:hover { filter: brightness(1.08); box-shadow: 0 12px 30px rgba(42, 171, 238, .28), inset 0 1px 0 rgba(255, 255, 255, .26); }
.btn:active { transform: scale(.975); }
.btn.green { background: linear-gradient(145deg, #3abcf4, #168bd2); box-shadow: 0 10px 28px rgba(42, 171, 238, .23), inset 0 1px 0 rgba(255, 255, 255, .24); }
.btn.soft {
  color: #dce9f7;
  border-color: rgba(197, 221, 255, .14);
  background: rgba(255, 255, 255, .065);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.btn.soft:hover { background: rgba(255, 255, 255, .1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09); }
.btn.danger { color: #ffd7dc; border-color: rgba(255, 100, 116, .26); background: rgba(255, 100, 116, .12); box-shadow: none; }
.btn.small { min-height: 38px; border-radius: 11px; font-size: 12px; }
.btn:disabled { opacity: .42; filter: saturate(.55); box-shadow: none; }

.notice {
  padding: 14px 15px;
  border-color: rgba(76, 191, 248, .22);
  border-radius: 14px;
  background: rgba(42, 171, 238, .09);
  color: #dcefff;
}
.notice.ok { border-color: rgba(49, 213, 124, .25); background: rgba(49, 213, 124, .09); color: #c9ffe2; }
.notice.warn { border-color: rgba(255, 182, 72, .24); background: rgba(255, 182, 72, .08); color: #ffe5b6; }

.tablewrap {
  border-color: rgba(197, 221, 255, .12);
  border-radius: 16px;
  background: rgba(3, 10, 21, .35);
}
table { font-size: 12px; }
th, td { padding: 13px 14px; border-bottom-color: rgba(197, 221, 255, .09); }
th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #95a9c1;
  background: rgba(7, 15, 28, .94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: rgba(42, 171, 238, .055); }

.badge { border: 1px solid rgba(197, 221, 255, .07); background: rgba(163, 184, 211, .10); color: #d1dbea; }
.badge.active, .badge.completed, .badge.running { border-color: rgba(49, 213, 124, .16); background: rgba(49, 213, 124, .12); color: #9af1bf; }
.badge.failed, .badge.error, .badge.unauthorized { border-color: rgba(255, 100, 116, .17); background: rgba(255, 100, 116, .11); color: #ffb3bd; }
.badge.waiting, .badge.paused, .badge.limited { border-color: rgba(255, 182, 72, .17); background: rgba(255, 182, 72, .11); color: #ffd58f; }

.progress { height: 6px; background: rgba(2, 8, 17, .85); }
.progress i { background: linear-gradient(90deg, #2aabee, #31d57c); box-shadow: 0 0 12px rgba(42, 171, 238, .24); }

.drop {
  min-height: 250px;
  border-color: rgba(79, 193, 249, .42);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(42, 171, 238, .095), rgba(80, 96, 222, .055));
}
.drop:hover, .drop.drag { border-color: #52c3fa; background: linear-gradient(145deg, rgba(42, 171, 238, .14), rgba(49, 213, 124, .065)); }
.uploadicon { border: 1px solid rgba(87, 199, 252, .17); border-radius: 17px; background: rgba(42, 171, 238, .12); color: #70d0ff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
.filerow { border-color: rgba(197, 221, 255, .11); border-radius: 13px; background: rgba(3, 10, 21, .6); }

.choicegrid { gap: 14px; }
.choice {
  min-height: 158px;
  padding: 18px;
  border-color: rgba(197, 221, 255, .13);
  border-radius: 18px;
  background: rgba(3, 10, 21, .55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
  transition: border-color .22s var(--ease-out), background .22s var(--ease-out), transform .1s ease-out, box-shadow .22s var(--ease-out);
}
.choice:hover { border-color: rgba(91, 199, 251, .45); background: rgba(8, 22, 40, .65); }
.choice:active { transform: scale(.985); }
.choice.selected {
  border-color: rgba(115, 214, 255, .62);
  background: linear-gradient(145deg, rgba(42, 171, 238, .88), rgba(54, 80, 188, .82));
  box-shadow: 0 16px 38px rgba(28, 121, 207, .22), inset 0 1px 0 rgba(255, 255, 255, .24);
}
.choice strong { font-size: 14px; }
.choice p { margin-top: 12px; color: #aebdd1; line-height: 1.55; }
.choice .radio { border-color: #7891ad; }

.wizardsteps { gap: 8px; }
.wizardsteps span {
  padding: 10px 12px;
  border: 1px solid rgba(197, 221, 255, .07);
  border-radius: 11px;
  background: rgba(255, 255, 255, .035);
}
.wizardsteps span:first-child { border-color: rgba(42, 171, 238, .15); background: rgba(42, 171, 238, .12); color: #82d5ff; }

dialog {
  width: min(700px, calc(100% - 28px));
  border-color: rgba(197, 221, 255, .2);
  border-radius: 24px;
  background: rgba(10, 20, 36, .78);
  -webkit-backdrop-filter: blur(38px) saturate(155%);
  backdrop-filter: blur(38px) saturate(155%);
  box-shadow: 0 35px 110px rgba(0, 3, 11, .68), inset 0 1px 0 rgba(255, 255, 255, .11);
}
dialog[open] { animation: dialog-in .3s var(--ease-out); }
dialog::backdrop { background: rgba(0, 5, 14, .65); -webkit-backdrop-filter: blur(10px) saturate(90%); backdrop-filter: blur(10px) saturate(90%); }
@keyframes dialog-in { from { opacity: 0; transform: scale(.965) translateY(10px); filter: blur(7px); } to { opacity: 1; transform: none; filter: blur(0); } }
.dialog { padding: 24px; }
.dialoghead { align-items: flex-start; margin-bottom: 20px; }
.dialoghead h3 { font-size: 18px; letter-spacing: -.02em; }
.close { width: 44px; height: 44px; border: 1px solid transparent; border-radius: 13px; }
.close:hover { color: #fff; border-color: var(--line); background: rgba(255, 255, 255, .07); }
pre { border-color: var(--line); border-radius: 14px; background: rgba(1, 6, 14, .82); }

.toast {
  right: 22px;
  bottom: 22px;
  padding: 14px 17px;
  border-color: var(--line-strong);
  border-radius: 15px;
  background: rgba(20, 38, 62, .82);
  -webkit-backdrop-filter: blur(24px) saturate(155%);
  backdrop-filter: blur(24px) saturate(155%);
  box-shadow: var(--shadow-float);
}
.toast.show { transform: translateY(0) scale(1); }
.toast.bad { border-color: rgba(255, 100, 116, .28); background: rgba(72, 22, 35, .88); }

:where(button, input, select, textarea, a):focus-visible {
  outline: 3px solid rgba(94, 202, 255, .8);
  outline-offset: 3px;
}

@media (max-width: 1020px) {
  .top, .tabs { width: calc(100% - 24px); }
  .tab { padding-inline: 11px; }
  .tab span { font-size: 12px; }
  main { padding-top: 34px; }
}

@media (max-width: 700px) {
  .top {
    top: 8px;
    width: calc(100% - 20px);
    height: 60px;
    margin-top: 8px;
    padding: 0 12px;
    border-radius: 18px;
  }
  .logo { width: 38px; height: 38px; border-radius: 13px; }
  .brand h1 { font-size: 15px; }
  .statusline { gap: 7px; }
  .statusline .btn { min-width: 44px; padding: 9px 11px; }

  .tabs {
    position: fixed;
    inset: auto 10px calc(10px + env(safe-area-inset-bottom));
    z-index: 40;
    width: auto;
    margin: 0;
    padding: 6px;
    gap: 3px;
    border-radius: 20px;
    background: rgba(7, 16, 30, .76);
    box-shadow: 0 22px 70px rgba(0, 3, 12, .64), inset 0 1px 0 rgba(255, 255, 255, .1);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    backdrop-filter: blur(30px) saturate(180%);
  }
  .tab { min-width: 48px; min-height: 48px; flex: 0 0 48px; padding: 0; border-radius: 15px; }
  .tab .icon { width: 20px; height: 20px; }
  main { padding: 34px 14px calc(112px + env(safe-area-inset-bottom)); }
  .head { gap: 14px; margin-bottom: 22px; }
  .head h2 { font-size: clamp(27px, 9vw, 34px); }
  .lead { font-size: 13px; }
  .card { padding: 17px; border-radius: 20px; }
  .metric { min-height: 140px; }
  .metric strong { font-size: 32px; }
  .choice { min-height: 118px; padding: 16px; }
  .dialog { padding: 19px; }
  .toast { right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .statusline > .dot { display: none; }
  .card { padding: 15px; }
  .row { gap: 0; }
  .metric { min-height: 128px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .panel, dialog[open] { transform: none !important; filter: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .top, .tabs, .card, dialog, .toast { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .top, .tabs { background: #0b1729; }
  .card { background: #101e32; }
  dialog, .toast { background: #0e1b2e; }
}

@media (prefers-contrast: more) {
  :root { --muted: #c5d1df; --line: rgba(255, 255, 255, .32); --line-strong: rgba(255, 255, 255, .52); }
  .top, .tabs, .card, dialog { background-color: rgba(5, 13, 25, .94); }
  input, select, textarea { border-width: 2px; }
}
