/* ─── Переменные ─────────────────────────────────────────────────────────── */
:root {
  --bg:           var(--tg-theme-bg-color, #0f0f0f);
  --text:         var(--tg-theme-text-color, #ffffff);
  --hint:         var(--tg-theme-hint-color, #8a8a8a);
  --link:         var(--tg-theme-link-color, #8774e1);
  --btn-bg:       var(--tg-theme-button-color, #8774e1);
  --btn-text:     var(--tg-theme-button-text-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #181818);
  --accent:       var(--tg-theme-accent-text_color, #8774e1);

  --card-bg:      var(--secondary-bg);
  --border:       rgba(255,255,255,0.07);
  --success:      #34c759;
  --warning:      #ff9f0a;
  --danger:       #ff453a;

  --radius:       16px;
  --radius-sm:    10px;
  --radius-xs:    6px;
  --bottom-nav-height: 72px;
  --header-height: 58px;
  --safe-bottom:  env(safe-area-inset-bottom, 0px);

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);

  --gradient-purple: linear-gradient(135deg, #8774e1 0%, #6c5fc7 100%);
  --gradient-green:  linear-gradient(135deg, #34c759 0%, #28a046 100%);
  --gradient-orange: linear-gradient(135deg, #ff9f0a 0%, #e8870a 100%);
  --gradient-blue:   linear-gradient(135deg, #0a84ff 0%, #0066cc 100%);
  --gradient-card:   linear-gradient(145deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
}

/* ─── Сброс ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100dvh;
  position: fixed;
  width: 100%;
  -webkit-font-smoothing: antialiased;
}
button { border: none; background: none; cursor: pointer; font-family: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
input, textarea, select { font-family: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
a { color: var(--link); text-decoration: none; }

/* ─── Layout ──────────────────────────────────────────────────────────────── */
#app { height: 100dvh; overflow: hidden; position: relative; }

.screen {
  display: none;
  flex-direction: column;
  height: 100dvh;
  position: absolute;
  inset: 0;
  background: var(--bg);
}
.screen.active { display: flex; }

/* ─── Splash ─────────────────────────────────────────────────────────────── */
.loading-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  background: radial-gradient(ellipse at 50% 40%, rgba(135,116,225,0.15) 0%, transparent 70%);
}
.splash-logo {
  font-size: 72px;
  filter: drop-shadow(0 0 30px rgba(135,116,225,0.5));
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
.splash-title {
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient-purple);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}
.splash-subtitle { font-size: 14px; color: var(--hint); }

/* ─── Header ─────────────────────────────────────────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.screen-header.with-back { gap: 8px; }
.screen-title {
  font-size: 20px;
  font-weight: 800;
  flex: 1;
  letter-spacing: -0.3px;
}
.back-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: var(--link);
  flex-shrink: 0;
  transition: background 0.15s;
}
.back-btn:active { background: rgba(135,116,225,0.15); }

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: var(--hint);
  transition: all 0.15s;
  background: var(--secondary-bg);
  border: 1px solid var(--border);
}
.icon-btn:active { background: rgba(135,116,225,0.2); color: var(--link); }

/* ─── Scroll container ───────────────────────────────────────────────────── */
.list-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px;
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);
  scrollbar-width: none;
}
.list-container::-webkit-scrollbar { display: none; }

/* ─── Spinners ───────────────────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 2.5px solid var(--border);
  border-top-color: var(--btn-bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-small {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--btn-bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-more { display: flex; justify-content: center; padding: 16px; }

/* ─── Vacancy Card ───────────────────────────────────────────────────────── */
.vacancy-card {
  background: var(--gradient-card);
  background-color: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.vacancy-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}
.vacancy-card:active { transform: scale(0.97); box-shadow: none; }

/* Цветная полоска слева по score */
.vacancy-card.score-high::after {
  content: '';
  position: absolute;
  left: 0; top: 16px; bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient-green);
}
.vacancy-card.score-mid::after {
  content: '';
  position: absolute;
  left: 0; top: 16px; bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient-purple);
}

.card-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }

.company-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  color: white;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}
.card-title-group { flex: 1; min-width: 0; }
.card-title {
  font-size: 15px; font-weight: 700;
  line-height: 1.3; margin-bottom: 3px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  letter-spacing: -0.2px;
}
.card-company { font-size: 13px; color: var(--hint); font-weight: 500; }

/* Match badge — кольцо */
.match-ring {
  position: relative;
  width: 46px; height: 46px;
  flex-shrink: 0;
}
.match-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.match-ring-bg { fill: none; stroke: var(--border); stroke-width: 3; }
.match-ring-fill {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ring-high .match-ring-fill  { stroke: #34c759; }
.ring-mid  .match-ring-fill  { stroke: #8774e1; }
.ring-low  .match-ring-fill  { stroke: #8a8a8a; }
.match-ring-label {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  line-height: 1;
}
.ring-high .match-ring-label { color: #34c759; }
.ring-mid  .match-ring-label { color: #8774e1; }
.ring-low  .match-ring-label { color: #8a8a8a; }

.card-salary {
  font-size: 15px; font-weight: 700;
  margin-bottom: 8px;
  background: var(--gradient-purple);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.card-meta { display: flex; gap: 10px; font-size: 12px; color: var(--hint); margin-bottom: 8px; flex-wrap: wrap; }
.meta-item { display: flex; align-items: center; gap: 3px; }
.skills-row { display: flex; gap: 5px; flex-wrap: wrap; }

/* ─── Skill badges ───────────────────────────────────────────────────────── */
.skill-badge {
  font-size: 11px; padding: 3px 9px;
  border-radius: 20px; font-weight: 600;
  letter-spacing: 0.1px;
}
.skill-match   { background: rgba(52,199,89,0.15);  color: #34c759; border: 1px solid rgba(52,199,89,0.2); }
.skill-miss    { background: rgba(255,69,58,0.12);  color: #ff6b6b; border: 1px solid rgba(255,69,58,0.15); }
.skill-neutral { background: rgba(255,255,255,0.06); color: var(--hint); border: 1px solid var(--border); }

/* ─── Search & Filters ───────────────────────────────────────────────────── */
.search-bar { padding: 8px 16px; }
.search-input {
  width: 100%;
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 16px 11px 40px;
  font-size: 15px;
  outline: none;
  color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus { border-color: var(--btn-bg); box-shadow: 0 0 0 3px rgba(135,116,225,0.15); }
.search-input::placeholder { color: var(--hint); }

.filters-panel { padding: 8px 16px 12px; background: var(--bg); border-bottom: 1px solid var(--border); }
.filters-panel.hidden { display: none; }
.filter-row { margin-bottom: 8px; }
.filter-label { font-size: 11px; color: var(--hint); margin-bottom: 5px; display: block; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 13px; padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--hint);
  background: var(--secondary-bg);
  transition: all 0.15s;
  font-weight: 500;
}
.chip.active { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); box-shadow: 0 2px 8px rgba(135,116,225,0.3); }
.chip:active { transform: scale(0.95); }

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; padding: 56px 24px calc(var(--bottom-nav-height) + var(--safe-bottom) + 56px); text-align: center; gap: 12px;
}
.empty-state.hidden { display: none; }
.empty-icon { font-size: 56px; filter: grayscale(0.3); }
.empty-title { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.empty-text  { font-size: 14px; color: var(--hint); line-height: 1.5; max-width: 260px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--gradient-purple);
  color: white;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-size: 15px; font-weight: 700;
  width: 100%; text-align: center;
  transition: all 0.15s;
  box-shadow: 0 4px 16px rgba(135,116,225,0.35);
  letter-spacing: -0.2px;
}
.btn-primary:active { transform: scale(0.97); box-shadow: none; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 13px 24px;
  font-size: 15px; font-weight: 600;
  width: 100%; text-align: center;
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.btn-secondary:active { opacity: 0.7; }

.btn-danger {
  background: rgba(255,69,58,0.12);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 13px 24px;
  font-size: 15px; font-weight: 600;
  width: 100%; text-align: center;
  border: 1px solid rgba(255,69,58,0.2);
}

.btn-add { font-size: 13px; color: var(--link); padding: 4px 8px; font-weight: 600; }

/* ─── Detail view ────────────────────────────────────────────────────────── */
.detail-content {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(88px + var(--safe-bottom));
  scrollbar-width: none;
}
.detail-content::-webkit-scrollbar { display: none; }

.detail-hero {
  padding: 24px 20px 20px;
  background: linear-gradient(180deg, rgba(135,116,225,0.08) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.detail-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(135,116,225,0.15) 0%, transparent 70%);
}
.detail-logo {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800;
  color: white;
  margin-bottom: 14px;
  box-shadow: var(--shadow-md);
}
.detail-title { font-size: 22px; font-weight: 800; line-height: 1.2; margin-bottom: 6px; letter-spacing: -0.5px; }
.detail-company { font-size: 15px; color: var(--hint); margin-bottom: 10px; font-weight: 500; }
.detail-source-badge {
  display: inline-block;
  font-size: 11px; padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.07);
  color: var(--hint);
  border: 1px solid var(--border);
  font-weight: 600; letter-spacing: 0.3px;
}

/* Match block — большое кольцо */
.match-block {
  margin: 16px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 20px;
  box-shadow: var(--shadow-sm);
}
.match-big-ring { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.match-big-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.match-big-ring-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900;
  line-height: 1;
}
.match-big-ring-label span { font-size: 10px; font-weight: 600; color: var(--hint); }
.match-info { flex: 1; }
.match-info-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.match-info-sub { font-size: 13px; color: var(--hint); line-height: 1.4; }

.params-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 16px 4px; }
.param-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.param-label { font-size: 11px; color: var(--hint); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.param-value { font-size: 14px; font-weight: 700; }

.section { padding: 0 16px 16px; }
.section-title {
  font-size: 12px; font-weight: 700;
  color: var(--hint);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 10px; padding-top: 16px;
}
.description-text {
  font-size: 14px; line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap; word-break: break-word;
  opacity: 0.85;
}
.description-collapsed {
  max-height: 180px; overflow: hidden;
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
.read-more-btn {
  display: block; text-align: center;
  color: var(--link); font-size: 14px; font-weight: 600;
  padding: 8px; margin-top: 4px;
}

/* Status track */
.status-track { display: flex; gap: 0; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.status-track::-webkit-scrollbar { display: none; }
.status-step { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 56px; position: relative; }
.status-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 12px; left: 50%; right: -50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.status-step.done:not(:last-child)::after { background: var(--success); }
.status-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--secondary-bg);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; z-index: 1; position: relative;
  transition: all 0.2s;
}
.status-dot.active { background: var(--btn-bg); border-color: var(--btn-bg); box-shadow: 0 0 0 4px rgba(135,116,225,0.2); }
.status-dot.done   { background: var(--success); border-color: var(--success); }
.status-step-label { font-size: 10px; color: var(--hint); text-align: center; font-weight: 500; }

.detail-actions {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
  left: 0; right: 0;
  padding: 12px 16px;
  background: rgba(15,15,15,0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}
.detail-actions .btn-primary { flex: 2; }
.detail-actions .btn-secondary { flex: 1; font-size: 13px; padding: 13px 8px; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
textarea {
  width: 100%;
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px; line-height: 1.6;
  resize: vertical; min-height: 120px;
  outline: none; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus { border-color: var(--btn-bg); box-shadow: 0 0 0 3px rgba(135,116,225,0.15); }

input[type="text"], input[type="number"], select {
  width: 100%;
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px; outline: none; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
input:focus, select:focus { border-color: var(--btn-bg); box-shadow: 0 0 0 3px rgba(135,116,225,0.15); }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--hint); margin-bottom: 6px; }
.form-hint  { font-size: 12px; color: var(--hint); margin-top: 5px; line-height: 1.4; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }

/* Chips input */
.chips-input {
  display: flex; flex-wrap: wrap; gap: 6px;
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px; min-height: 46px;
  transition: border-color 0.15s;
}
.chips-input:focus-within { border-color: var(--btn-bg); box-shadow: 0 0 0 3px rgba(135,116,225,0.15); }
.chip-tag {
  background: rgba(135,116,225,0.2);
  color: var(--link);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
  border: 1px solid rgba(135,116,225,0.3);
}
.remove-chip {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: rgba(135,116,225,0.3);
  font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; line-height: 1;
}
.chips-input input {
  border: none; background: none; outline: none;
  font-size: 14px; flex: 1; min-width: 80px; padding: 3px 0;
  color: var(--text);
}

/* ─── Voice input ────────────────────────────────────────────────────────── */
.voice-input-area {
  position: relative;
}
.voice-btn {
  position: absolute;
  bottom: 10px; right: 10px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--secondary-bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
  z-index: 2;
}
.voice-btn:active, .voice-btn.recording {
  background: rgba(255,69,58,0.2);
  border-color: var(--danger);
  box-shadow: 0 0 0 6px rgba(255,69,58,0.1);
  animation: pulse-red 1s infinite;
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255,69,58,0.1); }
  50%       { box-shadow: 0 0 0 10px rgba(255,69,58,0.05); }
}
.voice-hint {
  text-align: center; font-size: 12px; color: var(--hint);
  margin-top: 6px; display: none;
}
.voice-hint.visible { display: block; }

/* ─── Responses / Kanban ─────────────────────────────────────────────────── */
.kanban-tabs {
  display: flex; padding: 0 16px;
  gap: 0; overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.kanban-tabs::-webkit-scrollbar { display: none; }
.kanban-tab {
  padding: 12px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--hint);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
}
.kanban-tab.active { color: var(--link); border-bottom-color: var(--link); }

/* ─── Profile ────────────────────────────────────────────────────────────── */
.profile-section { margin-bottom: 24px; }
.profile-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.profile-section-title { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }

.profile-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s;
}
.profile-item:active { transform: scale(0.98); }
.profile-item-info { flex: 1; min-width: 0; }
.profile-item-name { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.profile-item-meta { font-size: 12px; color: var(--hint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toggle-switch {
  width: 46px; height: 26px;
  border-radius: 13px;
  background: var(--border);
  position: relative; cursor: pointer; flex-shrink: 0;
  transition: background 0.25s;
}
.toggle-switch.on { background: var(--success); box-shadow: 0 2px 8px rgba(52,199,89,0.3); }
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toggle-switch.on::after { transform: translateX(20px); }

/* ─── Subscription card ──────────────────────────────────────────────────── */
.subscription-card {
  background: var(--gradient-purple);
  border-radius: var(--radius);
  padding: 22px;
  color: white;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(135,116,225,0.4);
}
.subscription-card::before {
  content: '⭐';
  position: absolute;
  right: -10px; top: -10px;
  font-size: 80px;
  opacity: 0.15;
  transform: rotate(15deg);
}
.subscription-title  { font-size: 20px; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.3px; }
.subscription-price  { font-size: 28px; font-weight: 900; margin-bottom: 4px; }
.subscription-period { font-size: 13px; opacity: 0.8; margin-bottom: 16px; }
.subscription-features { font-size: 13px; opacity: 0.9; margin-bottom: 18px; line-height: 2; }
.subscription-btn {
  background: white;
  color: #7c63d0;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 15px; font-weight: 800;
  display: block; text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.1s;
}
.subscription-btn:active { transform: scale(0.97); }

.premium-badge {
  background: rgba(52,199,89,0.12);
  border: 1px solid rgba(52,199,89,0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.premium-badge-icon { font-size: 24px; }
.premium-badge-text .title { font-size: 15px; font-weight: 700; color: var(--success); }
.premium-badge-text .sub   { font-size: 12px; color: var(--hint); margin-top: 2px; }

/* ─── Adaptation result ──────────────────────────────────────────────────── */
.adaptation-result {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.score-comparison {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.score-box { text-align: center; flex: 1; }
.score-num { font-size: 40px; font-weight: 900; line-height: 1; letter-spacing: -1px; }
.score-num.before { color: var(--hint); }
.score-num.after  {
  background: var(--gradient-green);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.score-arrow { font-size: 28px; color: var(--success); }
.score-label { font-size: 11px; color: var(--hint); margin-top: 3px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }

.changes-list { font-size: 13px; line-height: 1.8; color: var(--text); }
.changes-list li { list-style: none; display: flex; gap: 6px; }
.changes-list li::before { content: '✓'; color: var(--success); flex-shrink: 0; font-weight: 700; }

.adapted-text {
  font-size: 14px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 12px;
  border: 1px solid var(--border);
}
.keyword-highlight {
  background: rgba(52,199,89,0.2);
  border-radius: 3px; padding: 0 2px;
  color: #34c759;
}

.loader-overlay {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 56px 24px; gap: 16px; text-align: center;
}
.loader-message {
  font-size: 15px; color: var(--hint);
  animation: fade-pulse 2s infinite;
}
@keyframes fade-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Bottom nav ─────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(15,15,15,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; z-index: 100;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; color: var(--hint);
  font-size: 10px; font-weight: 600;
  padding: 8px 4px;
  transition: color 0.15s;
  position: relative;
}
.nav-item.active { color: var(--link); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 20px; height: 2px;
  background: var(--link);
  border-radius: 0 0 2px 2px;
}
.nav-icon { width: 22px; height: 22px; transition: transform 0.2s; }
.nav-item.active .nav-icon { transform: scale(1.1); }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 1000; display: flex; flex-direction: column;
  gap: 8px; pointer-events: none;
  max-width: calc(100vw - 32px); min-width: 200px;
}
.toast {
  background: rgba(30,30,30,0.95);
  color: white; border-radius: var(--radius-sm);
  padding: 11px 18px; font-size: 14px; font-weight: 600;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: var(--shadow-md);
}
.toast.success { background: rgba(52,199,89,0.9); }
.toast.error   { background: rgba(255,69,58,0.9); }
.toast.out     { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in  { from { opacity:0; transform:translateY(-12px) scale(0.9); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes toast-out { from { opacity:1; transform:translateY(0); } to { opacity:0; transform:translateY(-8px); } }

/* ─── Skeleton ───────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--secondary-bg) 0%, rgba(255,255,255,0.05) 50%, var(--secondary-bg) 100%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.4s linear infinite;
  border-radius: var(--radius-xs);
}
@keyframes skeleton-wave { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton-card { background: var(--card-bg); border-radius: var(--radius); padding: 16px; margin-bottom: 10px; border: 1px solid var(--border); }
.skeleton-line { height: 13px; margin-bottom: 8px; }
.skeleton-line.h20 { height: 20px; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w40 { width: 40%; }

/* ─── Bottom sheet ───────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 200; display: none; backdrop-filter: blur(4px); }
.modal-overlay.active { display: block; }
.bottom-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--secondary-bg);
  border-radius: 24px 24px 0 0;
  padding: 16px; padding-bottom: calc(16px + var(--safe-bottom));
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 90dvh; overflow-y: auto;
  border: 1px solid var(--border); border-bottom: none;
}
.bottom-sheet.open { transform: translateY(0); }
.sheet-handle { width: 36px; height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; margin: 0 auto 16px; }
.sheet-title { font-size: 18px; font-weight: 800; margin-bottom: 16px; text-align: center; }

/* ─── Misc ───────────────────────────────────────────────────────────────── */
.inline-error {
  background: rgba(255,69,58,0.1);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(255,69,58,0.2);
}
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-hint    { color: var(--hint); }
.text-sm      { font-size: 13px; }
.text-center  { text-align: center; }
.hidden       { display: none !important; }
.mt-8         { margin-top: 8px; }
.mt-16        { margin-top: 16px; }

/* ─── Gradient text ──────────────────────────────────────────────────────── */
.gradient-text {
  background: var(--gradient-purple);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Section card (для группировки настроек) ───────────────────────────── */
.settings-group {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 16px;
}
.settings-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-icon { font-size: 20px; width: 28px; text-align: center; }
.settings-row-info { flex: 1; }
.settings-row-title { font-size: 15px; font-weight: 600; }
.settings-row-sub   { font-size: 12px; color: var(--hint); margin-top: 1px; }
