/* Coenergia · Stato ordine — stile allineato a coenergia.com */

:root {
  --green: #5da552;        /* verde del sito: filetti, bordi, accenti */
  --green-dark: #3f8136;   /* verde per testi e fondi con testo bianco (contrasto AA) */
  --ink: #333333;
  --title: #39414b;
  --muted: #6f6f6f;
  --line: #dddddd;
  --line-input: #cccccc;
  --soft: #f6f6f6;
  --band: #eeeeee;
  --dark: #272624;
  --footer: #333333;
  --error: #b42318;

  --font: "Open Sans", Arial, sans-serif;
  --font-title: Raleway, "Open Sans", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: #fff;
  font: 400 14px/1.6 var(--font);
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
}

a {
  color: var(--green-dark);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--green-dark);
  outline-offset: 1px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 15px;
}

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

.skip-link {
  position: absolute;
  top: -40px;
  left: 15px;
  z-index: 10;
  padding: 6px 12px;
  color: #fff;
  background: var(--dark);
}

.skip-link:focus {
  top: 0;
}

/* Testata ------------------------------------------------------------------ */

.topbar {
  color: var(--muted);
  border-bottom: 1px solid var(--band);
  font-size: 12px;
}

.topbar__inner {
  display: flex;
  gap: 20px;
  min-height: 32px;
  align-items: center;
}

.topbar a {
  color: var(--muted);
  font-weight: 400;
}

.header {
  border-bottom: 1px solid var(--band);
}

.header__inner {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand__logo {
  display: block;
  width: auto;
  height: 32px;
}

.brand__wordmark {
  color: #3c3c3b;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand__accent {
  color: var(--green);
}

.header__nav {
  display: flex;
  align-items: stretch;
}

.header__nav a,
.header__nav span {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  text-transform: uppercase;
  border-bottom: 3px solid transparent;
}

.header__nav a:hover {
  text-decoration: none;
  background: var(--soft);
}

.header__nav .is-active {
  background: var(--soft);
  border-bottom-color: var(--green);
}

.band {
  background: var(--band);
}

.band .container {
  display: flex;
  align-items: flex-end;
  min-height: 48px;
}

.breadcrumb {
  padding: 5px 10px;
  color: #fff;
  background: var(--green-dark);
  font-size: 13px;
}

/* Pannello di consultazione ------------------------------------------------ */

.main {
  flex: 1;
  padding-block: 30px 50px;
}

/* Mobile: introduzione, modulo, informazioni. Desktop: testo a sinistra, modulo a destra. */
.lookup {
  display: grid;
  grid-template-areas:
    "intro"
    "panel"
    "extra";
  gap: 24px;
}

.lookup__intro {
  grid-area: intro;
}

.lookup__extra {
  grid-area: extra;
}

.panel {
  grid-area: panel;
}

.page-title,
.panel__title,
.doc__title,
.doc__subtitle {
  color: var(--title);
  font-family: var(--font-title);
  font-weight: 400;
  line-height: 1.2;
}

.page-title {
  margin-bottom: 14px;
  font-size: 26px;
}


.note {
  margin-bottom: 14px;
  padding: 12px 15px;
  background: var(--soft);
  border-left: 4px solid var(--green);
}

.lookup__help {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  align-self: start;
  padding: 20px;
  border: 1px solid var(--line);
}

.panel__title {
  margin-bottom: 16px;
  padding-bottom: 10px;
  font-size: 20px;
  border-bottom: 1px solid var(--line);
}

.field {
  margin-bottom: 14px;
}

.field__label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.field__input {
  width: 100%;
  height: 36px;
  padding: 6px 12px;
  color: #555;
  background: var(--soft);
  border: 1px solid var(--line-input);
  border-radius: 0;
  font: inherit;
  font-size: 14px;
}

.field__input:focus {
  outline: none;
  background: #fff;
  border-color: var(--green);
}

.field__input::placeholder {
  color: #999;
}

.field__input--code {
  text-transform: uppercase;
}

.field__input--code::placeholder {
  text-transform: none;
}

.field__input[aria-invalid="true"] {
  border-color: var(--error);
}

.field__error {
  margin-top: 4px;
  color: var(--error);
  font-size: 13px;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.captcha {
  margin-bottom: 14px;
}

.panel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 6px;
}

.panel__privacy {
  flex: 1 1 220px;
  color: var(--muted);
  font-size: 12px;
}

.button {
  min-height: 36px;
  padding: 6px 22px;
  color: #f6f6f6;
  background: var(--dark);
  border: 1px solid var(--dark);
  border-radius: 0;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.button:hover {
  background: #000;
}

.button[disabled] {
  cursor: progress;
  opacity: 0.7;
}

.button--light {
  color: var(--ink);
  background: #fff;
  border-color: var(--line-input);
}

.button--light:hover {
  background: var(--soft);
}

.link-button {
  padding: 0;
  color: var(--green-dark);
  background: none;
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.link-button[disabled] {
  color: var(--muted);
  cursor: progress;
  text-decoration: none;
}

.alert {
  margin-top: 16px;
  padding: 10px 14px;
  color: #7a1a12;
  background: #fdf0ef;
  border-left: 4px solid var(--error);
}

/* Risultato: schede in stile documento ------------------------------------ */

.result {
  margin-top: 40px;
  outline: none;
}

.doc + .doc {
  margin-top: 30px;
}

.doc__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--green);
}

.doc__title {
  font-size: 24px;
}

.doc__subtitle {
  margin-bottom: 10px;
  font-size: 20px;
}

.doc__message {
  margin-top: 12px;
}

.doc__note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.doc__empty {
  padding: 12px 15px;
  color: var(--muted);
  background: var(--soft);
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.fields > div {
  padding: 8px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fields dt {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.fields dd {
  margin: 2px 0 0;
  font-weight: 600;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid currentColor;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag--done {
  color: #fff;
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.tag--partial {
  color: var(--green-dark);
}

.tag--neutral {
  color: var(--muted);
}

.tag--closed {
  color: #fff;
  background: var(--title);
  border-color: var(--title);
}

/* Tabelle */

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.table th {
  color: var(--title);
  background: var(--soft);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.table .num {
  text-align: right;
  white-space: nowrap;
}

.table .code,
.table .date {
  white-space: nowrap;
}

.table .code {
  font-weight: 600;
}

.table .is-group td {
  font-weight: 600;
  background: #fafafa;
}

.table .is-child td:first-child {
  padding-left: 24px;
}

.table__note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

/* DDT */

.ddt + .ddt {
  margin-top: 20px;
}

.ddt__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 8px 12px;
  background: var(--soft);
  border-left: 4px solid var(--green);
}

.ddt__title {
  font-weight: 700;
}

.ddt__date {
  color: var(--muted);
}

.ddt__head .tag {
  margin-left: auto;
}

.ddt .fields {
  margin-top: 0;
  border-top: 0;
}

.ddt .table {
  margin-top: 10px;
}

.carrier {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.carrier__logo {
  width: auto;
  height: 20px;
  max-width: 96px;
  object-fit: contain;
}

.tracking {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.tracking__number {
  font-weight: 600;
}

.inline-error {
  display: block;
  margin-top: 2px;
  color: var(--error);
  font-size: 12px;
  font-weight: 400;
}

.inline-error:empty {
  display: none;
}

.result__actions {
  margin-top: 30px;
}

/* Footer ------------------------------------------------------------------- */

.footer {
  padding-block: 14px;
  color: #bbb;
  background: var(--footer);
  font-size: 12px;
}

/* Schermi ampi ------------------------------------------------------------- */

@media (min-width: 860px) {
  .lookup {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "intro panel"
      "extra panel";
    gap: 14px 40px;
  }

  .band .container {
    min-height: 80px;
  }

  .brand__logo {
    height: 36px;
  }
}

/* Schermi stretti: le tabelle diventano elenchi etichetta/valore ----------- */

@media (max-width: 640px) {
  .topbar__inner {
    justify-content: space-between;
  }

  .header__nav a {
    display: none;
  }

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

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
  }

  .table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 10px;
    border: 0;
    text-align: right;
  }

  .table td::before {
    content: attr(data-label);
    flex: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
    text-align: left;
  }

  .table td:empty {
    display: none;
  }

  .table .num {
    text-align: right;
  }

  .table .is-child td:first-child {
    padding-left: 10px;
  }

  .table .is-child {
    padding-left: 12px;
    border-left: 3px solid var(--band);
  }

  .ddt__head .tag {
    margin-left: 0;
  }
}

@media print {
  .topbar,
  .header__nav,
  .band,
  .lookup,
  .result__actions,
  .link-button,
  .footer {
    display: none !important;
  }

  .result {
    margin-top: 0;
  }
}
