/* =========================================================================
   Come lo dici editorial — denser paper-on-teal for the reviewer's pages.
   Builds on the product's tokens.css / components.css / app.css (copied at
   build time from src/ComeLoDici.Web, never edited here). Every class of this
   file starts with ed- so the learner card keeps the product's look intact.
   No inline styles anywhere: the CSP is default-src 'self'.
   ========================================================================= */

.ed-body {
  --ed-gap: 14px;
  font-size: 0.9375rem;
  line-height: 1.45;
}

/* ---- Top bar ------------------------------------------------------------ */
.ed-top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 10px max(var(--gutter), var(--safe-left));
  background: color-mix(in srgb, var(--teal-deep) 92%, black);
  border-bottom: 1px solid rgba(246, 234, 212, 0.14);
}
.ed-brand {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--paper);
  text-decoration: none;
  white-space: nowrap;
}
.ed-brand__tag {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: var(--fs-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--cat-everyday);
}
.ed-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ed-nav a {
  padding: 6px 12px;
  border-radius: var(--r-round);
  color: var(--on-teal-soft);
  text-decoration: none;
  font-weight: 600;
}
.ed-nav a:hover {
  color: var(--paper);
  background: rgba(246, 234, 212, 0.08);
}
.ed-nav a[aria-current='page'] {
  color: var(--ink);
  background: var(--paper);
}
.ed-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--on-teal-soft);
  font-size: var(--fs-small);
}

/* ---- Page frame --------------------------------------------------------- */
.ed-main {
  max-width: 1720px;
  margin: 0 auto;
  padding: 18px max(var(--gutter), var(--safe-right)) 64px max(var(--gutter), var(--safe-left));
}
.ed-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  margin-bottom: var(--ed-gap);
  color: var(--on-teal);
}
.ed-page-head .ed-muted {
  color: var(--on-teal-soft);
  flex-basis: 100%;
}
.ed-page-head--review .ed-muted {
  flex-basis: auto;
}
.ed-page-head a {
  color: var(--paper);
}
.ed-h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.15;
}
.ed-h2 {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-soft);
}
.ed-muted {
  color: var(--ink-soft);
}
.ed-small {
  font-size: var(--fs-small);
  color: var(--ink-soft);
}
.ed-nowrap {
  white-space: nowrap;
}
code,
kbd,
.ed-code,
.ed-pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  line-height: 1.4;
  text-align: center;
  opacity: 0.8;
}

/* ---- Paper sheets ------------------------------------------------------- */
.ed-sheet {
  --focus: #10556e;
  position: relative;
  margin-bottom: var(--ed-gap);
  padding: 16px 18px;
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--r-sheet);
  box-shadow: var(--shadow-sheet);
}
.ed-sheet a {
  color: var(--teal);
}
.ed-sheet--error {
  box-shadow: var(--shadow-sheet), inset 4px 0 0 var(--no);
}
.ed-sheet--ok {
  box-shadow: var(--shadow-sheet), inset 4px 0 0 var(--ok);
}
.ed-narrow {
  max-width: 560px;
}
.ed-narrow-wide {
  max-width: 900px;
}
.ed-split {
  display: grid;
  gap: var(--ed-gap);
}
@media (min-width: 1100px) {
  .ed-split {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }
}

/* ---- Flash and errors --------------------------------------------------- */
.ed-flash {
  margin-bottom: var(--ed-gap);
  padding: 10px 14px;
  border-radius: var(--r-control);
  font-weight: 600;
  color: var(--ink);
}
.ed-flash--ok {
  background: var(--ok-tint);
  box-shadow: inset 4px 0 0 var(--ok);
}
.ed-flash--error {
  background: var(--no-tint);
  box-shadow: inset 4px 0 0 var(--no);
}
.ed-error {
  margin: 8px 0;
  color: var(--no-ink);
  font-weight: 600;
}
.ed-empty {
  padding: 20px 0;
  color: var(--ink-soft);
}

/* ---- Tiles -------------------------------------------------------------- */
.ed-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--ed-gap);
  margin-bottom: var(--ed-gap);
}
.ed-tile {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--r-sheet);
  box-shadow: var(--shadow-sheet);
  text-decoration: none;
}
.ed-tile:hover {
  background: var(--paper-light);
}
.ed-tile--warn {
  box-shadow: var(--shadow-sheet), inset 0 4px 0 var(--cat-everyday);
}
.ed-tile__n {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.25rem;
  line-height: 1;
}
.ed-tile__l {
  font-weight: 700;
}
.ed-tile__s {
  font-size: var(--fs-small);
  color: var(--ink-soft);
}

/* ---- Tables ------------------------------------------------------------- */
.ed-scroll {
  overflow-x: auto;
}
.ed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.ed-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 6px 8px;
  border-bottom: 1.5px solid var(--paper-edge);
}
.ed-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--paper-edge);
  vertical-align: top;
}
.ed-table--compact td {
  padding: 4px 8px;
}
.ed-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ed-table tr.is-warn td {
  background: color-mix(in srgb, var(--cat-everyday) 18%, var(--paper));
}
.ed-table tbody tr:hover td {
  background: var(--paper-light);
}
.ed-zero {
  color: color-mix(in srgb, var(--ink-soft) 55%, var(--paper));
}
.ed-total td {
  font-weight: 700;
  border-top: 1.5px solid var(--paper-edge);
}
.ed-muted-row td {
  color: var(--ink-soft);
}
.ed-progress {
  width: 110px;
  height: 10px;
  vertical-align: middle;
  accent-color: var(--ok);
}

/* ---- Tags and statuses --------------------------------------------------- */
.ed-tag,
.ed-status {
  display: inline-block;
  margin: 1px 2px 1px 0;
  padding: 0 7px;
  border-radius: var(--r-tag);
  border: 1px solid var(--paper-edge);
  background: var(--paper-light);
  color: var(--ink); /* never inherit the page head's paper colour: ink on every tint is >= 11:1 */
  font-size: 0.8125rem;
  line-height: 1.6;
  white-space: nowrap;
}
.ed-tag--flag,
.ed-tag--qc-flagged,
.ed-tag--qc-pending {
  background: var(--ojo-tint);
  border-color: var(--ojo-edge);
}
.ed-tag--reject,
.ed-tag--qc-failed {
  background: var(--no-tint);
  border-color: var(--no);
  color: var(--no-ink);
}
.ed-tag--ok,
.ed-tag--qc-passed,
.ed-tag--pass {
  background: var(--ok-tint);
  border-color: var(--ok);
  color: var(--ok-ink);
}
.ed-tag--report,
.ed-tag--report-new {
  background: color-mix(in srgb, var(--cat-out) 30%, var(--paper));
  border-color: var(--cat-out);
}
.ed-tag--kind {
  font-style: italic;
}
.ed-status {
  font-weight: 600;
}
.ed-status--validated,
.ed-status--in_review {
  background: var(--ojo-tint);
  border-color: var(--ojo-edge);
}
.ed-status--approved,
.ed-status--published {
  background: var(--ok-tint);
  border-color: var(--ok);
  color: var(--ok-ink);
}
.ed-status--rejected,
.ed-status--withdrawn {
  background: var(--no-tint);
  border-color: var(--no);
  color: var(--no-ink);
}
.ed-cat {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 2px;
  background: var(--cat);
  vertical-align: baseline;
}

/* ---- Buttons and forms ---------------------------------------------------- */
.ed-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--r-control);
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9375rem;
  text-decoration: none;
  cursor: pointer;
}
.ed-sheet a.ed-btn {
  color: var(--ink);
}
.ed-btn:hover {
  background: rgba(14, 40, 54, 0.06);
}
.ed-btn--primary {
  background: var(--ink);
  color: var(--paper);
}
.ed-btn--primary:hover {
  background: #173d50;
}
.ed-page-head .ed-btn--primary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}
.ed-btn--danger {
  border-color: var(--no-ink);
  color: var(--no-ink);
}
.ed-btn--danger:hover {
  background: var(--no-tint);
}
.ed-btn--ghost {
  border-color: rgba(246, 234, 212, 0.5);
  color: var(--paper);
  min-height: 32px;
}
.ed-btn--ghost:hover {
  background: rgba(246, 234, 212, 0.1);
}
.ed-btn--ghost-ink {
  border-color: var(--paper-edge);
}
.ed-btn--small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.8125rem;
}
.ed-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ed-btn kbd {
  font-size: 0.75rem;
}
.ed-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
.ed-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ed-form {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}
.ed-form + .ed-form {
  padding-top: 12px;
  border-top: 1px dashed var(--paper-edge);
}
.ed-field {
  display: grid;
  gap: 3px;
}
.ed-field > span {
  font-size: var(--fs-small);
  font-weight: 600;
}
.ed-field--inline {
  display: inline-grid;
}
.ed-field input,
.ed-field select,
.ed-field textarea,
.ed-code {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--option-edge);
  border-radius: 8px;
  background: var(--paper-light);
  color: var(--ink);
  font: inherit;
}
.ed-code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.45;
  resize: vertical;
  tab-size: 2;
}
.ed-fieldset {
  margin: 0;
  padding: 8px 12px 10px;
  border: 1px solid var(--paper-edge);
  border-radius: 8px;
  display: grid;
  gap: 8px;
}
.ed-fieldset legend {
  padding: 0 4px;
  font-size: var(--fs-small);
  font-weight: 700;
}
.ed-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
}
.ed-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
}
.ed-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.ed-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--ed-gap);
}
.ed-tabs a {
  padding: 6px 14px;
  border-radius: var(--r-round);
  color: var(--on-teal-soft);
  text-decoration: none;
  font-weight: 600;
}
.ed-tabs a[aria-current='page'] {
  background: var(--paper);
  color: var(--ink);
}
.ed-list {
  display: grid;
  gap: 4px;
  font-size: var(--fs-small);
}
.ed-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  margin: 8px 0 0;
  font-size: var(--fs-small);
}
.ed-meta dt {
  color: var(--ink-soft);
}
.ed-meta dd {
  margin: 0;
}
details > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 3px 0;
}
details + details {
  margin-top: 6px;
}
.ed-pre {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow: auto;
  padding: 10px;
  background: var(--paper-light);
  border-radius: 8px;
}

/* ---- Checklist ------------------------------------------------------------ */
.ed-checklist ol {
  list-style: decimal;
  padding-left: 1.4em;
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

/* ---- Validator results ---------------------------------------------------- */
.ed-results {
  display: grid;
  gap: 5px;
  font-size: var(--fs-small);
}
.ed-result {
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--paper-light);
}
.ed-result--reject {
  background: var(--no-tint);
}
.ed-result--flag {
  background: var(--ojo-tint);
}
.ed-result--pass {
  background: var(--ok-tint);
}

/* ---- Review page ------------------------------------------------------------
   The card column keeps the learner's width (1240 px container); the review panel
   sits beside it only when both fit, otherwise it follows the card. */
.ed-review {
  display: grid;
  gap: var(--ed-gap);
}
@media (min-width: 1660px) {
  .ed-review {
    grid-template-columns: minmax(0, 1176px) minmax(360px, 1fr);
    align-items: start;
  }
  .ed-review__side {
    position: sticky;
    top: 64px;
    max-height: calc(100vh - 76px);
    overflow-y: auto;
    padding-right: 4px;
  }
}
.ed-review__card {
  max-width: 1176px;
  min-width: 0;
}
.ed-review__card .card {
  margin-top: 0;
}
.ed-card-note {
  margin-bottom: 8px;
  font-size: var(--fs-small);
  color: var(--on-teal-soft);
}
/* Editorial annotations inside the learner card: dashed, teal, obviously not product. */
.ed-anno {
  margin: 6px 0 2px 12px;
  padding: 6px 10px;
  border: 1.5px dashed var(--teal);
  border-radius: 6px;
  background: color-mix(in srgb, var(--teal) 6%, var(--paper));
  font-size: var(--fs-small);
  line-height: 1.4;
}
.ed-anno--inline {
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  background: none;
}
.ed-anno__k {
  display: inline-block;
  margin-right: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
}
.ed-anno__why {
  display: block;
  margin-top: 3px;
}
.ed-if {
  margin-left: 6px;
  padding: 0 6px;
  border: 1.5px dashed var(--teal);
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--teal);
}
.ed-say {
  width: 36px;
  height: 36px;
}
.ed-review .btn-next[aria-disabled='true'],
.ed-review .report__toggle[aria-disabled='true'] {
  cursor: default;
  opacity: 0.7;
}

/* ---- Fix editor ------------------------------------------------------------ */
.ed-fix {
  display: grid;
  gap: var(--ed-gap);
}
@media (min-width: 1200px) {
  .ed-fix {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* ---- Register gate ---------------------------------------------------------- */
.ed-gate {
  display: grid;
  gap: 8px;
  list-style: decimal;
  padding-left: 1.6em;
}
.ed-gate__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid var(--paper-edge);
}
.ed-gate__prompt {
  width: 100%;
  padding: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

/* ---- Login ---------------------------------------------------------------- */
.ed-auth {
  display: grid;
  place-items: center;
  min-height: 70vh;
}
.ed-auth__sheet {
  width: min(100%, 420px);
}
.ed-auth .ed-h1 {
  margin-bottom: 4px;
}
.ed-note {
  width: 9em;
  padding: 3px 6px;
  border: 1px solid var(--option-edge);
  border-radius: 6px;
  background: var(--paper-light);
  font: inherit;
  font-size: 0.8125rem;
}

/* ---- Phone width (390 px and up, R-A11Y-01) ----------------------------------------
   Nothing may widen the page: grid children may shrink below their content, long keys
   and codes break, numeric tables scroll inside their own .ed-scroll box, and the
   list tables (.ed-table--stack) become one card per row with each cell labelled from
   its data-label attribute. */
.ed-main,
.ed-sheet,
.ed-scroll {
  max-width: 100%;
}
.ed-split > *,
.ed-review > *,
.ed-fix > *,
.ed-stack > * {
  min-width: 0;
}
.ed-h1,
.ed-table code,
.ed-results code,
.ed-page-head code {
  overflow-wrap: anywhere;
}
.ed-scroll > .ed-table {
  min-width: max-content;
}
@media (max-width: 720px) {
  .ed-table--stack,
  .ed-table--stack tbody,
  .ed-table--stack tr,
  .ed-table--stack td {
    display: block;
    width: 100%;
  }
  .ed-table--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .ed-table--stack tr {
    padding: 8px 0;
    border-bottom: 1.5px solid var(--paper-edge);
  }
  .ed-table--stack td,
  .ed-table--stack td.num {
    position: relative;
    min-height: 1.6em;
    padding: 2px 0 2px 7.5em;
    border: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .ed-table--stack td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    top: 4px;
    width: 7em;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }
  .ed-table--stack tbody tr:hover td {
    background: none;
  }
  .ed-tag,
  .ed-status {
    white-space: normal;
  }
}
