:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --good: #4ade80;
  --bad: #f87171;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 1.25rem;
  margin: 0;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.82rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent-2);
  color: #00121f;
  font-weight: 600;
  transition: filter 0.15s;
}
button:hover {
  filter: brightness(1.08);
}
button.ghost {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}
button.link {
  background: none;
  color: var(--muted);
  font-weight: 400;
  padding: 8px;
}
button.danger {
  color: var(--bad);
}

input {
  font: inherit;
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  margin-bottom: 10px;
}
input:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.error {
  color: var(--bad);
  font-size: 0.85rem;
  margin: 6px 0 0;
}

/* Login */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.login-card button {
  width: 100%;
  margin-top: 6px;
}
.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff;
  color: #1f2937;
  font-weight: 600;
  text-decoration: none;
  margin-top: 6px;
}
.google-btn:hover {
  filter: brightness(0.97);
}

/* App shell */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-top));
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 430px) {
  header h1 {
    font-size: 1.05rem;
  }
  .header-actions {
    flex: 1 1 100%;
    justify-content: flex-end;
  }
  .header-actions button {
    padding: 8px 11px;
    font-size: 0.85rem;
  }
}
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
footer {
  text-align: center;
  padding: 24px;
}

/* Add form */
.seg {
  display: flex;
  gap: 6px;
  background: var(--panel-2);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.seg-btn {
  flex: 1;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}
.seg-btn.active {
  background: var(--accent-2);
  color: #00121f;
}
.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin: -4px 0 12px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.field {
  flex: 1;
}
.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input {
  margin-bottom: 0;
}
#add-btn {
  white-space: nowrap;
  height: 43px;
}

/* Product list */
.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.empty {
  text-align: center;
  padding: 30px;
}
.product-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  position: relative;
}
.product-title {
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
}
.menu-btn {
  background: transparent;
  color: var(--muted);
  padding: 2px 10px;
  font-size: 1.3rem;
  line-height: 1;
}
.menu {
  position: absolute;
  right: 0;
  top: 28px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  z-index: 3;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.menu button {
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 400;
  padding: 9px 10px;
}
.menu button:hover {
  background: var(--panel);
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 10px 0 4px;
  flex-wrap: wrap;
}
.price {
  font-size: 1.7rem;
  font-weight: 700;
}
.price.none {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
}
.badge {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.change {
  font-size: 0.85rem;
  font-weight: 600;
}
.change.down {
  color: var(--good);
}
.change.up {
  color: var(--bad);
}

.spark {
  width: 100%;
  height: 56px;
  margin: 6px 0;
  display: block;
}
.spark.empty-spark {
  display: none;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.82rem;
  color: var(--muted);
}
.meta .source {
  color: var(--accent);
  text-decoration: none;
}
.meta .source:hover {
  text-decoration: underline;
}
.target-line.hit {
  color: var(--good);
  font-weight: 600;
}
.product .err {
  margin-top: 8px;
}

/* Detailpagina */
#detail header h1 {
  flex: 1;
  text-align: center;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-title {
  margin: 0 0 10px;
  font-size: 1rem;
}
.detail-chart {
  width: 100%;
  height: auto;
  display: block;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.stat .v {
  font-size: 1.1rem;
  font-weight: 700;
}
.stat .v.low {
  color: var(--good);
}
.stat .v.high {
  color: var(--bad);
}
.stat .l {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}
/* Productafbeeldingen */
.detail-image {
  display: block;
  max-width: 160px;
  max-height: 160px;
  margin: 0 auto 12px;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
}
.product-head .thumb {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  flex: 0 0 auto;
}

.offers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.offer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
}
.o-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
}
.o-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  flex: 0 0 auto;
}
.o-reject {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 5px 9px;
  font-size: 0.8rem;
  flex: 0 0 auto;
}
.o-reject:hover {
  color: var(--bad);
  border-color: var(--bad);
}
.rejected-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rejected-head {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 2px;
}
.rejected-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 6px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.rejected-row .r-name {
  flex: 1;
  text-decoration: line-through;
  word-break: break-all;
}
.rejected-row .row-act {
  background: transparent;
  color: var(--accent);
  padding: 3px 7px;
  font-size: 0.8rem;
}
a.offer-row:hover {
  border-color: var(--accent);
}
.o-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.o-shop {
  font-weight: 600;
  color: var(--accent);
}
.o-title {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}
.o-price {
  font-weight: 700;
  white-space: nowrap;
}
.o-price.low {
  color: var(--good);
}
.history-table {
  display: flex;
  flex-direction: column;
}
.hist-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.hist-row:last-child {
  border-bottom: none;
}
.hist-row .h-date {
  color: var(--muted);
}
.hist-row .h-price {
  font-weight: 600;
}
.hist-row .h-price.low {
  color: var(--good);
}
.product {
  cursor: pointer;
}

/* Beheer-modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 20;
}
.modal-box {
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
}
.testmail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  flex-wrap: wrap;
}
.user-add {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 12px 0 4px;
  flex-wrap: wrap;
}
.user-add input[type='email'] {
  flex: 1;
  margin-bottom: 0;
  min-width: 160px;
}
.chk {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}
.chk input {
  width: auto;
  margin: 0;
}
.user-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.user-row .email {
  flex: 1;
  word-break: break-all;
}
.user-row .tag {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-2);
  color: #00121f;
  font-weight: 600;
}
.user-row .tag.protected {
  background: var(--line);
  color: var(--muted);
}
.user-row .row-act {
  background: transparent;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 0.8rem;
}
.user-row .row-act.danger {
  color: var(--bad);
}
