:root {
  --bg-main: #0a0e17;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(24, 32, 50, 0.9);
  --bg-elevated: #161f30;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --cyan-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  
  --profit-color: #10b981;
  --profit-bg: rgba(16, 185, 129, 0.12);
  --profit-border: rgba(16, 185, 129, 0.3);
  
  --loss-color: #f43f5e;
  --loss-bg: rgba(244, 63, 94, 0.12);
  --loss-border: rgba(244, 63, 94, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Background glowing ambient orbs */
.app-background {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.22;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: #6366f1;
  top: -100px;
  left: 10%;
}

.orb-2 {
  width: 450px;
  height: 450px;
  background: #06b6d4;
  top: 30%;
  right: -50px;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: #d946ef;
  bottom: 5%;
  left: 20%;
}

/* App layout */
.app-layout {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.logo-badge {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glow);
}

.logo-text h1 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
}

.logo-text h1 span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

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

/* Control Pills */
.control-pill-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-lg);
}

.currency-toggle {
  display: flex;
  gap: 2px;
}

.curr-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.curr-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.rate-config {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border-left: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
}

.rate-config input {
  width: 58px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: #fff;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.rate-config input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* Stats Overview */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stat-icon-wrapper.invested { background: rgba(99, 102, 241, 0.15); }
.stat-icon-wrapper.value { background: rgba(6, 182, 212, 0.15); }
.stat-icon-wrapper.profit { background: rgba(16, 185, 129, 0.15); }
.stat-icon-wrapper.count { background: rgba(217, 70, 239, 0.15); }

.stat-title {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #fff;
}

.stat-foot {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.profit-badge {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--profit-bg);
  color: var(--profit-color);
  border: 1px solid var(--profit-border);
}

.profit-badge.negative {
  background: var(--loss-bg);
  color: var(--loss-color);
  border-color: var(--loss-border);
}

/* Quick Add Section */
.quick-add-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quick-add-header h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.quick-add-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

.quick-add-form {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flex-1 { flex: 1; min-width: 0; }
.flex-2 { flex: 2; min-width: 0; }
.flex-auto { flex: 0 0 80px; min-width: 0; }

/* Universal Clean Form Controls */
.form-group input,
.form-group select,
.modal-body input,
.modal-body select {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group select,
.modal-body select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 12px) center;
  padding-right: 32px;
}

.form-group select option,
.modal-body select option {
  background: #111827;
  color: #fff;
  padding: 8px;
}

.form-group input:focus,
.form-group select:focus,
.modal-body input:focus,
.modal-body select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.input-with-icon, .input-with-unit, .input-with-button {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.input-with-icon:focus-within, .input-with-unit:focus-within, .input-with-button:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.input-icon {
  padding: 0 12px;
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Reset for inputs inside composite wrappers */
.input-with-icon input,
.input-with-unit input,
.input-with-button input {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 10px 14px !important;
  width: 100%;
}

.qty-input {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
}

.input-with-unit select {
  width: 95px !important;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05) !important;
  border: none !important;
  border-left: 1px solid var(--border-color) !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  color: var(--text-secondary) !important;
  padding: 10px 8px !important;
  cursor: pointer;
  appearance: none;
}

.input-with-unit select:focus {
  outline: none;
}

/* Filter bar */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 12px;
  width: 320px;
}

.search-box input {
  background: transparent;
  border: none;
  color: #fff;
  padding: 10px 8px;
  font-size: 13px;
  width: 100%;
}

.search-box input:focus { outline: none; }

.clear-search {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}

.game-filters {
  display: flex;
  gap: 6px;
}

.filter-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.filter-chip.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: #fff;
}

.filter-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sort-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.sort-selector select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  padding: 8px 12px;
  font-size: 13px;
}

.view-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px;
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

.card-item {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}

.card-item:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.6), 0 0 20px rgba(99, 102, 241, 0.15);
}

.card-media {
  height: 200px;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.card-media img {
  height: 180px;
  max-width: 90%;
  object-fit: contain;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
}

.card-item:hover .card-media img {
  transform: scale(1.06);
}

.card-game-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}

.card-foil-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.card-content {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.card-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-item-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.card-item-set {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Card metrics box */
.card-price-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-md);
}

.price-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.price-col-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.price-col-value {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.price-col-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Card bottom summary: Profit badge and action buttons */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.card-profit-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  background: var(--profit-bg);
  color: var(--profit-color);
  border: 1px solid var(--profit-border);
}

.card-profit-chip.loss {
  background: var(--loss-bg);
  color: var(--loss-color);
  border-color: var(--loss-border);
}

.card-actions-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.action-icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.action-icon-btn.danger:hover {
  background: var(--loss-bg);
  color: var(--loss-color);
  border-color: var(--loss-border);
}

/* Table View */
.table-container {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-card);
}

.cards-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.cards-table th {
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.cards-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

.cards-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-card-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-card-thumb {
  width: 40px;
  height: 55px;
  object-fit: contain;
  border-radius: 4px;
}

.table-card-info strong {
  display: block;
  font-family: var(--font-heading);
  font-weight: 600;
  color: #fff;
}

.table-card-info span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Empty & Loading states */
.empty-state, .loading-state {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 60px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon {
  font-size: 54px;
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 22px;
  color: #fff;
}

.empty-state p {
  color: var(--text-secondary);
  max-width: 400px;
  font-size: 14px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-container {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  color: #fff;
  letter-spacing: -0.3px;
}

.modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.5);
  color: #f43f5e;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 75px);
}

.modal-form-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
}

.preview-card-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
}

.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.preview-icon { font-size: 44px; }

.preview-active {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-img-wrap {
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-img-wrap img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.5));
}

.preview-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.preview-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  border-radius: 999px;
}

.preview-meta h4 {
  font-family: var(--font-heading);
  font-size: 16px;
  color: #fff;
}

.preview-meta p {
  font-size: 12px;
  color: var(--text-secondary);
}

.preview-prices-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 8px;
}

.price-pill {
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.price-pill.highlight {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.modal-inputs-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  transition: .3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .3s;
}

input:checked + .toggle-slider {
  background-color: var(--accent-primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.25s ease-out;
}

.toast.success { border-color: var(--profit-color); }
.toast.error { border-color: var(--loss-color); }

/* Spinners */
.btn-spinner, .loader-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.loader-spinner {
  width: 36px;
  height: 36px;
  border-width: 3px;
  border-top-color: var(--accent-primary);
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Footer */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 0;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-muted);
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-link:hover { color: #fff; }

/* Responsive */
@media (max-width: 1024px) {
  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
  }
  .quick-add-form {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .header-right {
    width: 100%;
    flex-wrap: wrap;
  }
  .stats-overview {
    grid-template-columns: 1fr;
  }
  .modal-form-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    flex-wrap: wrap;
  }
  .portfolio-nav-tabs {
    overflow-x: auto;
    width: 100%;
  }
}

/* ========================================================
   NEW FEATURES: TABS, FOLDERS, CHARTS & SELL MODALS
======================================================== */

/* Portfolio Navigation Tabs */
.portfolio-nav-tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: rgba(18, 24, 38, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  margin-bottom: 20px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35) 0%, rgba(139, 92, 246, 0.25) 100%);
  border: 1px solid rgba(99, 102, 241, 0.5);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.nav-tab.active .tab-count {
  background: rgba(99, 102, 241, 0.5);
  color: #fff;
}

.nav-tab.alert-tab .tab-count.alert-count {
  background: #f59e0b;
  color: #000;
  animation: pulseAlert 1.5s infinite;
}

@keyframes pulseAlert {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Stat Card Realized Variant */
.stat-icon-wrapper.realized {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

/* Quick Wishlist Toggle */
.quick-wishlist-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.quick-wishlist-toggle label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Folder Filter Dropdown */
.folder-filter-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(18, 24, 38, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.folder-filter-icon {
  font-size: 15px;
}

.folder-filter-wrap select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.folder-filter-wrap select option {
  background: #121826;
  color: var(--text-primary);
}

/* Card Badges */
.card-folder-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-wishlist-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(245, 158, 11, 0.9);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4);
  z-index: 2;
}

.card-sold-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(16, 185, 129, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
  z-index: 2;
}

.card-alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
  animation: pulseGlow 2s infinite;
}

.card-alert-badge.buy {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.card-alert-badge.sell {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.5);
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; filter: drop-shadow(0 0 6px currentColor); }
}

/* Success Button */
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  font-weight: 600;
}
.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

/* History Modal Custom Styling */
.history-modal-container {
  max-width: 860px;
  width: 95%;
}

.history-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-icon {
  font-size: 26px;
}

.history-card-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.history-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.history-metrics-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.metric-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-box.highlight {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-val {
  font-family: var(--font-heading);
  font-size: 15px;
  color: var(--text-primary);
}

.metric-box.highlight .metric-val {
  color: #818cf8;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
  background: rgba(10, 14, 23, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
}

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

.history-table-wrap h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.history-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.history-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

/* Sell Modal Custom Styling */
.sell-modal-container {
  max-width: 520px;
  width: 90%;
}

.sell-card-preview-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.sell-preview-thumb {
  width: 48px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
}

.sell-preview-info h4 {
  font-size: 15px;
  font-weight: 700;
}

.sell-preview-info p {
  font-size: 12px;
  color: var(--text-secondary);
}

.sell-calculation-box {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
  font-size: 13px;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
}

.calc-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.calc-row.highlight {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.profit-highlight {
  font-family: var(--font-heading);
  font-size: 17px;
  color: #10b981;
}

/* Move Modal */
.move-modal-container {
  max-width: 420px;
  width: 90%;
}

/* ========================================================
   USER PROFILES & 2-PERSON SHARING SYSTEM
======================================================== */

/* Header User Profile Badge */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}

.user-profile-badge:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.user-profile-badge .user-avatar {
  font-size: 22px;
  line-height: 1;
}

.user-info-text {
  display: flex;
  flex-direction: column;
}

.user-info-text .user-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.user-info-text .user-name {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.user-switch-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  font-weight: 600;
}

/* Owner Filter Group */
.owner-filter-group {
  display: flex;
  gap: 6px;
}

/* Card Owner Badge */
.card-owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Profile Selection / Login Modal */
.profile-picker-modal {
  max-width: 580px;
  width: 95%;
  text-align: center;
}

.profile-modal-title h3 {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.profile-modal-title p {
  font-size: 13px;
  color: var(--text-secondary);
}

.profile-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 10px 0;
}

.profile-select-card {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-select-card:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: #6366f1;
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.25);
}

.profile-select-card.active {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.profile-card-avatar {
  font-size: 48px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.profile-card-name {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.profile-card-count {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
}

.profile-card-btn {
  margin-top: 6px;
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.profile-edit-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 15px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.profile-edit-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Edit Profile Modal */
.edit-profile-modal {
  max-width: 440px;
  width: 90%;
}

.avatar-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-input {
  width: 60px;
  text-align: center;
  font-size: 24px;
}

.avatar-quick-pick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.emoji-chip {
  font-size: 22px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.emoji-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
  transform: scale(1.15);
}


