/* ============================================================
   Подписуня — dark theme
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0d10;
  --surface:   #111118;
  --card:      #1a1a24;
  --border:    #2a2a3a;
  --cyan:      #00d4ff;
  --purple:    #7c3aed;
  --grad:      linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
  --text:      #e2e8f0;
  --muted:     #94a3b8;
  --danger:    #f87171;
  --success:   #34d399;
  --radius:    12px;
  --radius-sm: 8px;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.header-inner {
  max-width: 680px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon { font-size: 22px; }
.logo-text {
  font-size: 18px;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-sub {
  font-size: 13px;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 16px;
}

/* ── Main ────────────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Progress ────────────────────────────────────────────── */
.progress-wrap { display: flex; flex-direction: column; gap: 10px; }

.steps-labels {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.steps-labels::-webkit-scrollbar { display: none; }

.step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  transition: all .2s;
  border: 1px solid transparent;
}
.step-label.active {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(0,212,255,.08);
}
.step-label.done {
  color: var(--success);
  border-color: rgba(52,211,153,.3);
  background: rgba(52,211,153,.06);
}

.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--grad);
  border-radius: 3px;
  transition: width .3s ease;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

/* ── Step ────────────────────────────────────────────────── */
.step-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.step-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ── Field ───────────────────────────────────────────────── */
.field {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field:last-child { margin-bottom: 0; }

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.req { color: var(--cyan); }

.field-hint {
  font-size: 12px;
  color: var(--muted);
}

.input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .2s;
  width: 100%;
}
.input::placeholder { color: var(--muted); }
.input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,.12);
}
.input.error { border-color: var(--danger); }

.textarea { resize: vertical; min-height: 110px; }

.input-readonly {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  padding: 10px 14px;
}

.input-with-btn {
  display: flex;
  gap: 8px;
}
.input-with-btn .input { flex: 1; }

.btn-today {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--cyan);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s, background .2s;
}
.btn-today:hover { border-color: var(--cyan); background: rgba(0,212,255,.06); }

.fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 480px) { .fields-row { grid-template-columns: 1fr; } }

/* ── Toggle buttons ──────────────────────────────────────── */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.toggle-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px;
  cursor: pointer;
  transition: all .2s;
}
.toggle-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.toggle-btn.active {
  background: rgba(0,212,255,.12);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* ── Services grid ───────────────────────────────────────── */
.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) { .services-grid { grid-template-columns: 1fr; } }

.service-card { cursor: pointer; }
.service-card input { display: none; }

.service-card-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all .2s;
}
.service-card-inner:hover { border-color: rgba(0,212,255,.4); }

.service-card input:checked + .service-card-inner {
  border-color: var(--cyan);
  background: rgba(0,212,255,.07);
}

.service-icon { font-size: 20px; }
.service-name { font-size: 14px; font-weight: 600; color: var(--text); }
.service-desc { font-size: 12px; color: var(--muted); }

/* ── Budget notice ───────────────────────────────────────── */
.budget-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(124,58,237,.1);
  border: 1px solid rgba(124,58,237,.3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
}
.notice-icon { font-size: 16px; flex-shrink: 0; }

/* ── Summary ─────────────────────────────────────────────── */
.summary-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.summary-row {
  display: flex;
  gap: 12px;
  font-size: 14px;
}
.summary-key {
  color: var(--muted);
  flex-shrink: 0;
  width: 180px;
}
.summary-val { color: var(--text); font-weight: 500; white-space: pre-wrap; word-break: break-word; }

/* ── Navigation ──────────────────────────────────────────── */
.nav-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--cyan); color: var(--cyan); }

.btn-primary {
  background: var(--grad);
  color: #fff;
  margin-left: auto;
}
.btn-primary:hover:not(:disabled) { opacity: .88; }

.btn-generate {
  background: var(--grad);
  color: #fff;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-generate:hover:not(:disabled) { opacity: .88; }

.btn-generate.loading { opacity: .7; cursor: wait; }

/* ── Error banner ────────────────────────────────────────── */
.error-banner {
  background: rgba(248,113,113,.1);
  border: 1px solid rgba(248,113,113,.35);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
  padding: 12px 16px;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Tab nav ─────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 20px;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text); border-color: var(--border); }
.tab-btn.active {
  background: rgba(0,212,255,.1);
  border-color: var(--cyan);
  color: var(--cyan);
}
.header-sub { display: none; }

/* ── History / Clients tabs ──────────────────────────────── */
.tab-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.tab-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.tab-count {
  font-size: 12px;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
}

.list-wrap { display: flex; flex-direction: column; gap: 10px; }

.list-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color .2s;
}
.list-item:hover { border-color: rgba(0,212,255,.25); }

.list-item-main { flex: 1; min-width: 0; }
.list-item-title { font-size: 14px; font-weight: 600; color: var(--text); }
.list-item-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-date  { font-size: 11px; color: var(--muted); margin-top: 4px; opacity: .7; }

.list-item-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.btn-sm {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--cyan);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn-sm:hover { background: rgba(0,212,255,.08); border-color: var(--cyan); }

.btn-icon-delete {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color .2s;
  flex-shrink: 0;
}
.btn-icon-delete:hover { color: var(--danger); }

.empty-state {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 48px 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ── Client picker ───────────────────────────────────────── */
.client-picker-wrap {
  background: rgba(0,212,255,.05);
  border: 1px solid rgba(0,212,255,.2);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Save client row ─────────────────────────────────────── */
.save-client-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.save-client-row input { width: auto; accent-color: var(--cyan); }
