:root {
  color-scheme: dark;
  --bg: #09080d;
  --surface: rgba(21, 22, 27, .84);
  --surface-2: rgba(29, 28, 36, .86);
  --field: rgba(8, 10, 13, .8);
  --text: #f8f3e8;
  --muted: #a9a5ae;
  --green: #35e895;
  --green-dark: #123c2d;
  --red: #ef5364;
  --violet: #a566ff;
  --gold: #dcb96d;
  --gold-soft: rgba(220, 185, 109, .28);
  --line: rgba(255, 255, 255, .09);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh; margin: 0;
  padding: max(22px, env(safe-area-inset-top)) 16px calc(108px + env(safe-area-inset-bottom));
  overflow-x: hidden; color: var(--text);
  background:
    linear-gradient(145deg, rgba(15, 54, 39, .36), transparent 36%),
    linear-gradient(315deg, rgba(86, 33, 88, .28), transparent 42%),
    var(--bg);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.locked > * { display: none !important; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.ambient {
  position: fixed; width: 260px; height: 260px; border-radius: 50%;
  filter: blur(95px); opacity: .17; pointer-events: none; z-index: -1;
}
.ambient-green { background: var(--green); top: -100px; right: -90px; }
.ambient-red { background: var(--red); top: 42%; left: -190px; }
.ambient-violet { background: var(--violet); bottom: -120px; right: -90px; }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 2px 0 22px;
}
.eyebrow, .section-kicker {
  color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .18em;
}
.eyebrow i {
  display: inline-block; width: 18px; height: 1px; margin: 0 7px 3px 0;
  background: var(--gold);
}
h1, h2, h3 { margin: 0; letter-spacing: -.035em; }
h1 { font-size: 29px; line-height: 1.1; }
h1 span { color: var(--gold); }
h2 { margin-top: 2px; font-size: 20px; }
h3 { font-size: 19px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(18, 20, 24, .72); font-size: 12px; font-weight: 750;
}
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px currentColor; }
.status-pill.ok { color: var(--green); }
.status-pill.ok i { background: var(--green); }
.status-pill.bad { color: var(--red); }
.status-pill.bad i { background: var(--red); }

.view { display: none; animation: viewIn .28s ease both; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(7px); } }

.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.metric-card, .panel {
  position: relative; overflow: hidden;
  border: 1px solid var(--gold-soft); border-radius: 21px;
  background:
    linear-gradient(145deg, rgba(52, 232, 149, .07), transparent 42%),
    linear-gradient(320deg, rgba(165, 102, 255, .07), transparent 44%),
    var(--surface);
  box-shadow: inset 0 1px rgba(255,255,255,.035), 0 15px 40px rgba(0,0,0,.2);
}
.gold-cut::before, .gold-cut::after {
  content: ""; position: absolute; width: 42px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.gold-cut::before { top: 0; right: 18px; }
.gold-cut::after { bottom: 0; left: 18px; transform: rotate(180deg); }
.metric-card { padding: 17px; min-height: 130px; }
.metric-card > span { color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.metric-card strong { display: block; margin: 10px 0 3px; font-size: 27px; }
.metric-card small { color: var(--muted); font-size: 11px; }
.panel { padding: 17px; margin-top: 12px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }

.icon-button, .soft-button, .close-flow {
  border: 1px solid var(--gold-soft); color: var(--gold); background: rgba(220,185,109,.06);
}
.icon-button { width: 39px; height: 39px; border-radius: 12px; font-size: 20px; }
.soft-button { padding: 9px 11px; border-radius: 11px; font-size: 12px; font-weight: 700; }

.action-grid { display: grid; gap: 9px; }
.action-card {
  display: grid; grid-template-columns: 44px 1fr 18px; align-items: center; gap: 11px;
  width: 100%; padding: 13px; text-align: left;
  border: 1px solid var(--line); border-radius: 16px; color: var(--text);
  background: rgba(9, 10, 13, .62); transition: .2s ease;
}
.action-card:active { transform: scale(.985); border-color: var(--gold); }
.action-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px;
  border: 1px solid var(--gold-soft); color: var(--gold); font-size: 21px;
  background: linear-gradient(145deg, rgba(220,185,109,.14), rgba(165,102,255,.08));
}
.action-card strong, .action-card small { display: block; }
.action-card strong { font-size: 14px; }
.action-card small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.action-card b { color: var(--gold); font-size: 23px; font-weight: 300; }

.flow-shell {
  display: none; position: relative; margin-top: 13px; padding: 16px;
  border: 1px solid var(--gold-soft); border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(239,83,100,.055), transparent 38%),
    linear-gradient(315deg, rgba(165,102,255,.09), transparent 44%),
    rgba(8,9,12,.76);
}
.flow-shell.open { display: block; animation: unfold .3s ease both; }
@keyframes unfold { from { opacity: 0; transform: translateY(-8px) scale(.985); } }
.flow-head { display: flex; justify-content: space-between; align-items: center; }
.flow-head > div { display: flex; align-items: center; gap: 10px; }
.flow-number {
  display: grid; place-items: center; width: 31px; height: 31px;
  border: 1px solid var(--gold); border-radius: 9px; color: var(--gold); font-size: 10px; font-weight: 900;
}
.close-flow { width: 31px; height: 31px; border-radius: 9px; font-size: 19px; }
.flow-shell p { color: var(--muted); font-size: 12px; margin: 12px 0 14px; }

.dropzone {
  display: grid; place-items: center; gap: 3px; min-height: 130px; padding: 18px;
  border: 1px dashed var(--gold); border-radius: 15px; color: var(--text);
  background: rgba(220,185,109,.035); text-align: center;
}
.dropzone input { display: none; }
.dropzone .drop-icon { color: var(--gold); font-size: 27px; }
.dropzone small { color: var(--muted); font-size: 11px; }
.flow-status { min-height: 0; margin-top: 10px; color: var(--muted); font-size: 12px; }
.flow-status.success { color: var(--green); }
.flow-status.error { color: var(--red); }

.step-track { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin: 14px 0; }
.step-track i { height: 3px; border-radius: 5px; background: rgba(255,255,255,.09); transition: .25s; }
.step-track i.active { background: linear-gradient(90deg, var(--gold), var(--violet)); box-shadow: 0 0 12px rgba(220,185,109,.2); }
.phone-step { display: none; }
.phone-step.active { display: block; animation: viewIn .26s ease both; }

label { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
input, textarea {
  width: 100%; margin: 6px 0 13px; padding: 13px 14px;
  border: 1px solid rgba(220,185,109,.2); border-radius: 13px;
  outline: none; color: var(--text); background: var(--field);
  transition: border .2s, box-shadow .2s;
}
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(220,185,109,.08); }
textarea { resize: vertical; min-height: 120px; }
.primary-button {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; padding: 13px 15px; border: 1px solid #efcf88; border-radius: 13px;
  color: #120d06; font-weight: 850;
  background: linear-gradient(110deg, #b98a3e, #f0d58e 46%, #bd8f44);
  box-shadow: 0 9px 25px rgba(185,138,62,.14);
}
.primary-button:disabled { opacity: .55; }

.list { display: grid; gap: 8px; }
.item {
  padding: 13px; border: 1px solid var(--line); border-radius: 15px;
  background: rgba(8,9,12,.65);
}
.item-head { display: flex; justify-content: space-between; align-items: center; gap: 9px; }
.account-actions { display: grid; gap: 6px; flex: 0 0 88px; }
.account-actions button {
  width: 100%; padding: 7px 9px; border-radius: 9px; font-size: 11px; font-weight: 750;
}
.delete-account { border: 1px solid rgba(239,83,100,.28); color: var(--red); background: rgba(239,83,100,.06); }
.refresh-account { border: 1px solid rgba(53,232,149,.3); color: var(--green); background: rgba(53,232,149,.07); }
.refresh-account:disabled { opacity: .55; }
.muted { margin-top: 4px; color: var(--muted); font-size: 11px; }
.ok { color: var(--green); }
.bad { color: var(--red); }

.picker { display: grid; gap: 7px; margin: 7px 0 15px; }
.pick { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(8,9,12,.58); }
.pick input { width: auto; margin: 0; accent-color: var(--gold); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.single-media { grid-template-columns: 1fr; margin-top: 10px; }
.recipients-box {
  margin: 4px 0 12px; padding: 13px;
  border: 1px solid var(--gold-soft); border-radius: 16px;
  background: rgba(8,9,12,.58);
}
.manual-recipients { min-height: 132px; margin-bottom: 9px; }
.file-picker-button {
  display: flex; justify-content: center; align-items: center; min-height: 44px;
  border: 1px solid rgba(53,232,149,.3); border-radius: 12px;
  color: var(--green); background: rgba(53,232,149,.07);
}
.file-picker-button input { display: none; }
.file-picker-button span { font-size: 13px; font-weight: 800; }
#recipientsFileName { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.url-button-box {
  margin: 2px 0 14px; padding: 13px;
  border: 1px solid var(--gold-soft); border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(165,102,255,.08), transparent 52%),
    rgba(8,9,12,.58);
}
.url-button-box label { display: flex; justify-content: space-between; align-items: center; }
.url-button-box label small { color: var(--gold); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.url-button-box input { margin-bottom: 8px; }
.button-preview, .task-url-button {
  display: flex; justify-content: center; align-items: center; gap: 9px;
  min-height: 43px; padding: 10px 13px;
  border: 1px solid rgba(53,232,149,.32); border-radius: 12px;
  color: var(--green); font-size: 13px; font-weight: 800;
  background: linear-gradient(110deg, rgba(53,232,149,.09), rgba(165,102,255,.08));
}
.button-preview.empty { color: var(--muted); border-color: var(--line); background: rgba(255,255,255,.02); }
.button-preview.invalid { color: var(--red); border-color: rgba(239,83,100,.3); background: rgba(239,83,100,.06); }
.button-preview.valid i { color: var(--gold); font-style: normal; }
.field-hint { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.task-url-button { margin-top: 9px; color: var(--gold); text-decoration: none; border-color: var(--gold-soft); }
.task-url-button span { color: var(--green); }
.history-summary { display: flex; flex-wrap: wrap; gap: 8px 13px; margin-top: 9px; color: var(--text); font-size: 12px; }

.detail-open { overflow: hidden; }
.detail-overlay {
  display: none; position: fixed; z-index: 80; inset: 0;
  align-items: flex-end; padding-top: max(35px, env(safe-area-inset-top));
  background: rgba(3,3,5,.72); backdrop-filter: blur(8px);
}
.detail-overlay.open { display: flex; animation: fadeIn .2s ease both; }
@keyframes fadeIn { from { opacity: 0; } }
.detail-sheet {
  width: 100%; max-height: 92vh; overflow-y: auto; padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
  border: 1px solid var(--gold-soft); border-radius: 25px 25px 0 0;
  background:
    linear-gradient(145deg, rgba(53,232,149,.055), transparent 34%),
    linear-gradient(320deg, rgba(165,102,255,.1), transparent 44%),
    #111116;
  animation: sheetUp .28s ease both;
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: .4; } }
.detail-handle { width: 42px; height: 4px; margin: -4px auto 15px; border-radius: 4px; background: rgba(255,255,255,.18); }
.detail-status-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; color: var(--muted); font-size: 11px; }
.task-status { padding: 6px 9px; border: 1px solid var(--gold-soft); border-radius: 9px; color: var(--gold); font-weight: 850; font-size: 10px; }
.task-status.finished { color: var(--green); border-color: rgba(53,232,149,.28); }
.task-status.cancelled, .task-status.interrupted { color: var(--red); border-color: rgba(239,83,100,.28); }
.detail-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; }
.detail-stats div { padding: 11px 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,8,10,.64); text-align: center; }
.detail-stats strong, .detail-stats small { display: block; }
.detail-stats strong { font-size: 19px; }
.detail-stats small { color: var(--muted); font-size: 9px; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.detail-meta span { padding: 9px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(7,8,10,.48); font-size: 10px; }
.detail-meta b { display: block; margin-top: 2px; color: var(--text); font-size: 12px; }
.detail-section { margin-top: 18px; }
.detail-section > h3 { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--gold); font-size: 14px; }
.detail-section > h3 span { color: var(--muted); }
.detail-account-list { display: grid; gap: 7px; }
.detail-account { display: grid; grid-template-columns: 8px 1fr; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,8,10,.6); }
.detail-account i { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; }
.detail-account .ok-dot { background: var(--green); box-shadow: 0 0 10px rgba(53,232,149,.4); }
.detail-account .bad-dot { background: var(--red); }
.detail-account span strong, .detail-account span small { display: block; }
.detail-account span small { color: var(--muted); font-size: 10px; }
.detail-account em { grid-column: 2; color: var(--gold); font-size: 10px; font-style: normal; }
.message-preview { padding: 12px; white-space: pre-wrap; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: rgba(7,8,10,.6); font-size: 12px; }
.native-log { display: grid; gap: 7px; }
.log-row { display: grid; grid-template-columns: 29px 1fr; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,8,10,.62); }
.log-row > i { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: var(--gold); background: rgba(220,185,109,.09); font-style: normal; font-weight: 900; }
.log-row time { color: var(--muted); font-size: 9px; }
.log-row p { margin: 2px 0 0; font-size: 11px; }
.log-row.success > i { color: var(--green); background: rgba(53,232,149,.08); }
.log-row.error > i { color: var(--red); background: rgba(239,83,100,.08); }
.log-row.warning > i { color: var(--gold); }
.log-row.connect > i { color: var(--violet); background: rgba(165,102,255,.09); }
.file-field { padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: rgba(8,9,12,.58); }
.file-field input { margin: 7px 0 0; padding: 0; border: 0; font-size: 10px; }
.number-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 11px; }

.progress { height: 8px; margin: 12px 0; overflow: hidden; border-radius: 8px; background: #07070a; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--gold), var(--violet)); }
.actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.actions button { padding: 8px 10px; border: 1px solid var(--gold-soft); border-radius: 10px; color: var(--gold); background: rgba(220,185,109,.05); font-size: 11px; }
.empty-state { display: grid; place-items: center; min-height: 120px; color: var(--muted); text-align: center; }
.empty-icon { color: var(--gold); font-size: 30px; }

.bottom-nav {
  position: fixed; z-index: 50; left: 11px; right: 11px; bottom: max(10px,env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; padding: 7px;
  border: 1px solid var(--gold-soft); border-radius: 20px;
  background: rgba(14,13,18,.9); box-shadow: 0 15px 45px rgba(0,0,0,.42);
  backdrop-filter: blur(18px);
}
.bottom-nav button {
  display: grid; place-items: center; gap: 1px; min-width: 0; padding: 8px 2px;
  border: 1px solid transparent; border-radius: 13px; color: var(--muted); background: transparent;
}
.bottom-nav button i { font-style: normal; font-size: 18px; }
.bottom-nav button span { font-size: 9px; font-weight: 750; }
.bottom-nav button.active {
  border-color: var(--gold-soft); color: var(--gold);
  background: linear-gradient(145deg, rgba(53,232,149,.12), rgba(165,102,255,.12), rgba(239,83,100,.08));
}

#toast {
  position: fixed; z-index: 100; top: max(16px,env(safe-area-inset-top)); left: 18px; right: 18px;
  padding: 13px 15px; border: 1px solid var(--gold-soft); border-radius: 13px;
  color: var(--text); background: rgba(23,21,28,.95);
  transform: translateY(-130px); transition: .25s ease; box-shadow: 0 18px 45px rgba(0,0,0,.4);
}
#toast.show { transform: translateY(0); }

@media (max-width: 410px) {
  .field-grid, .number-grid { grid-template-columns: 1fr; }
  h1 { font-size: 26px; }
}
