/* Ljus och tydlig stil, inspirerad av stryketanalysen: en match per kort,
   1/X/2 som kolumner och värdena radvis under. Lätt att läsa lodrätt. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f4f4f2;
  color: #24262b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 3.5rem; /* plats för summeringsraden */
}

header {
  padding: 1.2rem 1rem;
  text-align: center;
  background: #fff;
  border-bottom: 1px solid #e0e0dd;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0.2rem 0 0;
  color: #74777d;
  font-size: 0.9rem;
}

main {
  flex: 1;
  padding: 1.2rem 1rem;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

/* --- Kontroller --- */

.controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.controls label {
  font-size: 0.85rem;
  color: #5c5f66;
}

.controls select,
.controls input[type="number"] {
  background: #fff;
  color: #24262b;
  border: 1px solid #ccccc8;
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  font-family: inherit;
}

.controls input[type="number"] {
  width: 6rem;
}

.controls button {
  background: #2f4f7f;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.controls button:hover {
  background: #26406a;
}

.hint {
  font-size: 0.8rem;
  color: #74777d;
  line-height: 1.5;
}

#value-weight-label {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 7.5rem;
}

#value-weight-hint {
  margin: -0.4rem 0 1rem;
}

#value-weight {
  width: 11rem;
}

.draw-info {
  color: #5c5f66;
  font-size: 0.85rem;
  margin: 0 0 0.8rem;
}

/* --- Matchkort --- */

.match-card {
  background: #fff;
  border: 1px solid #e0e0dd;
  border-radius: 5px;
  margin-bottom: 0.6rem;
  overflow: hidden;
}

.match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: #fafaf8;
  border-bottom: 1px solid #eeeeeb;
}

.match-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.match-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: #c8801f;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.match-teams {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-type {
  font-size: 0.75rem;
  color: #74777d;
  white-space: nowrap;
}

.sign-row {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Teckenknapp: grå = ej vald, blå = vald. Färgen på en vald knapp visar
   vilken grupp tecknet hör till (för min/max-villkoren). */
.sign-toggle {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  width: 2.2rem;
  height: 2rem;
  background: #e4e4e1;
  color: #74777d;
  border: 1px solid #d4d4d0;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.sign-toggle:hover {
  background: #d8d8d4;
}

.sign-toggle.chosen {
  background: #2f4f7f;
  border-color: #2f4f7f;
  color: #fff;
}

/* --- Värdetabellen i kortet --- */

.match-stats {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.match-stats th {
  text-align: left;
  font-weight: 400;
  color: #5c5f66;
  padding: 0.25rem 0.7rem;
  width: 40%;
}

.match-stats td {
  text-align: right;
  padding: 0.25rem 0.7rem;
  width: 20%;
  font-variant-numeric: tabular-nums;
}

.match-stats tr:nth-child(even) {
  background: #fafaf8;
}

.favourite-col {
  font-weight: 600;
}

/* Spelvärdets egen färgskala – systemets bedömning, skild från dina
   färggrupper på knapparna ovan. */
.bv-high {
  background: #7cb342;
  color: #fff;
  border-radius: 2px;
}

.bv-mid {
  background: #f5d949;
  color: #3a3200;
  border-radius: 2px;
}

.bv-low {
  color: #8a8d93;
}

.match-meta {
  margin: 0;
  padding: 0.35rem 0.7rem 0.5rem;
  font-size: 0.75rem;
  color: #8a8d93;
  border-top: 1px solid #f0f0ed;
}

.warning {
  color: #c8801f;
  cursor: help;
}

.manual-flag {
  color: #2f4f7f;
  margin-left: 0.2rem;
  cursor: help;
}

/* --- Kupongöversikt: hela systemet på en skärm --- */

.overview {
  background: #fff;
  border: 1px solid #e0e0dd;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.overview-list {
  padding: 0.4rem;
}

.overview-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0.3rem;
}

.overview-row:nth-child(even) {
  background: #fafaf8;
}

.overview-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 2px;
  background: #2e7d4f;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}

.overview-name {
  flex: 1;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overview-signs {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
}

.overview-sign {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 2px;
  background: #e4e4e1;
  color: #9a9da3;
  font-size: 0.75rem;
  font-weight: 700;
}

.overview-sign.picked {
  background: #2f4f7f;
  color: #fff;
}

.overview-summary {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.4rem 0.7rem;
  background: #24262b;
  color: #e8e8e6;
  font-size: 0.85rem;
}

.overview-summary b {
  font-weight: 400;
  color: #9a9da3;
  margin-right: 0.3rem;
}

.overview-summary .cost {
  margin-left: auto;
  background: #2f4f7f;
  padding: 0.2rem 0.9rem;
  border-radius: 3px;
  font-weight: 600;
}

.overview-summary .pending {
  color: #e0b341;
}

.overview-limits {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  flex-wrap: wrap;
}

.overview-reduced {
  font-weight: 600;
  margin-right: auto;
}

.overview-limit {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-variant-numeric: tabular-nums;
}

.match-details > summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #5c5f66;
  margin-bottom: 0.6rem;
}

/* --- Färgpanel --- */

#reduce-panel {
  background: #fff;
  border: 1px solid #e0e0dd;
  border-radius: 5px;
  padding: 0.9rem 1rem;
  margin-bottom: 1.2rem;
}

#reduce-panel h2 {
  margin: 0 0 0.7rem;
  font-size: 1.05rem;
}

#reduce-panel > details {
  border-top: 1px solid #eeeeeb;
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

#reduce-panel > details > summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #5c5f66;
}

#color-panel {
  padding: 0;
  margin-bottom: 0;
}

#color-picker {
  display: flex;
  gap: 0.3rem;
}

.count-option {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.45rem;
  background: #fff;
  border: 1px solid #ccccc8;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.8rem;
  color: #5c5f66;
  cursor: pointer;
}

.count-option.active {
  border-color: #2f4f7f;
  background: #eef2f8;
  color: #24262b;
  font-weight: 600;
}

.mini-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 1px;
}

#color-limits {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.5rem 0 0.8rem;
}

#color-limits th {
  text-align: left;
  font-weight: 500;
  color: #74777d;
  font-size: 0.75rem;
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid #e8e8e5;
}

#color-limits td {
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid #f2f2ef;
}

.swatch-dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 0.3rem;
}

.color-count {
  color: #8a8d93;
  font-variant-numeric: tabular-nums;
}

.limit-select {
  border: 1px solid #ccccc8;
  border-radius: 3px;
  padding: 0.15rem 0.3rem;
  font-family: inherit;
  font-size: 0.85rem;
  background: #fff;
  min-width: 3.2rem;
}

.limit-select:disabled {
  background: #f4f4f2;
  color: #b0b3b8;
  cursor: not-allowed;
}

/* --- Resultat av reducering --- */

.reduce-summary {
  font-size: 0.85rem;
  color: #24262b;
  margin: 0.6rem 0;
}

.distribution {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.distribution th {
  text-align: left;
  font-weight: 500;
  color: #74777d;
  font-size: 0.72rem;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid #e8e8e5;
}

.distribution td {
  padding: 0.2rem 0.4rem;
  font-variant-numeric: tabular-nums;
}

.distribution .muted {
  color: #8a8d93;
}

.share-input {
  width: 3.2rem;
  border: 1px solid #ccccc8;
  border-radius: 3px;
  padding: 0.15rem 0.3rem;
  font-family: inherit;
  font-size: 0.82rem;
  text-align: right;
}

.share-sum {
  font-size: 0.78rem;
  color: #8a8d93;
  padding-top: 0.4rem;
}

.off-target {
  color: #c0392b;
}

.bar {
  display: inline-block;
  height: 0.65rem;
  background: #6a8fc0;
  border-radius: 2px;
}

/* --- Import --- */


#import-text,
#reduce-result textarea {
  width: 100%;
  background: #fafaf8;
  color: #24262b;
  border: 1px solid #d8d8d4;
  border-radius: 4px;
  padding: 0.5rem;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.82rem;
  resize: vertical;
}

#import-status {
  font-size: 0.8rem;
  color: #5c5f66;
}

.notice {
  background: #fdf6e3;
  border-left: 3px solid #c8801f;
  color: #6b5320;
  padding: 0.6rem 0.8rem;
  margin: 0 0 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  border-radius: 0 3px 3px 0;
}

/* --- Summeringsrad längst ner --- */

#summary-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.6rem 1.2rem;
  background: #24262b;
  color: #e8e8e6;
  font-size: 0.9rem;
}

#summary-bar b {
  font-weight: 400;
  color: #9a9da3;
  margin-right: 0.3rem;
}

#summary-bar .pending {
  color: #e0b341;
}

#summary-bar .cost {
  margin-left: auto;
  background: #2f4f7f;
  padding: 0.3rem 1rem;
  border-radius: 3px;
  font-weight: 600;
}

footer {
  padding: 1rem;
  text-align: center;
}

.signature {
  margin: 0;
  font-size: 0.75rem;
  color: #a0a3a8;
}
