/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-body {
  padding: 16px;
}

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-btn);
  padding: 14px 20px;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-user-select: none;
  user-select: none;
  text-decoration: none;
  line-height: 1;
}

.btn:active { opacity: 0.75; transform: scale(0.98); }

.btn-primary {
  background: var(--accent-gold);
  color: #000;
  width: 100%;
}

.btn-secondary {
  background: var(--bg-card-2);
  color: var(--text-primary);
  width: 100%;
}

.btn-ghost {
  background: transparent;
  color: var(--accent-gold);
  padding: 10px 14px;
  font-size: 15px;
}

.btn-danger {
  background: rgba(255, 59, 48, 0.12);
  color: var(--loss);
  width: 100%;
}

.btn-danger:active { background: rgba(255, 59, 48, 0.2); }

.btn-sm {
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 10px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-card-2);
  color: var(--text-secondary);
  font-size: 18px;
}

/* ── Tab Bar ── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--tab-bar-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 0.5px solid var(--separator);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  z-index: 100;
  padding-top: 4px;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  padding: 6px 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  transition: color 0.15s;
  -webkit-user-select: none;
  user-select: none;
  text-decoration: none;
  position: relative;
}

.tab-item svg {
  width: 24px;
  height: 24px;
  transition: transform 0.15s;
}

.tab-item.active { color: var(--accent-gold); }
.tab-item:active svg { transform: scale(0.9); }

/* FAB center tab */
.tab-fab {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 0;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.tab-fab-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(145deg, #E4BC60, #C09030);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(180, 130, 30, 0.45), 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.15s, box-shadow 0.15s;
  margin-top: -14px;
  color: #000;
}

.tab-fab:active .tab-fab-circle {
  transform: scale(0.93);
  box-shadow: 0 2px 8px rgba(180, 130, 30, 0.35);
}

.tab-fab-circle svg { width: 26px; height: 26px; }

/* ── Live Price Card ── */
.price-card {
  background: linear-gradient(135deg, #2A2010 0%, #1C1C0E 100%);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  margin: 0 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(180, 130, 30, 0.2);
}

[data-theme="light"] .price-card {
  background: linear-gradient(135deg, #3A2E10 0%, #2A1E08 100%);
}

.price-card::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.1);
}

.price-card-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(201, 168, 76, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.price-card-value {
  font-size: 32px;
  font-weight: 700;
  color: #F0D080;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.price-card-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.price-card-change {
  font-size: 13px;
  font-weight: 600;
}

.price-card-updated {
  font-size: 12px;
  color: rgba(201, 168, 76, 0.5);
}

/* ── Portfolio Summary Card ── */
.summary-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  margin: 10px 16px 0;
  box-shadow: var(--shadow-card);
}

.summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 0;
}

.summary-row + .summary-row {
  border-top: 0.5px solid var(--separator);
  margin-top: 8px;
  padding-top: 8px;
}

.summary-label { font-size: 14px; color: var(--text-secondary); }
.summary-value { font-size: 16px; font-weight: 600; }

.summary-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--separator);
}

.summary-total-label { font-size: 15px; font-weight: 600; }
.summary-total-value { font-size: 22px; font-weight: 700; }
.summary-total-pct { font-size: 13px; font-weight: 600; margin-top: 2px; text-align: right; }

/* ── Holding Card ── */
.holding-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}

.holding-card:active { transform: scale(0.98); }

.holding-card-inner {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  position: relative;
  z-index: 1;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.holding-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.2), rgba(201, 168, 76, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  border: 1px solid rgba(201, 168, 76, 0.2);
}

.holding-card-info { flex: 1; min-width: 0; }

.holding-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.holding-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.holding-card-pnl { text-align: right; flex-shrink: 0; }
.holding-card-value { font-size: 15px; font-weight: 600; }
.holding-card-pct { font-size: 12px; font-weight: 600; margin-top: 2px; }

/* Swipe-to-delete */
.holding-card-delete {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: var(--loss);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 600;
  gap: 4px;
  flex-direction: column;
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.holding-card.swiped .holding-card-delete { opacity: 1; }

/* ── Form Elements ── */
.form-section {
  padding: 0 20px;
  margin-bottom: 20px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
  display: block;
}

.form-input {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--separator);
  border-radius: var(--radius-btn);
  padding: 13px 14px;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus { border-color: var(--accent-gold); }
.form-input::placeholder { color: var(--text-tertiary); }

.form-input-row {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1.5px solid var(--separator);
  border-radius: var(--radius-btn);
  overflow: hidden;
  transition: border-color 0.15s;
}

.form-input-row:focus-within { border-color: var(--accent-gold); }

.form-input-row .form-input {
  border: none;
  border-radius: 0;
  flex: 1;
  padding-right: 8px;
}

.form-input-suffix {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 0 12px;
  white-space: nowrap;
  border-left: 1px solid var(--separator);
  height: 100%;
  display: flex;
  align-items: center;
  min-height: 48px;
  cursor: pointer;
  background: var(--bg-card-2);
  font-weight: 500;
  transition: color 0.15s;
}

.form-input-suffix:hover { color: var(--accent-gold); }

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1.5px solid var(--separator);
  border-radius: var(--radius-btn);
  overflow: hidden;
}

.stepper-btn {
  width: 52px;
  min-height: 50px;
  background: var(--bg-card-2);
  border: none;
  font-size: 24px;
  font-weight: 300;
  color: var(--accent-gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
  -webkit-user-select: none;
  user-select: none;
}

.stepper-btn:active { background: var(--separator); }

.stepper-input {
  flex: 1;
  text-align: center;
  background: transparent;
  border: none;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  min-width: 0;
  padding: 0;
  min-height: 50px;
}

/* Pill Selector */
.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--separator);
  background: var(--bg-card);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

.pill.selected {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #000;
  font-weight: 700;
}

.pill:active { opacity: 0.75; }

/* Segmented Control */
.segmented {
  display: flex;
  background: var(--bg-card-2);
  border-radius: 10px;
  padding: 2px;
}

.seg-btn {
  flex: 1;
  padding: 7px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

.seg-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* Settings rows */
.settings-group {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  margin: 0 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.settings-row {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  min-height: 52px;
  gap: 12px;
}

.settings-row + .settings-row {
  border-top: 0.5px solid var(--separator);
}

.settings-row-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.settings-row-label {
  font-size: 15px;
  color: var(--text-primary);
  flex: 1;
}

.settings-row-value {
  font-size: 15px;
  color: var(--text-secondary);
}

.settings-row-arrow {
  color: var(--text-tertiary);
  font-size: 14px;
  flex-shrink: 0;
}

.settings-input {
  flex: 1;
  background: transparent;
  border: none;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  text-align: right;
  min-width: 0;
}

.settings-input::placeholder { color: var(--text-tertiary); }

/* Currency badge */
.currency-selector {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card-2);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  -webkit-user-select: none;
  user-select: none;
}

/* Changelog dot */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-green { background: var(--profit); }
.dot-red   { background: var(--loss);   }
.dot-gold  { background: var(--accent-gold); }

/* Section header with action */
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 8px;
}

.section-header-row .section-label {
  padding: 0;
  margin: 0;
}

/* ── Metal Badge (inline label in holding cards) ── */
.metal-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.2px;
}

/* ── Markup Badge ── */
.markup-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-card-2);
}

/* ── Metal Price Strip (dashboard) ── */
.metal-strip {
  display: flex;
  gap: 8px;
  padding: 10px 16px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.metal-strip::-webkit-scrollbar { display: none; }

.metal-strip-card {
  flex: 0 0 auto;
  min-width: 100px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--separator);
}

/* ── Charts screen ── */
.metal-tabs-row {
  display: flex;
  gap: 0;
  padding: 0 16px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.metal-tabs-row::-webkit-scrollbar { display: none; }

.metal-tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s, border-bottom-color 0.15s;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.metal-tab.active {
  font-weight: 700;
}

.chart-wrap {
  position: relative;
  margin: 0 16px;
  height: 200px;
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

#chart-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: var(--text-primary);
}

.chart-range-row {
  padding: 12px 16px 0;
}

.chart-legend {
  padding: 10px 16px 4px;
}

.chart-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Alerts (settings) ── */
.alert-row {
  cursor: default;
  gap: 10px;
}

/* ── Spinner (inline loading) ── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--separator);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

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