:root {
  --bg: #0f172a;
  --bg-soft: #020617;
  --surface: rgba(15, 23, 42, 0.92);
  --surface-soft: rgba(30, 41, 59, 0.9);
  --surface-strong: rgba(17, 24, 39, 0.96);
  --border: rgba(71, 85, 105, 0.55);
  --border-soft: rgba(51, 65, 85, 0.72);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --title: #f8fafc;
  --primary: #10b981;
  --primary-strong: #059669;
  --primary-soft: rgba(16, 185, 129, 0.12);
  --danger: #f87171;
  --success: #6ee7b7;
  --shadow: 0 18px 46px rgba(2, 6, 23, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Vazirmatn", sans-serif;
  color: var(--text);
  background: var(--bg-soft);
}

button,
input,
select {
  font: inherit;
}

.app-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(rgba(2, 6, 23, 0.82), rgba(2, 6, 23, 0.94)),
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.12), transparent 22%),
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 18%);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1450px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.app-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.compact-topbar {
  margin-bottom: 14px;
}

.brand-kicker,
.section-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.brand-title,
.panel-title {
  margin: 0;
  color: var(--title);
}

.brand-title {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 800;
}

.brand-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn {
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
  font-weight: 700;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: #052e2b;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.18);
}

.btn-primary:hover {
  background: var(--primary-strong);
  color: white;
}

.btn-secondary {
  background: var(--surface-soft);
  border-color: var(--border);
  color: var(--text);
}

.meta-box,
.status-chip,
.pill,
.source-note,
.nav-link {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.meta-box {
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding: 10px 12px;
  color: var(--muted);
}

.meta-box strong {
  color: var(--title);
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 20px;
}

.nav-list {
  display: grid;
  gap: 10px;
}

.nav-link {
  display: block;
  padding: 13px 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  transition: 160ms ease;
}

.nav-link:hover {
  border-color: rgba(16, 185, 129, 0.32);
  color: var(--title);
}

.nav-link.active {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.34);
  color: #d1fae5;
}

.content {
  display: grid;
  gap: 18px;
}

.panel {
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) auto;
  gap: 16px;
}

.hero-text {
  margin: 12px 0 0;
  max-width: 68ch;
  color: var(--muted);
  line-height: 1.9;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
}

.status-chip,
.pill,
.source-note {
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-chip-live {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.32);
  color: #d1fae5;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header-tight {
  align-items: end;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.panel-title-xl {
  font-size: 1.45rem;
}

.pill-row,
.source-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  background: var(--primary-soft);
  border-color: rgba(16, 185, 129, 0.2);
  color: #d1fae5;
}

.source-note {
  color: #cbd5e1;
}

.spotlight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card,
.editor-card,
.input-row,
.note-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 142px;
  padding: 16px;
}

.metric-label,
.row-label,
.editor-description,
.note-card p {
  color: var(--muted);
  line-height: 1.8;
}

.metric-value {
  color: var(--title);
  font-size: 1.38rem;
  font-weight: 800;
}

.metric-delta {
  margin-top: auto;
  font-size: 0.84rem;
  font-weight: 700;
}

.metric-delta.good,
.delta-chip.good {
  color: var(--success);
}

.metric-delta.bad,
.delta-chip.bad {
  color: var(--danger);
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-grid,
.input-list,
.notes-list {
  display: grid;
  gap: 12px;
}

.editor-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.editor-card h3,
.note-card strong {
  margin: 0;
  color: var(--title);
}

.editor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.field input,
.table-input,
.table-select,
.search-box input {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

.field input:focus,
.table-input:focus,
.table-select:focus,
.search-box input:focus {
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08);
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
}

.input-row strong {
  color: var(--title);
}

.delta-chip {
  min-width: 88px;
  text-align: center;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(148, 163, 184, 0.1);
  font-size: 0.82rem;
  font-weight: 700;
}

.note-card {
  padding: 16px;
}

.search-box {
  display: grid;
  gap: 8px;
  min-width: 280px;
  color: var(--muted);
  font-size: 0.84rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.35);
}

.table-wrap-large {
  max-height: 70vh;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid rgba(51, 65, 85, 0.75);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(15, 23, 42, 0.98);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 800;
}

td {
  color: #e2e8f0;
  font-size: 0.91rem;
}

tbody tr:hover {
  background: rgba(30, 41, 59, 0.6);
}

.price-cell {
  color: #f8fafc;
  font-weight: 800;
}

.profit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--primary-soft);
  color: #d1fae5;
  font-size: 0.82rem;
  font-weight: 800;
}

.empty-state {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .layout,
  .grid-two,
  .hero-panel,
  .spotlight-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 900px) {
  .editor-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1450px);
    padding-top: 16px;
  }

  .app-topbar,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    min-width: 100%;
  }

  .input-row {
    grid-template-columns: 1fr;
  }
}
