:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e2e8f0;

  --red:#b91c1c;
  --green:#15803d;
  --yellow:#a16207;
  --blue:#1d4ed8;
  --gray:#6b7280;
  --violet:#7c3aed;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:var(--bg);
}

.container{
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 18px 36px 18px;
}

.topbar{
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar-inner{
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  gap:16px;
  padding: 14px 18px;
}

.brand{
  justify-self: center;
  text-align: center;
}

.brand-title{
  display: inline-block;
  font-weight: 900;
  letter-spacing: .3px;
  font-size: 22px;
  color: var(--text);
  text-decoration: none;
}
.brand-sub{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.nav{
  display:flex;
  align-items:center;
  gap: 14px;
  justify-self: end;
}
.nav-link{
  color: var(--muted);
  text-decoration:none;
  font-weight: 600;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 10px;
}
.nav-link:hover{
  background: #f1f5f9;
  color: var(--text);
}
.button-link{
  border: none;
  background: transparent;
  cursor: pointer;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 1px 0 rgba(15,23,42,.02);
}

.h1{
  font-size: 20px;
  margin: 0 0 10px 0;
}
.muted{
  color: var(--muted);
}

.page-header{
  display:grid;
  /* Keep the logo column stable and give more space to the search filters */
  grid-template-columns: minmax(320px, 520px) 1fr;
  align-items:center;
  gap:16px;
  margin-bottom: 14px;
}

.header-logo{
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 8px 0;
  /* Make the header area tall enough so the logo can actually “fill” it. */
  height: clamp(170px, 22vh, 260px);
}

.expansion-logo--header{
  /* Occupy ~80% of the header logo area. */
  height: 80%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.title-row{
  display:flex;
  align-items:baseline;
  gap: 14px;
}

.autosave-note{
  font-size: 13px;
  margin-top: 2px;
  white-space: nowrap;
}

.meta{
  font-size: 13px;
  margin-top: 4px;
}

.filters{
  display:flex;
  align-items:flex-end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content:flex-end;
  min-width: 420px;
}
.filter-setsearch{
  /* Wider search input so the full label is readable. */
  flex: 1 1 820px;
  min-width: 820px;
}
.input-setsearch{
  width: 100%;
  padding-right: 46px;
}

.set-search{
  position: relative;
}
.set-dropdown{
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 0 12px 12px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: var(--muted);
}

.set-dropdown:hover{
  background: #f1f5f9;
  color: var(--text);
}

.set-dropdown:active{
  background: #e2e8f0;
}

.set-suggestions{
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15,23,42,.10);
  max-height: 320px;
  overflow: auto;
  z-index: 20;
  padding: 6px;
}
.set-suggestion{
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
}
.set-suggestion:hover,
.set-suggestion.is-active{
  background: #f1f5f9;
}

.set-summary-count{
  font-weight: 900;
}

@media (max-width: 980px){
  .topbar-inner{ grid-template-columns: auto 1fr auto; }
  .brand{ justify-self: start; }
  .nav{ justify-self: end; }

  .page-header{ grid-template-columns: 1fr; }
  .filters{ justify-content: flex-start; min-width: 0; }
  .filter-setsearch{ min-width: 0; width: 100%; }
}
.filter{
  display:flex;
  flex-direction:column;
  gap: 6px;
  min-width: 210px;
}
.filter-actions{
  min-width: auto;
}
.label-sm{
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .2px;
}
.input, .select{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-size: 14px;
}

.table-card{
  padding: 0;
  overflow-x: auto;
}
.table{
  width: 100%;
  min-width: 1380px;
  border-collapse: collapse;
}
.table thead th{
  text-align: left;
  font-size: 12px;
  letter-spacing: .4px;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: #fbfdff;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table thead tr:first-child th{
  z-index: 3;
}
.table thead tr.filter-row th{
  padding-top: 10px;
  padding-bottom: 10px;
  top: 42px;
  z-index: 2;
}
.table tbody td{
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.th-symbol, .td-symbol{
  width: 70px;
  text-align: center;
}
.symbol-img{
  height: 36px;
  width: auto;
  max-width: 72px;
  display: inline-block;
  vertical-align: middle;
}
.th-num, .td-num{
  width: 90px;
  white-space: nowrap;
}
.td-name{
  width: 260px;
}
.name-row{
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-name{
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}
.card-name:hover{
  text-decoration: underline;
}
.card-name:focus{
  outline: 2px solid rgba(15,23,42,.10);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Alerts: "Carta" cell layout (Set / Numero / Nome) */
.alert-card-link{
  display: block;
  width: 100%;
  text-decoration: none;
}

/* Override the generic .card-name:hover underline: underline only the title */
.alert-card-link:hover{
  text-decoration: none;
}
.alert-card-link:hover .alert-card-title{
  text-decoration: underline;
}

.alert-card-set{
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 2px;
}

.alert-card-num{
  display: block;
  font-weight: 900;
}

.alert-card-title{
  display: block;
  font-weight: 800;
  margin-top: 2px;
}


/* Alerts table: set symbol column */
.th-symbol-alerts, .td-symbol-alerts{
  width: 52px;
  text-align: center;
}
.symbol-img-alerts{
  height: 22px;
  width: auto;
  max-width: 44px;
  display: inline-block;
  vertical-align: middle;
}
.card-icon-alerts{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  width: 22px;
  color: var(--muted);
}
.card-icon-alerts svg{
  height: 22px;
  width: 22px;
}
.tiny-link{
  font-size: 12px;
  text-decoration:none;
}

/* Small bell links used to create alerts directly from the Collection page. */
.bell-link{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 900;
  color: var(--text);
}
.bell-link:hover{
  background: #f8fafc;
}
.bell-cell{
  text-align: center;
  width: 70px;
}

.th-alert{
  width: 70px;
  text-align: center;
}

.table-filter{
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-size: 12px;
}

.cell-form{
  margin: 0;
}
.cell-form.saving{
  opacity: .75;
}

.status-pill{
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  align-items: center;
}

/* Background color lives on the wrapper to avoid the common browser behaviour where the <select>
   background color bleeds into the expanded dropdown list. */
.status-pill.status-in-collection{ background: var(--green); }
.status-pill.status-ordered{ background: var(--yellow); }
.status-pill.status-in-cart{ background: var(--blue); }
.status-pill.status-missing{ background: var(--red); }
.status-pill.status-unknown{ background: var(--violet); }
.status-pill.status-not-applicable{ background: var(--gray); }

.status-select{
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 9px 34px 9px 14px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .2px;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255,255,255,.95) 50%),
                    linear-gradient(135deg, rgba(255,255,255,.95) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px),
                       calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.status-pill.status-not-applicable .status-select{
  cursor: not-allowed;
}

.status-select:focus{
  outline: 2px solid rgba(15,23,42,.10);
  outline-offset: 2px;
}

.button{
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor:pointer;
  font-weight: 800;
  font-size: 14px;
  background: var(--text);
  color: #fff;
}
.button-secondary{
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

/* Smaller button variant (used in Alerts dashboard). */
.button-small{
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
}

/* Destructive action button (delete, etc.). */
.button-danger{
  background: var(--red);
  border: 1px solid rgba(239,68,68,.35);
  color: #fff;
}

.badge{
  display:inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .3px;
  background: #f1f5f9;
  color: var(--muted);
}
.badge-ok{
  background: rgba(16,185,129,.14);
  color: rgba(6,95,70,1);
}


/* Language badge + SVG flags (avoid relying on emoji fonts). */
.lang-badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .3px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  white-space: nowrap;
}
.lang-flag-img{
  width: 18px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(15,23,42,.18);
  object-fit: cover;
  display: block;
}
.lang-code{
  font-variant-numeric: tabular-nums;
}

/* CardTrader-like condition pills (NM/SP/MP/PL/PO...). */
.cond-pill{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .3px;
  line-height: 1;
  color: #fff;
  margin-left: 8px;
  vertical-align: middle;
}
.cond-m{ background: rgba(37,99,235,1); }
.cond-nm{ background: rgba(22,163,74,1); }
.cond-sp{ background: rgba(132,204,22,1); }
.cond-mp{ background: rgba(245,158,11,1); }
.cond-pl{ background: rgba(249,115,22,1); }
.cond-hp{ background: rgba(239,68,68,1); }
.cond-po{ background: rgba(146,64,14,1); }
.cond-dmg{ background: rgba(127,29,29,1); }
.cond-unk{ background: rgba(100,116,139,1); }

.scan-pill{
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .3px;
  border: 1px solid var(--border);
  background: #fff;
}
.scan-idle{
  background: #f8fafc;
  color: var(--muted);
}
.scan-running{
  background: rgba(37,99,235,.12);
  color: rgba(30,64,175,1);
}
.scan-error{
  background: rgba(239,68,68,.14);
  color: rgba(153,27,27,1);
}

.row-muted{
  opacity: .65;
}

.login-card{
  max-width: 420px;
  margin: 30px auto;
}
.form{
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.form-row{
  display:flex;
  flex-direction:column;
  gap: 6px;
}
.label{
  font-weight: 700;
  color: var(--muted);
  font-size: 13px;
}
.error{
  color: var(--red);
  font-weight: 700;
  font-size: 13px;
}

.pagination{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px 14px;
  background: #fbfdff;
}
.pager{
  display:flex;
  gap: 10px;
}

pre.pre{
  background:#0b1220;
  color:#e2e8f0;
  padding: 12px 14px;
  border-radius: 14px;
  overflow:auto;
}

.table-top{
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: #fbfdff;
}
.expansion-logo{
  height: 64px;
  width: auto;
  max-width: 420px;
  display: block;
}

/* Header logo should be large; override the generic `.expansion-logo` size. */
.header-logo .expansion-logo{
  height: 80%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.card-hover-preview{
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px;
  box-shadow: 0 18px 50px rgba(15,23,42,.20);
  width: 360px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: hidden;
}
.card-hover-preview img{
  display: block;
  width: 100%;
  height: auto;
  max-height: 75vh;
  object-fit: contain;
  background: #ffffff;
}

.card-modal{
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(2,6,23,.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}
.card-modal[hidden]{
  display: none;
}
.card-modal-inner{
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}
.card-modal-inner img{
  display: block;
  width: 100%;
  height: auto;
  max-height: 92vh;
  object-fit: contain;
  background: #ffffff;
}

body.modal-open{
  overflow: hidden;
}
