:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #21262d;
  --surface-alt: #1c2128;
  --border: #30363d;
  --border-hover: #58a6ff44;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --accent-dim: #58a6ff18;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --telegram: #2aabee;
  --trial: #8b5cf6;
  --trial-dim: #8b5cf618;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --text-bright: #f0f6fc;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
  --header-bg: rgba(13, 17, 23, 0.9);
}

/* ── Light theme ─────────────────────────────────────────────────── */
.light {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface-2: #eaeef2;
  --surface-alt: #e8ecf0;
  --border: #d0d7de;
  --border-hover: #0969da33;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --accent-dim: #0969da12;
  --success: #1a7f37;
  --warning: #9a6700;
  --danger: #d1242f;
  --telegram: #0088cc;
  --trial: #8250df;
  --trial-dim: #8250df12;
  --text: #24292f;
  --text-muted: #57606a;
  --text-bright: #1f2328;
  --header-bg: rgba(246, 248, 250, 0.92);
}

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

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

/* ── Header ──────────────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.logo-icon { font-size: 1.2rem; }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ── Lang Switcher ───────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  gap: 4px;
}

.lang-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  font-family: inherit;
}

.lang-btn:hover { color: var(--text); border-color: var(--text-muted); }
.lang-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }

/* ── Theme Toggle ────────────────────────────────────────────────── */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.theme-toggle-btn:hover { border-color: var(--text-muted); background: var(--accent-dim); }

/* ── User Area ───────────────────────────────────────────────────── */
#user-area { display: flex; align-items: center; gap: 10px; }

.user-name { font-size: 0.9rem; color: var(--text); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.btn-login-header {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--telegram);
  border: none;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn-login-header:hover  { opacity: 0.88; }
.btn-login-header:active { transform: scale(0.97); opacity: 0.82; }

.btn-login-header .tg-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: #fff;
}

/* ── Navigation: top-level groups ───────────────────────────────── */
.nav-groups {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px 10px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav-groups::-webkit-scrollbar { display: none; }

.nav-group {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-group:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}
.nav-group.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent);
}
.nav-group-icon { font-size: 1.05rem; }

/* ── Tool search ─────────────────────────────────────────────────── */
.tool-search-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.tool-search-input {
  width: 180px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px 6px 32px;
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%238b949e' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.242 1.156a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  transition: border-color .2s, width .2s;
}
.tool-search-input:focus {
  border-color: var(--accent);
  width: 240px;
}
.tool-search-input::placeholder { color: var(--text-muted); }

.tool-search-results {
  position: fixed;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 9999;
  max-height: 320px;
  overflow-y: auto;
}
.tool-search-results.hidden { display: none; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--surface-2);
  transition: background .15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface-2); }
.search-result-icon { font-size: 1.3rem; flex-shrink: 0; }
.search-result-name { font-size: 0.9rem; color: var(--text-bright); font-weight: 500; }
.search-result-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 1px; }
.search-result-empty { padding: 16px 14px; color: var(--text-muted); font-size: 0.88rem; text-align: center; }

/* ── Navigation: subtool row ─────────────────────────────────────── */
.nav-subtabs-wrap {
  position: relative;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav-subtabs-wrap.hidden { display: none; }

/* Right fade — hints that more items can be scrolled */
.nav-subtabs-wrap::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 40px;
  background: linear-gradient(to right, transparent, var(--surface));
  pointer-events: none;
  z-index: 1;
}

.nav-subtabs {
  display: flex;
  gap: 6px;
  padding: 6px 24px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  scroll-snap-type: x proximity;
}
.nav-subtabs::-webkit-scrollbar { display: none; }
.nav-subtabs:active { cursor: grabbing; }

.nav-subtab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.83rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  scroll-snap-align: start;
  user-select: none;
  -webkit-user-select: none;
}
.nav-subtab:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--text-muted);
}
.nav-subtab.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent);
}
.nav-subtab-icon { font-size: 0.9rem; }

/* ── Main & Card ─────────────────────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 640px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ── States ──────────────────────────────────────────────────────── */
.state { display: none; }
.state.active { display: flex; flex-direction: column; gap: 18px; }
.hidden { display: none !important; }

.state-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-bright);
}

/* ── Tool description block ──────────────────────────────────────── */
.tool-desc-block {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.tool-desc-icon { font-size: 2rem; flex-shrink: 0; }

.tool-desc-title {
  font-weight: 600;
  color: var(--text-bright);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.tool-desc-text {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 8px;
}

.trial-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--trial-dim);
  border: 1px solid var(--trial);
  color: var(--trial);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 500;
}

/* ── Dropzone ────────────────────────────────────────────────────── */
#dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
}

#dropzone:hover,
#dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.dz-icon { font-size: 2.8rem; margin-bottom: 14px; display: block; }
.dz-text { color: var(--text-bright); font-size: 1.05rem; font-weight: 500; margin-bottom: 6px; }
.dz-formats { color: var(--text-muted); font-size: 0.83rem; margin-top: 6px; }

/* ── File List ───────────────────────────────────────────────────── */
.file-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
}

.file-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;      /* prevents flex item from exceeding grid cell */
  overflow: hidden;  /* clips any content that still escapes */
}

.file-icon { font-size: 1.4rem; flex-shrink: 0; }

.file-index {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
  align-self: center;
}

/* min-width:0 is required for text-overflow to work inside flex */
.file-info { flex: 1; min-width: 0; overflow: hidden; }

.file-name {
  color: var(--text-bright);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-trial-tag {
  color: var(--trial);
  font-size: 0.75rem;
  margin-top: 2px;
}

.file-size { color: var(--text-muted); font-size: 0.78rem; margin-top: 2px; }

/* ── Suggestions ─────────────────────────────────────────────────── */
.suggestions-list { display: flex; flex-direction: column; gap: 8px; }

.suggestion-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color var(--transition), background var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: inherit;
  color: var(--text);
}

.suggestion-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.suggestion-btn:active {
  transform: scale(0.98);
  background: var(--accent-dim);
  border-color: var(--accent);
}

.suggestion-left { display: flex; align-items: center; gap: 12px; }
.suggestion-icon { font-size: 1.4rem; flex-shrink: 0; }
.suggestion-title { color: var(--text-bright); font-weight: 500; font-size: 0.92rem; }
.suggestion-trial { color: var(--trial); font-size: 0.78rem; margin-top: 2px; }

.suggestion-price {
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 12px;
}

.suggestion-price.free { color: var(--success); }
.suggestion-price.paid { color: var(--warning); }

/* "Full version:" label inside suggestion price and result badge */
.price-full-label {
  color: var(--accent);
  font-weight: 600;
}

.suggestion-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.suggestion-go {
  color: var(--accent);
  font-size: 0.85rem;
  opacity: 0.7;
  transition: opacity var(--transition), transform var(--transition);
}

.suggestion-btn:hover .suggestion-go {
  opacity: 1;
  transform: translateX(3px);
}

/* ── Preview actions (multi-file tools) ─────────────────────────── */
.preview-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Format picker (image_convert) ──────────────────────────────── */
.format-picker-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
}

.format-picker-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 4px;
  white-space: nowrap;
}

.format-btn {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.format-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.format-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* ── Extra inputs (rotate, password, watermark, resize) ─────────── */
.extra-inputs-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
}

.extra-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 100px;
}

.extra-input-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.extra-input-select,
.extra-input-field {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition);
  width: 100%;
  box-sizing: border-box;
}

.extra-input-select:focus,
.extra-input-field:focus {
  outline: none;
  border-color: var(--accent);
}

.extra-input-field[type="number"] {
  max-width: 110px;
}

.btn-add-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px;
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.btn-add-more:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Spinner & Processing ────────────────────────────────────────── */
.spinner-wrap { display: flex; justify-content: center; margin: 32px 0 16px; }

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.processing-text { text-align: center; color: var(--text-muted); font-size: 0.93rem; }

.queue-info {
  text-align: center;
  color: var(--text);
  font-size: 0.88rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
}

.progress-bar {
  height: 5px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 16px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #58c96a);
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.processing-tool-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}
.processing-tool-row.hidden { display: none; }
.processing-tool-icon { font-size: 1.6rem; }
.processing-tool-name { font-size: 0.95rem; color: var(--text-bright); font-weight: 500; }

.processing-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  min-height: 18px;
}
.processing-status-text { }
.processing-elapsed { font-variant-numeric: tabular-nums; }

/* ── Result ──────────────────────────────────────────────────────── */
.result-icon, .error-icon, .paid-icon {
  font-size: 2.8rem;
  text-align: center;
}

.result-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  color: var(--success);
}

.error-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  color: var(--danger);
}

.paid-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-bright);
}

.paid-desc {
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  font-size: 0.93rem;
}

/* ── Result file info ────────────────────────────────────────────── */
.result-file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  min-width: 0;
}

.result-file-icon { font-size: 1.8rem; flex-shrink: 0; }

/* min-width:0 critical for flex truncation to work */
.result-file-info > div {
  min-width: 0;
  overflow: hidden;
}

.result-filename {
  color: var(--text-bright);
  font-weight: 500;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trial-inline {
  color: var(--trial);
  font-size: 0.8rem;
  margin-top: 3px;
}

/* ── Full-version upgrade badge (shown in result state) ─────────── */
.result-upgrade {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 4px 0 2px;
}

.upgrade-label {
  color: var(--accent);
  font-weight: 700;
}

.upgrade-price {
  color: var(--warning);
  font-weight: 600;
}

/* ── Trial notice ────────────────────────────────────────────────── */
.trial-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--trial-dim);
  border: 1px solid var(--trial);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}

.trial-notice-icon { flex-shrink: 0; }

/* ── История конвертаций ─────────────────────────────────────────── */
.history-section {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.history-section.hidden { display: none; }

.history-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}
.history-header:hover { color: var(--text); }
.history-count {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 0.75rem;
}
.history-chevron { margin-left: auto; font-size: 0.8rem; transition: transform .2s; }
.history-chevron.open { transform: rotate(180deg); }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.history-list.open { max-height: 500px; }

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.82rem;
  min-width: 0;
}
.history-item.expired { opacity: 0.45; }
.history-item-icon { font-size: 1.2rem; flex-shrink: 0; }
.history-item-info { flex: 1; min-width: 0; }
.history-item-name {
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.history-item-tool { color: var(--text-muted); font-size: 0.75rem; margin-top: 1px; }
.history-item-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.history-item-time.soon { color: var(--warning); }
.history-item-dl {
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.history-item-dl:hover { filter: brightness(1.1); }
.history-item-expired-label {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-expiry-note {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  display: none;
}
.history-list.open + .history-expiry-note { display: block; }

/* ── File expiry notice ──────────────────────────────────────────── */
.result-expiry {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0;
}
.result-expiry.expiring-soon { color: var(--warning); }
.result-expiry.expired { color: var(--danger); }

/* ── Result actions ──────────────────────────────────────────────── */
.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* ── Auth CTA ────────────────────────────────────────────────────── */
.auth-cta {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: 0.93rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  text-align: center;
  font-family: inherit;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-telegram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  background: var(--telegram);
  color: #fff;
  font-weight: 600;
  font-size: 0.93rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: opacity var(--transition);
  text-decoration: none;
  text-align: center;
  font-family: inherit;
}

.btn-telegram:hover  { opacity: 0.88; }
.btn-telegram:active { transform: scale(0.98); opacity: 0.82; }

.btn-telegram .tg-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: #fff;
}

.btn-ghost {
  display: block;
  width: 100%;
  padding: 11px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  font-family: inherit;
  text-align: center;
}

.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

/* ── Auth Modal ──────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden { display: none !important; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.modal-title { font-size: 1.05rem; font-weight: 600; color: var(--text-bright); }
.modal-sub { color: var(--text-muted); font-size: 0.88rem; }
#telegram-widget-container { margin: 4px 0; min-height: 48px; }

.widget-loading {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 12px 0;
  text-align: center;
}

.widget-no-bot {
  padding: 12px 0;
  text-align: center;
}

.widget-no-bot p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 10px;
}

.widget-open-tg {
  display: inline-flex !important;
  width: auto !important;
  padding: 10px 20px;
  font-size: 0.9rem;
  text-decoration: none;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .card { padding: 20px 14px; }
  .file-list { grid-template-columns: 1fr; }
  header { padding: 10px 16px; }
  .nav-groups { padding: 8px 12px; gap: 4px; }
  .tool-search-input { width: 32px; padding-left: 32px; color: transparent; }
  .tool-search-input:focus { width: 160px; color: var(--text); }
  .nav-group { padding: 7px 14px; font-size: 0.83rem; }
  .nav-group-icon { display: none; }
  .nav-subtabs { padding: 5px 12px 7px; gap: 6px; cursor: default; }
  .nav-subtab { padding: 6px 12px; font-size: 0.8rem; }
  .nav-subtab-icon { display: none; }
  /* On touch devices, no grab cursor — native touch scroll is sufficient */
  @media (hover: none) {
    .nav-subtabs { cursor: default; }
    .nav-subtabs:active { cursor: default; }
  }
}

/* ── Drag reorder ────────────────────────────────────────────────── */
.draggable-card { cursor: grab; position: relative; }
.draggable-card:active { cursor: grabbing; }
.draggable-card.dragging { opacity: 0.4; }
.draggable-card.drag-over-card { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.drag-handle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-right: 6px;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}

.file-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  margin-left: auto;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.file-remove:hover { color: #e05; background: rgba(255,0,50,0.08); }

/* ── Feedback ────────────────────────────────────────────────────── */
.result-feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 2px;
  padding: 10px 16px;
  background: var(--surface2);
  border-radius: 10px;
  font-size: 0.9rem;
}
.result-feedback.hidden { display: none; }
.feedback-label { color: var(--text-muted); flex: 1; }
.feedback-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.feedback-btn:hover { background: var(--surface3); border-color: var(--accent); }
.feedback-thanks { color: var(--accent); font-size: 0.9rem; }

/* ── ZIP info ────────────────────────────────────────────────────── */
.zip-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}
