:root {
  color-scheme: dark;
  --bg: #0f0b14;
  --panel: #181220;
  --panel-strong: #21172f;
  --line: #3a2c4f;
  --text: #f2f5f8;
  --muted: #b9adc9;
  --accent: #9f7ac8;
  --accent-strong: #76569c;
  --price: #2dd4bf;
  --danger: #fb7185;
  --warn: #fbbf24;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 8%, rgba(118, 86, 156, 0.34), transparent 32%),
    linear-gradient(rgba(15, 11, 20, 0.86), rgba(15, 11, 20, 0.94)),
    url("https://images.unsplash.com/photo-1446776811953-b23d57bd21aa?auto=format&fit=crop&w=1800&q=80");
  background-size: cover;
  background-position: center;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  width: min(1280px, 100%);
  margin: 0 auto;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.2rem;
}

.calculator-panel {
  display: block;
}

.login-form {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(120px, 150px) auto auto;
  align-items: end;
  gap: 8px;
}

.login-form input {
  min-height: 38px;
}

.login-form .ghost-action {
  min-height: 38px;
}

.tab-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: rgba(24, 18, 32, 0.7);
  color: var(--muted);
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
}

.tab-button.is-active {
  background: rgba(24, 18, 32, 0.92);
  color: var(--text);
  box-shadow: inset 0 3px 0 var(--accent);
}

.price-form,
.deal-section {
  border: 1px solid var(--line);
  background: rgba(24, 18, 32, 0.92);
  backdrop-filter: blur(10px);
}

.price-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: end;
  gap: 16px;
  min-height: 92px;
  padding: 18px 20px;
}

.status-message {
  margin: 0;
  border: 1px solid var(--line);
  border-top: 0;
  background: rgba(24, 18, 32, 0.78);
  color: var(--muted);
  padding: 10px 20px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-message.positive {
  color: var(--price);
}

.status-message.negative {
  color: var(--danger);
}

.status-message.warning {
  color: var(--warn);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #110d17;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(159, 122, 200, 0.18);
}

.input-pair {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #110d17;
}

.input-pair input {
  border: 0;
  background: transparent;
}

.input-pair span {
  padding-right: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.primary-action,
.ghost-action {
  min-height: 44px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.primary-action {
  border: 0;
  background: var(--accent);
  color: #110d17;
}

.form-action {
  width: 100%;
}

.primary-action:hover {
  background: var(--accent-strong);
  color: var(--text);
}

.ghost-action {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 0 14px;
}

.deal-section {
  margin-top: 18px;
}

.latest-section {
  margin-top: 18px;
  border: 1px solid var(--line);
  background: rgba(24, 18, 32, 0.9);
  backdrop-filter: blur(10px);
}

.compact-heading {
  padding-block: 14px;
}

.latest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  padding: 14px 18px 18px;
}

.price-card,
.empty-card {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #110d17;
  padding: 11px 12px;
}

.price-card h3 {
  min-width: 0;
  margin: 0 0 9px;
  overflow: hidden;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.price-card li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.28;
}

.location-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-label {
  flex: 0 0 auto;
  color: var(--price);
  white-space: nowrap;
}

.price-card p,
.empty-card {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.database-toggle-wrap {
  display: flex;
  justify-content: flex-start;
  margin-top: 18px;
}

.is-hidden {
  display: none;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  font-weight: 700;
}

.positive {
  color: var(--price);
}

.negative {
  color: var(--danger);
}

.warning {
  color: var(--warn);
}

@media (max-width: 900px) {
  .app-shell {
    padding: 16px;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .login-form {
    grid-template-columns: 1fr 1fr auto auto;
  }

  .price-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 580px) {
  .login-form {
    grid-template-columns: 1fr;
  }

  .price-form {
    grid-template-columns: 1fr;
  }
}
