/* Materialet box: MGP lists, plus/minus per lancio, stock counts.
   Built on the shared phone classes (phone-page, big-button, seg-tabs,
   tap-save, pill); everything here is prefixed mat-. Buttons at least 48px. */

.mat-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.mat-page * {
  min-width: 0;
}

/* Long codes and file names (Google's "ACFrOg…") must not widen the page. */
.mat-row-name span,
.mat-row-name small,
.mat-row-name strong,
.mat-check li,
.mat-others li,
.mat-page .hint-line,
.mat-page .sub {
  overflow-wrap: anywhere;
}

.mat-back {
  justify-self: start;
  min-height: 48px;
}

.mat-page .button {
  min-height: 48px;
}

.mat-title {
  margin: 10px 0 0;
  font-size: 19px;
}

.mat-subtitle {
  margin: 14px 0 6px;
  font-size: 15px;
}

.mat-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mat-tools .button {
  flex: 1 1 150px;
  justify-content: center;
}

.mat-wide {
  width: 100%;
}

/* "N codes in minus": the first thing on the screen when MGP is short. */
.mat-alert {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 14px 16px;
  border: 2px solid var(--red);
  border-radius: var(--radius);
  color: var(--red);
  background: var(--red-soft);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mat-alert strong {
  font-size: 18px;
}

.mat-alert span {
  color: var(--ink);
  font-size: 14px;
}

/* Lanci (and counts) as big cards. */
.mat-season[hidden] {
  display: none;
}

.mat-season-title {
  margin: 8px 0 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mat-lanci {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.mat-lancio {
  display: grid;
  gap: 6px;
  min-height: 72px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mat-lancio[hidden] {
  display: none;
}

.mat-lancio.is-short {
  border-color: var(--red);
}

.mat-lancio-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.mat-lancio-top strong {
  font-size: 20px;
}

.mat-lancio-top small,
.mat-lancio-line {
  color: var(--muted);
  font-size: 13px;
}

.mat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Summary tiles at the top of a lancio / the balance / the files. */
.mat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.mat-tile {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.mat-tile strong {
  font-size: 24px;
  line-height: 1.1;
}

.mat-tile span {
  color: var(--muted);
  font-size: 12px;
}

.mat-tile.is-red {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

.mat-tile.is-orange {
  border-color: var(--orange);
  background: var(--orange-soft);
}

/* One material of a lancio. */
.mat-rows,
.mat-lines {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mat-row {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.mat-row.is-short {
  border-left-color: var(--red);
  background: var(--red-soft);
}

.mat-row.is-open {
  border-left-color: var(--orange);
}

.mat-row-name {
  display: grid;
  gap: 2px;
  min-height: 48px;
  padding: 0;
  border: 0;
  color: inherit;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mat-row-name strong {
  font-size: 16px;
}

.mat-row-name span {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.mat-row-name small {
  color: var(--muted);
  font-size: 12px;
}

.mat-nums {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.mat-num {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--soft);
}

.mat-num small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mat-num b {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.mat-num.is-red {
  color: #fff;
  background: var(--red);
}

.mat-num.is-red small {
  color: #fff;
}

.mat-num.is-green b {
  color: var(--green);
}

.mat-input {
  padding: 4px;
  background: var(--panel);
}

.mat-input input,
.mat-count-input input {
  width: 100%;
  height: 48px;
  border: 2px solid var(--green);
  border-radius: 12px;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.mat-row-foot {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.mat-edit-head {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--green);
  border-radius: var(--radius);
  background: var(--green-soft);
}

.mat-edit-head span {
  color: var(--muted);
  font-size: 13px;
}

/* A list line: code and text left, quantity right. */
.mat-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.mat-line[hidden],
.mat-section[hidden] {
  display: none;
}

.mat-line .mat-row-name {
  flex: 1;
  min-width: 0;
}

.mat-line.is-short {
  border-color: var(--red);
  background: var(--red-soft);
}

.mat-line.is-short .mat-line-qty b {
  color: var(--red);
}

.mat-line-qty {
  display: grid;
  flex: none;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.mat-line-qty b {
  font-size: 17px;
}

.mat-line-qty small {
  color: var(--muted);
  font-size: 11px;
}

.mat-section {
  margin-top: 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* Counting: a big box per line. */
.mat-count-input {
  display: grid;
  flex: none;
  justify-items: center;
  gap: 2px;
  width: 104px;
}

.mat-count-input small {
  color: var(--muted);
  font-size: 11px;
}

.mat-form {
  display: grid;
  gap: 10px;
}

.mat-form h2 {
  margin: 0;
  font-size: 18px;
}

.mat-form label {
  display: grid;
  gap: 4px;
  font-weight: 700;
}

.mat-form input,
.mat-form select {
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
}

.mat-form.mat-inline {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.mat-form.mat-inline > label:only-child {
  grid-column: 1 / -1;
}

.mat-file {
  justify-content: center;
  min-height: 48px;
}

/* Things that fold away: other codes, the import checks. */
.mat-others,
.mat-check {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.mat-others summary,
.mat-check summary {
  min-height: 32px;
  font-weight: 700;
  cursor: pointer;
}

.mat-check summary b {
  margin-left: 6px;
  color: var(--red);
}

.mat-check.is-info summary b {
  color: var(--muted);
}

.mat-check.is-ok summary b {
  color: var(--green);
}

.mat-others ul,
.mat-check ul {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
}

.mat-history {
  display: grid;
  gap: 4px;
  max-height: 40vh;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.mat-history li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

@media (max-width: 420px) {
  .mat-nums {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mat-count-input {
    width: 92px;
  }
}
