:root {
  --bg: #0f1629;
  --card: #121c32;
  --muted: #9fb1d6;
  --text: #e8f0ff;
  --accent: #f39c12;
  --accent-2: #5ad8a1;
  --danger: #f06272;
  --border: rgba(255, 255, 255, 0.08);
  --pill: rgba(255, 255, 255, 0.12);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  font-family: "Inter Tight", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

body {
  margin: 0;
  padding: 0 20px 40px;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.04), transparent 25%),
    radial-gradient(circle at 80% 0%, rgba(243, 156, 18, 0.08), transparent 30%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

p {
  margin: 0;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 36px 12px 8px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 12px;
  color: var(--muted);
}

.lede {
  margin-top: 10px;
  max-width: 560px;
  line-height: 1.5;
}

.header-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.file-input {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #f0b429, #ff7f50);
  color: #0d1323;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.file-input.subtle {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.file-input input {
  display: none;
}

button {
  background: var(--accent-2);
  color: #05241a;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  box-shadow: var(--shadow);
}

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

button:active {
  transform: translateY(0);
}

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

button.small {
  padding: 6px 10px;
  font-size: 13px;
}

button.danger {
  color: var(--danger);
  border-color: rgba(240, 98, 114, 0.5);
}

select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  min-width: 320px;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
}

.stat-value.warning {
  color: var(--accent);
}

.stat-value.muted {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel h2 {
  margin-bottom: 6px;
}

.tips {
  max-width: 420px;
  font-size: 13px;
}

.tips p {
  color: var(--muted);
}

.import-panel textarea {
  width: 100%;
  min-height: 120px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  resize: vertical;
}

.import-panel textarea.dragging {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(243, 156, 18, 0.3);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

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

.list-head,
.item {
  display: grid;
  grid-template-columns: 2.2fr 1.1fr 0.9fr 1.2fr;
  gap: 10px;
  align-items: center;
}

.list-head {
  margin-top: 10px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.item:last-child {
  border-bottom: none;
}

.product .name {
  color: var(--text);
  font-weight: 700;
}

.product .note {
  font-size: 13px;
  color: var(--muted);
}

.qty-col,
.qty-field,
.wizard-qty {
  display: none;
}

.quantity input,
.date input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.status .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

.pill.soon {
  color: #f39c12;
  background: rgba(243, 156, 18, 0.15);
}

.pill.safe {
  color: #5ad8a1;
  background: rgba(90, 216, 161, 0.15);
}

.pill.expired {
  color: var(--danger);
  background: rgba(240, 98, 114, 0.18);
}

.pill.unknown {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
}

.empty {
  text-align: center;
  color: var(--muted);
  margin: 18px 0 6px;
}

dialog {
  border: none;
  border-radius: 12px;
  padding: 18px;
  background: #0a1020;
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

dialog form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
  max-height: 70vh;
}

dialog label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

dialog input {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

.helper {
  min-height: 18px;
  font-size: 13px;
}

.helper.warning {
  color: var(--danger);
}

.dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.wizard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wizard-head p {
  color: var(--text);
  font-weight: 700;
}

#wizardDialog {
  width: 380px;
  max-width: 92vw;
  max-height: 80vh;
}

#wizardDialog h3 {
  min-height: 48px;
  max-height: 96px;
  display: flex;
  align-items: center;
  overflow: auto;
}

#wizardDialog .dialog-actions {
  margin-top: auto;
}

@media (max-width: 900px) {
  .app-header {
    flex-direction: column;
  }

  .stats {
    width: 100%;
  }

  .list-head,
  .item {
    grid-template-columns: 1.6fr 1.2fr 1fr;
    grid-template-areas:
      "product product product"
      "date status status"
      "actions actions actions";
    gap: 8px 10px;
  }

  .item .product {
    grid-area: product;
  }
  .item .date {
    grid-area: date;
  }
  .item .status {
    grid-area: status;
  }
  .item .actions {
    grid-area: actions;
  }

  .list-head {
    display: none;
  }
}
