:root {
  --bg: #0f1419;
  --surface: #1a222d;
  --border: #2d3a4a;
  --text: #e8edf4;
  --muted: #8b9bb0;
  --accent: #3dd6c3;
  --accent-dim: #2a9d8f;
  --danger: #f07178;
  --radius: 10px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Instrument Sans", "DM Sans", system-ui, sans-serif;
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 10% -20%, rgba(61, 214, 195, 0.12), transparent),
    radial-gradient(ellipse 80% 60% at 100% 50%, rgba(45, 58, 74, 0.5), transparent);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

header {
  margin-bottom: 2rem;
}

.header-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

header h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.header-title-row h1 {
  margin: 0;
  flex: 1;
  min-width: 0;
}

header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.5rem;
}

.panel h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text);
}

label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

input[type="text"]:focus {
  outline: 2px solid var(--accent-dim);
  outline-offset: 1px;
  border-color: var(--accent-dim);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
  align-items: center;
}

button,
.button {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.primary,
a.button.primary {
  background: linear-gradient(165deg, var(--accent), var(--accent-dim));
  color: #0a0e12;
}

button.primary:hover,
a.button.primary:hover {
  filter: brightness(1.06);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

button.ghost:hover {
  color: var(--text);
  border-color: var(--muted);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.msg {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  display: none;
}

.msg.visible {
  display: block;
}

.msg.ok {
  background: rgba(61, 214, 195, 0.12);
  border: 1px solid rgba(61, 214, 195, 0.35);
}

.msg.err {
  background: rgba(240, 113, 120, 0.1);
  border: 1px solid rgba(240, 113, 120, 0.35);
  color: #f5b4b8;
}

.user-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.user-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.user-pill {
  display: inline-block;
  margin-top: 0;
  padding: 0.4rem 0.9rem;
  background: linear-gradient(
    145deg,
    rgba(61, 214, 195, 0.14) 0%,
    rgba(26, 34, 45, 0.95) 55%,
    rgba(15, 20, 25, 0.98) 100%
  );
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid rgba(61, 214, 195, 0.45);
  box-shadow:
    0 0 0 1px rgba(61, 214, 195, 0.12),
    0 4px 24px rgba(61, 214, 195, 0.12),
    0 4px 24px rgba(0, 0, 0, 0.35);
}

button.user-pill-btn {
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

button.user-pill-btn:hover {
  border-color: rgba(61, 214, 195, 0.75);
  background: linear-gradient(
    145deg,
    rgba(61, 214, 195, 0.22) 0%,
    rgba(26, 34, 45, 0.98) 55%,
    rgba(15, 20, 25, 1) 100%
  );
  box-shadow:
    0 0 0 1px rgba(61, 214, 195, 0.2),
    0 6px 28px rgba(61, 214, 195, 0.18),
    0 4px 24px rgba(0, 0, 0, 0.4);
}

button.user-pill-btn:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 2px;
}

.report-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.report-head h2 {
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

th {
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:last-child td {
  border-bottom: none;
}

td.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.ean-merge-cell {
  vertical-align: middle;
  text-align: center;
  font-weight: 600;
  max-width: 12rem;
  white-space: normal;
  word-break: break-all;
}

.empty-report {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.no-ean-dialog {
  margin: auto;
  border: 1px solid rgba(240, 113, 120, 0.45);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  max-width: min(22rem, calc(100vw - 2rem));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
}

.no-ean-dialog::backdrop {
  background: rgba(8, 12, 18, 0.72);
  backdrop-filter: blur(2px);
}

.no-ean-dialog-inner {
  margin: 0;
  padding: 1.35rem 1.5rem 1.25rem;
}

.no-ean-msg {
  margin: 0 0 1.15rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #f5b4b8;
  text-align: center;
}

.no-ean-dialog .modal-actions {
  display: flex;
  justify-content: center;
  margin: 0;
}

.no-ean-dialog .modal-actions .primary {
  min-width: 7rem;
}

.duplicate-label-dialog {
  border-color: rgba(224, 160, 80, 0.5);
}

.duplicate-label-msg {
  color: #e8c89a !important;
}

.hidden {
  display: none !important;
}
