/* ===========================================================================
 * /nominate only — registering one AED or several (CSV upload).
 *
 * Loaded after styles.css and flyer-theme.css, and only by nominate.html, so
 * nothing here can move another page. Same pixel vocabulary as the flyer
 * theme: navy outlines, square corners, hard offset shadows, Atma for labels.
 * ------------------------------------------------------------------------ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------- one AED / several --------------------------- */

/* The two cards are a smaller cousin of the school / organisation chooser:
   icon on the left, so the pair doesn't push the serial box below the fold. */
.device-mode {
  margin: 4px 0 8px;
}

.device-mode .path-card {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "icon title"
    "icon copy";
  justify-items: start;
  align-items: center;
  gap: 2px 14px;
  padding: 14px 18px;
  text-align: left;
}

.device-mode .path-emoji {
  grid-area: icon;
  font-size: 2rem;
}

.device-mode .path-title {
  grid-area: title;
  font-size: 1.15rem;
}

.device-mode .path-copy {
  grid-area: copy;
  text-align: left;
}

/* ------------------------------- the upload ------------------------------- */

/* Room before "2. Who are you nominating?", whichever mode is open. */
#single-device,
#multi-device {
  margin-bottom: 26px;
}

#multi-device .approval-note {
  margin-top: 20px;
}

.csv-template-line {
  margin: 0 0 4px;
}

.csv-template-line .secondary-link {
  font-size: 0.8rem;
}

.csv-drop {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-top: 14px;
  padding: 26px 18px;
  border: 4px dashed var(--fl-navy);
  background: #eaf3ff;
  color: var(--fl-navy);
  text-align: center;
  cursor: pointer;
  box-shadow: 6px 6px 0 0 var(--fl-lip);
}

.csv-drop:hover,
.csv-drop.is-dragging {
  background: var(--fl-yellow-hi);
  border-style: solid;
}

.csv-drop:focus-within {
  outline: 3px dashed #fff;
  outline-offset: 6px;
}

.csv-drop-title {
  font-family: var(--fl-font-heading);
  font-size: 1.05rem;
  line-height: 1.2;
}

.csv-drop-copy {
  font-family: var(--fl-font-sub);
  font-weight: 700;
  font-size: 0.95rem;
}

/* The real control stays in the tab order (Space/Enter opens the picker); the
   drop zone around it is what you see. */
.csv-file-input {
  position: absolute;
  inset: auto;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.csv-preview {
  margin-top: 6px;
}

.csv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 18px;
  margin-bottom: 10px;
}

.csv-counts {
  margin: 0;
  color: var(--fl-yellow);
  font-family: var(--fl-font-sub);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.35;
  text-shadow: 2px 2px 0 var(--fl-navy);
}

.csv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.csv-actions .link-button {
  margin-top: 0;
  color: #fff;
  font-size: 0.95rem;
}

/* ------------------------------ the preview ------------------------------- */

.csv-table-wrap {
  max-height: min(560px, 70vh);
  overflow: auto;
  border: 4px solid var(--fl-navy);
  background: #fff;
  box-shadow: 6px 6px 0 0 var(--fl-lip);
}

.csv-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--fl-navy);
  font-size: 1rem;
}

/* The caption is the table's accessible name; the counts above already say
   it on screen. */
.csv-caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.csv-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 10px;
  background: var(--fl-navy);
  color: #fff;
  font-family: var(--fl-font-sub);
  font-weight: 700;
  font-size: 0.9rem;
  text-align: left;
  white-space: nowrap;
}

.csv-table td {
  padding: 8px 10px;
  border-top: 2px solid #d5e3f5;
  vertical-align: top;
  font-weight: 700;
  line-height: 1.35;
}

.csv-table tbody tr:nth-child(even) td {
  background: #f3f8ff;
}

.csv-table tbody tr.is-taken td,
.csv-table tbody tr.is-invalid td,
.csv-table tbody tr.is-duplicate td {
  background: #fff4e0;
}

.csv-cell-row {
  width: 1%;
  color: #6b7fa3;
  white-space: nowrap;
}

.csv-cell-serial,
.csv-cell-ref {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.csv-cell-location {
  overflow-wrap: anywhere;
}

.csv-none {
  color: #9aabc6;
}

.csv-note,
.csv-detail {
  color: #4a5d80;
  font-size: 0.85rem;
  font-weight: 700;
}

.csv-detail {
  display: block;
  margin-top: 4px;
}

.csv-chip {
  display: inline-block;
  padding: 2px 8px;
  border: 2px solid var(--fl-ink);
  font-family: var(--fl-font-sub);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 2px 2px 0 0 var(--fl-lip);
}

.csv-chip.is-ready {
  background: var(--fl-green);
  color: #fff;
}

.csv-chip.is-taken {
  background: var(--fl-yellow);
  color: var(--fl-navy);
}

.csv-chip.is-invalid {
  background: var(--fl-red);
  color: #fff;
}

.csv-chip.is-duplicate {
  background: #ff9a3c;
  color: var(--fl-navy);
}

.csv-chip.is-checking {
  background: #d4dde8;
  color: var(--fl-navy);
}

.csv-cell-remove {
  width: 1%;
  text-align: right;
}

.csv-remove {
  padding: 4px 10px;
  border: 2px solid var(--fl-navy);
  background: #fff;
  color: var(--fl-navy);
  font-family: var(--fl-font-sub);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 0 var(--fl-lip);
}

.csv-remove:hover {
  background: var(--fl-yellow-hi);
}

.csv-remove:focus-visible {
  outline: 3px solid var(--fl-yellow);
  outline-offset: 1px;
}

/* The keepthebeat@ address in the receipt's note is a block link that
   doesn't wrap, and at phone width it pushed the whole page 30px sideways
   (it did before this page learnt about uploads, too). Let it break. */
.approval-note .inline-cta {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* The receipt's list of what was registered. */
#done-devices {
  margin: 0 0 18px;
}

/* --------------------------------- phones --------------------------------- *
 * Five columns don't fit at 390px, and a table that scrolls sideways hides
 * the Remove button. Each row becomes a small card instead: serial + Remove
 * on top, then where it's kept, then its status.
 * ------------------------------------------------------------------------ */
@media (max-width: 600px) {
  /* Small enough that the address fits on one line at 360px+. */
  .approval-note .inline-cta {
    margin-left: 0;
    padding: 8px 10px;
    font-size: 0.66rem;
  }

  .csv-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .csv-table,
  .csv-table tbody {
    display: block;
  }

  .csv-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    padding: 10px 12px;
    border-top: 2px solid #d5e3f5;
  }

  .csv-table tbody tr:first-child {
    border-top: 0;
  }

  .csv-table tbody tr:nth-child(even) {
    background: #f3f8ff;
  }

  .csv-table tbody tr.is-taken,
  .csv-table tbody tr.is-invalid,
  .csv-table tbody tr.is-duplicate {
    background: #fff4e0;
  }

  .csv-table td,
  .csv-table tbody tr:nth-child(even) td,
  .csv-table tbody tr.is-taken td,
  .csv-table tbody tr.is-invalid td,
  .csv-table tbody tr.is-duplicate td {
    display: block;
    padding: 0;
    border: 0;
    background: none;
    width: auto;
  }

  .csv-cell-row {
    grid-column: 1;
    font-size: 0.8rem;
  }

  .csv-cell-row::before {
    content: "Row ";
  }

  .csv-cell-serial {
    grid-column: 1;
  }

  .csv-cell-remove {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .csv-cell-location,
  .csv-cell-status,
  .csv-cell-ref {
    grid-column: 1 / -1;
  }

  .csv-cell-location::before,
  .csv-cell-ref::before {
    content: attr(data-label) ": ";
    color: #6b7fa3;
    font-family: var(--fl-font-body);
    font-size: 0.85rem;
    letter-spacing: 0;
  }

  .done-table .csv-cell-serial {
    grid-column: 1 / -1;
  }

  .csv-table-wrap {
    max-height: 75vh;
  }
}
