:root {
  /* Premium Deep Blue Theme - одинаковый для светлой и темной темы */
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-elevated: #334155;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent: #64748b;
  --accent-dark: #475569;
  --accent-light: #94a3b8;
  --accent-text: #f1f5f9;
  --gold: #fbbf24;
  --gold-light: #fcd34d;
  --gold-glow: rgba(251, 191, 36, 0.3);
  --border: rgba(148, 163, 184, 0.2);
  --border-hover: rgba(212, 168, 67, 0.4);
  --success: #10b981;
  --money: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --glow: 0 0 20px rgba(212, 168, 67, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* iOS fixes */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* All section headings - светло-желтые */
h2, h3 {
  color: var(--gold-light);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(80px + var(--safe-bottom));
  /* iOS safe area support */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ==================== HEADER ==================== */
.header {
  padding: max(24px, env(safe-area-inset-top)) 20px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.header__title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fde047 0%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.header__sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ==================== MAIN ==================== */
.main {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==================== NAVIGATION ==================== */
.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  z-index: 100;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

.nav__btn {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.2s ease;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav__btn:active {
  transform: scale(0.95);
}

.nav__btn--active {
  opacity: 1;
  background: rgba(212, 168, 67, 0.15);
  box-shadow: inset 0 0 0 1px rgba(212, 168, 67, 0.3);
}

/* ==================== SEARCH ==================== */
.search {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search input {
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 1rem;
  transition: all 0.2s ease;
  min-height: 48px;
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.1);
}

.search input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border: 1px solid var(--gold-glow);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  min-height: 48px;
  letter-spacing: 0.01em;
}

.btn:active {
  transform: scale(0.97);
  background: rgba(251, 191, 36, 0.15);
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

.btn--block {
  width: 100%;
  margin-top: 10px;
}

.btn--ghost {
  background: rgba(148, 163, 184, 0.05);
  border: 1px solid var(--gold-glow);
}

.btn--ghost:active {
  background: rgba(251, 191, 36, 0.1);
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

.btn--danger {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: #fff;
  box-shadow: var(--shadow-sm), 0 0 20px rgba(239, 68, 68, 0.2);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ==================== CARDS ==================== */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.card:active {
  transform: translateY(1px);
  box-shadow: var(--shadow);
  border-color: var(--border-hover);
}

.card__title {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card__meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 4px;
}

.card__price {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--money);
  letter-spacing: -0.01em;
}

/* ==================== GOLD PRICE INPUT BOX (like cards) ==================== */
.gold-price-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.gold-price-box label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gold-light);
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}

.gold-price-box .input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gold-price-box input {
  width: 100%;
}

.gold-price-box input {
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  min-height: 48px;
  transition: all 0.2s ease;
}

.gold-price-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.1);
}

/* ==================== FORMS ==================== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1rem;
  transition: all 0.2s ease;
  min-height: 48px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.1);
}

.form-group input::placeholder {
  color: var(--text-secondary);
  opacity: 0.5;
}

/* ==================== DETAIL PAGE ==================== */
.detail-photo {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: var(--radius);
  margin-bottom: 20px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

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

.detail-row span:first-child {
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-row span:last-child {
  color: var(--text);
  font-weight: 600;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

/* ==================== REPORTS ==================== */
.report-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.report-box h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--gold-light);
  letter-spacing: -0.01em;
}

.report-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.95rem;
}

.report-stat span:first-child {
  color: var(--text-secondary);
  font-weight: 500;
}

.report-stat span:last-child,
.report-stat b {
  color: var(--text);
  font-weight: 700;
}

/* ==================== UTILITY ==================== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.back-bar {
  margin-bottom: 14px;
}

.hidden {
  display: none !important;
}

/* ==================== TOAST ==================== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 14px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 200;
  box-shadow: var(--shadow-lg), var(--glow);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ==================== LOADER ==================== */
.loader {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  backdrop-filter: blur(4px);
}

.loader[hidden] {
  display: none !important;
}

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

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

/* ==================== MODAL ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

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

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  border-top: 2px solid var(--accent);
  box-shadow: var(--shadow-lg);
  animation: slideUpModal 0.3s ease;
}

@keyframes slideUpModal {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
  color: var(--gold-light);
}

/* ==================== SCROLLBAR ==================== */
.main::-webkit-scrollbar,
.modal::-webkit-scrollbar {
  width: 6px;
}

.main::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track {
  background: transparent;
}

.main::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb {
  background: rgba(212, 168, 67, 0.3);
  border-radius: 3px;
}

.main::-webkit-scrollbar-thumb:hover,
.modal::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 168, 67, 0.5);
}
