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

:root {
  --bg:          var(--tg-theme-bg-color, #18181b);
  --text:        var(--tg-theme-text-color, #fafafa);
  --hint:        var(--tg-theme-hint-color, #71717a);
  --accent:      var(--tg-theme-button-color, #6366f1);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --surface:     var(--tg-theme-secondary-bg-color, #27272a);
  --danger:      #ef4444;
  --success:     #22c55e;
  --gold:        #f59e0b;
  --radius:      14px;
  --radius-sm:   8px;
  --nav-h:       60px;

  /* Адаптивные — переопределяются в светлой теме */
  --border:          rgba(255,255,255,.08);
  --overlay:         rgba(0,0,0,.6);
  --handle-bg:       rgba(255,255,255,.2);
  --close-btn-bg:    rgba(255,255,255,.08);
  --close-btn-hover: rgba(255,255,255,.16);
  --track-off:       rgba(255,255,255,.14);
  --track-shadow:    rgba(0,0,0,.35);
  --progress-track:  rgba(255,255,255,.08);
  --tag-bg:          rgba(239,68,68,.15);
  --tag-border:      rgba(239,68,68,.28);
  --tag-text:        #fca5a5;
  --tag-remove:      #f87171;
  --surface-alt:     var(--bg);   /* bg внутри surface (pill, result) */
}

/* ── Светлая тема ── */
[data-theme="light"] {
  --border:          rgba(0,0,0,.1);
  --overlay:         rgba(0,0,0,.45);
  --handle-bg:       rgba(0,0,0,.14);
  --close-btn-bg:    rgba(0,0,0,.07);
  --close-btn-hover: rgba(0,0,0,.13);
  --track-off:       rgba(0,0,0,.14);
  --track-shadow:    rgba(0,0,0,.18);
  --progress-track:  rgba(0,0,0,.08);
  --tag-bg:          rgba(239,68,68,.1);
  --tag-border:      rgba(239,68,68,.22);
  --tag-text:        #b91c1c;
  --tag-remove:      #dc2626;
  --surface-alt:     var(--tg-theme-bg-color, #f4f4f5);
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 0;
}

/* ── Layout ── */
.screen { padding: 16px 16px calc(16px + var(--nav-h) + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; }

/* ── Top bar with back ── */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  padding: 12px 16px 4px;
  max-width: 520px;
  margin: 0 auto;
}
.back-btn {
  background: none; border: none; cursor: pointer;
  color: var(--accent); display: flex; align-items: center;
  gap: 4px; font-size: 15px; padding: 4px 0;
  flex-shrink: 0; z-index: 1;
}
.back-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topbar-title {
  position: absolute; left: 0; right: 0;
  text-align: center; font-size: 17px; font-weight: 600;
  pointer-events: none;
}

/* ── Nav ── */
nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  display: flex;
  border-top: 1px solid var(--border);
  z-index: 100;
}
nav button {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--hint);
  font-size: 10px; font-weight: 500; letter-spacing: .3px; text-transform: uppercase;
  transition: color .15s;
}
nav button.active { color: var(--accent); }
nav button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Section title ── */
.section-title {
  font-size: 11px; font-weight: 600; letter-spacing: .6px;
  text-transform: uppercase; color: var(--hint);
  margin: 20px 0 8px;
}

/* ── Menu rows ── */
.menu-list { display: flex; flex-direction: column; gap: 2px; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; border: 1px solid var(--border);
  cursor: pointer; transition: opacity .15s;
  text-decoration: none; color: var(--text);
}
.menu-item:active { opacity: .7; }
.menu-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(99,102,241,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.menu-icon.gold { background: rgba(245,158,11,.15); }
.menu-icon.red  { background: rgba(239,68,68,.12); }
.menu-body { flex: 1; }
.menu-label { font-weight: 600; font-size: 15px; }
.menu-sub   { font-size: 12px; color: var(--hint); margin-top: 1px; }
.menu-chevron { color: var(--hint); }
.menu-chevron svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Cards ── */
.card-list { display: flex; flex-direction: column; gap: 8px; }
.card {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center;
  gap: 12px; border: 1px solid var(--border);
}
.card-body { flex: 1; min-width: 0; }
.card-title { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub   { font-size: 12px; color: var(--hint); margin-top: 2px; }

.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--hint); padding: 6px; border-radius: var(--radius-sm);
  display: flex; align-items: center; flex-shrink: 0;
  transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--danger); background: rgba(239,68,68,.1); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-text);
  border: none; border-radius: var(--radius);
  padding: 13px 20px; font-size: 15px; font-weight: 600;
  cursor: pointer; width: 100%;
  transition: opacity .15s, transform .1s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-gold { background: linear-gradient(135deg, #f59e0b, #d97706); color: #1c1917; }
.btn-ghost {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}

/* ── Form ── */
.form-row { display: flex; gap: 8px; }
.input {
  flex: 1; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; font-size: 15px; color: var(--text);
  outline: none; transition: border-color .2s; min-width: 0;
}
.input::placeholder { color: var(--hint); }
.input:focus { border-color: var(--accent); }
.select {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 12px 10px;
  font-size: 14px; color: var(--text); outline: none;
  transition: border-color .2s; cursor: pointer; flex-shrink: 0;
}
.select:focus { border-color: var(--accent); }

/* ── Add panel (sticky bottom form) ── */
.add-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 16px;
}
.add-panel-title {
  font-size: 12px; font-weight: 600; letter-spacing: .4px;
  text-transform: uppercase; color: var(--hint); margin-bottom: 10px;
}

/* ── Progress ── */
.progress-wrap {
  background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; border: 1px solid var(--border); margin-bottom: 16px;
}
.progress-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.progress-label { font-size: 13px; color: var(--hint); }
.progress-count { font-size: 13px; font-weight: 600; }
.progress-bar-bg { height: 6px; background: var(--progress-track); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width .3s ease; }
.progress-bar-fill.full { background: var(--danger); }

/* ── Toggle ── */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; border: 1px solid var(--border);
}
.toggle-info { display: flex; align-items: center; gap: 12px; }
.toggle-icon-wrap {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--close-btn-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.toggle-name { font-weight: 600; font-size: 14px; }
.toggle-url  { font-size: 12px; color: var(--hint); }
.toggle { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: absolute; inset: 0;
  background: var(--track-off); border-radius: 13px;
  cursor: pointer; transition: background .2s;
}
.toggle input:checked + .track { background: var(--accent); }
.toggle input:disabled + .track { cursor: default; opacity: .5; }
.toggle .thumb {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; background: #fff; border-radius: 50%;
  pointer-events: none; transition: transform .2s;
  box-shadow: 0 1px 4px var(--track-shadow);
}
.toggle input:checked ~ .thumb { transform: translateX(20px); }

/* ── Profile ── */
.profile-header {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border-radius: var(--radius);
  padding: 18px 16px; border: 1px solid var(--border);
  margin-bottom: 4px;
}
.avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff;
  flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name     { font-size: 17px; font-weight: 700; }
.profile-username { font-size: 13px; color: var(--hint); margin-top: 2px; }

/* ── Premium page ── */
.premium-hero {
  background: linear-gradient(135deg, #312e81 0%, #1e1b4b 60%, #0f172a 100%);
  border-radius: var(--radius); padding: 22px;
  border: 1px solid rgba(99,102,241,.3);
  position: relative; overflow: hidden; margin-bottom: 16px;
}
.premium-hero::after {
  content: '✦'; position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%); font-size: 72px; opacity: .06; line-height: 1;
}
.premium-hero-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1c1917; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 6px; margin-bottom: 10px;
}
.premium-hero-title { font-size: 19px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.premium-hero-sub   { font-size: 13px; color: rgba(255,255,255,.5); margin-bottom: 16px; }
.perk-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: rgba(255,255,255,.8); margin-bottom: 8px; }
.perk-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }

.premium-active-card {
  background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.2);
  border-radius: var(--radius); padding: 18px 16px;
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
}
.premium-active-icon  { font-size: 32px; }
.premium-active-label { font-size: 16px; font-weight: 700; color: #4ade80; }
.premium-active-sub   { font-size: 13px; color: rgba(74,222,128,.6); margin-top: 2px; }

/* ── Exclusion tags ── */
.tag-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-top: 10px;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--tag-bg); border: 1px solid var(--tag-border);
  border-radius: 20px; padding: 4px 10px 4px 12px;
  font-size: 13px; color: var(--tag-text);
}
.tag-remove {
  background: none; border: none; cursor: pointer;
  color: var(--tag-remove); padding: 0; line-height: 1;
  display: flex; align-items: center; flex-shrink: 0;
  font-size: 14px; transition: color .15s;
}
.tag-remove:hover { color: var(--danger); }

/* ── Feed card ── */
.feed-card {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.respond-btn {
  width: 100%;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
}

/* ── Respond drawer (bottom sheet) ── */
.respond-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--overlay);
  display: flex; align-items: flex-end;
}
.respond-drawer {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
  width: 100%; max-height: 88dvh; overflow-y: auto;
  scrollbar-width: none;
}
.respond-drawer::-webkit-scrollbar { display: none; }
.respond-handle {
  width: 36px; height: 4px;
  background: var(--handle-bg); border-radius: 2px;
  margin: 0 auto 16px;
}
.respond-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.respond-drawer-title { font-size: 17px; font-weight: 700; }
.respond-close {
  background: var(--close-btn-bg); border: none;
  border-radius: 50%; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--hint); flex-shrink: 0;
  transition: background .15s;
}
.respond-close:hover { background: var(--close-btn-hover); }

/* Project pill */
.respond-project-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 20px;
}
.respond-project-emoji { font-size: 16px; flex-shrink: 0; }
.respond-project-name {
  flex: 1; font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.respond-project-link {
  color: var(--hint); flex-shrink: 0; display: flex; align-items: center;
  transition: color .15s;
}
.respond-project-link:hover { color: var(--accent); }

/* Section label */
.respond-section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .5px;
  text-transform: uppercase; color: var(--hint); margin-bottom: 10px;
}

/* Template pick list */
.tpl-pick-list { display: flex; flex-direction: column; gap: 6px; }
.tpl-pick-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-alt); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  cursor: pointer; text-align: left; width: 100%;
  transition: border-color .15s, background .15s;
}
.tpl-pick-item.selected {
  border-color: var(--accent);
  background: rgba(99,102,241,.08);
}
.tpl-pick-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.tpl-pick-item.selected .tpl-pick-check {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.tpl-pick-name { font-size: 14px; font-weight: 500; color: var(--text); }

/* Generating state */
.respond-generating {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 0; gap: 14px;
}
.respond-gen-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
.respond-gen-label { font-size: 14px; color: var(--hint); }

/* Result */
.respond-result {
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  max-height: 260px; overflow-y: auto;
}
.respond-result-text {
  font-size: 14px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; color: var(--text);
}

.btn-success {
  background: var(--success) !important;
  color: #fff !important;
}

/* ── Respond: balance badge ── */
.respond-balance {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.respond-balance-chip {
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
}
.respond-balance-free  { background: rgba(245,158,11,.15); color: var(--gold); }
.respond-balance-paid  { background: rgba(99,102,241,.15); color: var(--accent); }
.respond-balance-empty { background: rgba(239,68,68,.12);  color: var(--danger); }

/* ── Respond: no credits ── */
.respond-no-credits {
  background: rgba(239,68,68,.07); border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius); padding: 14px 16px; margin-top: 12px;
  text-align: center;
}
.respond-no-credits-text { font-size: 14px; color: var(--danger); }

/* ── Credits balance card ── */
.credits-balance-card {
  display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px; gap: 0;
}
.credits-balance-left, .credits-balance-right {
  flex: 1; text-align: center;
}
.credits-balance-divider {
  width: 1px; background: var(--border); align-self: stretch; margin: 0 16px;
}
.credits-balance-num {
  font-size: 28px; font-weight: 700; line-height: 1;
}
.credits-free { color: var(--gold); }
.credits-zero { color: var(--hint); }
.credits-balance-label {
  font-size: 11px; color: var(--hint); margin-top: 4px;
}

/* ── Credit packages ── */
.credits-packages {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  margin-bottom: 4px;
}
.credits-pkg {
  position: relative;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px 12px;
  cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.credits-pkg:hover:not(:disabled) {
  border-color: var(--accent); background: rgba(99,102,241,.07);
}
.credits-pkg:disabled { opacity: .5; cursor: default; }
.credits-pkg-amount { font-size: 24px; font-weight: 700; }
.credits-pkg-unit   { font-size: 11px; color: var(--hint); }
.credits-pkg-price  { font-size: 15px; font-weight: 600; color: var(--accent); margin-top: 4px; }
.credits-pkg-badge  {
  position: absolute; top: -8px; right: 8px;
  background: var(--success); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
}

/* ── Tab switcher ── */
.tab-switcher {
  display: flex; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px;
  margin-bottom: 16px;
}
.tab-btn {
  flex: 1; background: none; border: none; cursor: pointer;
  color: var(--hint); font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: calc(var(--radius) - 4px);
  transition: color .15s, background .15s;
}
.tab-btn.active {
  background: var(--accent); color: var(--accent-text);
}

/* ── Misc ── */
.empty { text-align: center; padding: 40px 20px; color: var(--hint); }
.empty-icon { font-size: 40px; margin-bottom: 10px; }
.empty-text { font-size: 14px; }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; }
.hint-text { color: var(--hint); font-size: 13px; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }

.spinner {
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; width: 32px; height: 32px;
  animation: spin .7s linear infinite; margin: 60px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Template cards ── */
.template-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.template-card-body { flex: 1; min-width: 0; }
.template-card-title {
  font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.template-card-preview { font-size: 13px; color: var(--hint); line-height: 1.4; }
.template-card-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ── Template editor ── */
.template-editor textarea.input {
  display: block; width: 100%;
}

/* ── Wizard ── */
.wizard-step {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px 16px;
}
.wizard-progress-bar {
  height: 4px; background: var(--progress-track);
  border-radius: 2px; overflow: hidden; margin-bottom: 14px;
}
.wizard-progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px; transition: width .3s ease;
}
.wizard-step-num { font-size: 12px; color: var(--hint); margin-bottom: 8px; }
.wizard-question { font-size: 16px; font-weight: 600; line-height: 1.4; }

/* ── Credits page ── */
.credits-balance-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px 16px;
  display: flex; align-items: center; gap: 0;
  margin-bottom: 10px;
}
.credits-balance-left, .credits-balance-right {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.credits-balance-divider {
  width: 1px; height: 48px; background: var(--border); flex-shrink: 0;
}
.credits-balance-num {
  font-size: 36px; font-weight: 700; line-height: 1;
}
.credits-free { color: var(--accent); }
.credits-zero { color: var(--hint); }
.credits-balance-label { font-size: 12px; color: var(--hint); text-align: center; }

.credits-status-card {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; margin-bottom: 20px;
}
.credits-status-ok {
  background: rgba(74, 222, 128, 0.12); color: #4ade80;
}
.credits-status-empty {
  background: rgba(239, 68, 68, 0.12); color: #ef4444;
}
[data-theme="light"] .credits-status-ok {
  background: rgba(22, 163, 74, 0.12); color: #15803d;
}
[data-theme="light"] .credits-status-empty {
  background: rgba(220, 38, 38, 0.12); color: #b91c1c;
}
.credits-status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: currentColor;
}

.credits-how { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.credits-how-row {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 12px 14px;
}
.credits-how-icon { font-size: 20px; flex-shrink: 0; line-height: 1.4; }
.credits-how-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.credits-how-sub { font-size: 12px; color: var(--hint); }

.credits-premium-hint {
  font-size: 13px; color: var(--hint);
  margin-bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap;
}
.credits-premium-link {
  color: #f59e0b; font-weight: 600; cursor: pointer;
}

.credits-packages {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 16px;
}
.credits-pkg {
  position: relative; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 10px; cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.credits-pkg:hover:not(:disabled) { border-color: var(--accent); }
.credits-pkg:disabled { opacity: .5; cursor: not-allowed; }
.credits-pkg-badge {
  position: absolute; top: -8px; right: 10px;
  background: #f59e0b; color: #1c1917;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .5px;
}
.credits-pkg-amount { font-size: 24px; font-weight: 700; color: var(--accent); line-height: 1; }
.credits-pkg-unit { font-size: 11px; color: var(--hint); margin-bottom: 6px; }
.credits-pkg-price { font-size: 16px; font-weight: 600; }
.credits-pkg-per { font-size: 11px; color: var(--hint); }

/* ── Custom amount ── */
.credits-custom-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 16px; margin-top: 0;
}
.credits-custom-row {
  display: flex; gap: 10px; align-items: center;
}
.credits-custom-input {
  flex: 1; min-width: 0;
  -moz-appearance: textfield;
}
.credits-custom-input::-webkit-outer-spin-button,
.credits-custom-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.credits-custom-btn {
  width: auto; flex-shrink: 0; padding: 12px 20px; font-size: 15px;
}
.credits-custom-preview {
  display: flex; align-items: baseline; gap: 6px; margin-top: 10px;
}
.credits-custom-total {
  font-size: 20px; font-weight: 700; color: var(--accent);
}
.credits-custom-per {
  font-size: 13px; color: var(--hint);
}
.credits-custom-discount {
  font-size: 12px; font-weight: 700; color: var(--success);
  background: rgba(34,197,94,.12); padding: 2px 7px; border-radius: 6px;
}
.credits-custom-hint {
  font-size: 12px; color: var(--hint); margin-top: 8px;
}

.credits-msg-ok {
  color: #4ade80; font-size: 14px; font-weight: 500;
  text-align: center; margin-top: 10px;
}
[data-theme="light"] .credits-msg-ok { color: #16a34a; }

/* ── Admin panel ── */
.admin-tabs {
  display: flex; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px;
  margin-bottom: 14px;
}
.admin-tab {
  flex: 1; background: none; border: none; cursor: pointer;
  color: var(--hint); font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: calc(var(--radius) - 4px);
  transition: color .15s, background .15s;
}
.admin-tab.active { background: var(--accent); color: var(--accent-text); }

.admin-user-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  cursor: pointer; transition: opacity .15s;
  display: flex; flex-direction: column; gap: 4px;
}
.admin-user-card:active { opacity: .7; }
.admin-user-card-main { display: flex; align-items: center; gap: 8px; }
.admin-user-id { font-weight: 600; font-size: 15px; font-family: monospace; }
.admin-user-card-meta { display: flex; gap: 12px; }

.admin-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.admin-badge--gold   { background: rgba(245,158,11,.18); color: var(--gold); }
.admin-badge--source { background: rgba(99,102,241,.15); color: var(--accent); }

.admin-detail-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 4px;
}

.admin-stat-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.admin-stat-label { font-size: 13px; color: var(--hint); }
.admin-stat-value  { font-size: 14px; font-weight: 500; text-align: right; }

.admin-action-row {
  display: flex; gap: 8px; align-items: center;
}

.admin-project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.admin-project-header { display: flex; align-items: center; justify-content: space-between; }
.admin-project-title  { font-size: 14px; font-weight: 500; }
.admin-project-title a { color: var(--text); text-decoration: none; }
.admin-project-title a:hover { color: var(--accent); }
.admin-project-meta   { display: flex; align-items: center; gap: 12px; }
.admin-project-price  { font-size: 13px; color: var(--accent); font-weight: 600; }

.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-top: 16px;
}
.pagination-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 14px;
  font-size: 16px; cursor: pointer; color: var(--text);
  transition: opacity .15s;
}
.pagination-btn:disabled { opacity: .35; cursor: default; }
.pagination-info { font-size: 14px; color: var(--hint); min-width: 60px; text-align: center; }

.msg { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; }
.msg--success { background: rgba(34,197,94,.12); color: var(--success); }
.msg--error   { background: rgba(239,68,68,.1); color: var(--danger); }

.btn-danger {
  background: var(--danger); color: #fff;
  border: none; border-radius: var(--radius-sm);
  padding: 12px 20px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: opacity .15s; width: auto;
}
.btn-danger:active { opacity: .8; }

/* Красная кнопка полной ширины (для профиля) */
.admin-btn-danger {
  background: rgba(239,68,68,.12);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--radius);
  padding: 14px 20px; font-size: 15px; font-weight: 600;
  cursor: pointer; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s;
}
.admin-btn-danger:active { background: rgba(239,68,68,.2); }

/* ── DatePicker ── */
.dp-wrap { position: relative; }

.dp-trigger {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 11px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text); font-size: 14px; font-weight: 500;
  transition: border-color .15s;
}
.dp-trigger:hover { border-color: var(--accent); }

.dp-icon {
  width: 16px; height: 16px; flex-shrink: 0;
  stroke: var(--accent); fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.dp-chevron {
  width: 16px; height: 16px; flex-shrink: 0; margin-left: auto;
  stroke: var(--hint); fill: none; stroke-width: 2;
  stroke-linecap: round; transition: transform .2s;
}
.dp-chevron.open { transform: rotate(180deg); }

.dp-calendar {
  margin-top: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  user-select: none;
}

.dp-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.dp-month-label { font-size: 14px; font-weight: 600; }
.dp-nav {
  background: none; border: none; cursor: pointer;
  color: var(--hint); padding: 4px 8px; border-radius: var(--radius-sm);
  transition: background .15s;
}
.dp-nav:hover { background: var(--bg); color: var(--text); }
.dp-nav svg {
  display: block; width: 18px; height: 18px;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

.dp-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dp-dayname {
  text-align: center; font-size: 11px; color: var(--hint);
  font-weight: 600; padding: 4px 0 6px; letter-spacing: .3px;
}
.dp-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .12s, color .12s;
}
.dp-cell:not(.dp-cell--empty):hover { background: var(--bg); }
.dp-cell--empty { cursor: default; }
.dp-cell--past  { color: var(--hint); opacity: .5; }
.dp-cell--today { font-weight: 700; color: var(--accent); }
.dp-cell--selected {
  background: var(--accent) !important;
  color: var(--accent-text) !important;
}

/* ── Policy pages ── */
.policy-screen { padding-top: 12px; }

.policy-block {
  margin-bottom: 20px;
}

.policy-title {
  font-size: 20px; font-weight: 700; letter-spacing: -.3px;
  margin-bottom: 4px;
}

.policy-date {
  font-size: 12px; color: var(--hint);
}

.policy-h3 {
  font-size: 15px; font-weight: 700;
  margin-bottom: 8px; color: var(--text);
}

.policy-block p {
  font-size: 14px; color: var(--hint); line-height: 1.6;
  margin-bottom: 6px;
}

.policy-list {
  padding-left: 18px; margin: 6px 0;
  display: flex; flex-direction: column; gap: 5px;
}

.policy-list li {
  font-size: 14px; color: var(--hint); line-height: 1.55;
}

.policy-list b { color: var(--text); }

.policy-link {
  color: var(--accent); text-decoration: none;
}
.policy-link:hover { text-decoration: underline; }

.policy-contact {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  margin-top: 8px; margin-bottom: 24px;
  font-size: 14px; color: var(--hint);
  flex-wrap: wrap;
}

.policy-contact-link {
  color: var(--accent); font-weight: 600; text-decoration: none;
}
.policy-contact-link:hover { text-decoration: underline; }
