* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  -webkit-font-smoothing: antialiased;
}

/* Turbo progress bar */

.turbo-progress-bar {
  height: 2px;
  background: #3b82f6;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
}

/* Analyzing spinner */

.analyzing-indicator {
  display: inline-block;
  color: #3b82f6;
  font-size: 1rem;
  animation: spin 0.8s linear infinite;
}

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

/* Smooth row removal */

tr, .m-row {
  transition: opacity 0.2s ease, max-height 0.2s ease;
}

/* Disabled button state */

.btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* Header */

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: #64748b;
  font-size: 0.875rem;
}

/* Flash */

.flash {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 100;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  max-width: calc(100% - 32px);
  text-align: center;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

.flash-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.flash-notice {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.flash-alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Cards */

.card {
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

/* Toolbar */

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.add-form {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}

.add-input {
  flex: 1;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 8px 12px;
  background: #0b1220;
  color: #e2e8f0;
  font-size: 0.875rem;
}

.add-input:focus {
  outline: none;
  border-color: #3b82f6;
}

.add-input::placeholder {
  color: #475569;
}

/* Search Autocomplete */

.search-wrap {
  position: relative;
  flex: 1;
}

.search-wrap .add-input {
  width: 100%;
}

.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.search-dropdown.open {
  display: block;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.1s;
}

.search-item:hover,
.search-item.active {
  background: #334155;
}

.search-item:first-child {
  border-radius: 8px 8px 0 0;
}

.search-item:last-child {
  border-radius: 0 0 8px 8px;
}

.search-symbol {
  font-weight: 700;
  color: #f1f5f9;
  font-size: 0.875rem;
  min-width: 60px;
}

.search-name {
  color: #94a3b8;
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty {
  padding: 12px;
  color: #64748b;
  font-size: 0.8125rem;
  text-align: center;
}

.analyze-form {
  display: flex;
}

/* Buttons */

.btn {
  border: 0;
  border-radius: 8px;
  background: #1e293b;
  color: #e2e8f0;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn:hover {
  background: #334155;
}

.btn-accent {
  background: #3b82f6;
  color: #fff;
}

.btn-accent:hover {
  background: #2563eb;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8125rem;
}

.btn-remove {
  border: 0;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.btn-remove:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
}

/* Ticker List */

.ticker-list-card {
  padding: 0;
  overflow: hidden;
}

.ticker-table td {
  vertical-align: middle;
}

.ticker-row:hover {
  background: rgba(30, 41, 59, 0.4);
}

/* Row highlights: strong (высокая confidence) */
.ticker-hot-buy {
  background: rgba(34, 197, 94, 0.10);
  border-left: 3px solid #22c55e;
}

.ticker-hot-buy:hover {
  background: rgba(34, 197, 94, 0.16);
}

.ticker-hot-sell {
  background: rgba(239, 68, 68, 0.10);
  border-left: 3px solid #ef4444;
}

.ticker-hot-sell:hover {
  background: rgba(239, 68, 68, 0.16);
}

/* Row highlights: soft (средняя confidence) */
.ticker-warm-buy {
  background: rgba(34, 197, 94, 0.04);
  border-left: 3px solid rgba(34, 197, 94, 0.4);
}

.ticker-warm-buy:hover {
  background: rgba(34, 197, 94, 0.08);
}

.ticker-warm-sell {
  background: rgba(239, 68, 68, 0.04);
  border-left: 3px solid rgba(239, 68, 68, 0.4);
}

.ticker-warm-sell:hover {
  background: rgba(239, 68, 68, 0.08);
}

.td-actions {
  width: 70px;
  text-align: center;
  white-space: nowrap;
}

.text-nowrap {
  white-space: nowrap;
}

.price-cell {
  font-weight: 600;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}

.change-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.75rem;
}

.ticker-symbol {
  font-size: 1.125rem;
  font-weight: 700;
  color: #f1f5f9;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.ticker-symbol:hover {
  color: #60a5fa;
}

.ticker-name,
.ticker-exchange {
  font-size: 0.75rem;
  line-height: 1.2;
  margin-top: 2px;
}

.ticker-exchange {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Badges */

.badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 5px;
}

.badge-buy {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.badge-sell {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.badge-wait {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
}

.badge-no-trade {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
}

.badge-lg {
  font-size: 0.8125rem;
  padding: 4px 12px;
}

.badge-sm {
  font-size: 0.625rem;
  padding: 2px 6px;
}

/* Signal Body */

.signal-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.signal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
}

.signal-label {
  color: #64748b;
}

.signal-value {
  color: #cbd5e1;
  font-weight: 500;
  text-align: right;
}

.signal-confirmation {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: #64748b;
  font-style: italic;
  line-height: 1.4;
}

.signal-risk {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: #f87171;
  line-height: 1.4;
}

.signal-time {
  margin: 6px 0 0;
  font-size: 0.6875rem;
  color: #475569;
}

.signal-empty {
  padding: 12px 0 4px;
  font-size: 0.8125rem;
}

/* Color helpers */

.text-green {
  color: #4ade80;
}

.text-red {
  color: #f87171;
}

/* Confidence colors */

.confidence-высокая {
  color: #4ade80;
}

.confidence-средняя {
  color: #facc15;
}

.confidence-низкая {
  color: #94a3b8;
}

/* Detail Grid */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 0.6875rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  font-size: 1rem;
  font-weight: 600;
  color: #e2e8f0;
}

/* Empty state */

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: #64748b;
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

th {
  text-align: left;
  font-weight: 500;
  color: #64748b;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px;
  border-bottom: 1px solid #1e293b;
}

td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
  color: #cbd5e1;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Links */

a {
  color: #60a5fa;
  text-decoration: none;
}

a:hover {
  color: #93bbfd;
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.875rem;
  color: #64748b;
}

.back-link:hover {
  color: #94a3b8;
}

/* Form elements */

label {
  display: block;
  margin: 12px 0 6px;
  color: #cbd5e1;
  font-size: 0.875rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 10px;
  background: #0b1220;
  color: #e2e8f0;
  font-size: 0.875rem;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #3b82f6;
}

/* Misc */

.muted {
  color: #64748b;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

/* Mobile compact list */

.mobile-list {
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 10px;
  overflow: hidden;
}

.m-row {
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}

.m-row:last-child {
  border-bottom: none;
}

.m-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.m-row-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.m-row-right {
  display: flex;
  align-items: baseline;
  gap: 6px;
  text-align: right;
}

.m-symbol {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #f1f5f9;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.m-symbol:hover {
  color: #60a5fa;
}

.m-name {
  display: block;
  font-size: 0.6875rem;
  line-height: 1.2;
  margin-top: 1px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-price {
  font-weight: 600;
  color: #f1f5f9;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.m-change {
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.m-row-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.6875rem;
}

.m-stat {
  white-space: nowrap;
}

/* Swipe-to-reveal actions */

.m-row {
  position: relative;
  overflow: hidden;
}


.swipe-content {
  position: relative;
  z-index: 1;
  background: #111827;
  padding: 10px 12px;
  will-change: transform;
}

.ticker-hot-buy > .swipe-content {
  background: rgba(17, 24, 39, 1);
  border-left: 3px solid #22c55e;
}

.ticker-hot-sell > .swipe-content {
  background: rgba(17, 24, 39, 1);
  border-left: 3px solid #ef4444;
}

.ticker-warm-buy > .swipe-content {
  background: rgba(17, 24, 39, 1);
  border-left: 3px solid rgba(34, 197, 94, 0.4);
}

.ticker-warm-sell > .swipe-content {
  background: rgba(17, 24, 39, 1);
  border-left: 3px solid rgba(239, 68, 68, 0.4);
}

/* Responsive visibility */

.mobile-only {
  display: none;
}

.desktop-only {
  display: block;
}

/* Tablet: 768px */

@media (max-width: 768px) {
  .container {
    padding: 16px 12px 40px;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .add-form {
    width: 100%;
  }

  .analyze-form {
    width: 100%;
  }

  .analyze-form .btn {
    width: 100%;
  }

  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: block;
  }
}

/* Small mobile: 480px */

@media (max-width: 480px) {
  .container {
    padding: 12px 8px 32px;
  }

  .card {
    border-radius: 8px;
    padding: 12px;
  }

  .ticker-card-grid {
    grid-template-columns: 1fr 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .ticker-symbol {
    font-size: 1rem;
  }

  .ticker-card-price .price-cell {
    font-size: 1.125rem;
  }
}
