:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #edf3f9;
  --line: #e3eaf1;
  --text: #203047;
  --muted: #718198;
  --accent: #168c81;
  --accent-ink: #ffffff;
  --warn: #b77a19;
  --bad: #cc4c55;
  --ok: #13846d;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
aside {
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: #ffffff;
}
.brand { display: grid; }
.brand strong { font-size: 18px; }
.brand span { color: var(--muted); font-size: 12px; letter-spacing: 0.12em; }
nav { display: grid; gap: 6px; }
nav button, .side-foot button, .ghost, .danger {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--muted);
}
nav button.active, nav button:hover { background: var(--panel-2); color: var(--text); }
.side-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.workspace { padding: 28px 32px 48px; }
header { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 22px; }
header h1 { font-size: 28px; letter-spacing: -0.03em; }
.chip, .pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  background: var(--panel);
}
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.card, .block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.card span, .muted { color: var(--muted); }
.card strong { display: block; margin-top: 8px; font-size: 26px; letter-spacing: -0.03em; }
.stack { display: grid; gap: 14px; margin-top: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label { display: grid; gap: 6px; margin: 10px 0; }
input, textarea {
  width: 100%;
  background: #f9fbfd;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid rgba(22, 140, 129, 0.14); border-color: var(--accent); }
.primary, button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
}
.ghost { border: 1px solid var(--line); }
.danger { color: var(--bad); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; word-break: break-all; }
.pill.pending, .pill.buying { color: var(--warn); }
.pill.completed, .pill.running { color: var(--ok); }
.pill.failed, .pill.error { color: var(--bad); }
.banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff7e8;
  color: #92651d;
  margin-bottom: 12px;
}
.split { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 14px; }
.checks { display: flex; gap: 16px; align-items: center; }
.checks label { display: flex; gap: 8px; align-items: center; margin: 0; }
.bot-card { display: grid; gap: 8px; }
#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 14px;
  border-radius: 12px;
  max-width: 360px;
}
#toast.bad { background: var(--bad); color: white; }
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(500px 240px at 80% 0%, rgba(22, 140, 129, 0.12), transparent 60%),
    var(--bg);
}
.login-card { width: min(420px, calc(100% - 32px)); }
.login-card h1 { margin: 8px 0 16px; font-size: 36px; }
.eyebrow { color: var(--accent); letter-spacing: 0.14em; font-size: 12px; }
.error { color: var(--bad); }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; align-content: start; }
  aside { border-right: 0; border-bottom: 1px solid var(--line); gap: 12px; }
  .side-foot { margin-top: 4px; }
  nav { grid-template-columns: repeat(3, 1fr); }
  .grid, .split { grid-template-columns: 1fr; }
  .workspace { padding: 18px 14px 40px; }
}

/* Clear controls, responsive operations editor and Telegram preview. */
button, .ghost, .primary { min-height: 42px; transition: background .15s, border-color .15s, opacity .15s; }
button:hover:not(:disabled) { filter: brightness(1.12); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a.ghost { text-decoration: none; display: inline-flex; align-items: center; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); padding: 0; flex: 0 0 auto; }
select { font: inherit; color: var(--text); background: #f9fbfd; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; max-width: 100%; }
.workspace, .block, .card { min-width: 0; }
aside { position: sticky; top: 0; height: 100vh; }
nav button.active { background: rgba(22,140,129,.09); color: var(--accent); border-left: 3px solid var(--accent); }
.ghost.selected { background: rgba(22,140,129,.09); color: var(--accent); border-color: #a9d8d2; }
.check-label { display: inline-flex; align-items: center; gap: 8px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.operations-layout { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(280px,.8fr); gap: 24px; align-items: start; }
.toolbar { margin-bottom: 14px; }
.toolbar label { min-width: 220px; }
.editor-entry { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #f8fafc; margin-top: 14px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.placement-options { display: flex; flex-wrap: wrap; gap: 12px; }
.editor-actions { position: sticky; bottom: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; z-index: 2; }
.preview-panel { position: sticky; top: 24px; padding-top: 14px; }
.telegram-preview { margin-top: 14px; padding: 20px; border-radius: 22px; border: 1px solid #d3e4ef; background: #e7f2f9; }
.telegram-message { white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px; background: #ffffff; border-radius: 14px 14px 14px 4px; color: #29465b; line-height: 1.7; }
.telegram-buttons { display: grid; gap: 6px; margin-top: 7px; }
.telegram-row { display: flex; gap: 6px; }
.telegram-button { flex: 1; text-align: center; padding: 10px 6px; border-radius: 7px; background: #d2e7f5; font-size: 13px; overflow-wrap: anywhere; color: #2a6284; }
.preview-note { font-size: 12px; margin-top: 16px; }
.empty-hint { border: 1px dashed var(--line); border-radius: 12px; padding: 24px; color: var(--muted); margin-top: 14px; }
.empty-state { display: grid; gap: 16px; justify-items: start; }
.table-scroll { overflow: auto; }
.flow-list { padding-left: 24px; display: grid; gap: 16px; margin: 20px 0; }
.pill.awaiting_payment { color: #4477b5; }
@media(max-width:1100px) { .operations-layout { grid-template-columns: 1fr; } .preview-panel { position: static; } }
@media(max-width:980px) { aside { position: static; height: auto; } nav { grid-template-columns: repeat(3,minmax(0,1fr)); } .grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:560px) { header { flex-wrap: wrap; } nav { grid-template-columns: repeat(2,minmax(0,1fr)); } .field-grid { grid-template-columns: 1fr; gap: 0; } .checks { flex-wrap: wrap; } .editor-actions { position: static; } .telegram-preview { padding: 12px; } }

/* Light workspace, clear hierarchy and a dedicated sign-in experience. */
body { font-size: 14px; }
.shell { grid-template-columns: 246px minmax(0,1fr); }
aside { padding: 28px 18px; overflow-y: auto; }
.brand { grid-template-columns: 40px 1fr; align-items: center; column-gap: 12px; margin: 0 8px 10px; }
.brand-mark { grid-row: span 2; width: 40px; height: 40px; display: grid; place-items: center; background: linear-gradient(145deg,#18a592,#087c75); border-radius: 13px; color: white; box-shadow: 0 6px 15px #168c8126; }
.brand-mark svg { width: 23px; height: 23px; }
.brand strong { font-size: 18px; }
.brand span { font-size: 10px; letter-spacing: .13em; }
.nav-group-title { font-size: 11px; color: #9ba8b8; padding: 16px 12px 6px; letter-spacing: .08em; }
nav button { display: flex; align-items: center; gap: 12px; min-height: 46px; font-size: 14px; color: #66768a; }
nav button.active { border-left: 0; background: #e9f6f3; color: #0d8b7c; font-weight: 650; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.side-foot { border-top: 1px solid var(--line); padding: 18px 8px 0; }
.admin-avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #edf3fa; color: #657e9f; margin-right: 8px; }
.workspace { padding: 30px 36px 48px; max-width: 1680px; width: 100%; }
.workspace > header { margin-bottom: 28px; }
.header-title .eyebrow { color: #93a0b1; font-size: 10px; margin-bottom: 5px; }
header h1 { font-size: 26px; font-weight: 700; }
#page-description { color: var(--muted); font-size: 13px; margin-top: 5px; }
.chip { background: #e9f6f0; border-color: #d4eadd; color: #378063; font-size: 12px; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: #3fa37c; margin-right: 7px; vertical-align: 1px; }
.card, .block { box-shadow: 0 3px 16px #20304703; padding: 22px; border-radius: 16px; }
.grid { gap: 18px; }
.card { position: relative; overflow: hidden; min-height: 132px; }
.card::after { content: ''; position: absolute; right: 20px; top: 22px; width: 32px; height: 32px; border-radius: 10px; background: #eaf6f2; }
.card:nth-child(2)::after { background: #fff4dd; }
.card:nth-child(3)::after { background: #e9f0fc; }
.card:nth-child(4)::after { background: #f1ebfc; }
.card strong { font-size: 30px; color: #27394d; margin-top: 16px; }
h2 { font-size: 17px; }
.primary, button.primary { border-radius: 10px; box-shadow: 0 3px 8px #168c811a; }
.ghost, .danger { border-radius: 9px; background: white; }
.ghost:hover { background: #f2f7fb; }
.danger:hover { background: #fff0f1; }
input, textarea, select { border-radius: 9px; font-size: 14px; }
input::placeholder, textarea::placeholder { color: #a4afbe; }
input:focus, textarea:focus, select:focus { outline: 3px solid #168c8114; border-color: #7dc8be; background: white; }
.pill { font-size: 12px; padding: 4px 10px; }
.pill.pending, .pill.buying { background: #fff7e7; border-color: #f5e7c5; }
.pill.completed, .pill.running { background: #eaf7f1; border-color: #d5ecdf; }
.pill.failed, .pill.error { background: #fff0f1; border-color: #f5d9dc; }
th { background: #f8fafc; padding: 13px 10px; white-space: nowrap; }
td { padding: 16px 10px; }
tbody tr:hover { background: #fbfdff; }
#toast { box-shadow: 0 8px 30px #20304720; z-index: 20; }
.dashboard-welcome { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; padding: 26px 28px; border-radius: 18px; background: linear-gradient(115deg,#e7f5f1,#eff5fd); border: 1px solid #dcece8; }
.dashboard-welcome h2 { font-size: 23px; color: #254e4d; margin-bottom: 8px; }
.dashboard-welcome p { color: #64827f; }
.dashboard-welcome .row { flex-shrink: 0; }
.login-body { padding: 32px; background: radial-gradient(ellipse at 15% 20%,#dfefe9,transparent 50%),radial-gradient(ellipse at 90% 80%,#e5edf9,transparent 45%),#f3f7f9; }
.login-shell { display: grid; grid-template-columns: 1.1fr 1fr; width: min(1040px,100%); min-height: 620px; border-radius: 26px; overflow: hidden; background: white; border: 1px solid #e1e9ec; box-shadow: 0 24px 90px #264d5a12; }
.login-intro { padding: 48px; background: linear-gradient(150deg,#e7f3ee,#edf4fa); position: relative; display: flex; flex-direction: column; }
.login-brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; color: #32615b; }
.login-intro h2 { font-size: clamp(30px,3vw,40px); line-height: 1.45; color: #244b48; letter-spacing: -.04em; margin: 44px 0 14px; }
.login-intro > p { color: #6b8580; font-size: 14px; line-height: 1.9; max-width: 350px; }
.login-feature-list { display: grid; gap: 12px; margin: 28px 0; }
.login-feature { display: flex; align-items: center; gap: 14px; background: #ffffffa6; border: 1px solid #ffffff; padding: 15px 18px; border-radius: 13px; }
.login-feature svg { width: 22px; height: 22px; color: #31998a; flex-shrink: 0; }
.login-feature strong { display: block; font-size: 13px; color: #365852; }
.login-feature span { font-size: 12px; color: #80968f; }
.login-intro .intro-foot { margin-top: auto; font-size: 11px; letter-spacing: .14em; color: #8aa19b; }
.login-form-wrap { padding: 62px 48px 38px; display: flex; flex-direction: column; justify-content: center; }
.login-card { width: 100%; }
.login-card .eyebrow { font-size: 10px; color: #96a6b9; }
.login-card h1 { font-size: 29px; margin: 8px 0; color: #203047; }
.login-caption { margin: 0 0 30px; color: #8592a4; font-size: 13px; }
.login-card label { margin: 20px 0; font-size: 13px; color: #5d6d82; gap: 9px; }
.login-card input { min-height: 48px; background: #fafcfe; }
.password-field { position: relative; }
.password-field input { padding-right: 66px; }
.password-toggle { position: absolute; right: 8px; top: 5px; border: 0; background: transparent; color: #718598; padding: 6px 10px; min-height: 38px; font-size: 12px; }
.login-submit { width: 100%; margin-top: 8px; min-height: 48px; font-size: 14px; }
.login-form-foot { margin-top: 34px; border-top: 1px solid #edf1f5; padding-top: 22px; display: flex; justify-content: space-between; gap: 12px; color: #9aa5b5; font-size: 12px; }
.login-form-foot a { color: #6c8599; text-decoration: none; }
#login-error { background: #fff1f2; padding: 11px 14px; border: 1px solid #f5d9df; border-radius: 9px; margin-top: 16px; font-size: 13px; }
@media(max-width:1100px) { .workspace { padding: 26px 24px; } .dashboard-welcome { flex-wrap: wrap; } }
@media(max-width:980px) { .shell { grid-template-columns: 1fr; } aside { padding: 18px; } .brand { margin-bottom: 0; } .nav-group-title { display: none; } .side-foot { padding-top: 10px; margin-top: 0; } nav { gap: 5px; } nav button { min-height: 42px; } .login-intro { padding: 36px; } .login-form-wrap { padding: 40px 32px; } }
@media(max-width:700px) { .login-body { padding: 20px; } .login-shell { grid-template-columns: 1fr; min-height: auto; max-width: 460px; } .login-intro { padding: 24px 28px; } .login-intro h2 { font-size: 24px; margin: 18px 0 6px; } .login-intro > p { font-size: 12px; } .login-feature-list, .intro-foot { display: none; } .login-form-wrap { padding: 28px; } .login-caption { margin-bottom: 20px; } }
@media(max-width:560px) { .workspace { padding: 22px 16px 40px; } header h1 { font-size: 23px; } .card, .block { padding: 18px; } .card strong { font-size: 24px; } .card::after { width: 24px; height: 24px; right: 15px; top: 18px; } .dashboard-welcome { padding: 22px; } .dashboard-welcome h2 { font-size: 21px; } .dashboard-welcome .row { flex-wrap: wrap; flex-shrink: 1; } }
.metric-icon { position: absolute; width: 18px; height: 18px; right: 27px; top: 29px; z-index: 1; color: #269181; }
.card:nth-child(2) .metric-icon { color: #c59837; }
.card:nth-child(3) .metric-icon { color: #5e8cd2; }
.card:nth-child(4) .metric-icon { color: #9270c1; }
@media(max-width:560px) { .metric-icon { width: 16px; height: 16px; top: 22px; right: 19px; } }
.integration-heading { margin-bottom: 20px; }
.integration-heading p { margin-top: 6px; }
.integration-stats { grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 22px; }
.integration-stats .card { min-height: 108px; }
.integration-stats .card strong { font-size: 24px; }
.integration-layout { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(320px,.8fr); gap: 22px; align-items: start; }
.integration-list { margin-top: 0; }
.integration-card { display: grid; gap: 16px; }
.integration-mark { display: grid; place-items: center; width: 42px; height: 42px; background: #e6f4f1; border: 1px solid #d7ece6; color: #23877b; border-radius: 12px; font-size: 19px; font-weight: 700; }
.integration-url { background: #f7fafc; border: 1px solid #ecf0f5; border-radius: 9px; padding: 10px 12px; font-size: 12px; }
.integration-actions { border-top: 1px solid var(--line); padding-top: 14px; }
.integration-editor { position: sticky; top: 24px; }
.integration-editor > p { margin-top: 10px; font-size: 12px; }
.integration-help { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; font-size: 12px; }
.integration-help p { margin-top: 8px; }
.default-badge { background: #edf2fc; color: #5780be; border-color: #dbe5f7; }
@media(max-width:1150px) { .integration-layout { grid-template-columns: 1fr; } .integration-editor { position: static; } }
@media(max-width:560px) { .integration-stats { grid-template-columns: 1fr; gap: 10px; } .integration-stats .card { min-height: auto; } .integration-stats .card strong { margin-top: 8px; } }
