:root {
  --bg-1: #09161a;
  --bg-2: #10282e;
  --sand: #d7c4a5;
  --ink: #eff5ef;
  --muted: rgba(239, 245, 239, 0.72);
  --line: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  --green: #4ab17b;
  --amber: #f0b85a;
  --teal: #55b1b2;
  --coral: #ea7f66;
  --blue: #6d99d4;
  --stone: #a4a9af;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(85, 177, 178, 0.26), transparent 36%),
    radial-gradient(circle at right 10% top 18%, rgba(240, 184, 90, 0.18), transparent 28%),
    linear-gradient(150deg, #071316 0%, #0b1f24 48%, #102b31 100%);
}

.page-bg,
.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.page-bg {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0, rgba(255, 255, 255, 0) 40%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 72px
    );
  opacity: 0.35;
}

.page-noise {
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px),
    radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px);
  background-size: 22px 22px, 28px 28px;
  opacity: 0.4;
}

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

a {
  color: inherit;
  text-decoration: none;
}

main {
  display: grid;
  gap: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(5, 14, 17, 0.62);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--amber), #d07f39);
  color: #071316;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong,
h1,
h2,
h3,
h4 {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.04em;
}

.brand-copy small,
.muted,
.eyebrow {
  color: var(--muted);
}

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

.topnav a {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
}

.topnav a.is-active,
.topnav a:hover {
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.flash-stack {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.flash {
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.2);
}

.flash-success {
  border-color: rgba(74, 177, 123, 0.3);
}

.flash-error {
  border-color: rgba(234, 127, 102, 0.3);
}

.glass-card,
.app-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(17, 37, 43, 0.88) 0%, rgba(9, 24, 28, 0.82) 100%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.dashboard-hero,
.product-panel,
.product-shelf-panel {
  padding: 28px;
}

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

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

h2 {
  font-size: clamp(1.3rem, 2vw, 1.9rem);
}

h3 {
  font-size: 1.05rem;
}

.lead {
  margin-top: 12px;
  max-width: 64ch;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.65;
}

.btn,
button,
input,
select,
textarea {
  font: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--amber), #db9342);
  color: #071316;
  font-weight: 800;
}

.btn-secondary {
  background: rgba(85, 177, 178, 0.15);
  border-color: rgba(85, 177, 178, 0.22);
  color: var(--ink);
}

.btn-ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
}

.btn-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.product-shelf-panel {
  display: grid;
  gap: 18px;
}

.product-shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.summary-card {
  padding: 20px;
}

.summary-card p {
  color: var(--muted);
  margin-bottom: 14px;
}

.summary-card strong {
  display: block;
  font-size: clamp(1.3rem, 3vw, 2.2rem);
}

.tone-green {
  --tone: var(--green);
}

.tone-amber {
  --tone: var(--amber);
}

.tone-teal {
  --tone: var(--teal);
}

.tone-coral {
  --tone: var(--coral);
}

.tone-blue {
  --tone: var(--blue);
}

.tone-sand {
  --tone: var(--sand);
}

.tone-stone {
  --tone: var(--stone);
}

.summary-card,
.crate-card,
.loose-card,
.product-card {
  position: relative;
  overflow: hidden;
}

.summary-card::before,
.crate-card::before,
.loose-card::before,
.product-card::before {
  content: "";
  position: absolute;
  inset: auto auto 0 0;
  width: 72px;
  height: 72px;
  background: radial-gradient(circle, color-mix(in srgb, var(--tone, var(--amber)) 24%, transparent) 0%, transparent 68%);
  transform: translate(-18%, 18%);
  pointer-events: none;
}

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(300px, 0.85fr);
  gap: 18px;
  align-items: start;
}

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

.location-panel,
.activity-panel {
  padding: 22px;
}

.location-panel {
  min-height: 720px;
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

.location-panel.is-drop-target {
  border-color: rgba(240, 184, 90, 0.42);
  transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(32, 57, 55, 0.9) 0%, rgba(9, 24, 28, 0.82) 100%);
}

.panel-head,
.section-head,
.crate-card-top,
.crate-actions,
.loose-card-top,
.loose-meta,
.product-card,
.product-card-main,
.product-card-side,
.combo-row,
.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drop-hint {
  color: var(--muted);
  font-size: 0.88rem;
}

.location-section {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.section-head span,
.quantity-badge,
.state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.86rem;
}

.crate-stack,
.loose-grid,
.activity-list,
.stack-form,
.dialog-form,
.product-list,
.hero-list {
  display: grid;
  gap: 12px;
}

.crate-card,
.loose-card,
.product-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
}

.crate-card {
  cursor: grab;
}

.product-shelf-card {
  cursor: grab;
}

.crate-card.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.product-shelf-card.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.drag-shadow {
  position: fixed;
  z-index: 9999;
  width: min(340px, 78vw);
  pointer-events: none;
  margin: 0;
  opacity: 0.95;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.crate-card p,
.loose-card p,
.product-card p {
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.crate-card h4,
.loose-card h4,
.product-card h3 {
  font-size: 1.05rem;
}

.crate-card-top,
.loose-card-top {
  align-items: flex-start;
}

.crate-card-top > div,
.loose-card-top > div,
.crate-metrics,
.loose-meta {
  min-width: 0;
}

.crate-status {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.06);
}

.crate-status.is-full {
  color: var(--green);
}

.crate-status.is-partial {
  color: var(--amber);
}

.crate-status.is-empty {
  color: var(--sand);
}

.crate-metrics strong {
  display: block;
  margin: 12px 0 4px;
  font-size: 1.4rem;
}

.crate-metrics span,
.loose-meta span,
time {
  color: var(--muted);
}

.crate-metrics {
  display: grid;
  gap: 4px;
}

.crate-actions,
.move-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}

.crate-actions .btn,
.move-actions .chip-btn {
  flex: 0 0 auto;
}

.adjust-strip {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.adjust-label {
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.adjust-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.stock-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.move-actions {
  gap: 8px;
}

.chip-btn,
.icon-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  cursor: pointer;
}

.chip-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
}

.chip-btn[disabled],
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.bottle-visual {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.bottle-visual span {
  width: 12px;
  height: 34px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone, var(--green)) 85%, white) 0%, color-mix(in srgb, var(--tone, var(--green)) 80%, black) 100%);
  opacity: 0.92;
}

.activity-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.activity-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), var(--green));
  box-shadow: 0 0 0 6px rgba(240, 184, 90, 0.1);
}

.activity-item p {
  line-height: 1.5;
}

.login-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  min-height: calc(100vh - 180px);
}

.hero-panel,
.auth-card {
  padding: 34px;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(22, 49, 54, 0.68) 0%, rgba(10, 26, 30, 0.8) 100%);
}

.hero-list {
  margin-top: 24px;
  padding-left: 18px;
  color: var(--muted);
}

.stack-form label,
.dialog-form label {
  display: grid;
  gap: 8px;
}

label span {
  color: var(--muted);
  font-size: 0.92rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(240, 184, 90, 0.42);
  border-color: transparent;
}

.product-list {
  margin-top: 16px;
}

.product-card-side {
  flex-shrink: 0;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
}

.product-stock-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-stat {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.88rem;
}

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

.room-stock-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.room-stock-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.room-stock-copy strong {
  font-size: 0.98rem;
}

.room-stock-copy span {
  color: var(--muted);
  font-size: 0.9rem;
}

.room-stock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.product-chip {
  width: 14px;
  height: 54px;
  border-radius: 999px;
  background: var(--tone, var(--green));
  flex-shrink: 0;
}

.state-pill.is-active {
  color: var(--green);
}

.state-pill.is-muted {
  color: var(--sand);
}

.app-dialog {
  width: min(560px, calc(100vw - 24px));
  padding: 0;
}

.app-dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(4px);
}

.dialog-form {
  padding: 24px;
}

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

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

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.empty-state.compact {
  min-height: 96px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 18px;
  border: 1px solid rgba(74, 177, 123, 0.25);
  border-radius: 16px;
  background: rgba(10, 30, 20, 0.92);
  color: var(--ink);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-error {
  border-color: rgba(234, 127, 102, 0.25);
  background: rgba(42, 14, 15, 0.94);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.is-loading {
  animation: pulse 1.1s ease-in-out infinite alternate;
}

@keyframes pulse {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 1180px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .board-layout {
    grid-template-columns: 1fr;
  }

  .activity-panel {
    order: -1;
  }
}

@media (max-width: 920px) {
  .location-grid,
  .login-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .dashboard-hero,
  .topbar-user,
  .panel-head,
  .product-card,
  .product-card-main,
  .product-card-side {
    flex-direction: column;
    align-items: stretch;
  }

  .page-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 12px;
  }

  .activity-panel {
    order: 0;
  }
}

@media (max-width: 720px) {
  .hero-actions,
  .crate-actions,
  .move-actions,
  .dialog-actions,
  .room-stock-actions {
    flex-wrap: wrap;
  }

  .dashboard-hero,
  .location-panel,
  .activity-panel,
  .product-panel,
  .hero-panel,
  .auth-card {
    padding: 20px;
  }

  .summary-grid {
    position: sticky;
    top: 12px;
    z-index: 5;
    padding-bottom: 4px;
  }

  .summary-card {
    backdrop-filter: blur(16px);
  }

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