* { box-sizing: border-box; }
:root {
  --bg: #0f1216; --card: #191d24; --card2: #21262e; --line: #2b313a;
  --text: #e6e9ee; --muted: #8b95a3; --accent: #4CAF50; --danger: #e5484d;
  --blue: #3b82f6; --radius: 10px;
}
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px; line-height: 1.5;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--card);
}
.brand { font-weight: 700; font-size: 18px; }
.brand span { color: var(--accent); }

/* ЛОГОТИП ApplAI */
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; letter-spacing: -.5px; }
.logo-mark { width: 24px; height: 24px; fill: var(--accent); filter: drop-shadow(0 0 6px rgba(76,175,80,.4)); }
.logo-word .ai { color: var(--accent); }
.landing-logo { font-size: 26px; margin-bottom: 20px; }
.health { font-size: 12px; color: var(--muted); }
.health.ok { color: var(--accent); }
.health.bad { color: var(--danger); }

.tabs { display: flex; gap: 4px; padding: 12px 22px 0; border-bottom: 1px solid var(--line); background: var(--card); }
.tabs button {
  background: none; border: none; color: var(--muted); padding: 10px 18px;
  cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

main { max-width: 920px; margin: 0 auto; padding: 28px 22px 60px; }
.tab { display: none; }
.tab.active { display: block; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; margin-bottom: 18px; }
.card h2 { margin: 0 0 6px; font-size: 17px; letter-spacing: -.2px; }
.card > .muted:first-of-type { margin-top: 0; }
h3 { margin: 0; font-size: 15px; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; font-size: 14px; }

/* метрики системы */
.metrics { display: grid; gap: 14px; }
.metric-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.metric-top b { font-weight: 600; }
.progress-bar .m-ok { background: var(--accent); height: 100%; }
.progress-bar .m-warn { background: #f0b45a; height: 100%; }
.progress-bar .m-err { background: var(--danger); height: 100%; }
.metric-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

/* карточки профилей */
.profcard { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; flex-wrap: wrap; }
.profcard-info { display: flex; align-items: center; gap: 12px; }
.prof-avatar { display: inline-flex; }
.avatar-ic { width: 26px; height: 26px; color: var(--accent); }
.profcard-info b { font-size: 15px; }

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); margin-top: 14px; }
label.check input { width: auto; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; background: var(--card2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }

button {
  background: var(--card2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 16px; cursor: pointer; font-size: 14px;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }

.log {
  background: #0b0e12; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px;
  white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow-y: auto; margin: 0;
}
.run-state { font-size: 13px; padding: 3px 10px; border-radius: 20px; background: var(--card2); }
.run-state.on { background: var(--accent); color: #fff; }

.sticky-save { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 40%); }

.stats { display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.stats .pill { background: var(--card2); border-radius: 8px; padding: 6px 12px; font-size: 13px; }
.stats .pill b { font-size: 16px; }

table.history { width: 100%; border-collapse: collapse; font-size: 13px; }
table.history th, table.history td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.history th { color: var(--muted); font-weight: 500; }
table.history tr.clickable { cursor: pointer; }
table.history tr.clickable:hover { background: var(--card2); }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 12px; white-space: nowrap; }
.badge.ok { background: rgba(76,175,80,.2); color: #7ddc82; }
.badge.skip, .badge.gray { background: rgba(139,149,163,.2); color: var(--muted); }
.badge.err { background: rgba(229,72,77,.2); color: #f08a8d; }
.badge.warn { background: rgba(245,158,66,.2); color: #f0b45a; }
.badge.blue { background: rgba(59,130,246,.2); color: #7fb0ff; }

/* лента событий бота */
.feed { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.feed-row { display: flex; align-items: baseline; gap: 10px; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.feed-row:nth-child(odd) { background: rgba(255,255,255,.02); }
.feed-row .badge { flex: none; }

.qitem { border-left: 2px solid var(--line); padding: 6px 0 6px 12px; margin-bottom: 10px; }
.qitem .q { font-weight: 500; }
.qitem .a { color: var(--accent); margin-top: 2px; }
.qitem .opts { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ЛЕНДИНГ + ВХОД */
.landing {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto; padding: 48px 24px;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(76,175,80,.10), transparent 60%),
              radial-gradient(1000px 500px at 100% 10%, rgba(59,130,246,.08), transparent 55%), var(--bg);
}
.landing-inner { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; min-height: calc(100vh - 96px); }
.hero-badge { display: inline-block; font-size: 12px; color: var(--accent); background: rgba(76,175,80,.1); border: 1px solid rgba(76,175,80,.3); padding: 5px 12px; border-radius: 20px; margin-bottom: 18px; }
.landing-pitch h1 { font-size: 42px; line-height: 1.1; margin: 0 0 18px; letter-spacing: -.8px; font-weight: 800; }
.feat-ic { width: 22px; height: 22px; color: var(--accent); flex: none; }
.auth-headline { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.auth-foot { font-size: 11px; margin-top: 14px; text-align: center; }
.landing-pitch .lead { font-size: 16px; color: var(--muted); line-height: 1.6; margin: 0 0 28px; max-width: 520px; }
.landing-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.landing-features li { display: flex; gap: 14px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.landing-features li span { font-size: 22px; flex: none; line-height: 1.2; }
.landing-features li b { color: var(--text); }

.auth-box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-tabs { display: flex; gap: 6px; background: var(--card2); padding: 4px; border-radius: 10px; margin-bottom: 20px; }
.auth-tabs button { flex: 1; border: none; background: none; color: var(--muted); padding: 9px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.auth-tabs button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.auth-box label { margin-top: 14px; }
.auth-submit { width: 100%; margin-top: 22px; padding: 12px; font-size: 15px; }

@media (max-width: 820px) {
  .landing-inner { grid-template-columns: 1fr; gap: 32px; }
  .landing-pitch h1 { font-size: 30px; }
}

/* джобы */
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.switch.inline { display: inline-flex; }

/* иконки */
.ic { width: 15px; height: 15px; vertical-align: -2px; display: inline-block; }
.mini { font-size: 12px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.jobcard { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; transition: border-color .2s; }
.jobcard.is-running { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(76,175,80,.3); }
.jobcard.collapsed .jobcard-body { display: none; }
.chevron { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px 8px; font-size: 11px; }
.chevron:hover { color: var(--text); border: none; }
.jobcard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.jobcard-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.jobcard-title b { font-size: 15px; }
.jobcard-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { font-size: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--line); padding: 3px 9px; border-radius: 20px; color: var(--muted); }
.chip-warn { color: #f0b45a; border-color: rgba(245,158,66,.4); }
.jobcard-url { display: block; font-size: 12px; color: var(--muted); text-decoration: none; margin-bottom: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jobcard-url:hover { color: var(--blue); }
.jobcard-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 12px; }
.progress-bar { flex: 1; height: 6px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.progress-bar > div { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.jobcard-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.jobcard-actions button { padding: 7px 14px; font-size: 13px; }
button.ghost-danger { color: #f08a8d; border-color: transparent; background: none; }
button.ghost-danger:hover { border-color: var(--danger); }

/* тумблер-переключатель */
.toggle { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider { position: absolute; inset: 0; background: var(--line); border-radius: 22px; transition: .2s; cursor: pointer; }
.toggle .slider::before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(16px); }
.jobhist { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.day-group { margin-bottom: 10px; }
.day-head { font-size: 12px; color: var(--muted); margin: 6px 0 4px; text-transform: uppercase; letter-spacing: .5px; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 6px; font-size: 13px; }
.hist-row:hover { background: var(--card2); }
.hist-title { flex: 1; min-width: 0; }
.hist-row .muted { flex: none; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-inner { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-width: 640px; width: 90%; max-height: 80vh; overflow-y: auto; }
.modal-inner h3 { margin-bottom: 12px; }

/* согласие при регистрации */
.consent { font-size: 12px; margin-top: 14px; align-items: flex-start; }
.consent input { margin-top: 2px; }
.consent a { color: var(--accent); }
