:root {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #23302e;
  background: #f8f9f7;
  font-size: 14px;
  --accent: #216f57;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
aside {
  position: fixed;
  width: 224px;
  inset: 0 auto 0 0;
  background: #eef1ec;
  border-right: 1px solid #dde3dc;
  padding: 36px 22px;
}
.brand {
  font-size: 27px;
  font-weight: 750;
  letter-spacing: -1px;
}
.brand span {
  font-weight: 400;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  margin-top: 10px;
  color: #728078;
}
nav {
  margin-top: 58px;
  display: grid;
  gap: 8px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid #d9dfd9;
  background: white;
  border-radius: 7px;
  padding: 10px 14px;
  color: inherit;
  transition:
    background 0.16s,
    transform 0.16s;
}
button:hover {
  background: #e9eee8;
}
nav button {
  border: 0;
  text-align: left;
  background: transparent;
  padding: 14px 10px;
}
nav .active {
  background: #dce7dd;
  color: #18513f;
}
.aside-bottom {
  position: absolute;
  bottom: 30px;
  line-height: 2;
}
.aside-bottom small {
  color: #7a857d;
}
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #216f57;
  border-radius: 50%;
  margin-right: 7px;
}
main {
  margin-left: 224px;
  padding: 0 46px;
}
header {
  height: 78px;
  border-bottom: 1px solid #e0e5df;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #778178;
  font-size: 12px;
}
header b {
  font-weight: 500;
  color: #354039;
}
.local {
  font-size: 10px;
  letter-spacing: 1px;
}
section {
  animation: enter 0.22s ease;
}
.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 42px 0 24px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.8px;
  color: #768177;
}
h1 {
  font-size: 34px;
  letter-spacing: -1.2px;
  font-weight: 600;
  margin: 10px 0;
}
p {
  color: #768078;
  line-height: 1.6;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.primary:hover {
  background: #175a45;
}
.notice {
  padding: 13px 0;
  border-top: 1px solid #e0e5df;
  border-bottom: 1px solid #e0e5df;
  color: #6f7b72;
  font-size: 12px;
}
.metrics {
  display: flex;
  gap: 80px;
  padding: 30px 0;
}
.metrics div {
  display: grid;
  gap: 7px;
}
.metrics strong {
  font-size: 28px;
  font-weight: 500;
}
.metrics span {
  color: #778078;
  font-size: 12px;
}
.filters {
  display: flex;
  gap: 9px;
  margin: 12px 0 22px;
  flex-wrap: wrap;
}
input,
textarea,
select {
  border: 1px solid #dce2da;
  background: #fff;
  border-radius: 6px;
  padding: 10px;
  outline: none;
  max-width: 100%;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}
#query {
  flex: 1;
  min-width: 220px;
}
.table-wrap {
  border-top: 1px solid #dce2da;
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  padding: 16px 12px;
  color: #7b847c;
  font-size: 11px;
  font-weight: 500;
  background: #f0f3ee;
}
td {
  padding: 20px 12px;
  border-bottom: 1px solid #e1e6df;
  font-size: 12px;
}
tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}
tbody tr:hover {
  background: #edf2eb;
}
td strong {
  display: block;
  font-size: 14px;
  font-weight: 550;
}
td small {
  display: block;
  color: #7b847c;
  margin-top: 7px;
}
.badge {
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 4px;
  background: #e9ede7;
  white-space: nowrap;
}
.badge.produttore {
  background: #dfede3;
  color: #246249;
}
.empty {
  text-align: center;
  padding: 62px 20px 70px;
}
.empty > div {
  font-size: 38px;
  color: #809684;
}
.empty h2 {
  font-size: 19px;
  font-weight: 500;
}
.empty button {
  margin-top: 8px;
}
.footnote {
  font-size: 11px;
}
dialog {
  width: 560px;
  max-width: calc(100vw - 30px);
  border: 1px solid #dce2da;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 24px 90px #1f34232b;
  animation: enter 0.2s ease;
}
dialog::backdrop {
  background: #16261f55;
}
dialog h2 {
  font-size: 23px;
  font-weight: 550;
  margin: 0;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.close {
  border: 0;
  font-size: 23px;
  padding: 0 7px;
}
label {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  font-size: 12px;
}
textarea {
  resize: vertical;
  line-height: 1.5;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
form > .primary {
  width: 100%;
  margin-top: 8px;
}
#detail-dialog {
  width: 720px;
}
#detail a {
  color: var(--accent);
  overflow-wrap: anywhere;
}
.evidence {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.8;
  background: #f3f5f0;
  padding: 18px;
  max-height: 300px;
  overflow: auto;
}
.search-row {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding: 26px 0;
  border-bottom: 1px solid #dfe5dc;
}
.search-row h2 {
  font-size: 19px;
  margin: 0;
}
.search-row p {
  max-width: 650px;
}
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #233d30;
  color: white;
  padding: 14px 22px;
  border-radius: 7px;
  display: none;
  max-width: 500px;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
[hidden] {
  display: none !important;
}
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 900px) {
  aside {
    width: 175px;
    padding: 25px 15px;
  }
  main {
    margin-left: 175px;
    padding: 0 20px;
  }
  .metrics {
    gap: 30px;
  }
  .heading {
    gap: 15px;
  }
  h1 {
    font-size: 28px;
  }
}
@media (max-width: 600px) {
  aside {
    position: relative;
    width: 100%;
    padding: 18px;
  }
  .brand small,
  .aside-bottom {
    display: none;
  }
  nav {
    margin-top: 15px;
    display: flex;
  }
  main {
    margin: 0;
    padding: 0 16px;
  }
  header {
    height: 50px;
  }
  .heading {
    margin-top: 25px;
    align-items: flex-start;
  }
  .metrics {
    gap: 20px;
  }
  .metrics span {
    font-size: 10px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}
.search-row > .badge {
  align-self: flex-start;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
.provider-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 1px solid #dfe5dc;
  flex-wrap: wrap;
}
.provider-bar > span {
  flex: 1;
  font-size: 12px;
  color: #758077;
}
.search-actions {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 170px;
}
.search-actions small {
  font-size: 11px;
  color: #778078;
}
#run-status {
  padding: 16px;
  background: #eaf0e8;
  margin-top: 20px;
  font-size: 13px;
  line-height: 1.7;
}
.query-line {
  padding: 12px 0;
  border-bottom: 1px solid #e1e6df;
  display: grid;
  gap: 5px;
}
.query-line small {
  color: #768078;
}
#query-plan {
  max-height: 320px;
  overflow: auto;
}
#start-run {
  width: 100%;
}
#search-dialog {
  width: 850px;
  max-height: 90vh;
  overflow: auto;
}
fieldset {
  border: 0;
  border-top: 1px solid #dfe5dc;
  padding: 18px 0;
  margin: 12px 0;
}
legend {
  font-size: 13px;
  font-weight: 600;
  padding-right: 12px;
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #dce2da;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.choice:has(input:checked) {
  background: #e1ede3;
  border-color: #7f9c86;
}
.choice input {
  accent-color: #216f57;
  margin: 0;
  width: 14px;
  height: 14px;
}
.edit-search {
  font-size: 12px;
}
.evidence {
  white-space: normal;
  max-height: 440px;
  font-size: 14px;
  line-height: 1.85;
}
.evidence p {
  color: #465149;
  margin: 0 0 18px;
  line-height: inherit;
}
.evidence p:last-child {
  margin-bottom: 0;
}
.evidence strong {
  font-weight: 750;
  color: #172f23;
}
#detail-dialog {
  max-height: 92vh;
  overflow: auto;
}
.dialog-head h2 {
  line-height: 1.3;
}
#ai-assessment {
  border-top: 1px solid #dce2da;
  border-bottom: 1px solid #dce2da;
  margin: 22px 0;
  padding: 8px 0 20px;
}
#ai-result blockquote {
  margin: 12px 0;
  padding: 8px 14px;
  border-left: 3px solid #789e83;
  background: #f3f5f0;
  color: #314938;
  font-size: 13px;
  line-height: 1.7;
}
.jev-decisions {
  font-size: 12px;
}
.jev-decisions > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #e0e5df;
  padding: 10px 0;
}
.jev-decisions dd {
  margin: 0;
  text-align: right;
  color: #536658;
}
#criteria-editor {
  margin: 24px 0 32px;
  padding: 26px;
  background: #fff;
  border: 1px solid #dce2da;
  border-radius: 8px;
}
#criteria-editor .dialog-head {
  margin-bottom: 22px;
}
#criteria-editor .dialog-head h2 {
  font-size: 22px;
}
#criteria-editor .form-grid {
  grid-template-columns: 1fr 1fr;
}
#criteria-editor form > .primary {
  width: auto;
  min-width: 180px;
}
#criteria-editor #dimensions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 26px;
}
#criteria-editor fieldset {
  min-width: 0;
}
@media (max-width: 900px) {
  #criteria-editor #dimensions {
    grid-template-columns: 1fr;
  }
}
#company-profile {
  padding: 14px 0 24px;
  border-bottom: 1px solid #dce2da;
  margin-bottom: 20px;
}
.company-facts > div {
  display: grid;
  grid-template-columns: 120px 1fr;
  padding: 14px 0;
  border-top: 1px solid #e0e5df;
  gap: 12px;
}
.company-facts dt {
  font-size: 12px;
  color: #758077;
}
.company-facts dd {
  margin: 0;
  font-size: 13px;
}
.company-facts small {
  display: block;
  margin: 6px 0;
  color: #758077;
}
#enrichment-result blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  background: #f3f5f0;
  border-left: 2px solid #9daf9e;
  font-size: 12px;
  line-height: 1.7;
}
#enrichment-result details {
  margin: 16px 0;
  font-size: 12px;
}
#enrichment-result summary {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  width: 100%;
}
.auth-screen form {
  width: min(420px, 90vw);
  padding: 32px;
  background: white;
  border: 1px solid #dce3dc;
  border-radius: 12px;
}
.account {
  margin-top: 24px;
  display: grid;
  gap: 12px;
  overflow-wrap: anywhere;
}
.account small {
  font-size: 12px;
}
/* Touch layouts */
aside {
  overflow-y: auto;
}
.aside-bottom {
  position: static;
  margin-top: 28px;
}
.heading > div,
.search-row > div {
  min-width: 0;
}
.dialog-head h2,
.company-facts dd,
.evidence,
.jev-decisions dt {
  overflow-wrap: anywhere;
}
.dialog-head .close {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
@media (max-width: 1024px) {
  button,
  input:not([type="checkbox"]),
  select {
    min-height: 44px;
  }
  input,
  select,
  textarea {
    font-size: 16px;
  }
  .choice {
    min-height: 44px;
  }
  .choice input {
    width: 18px;
    height: 18px;
  }
  .account {
    margin-top: 20px;
  }
}
@media (max-width: 600px) {
  .heading {
    flex-direction: column;
    align-items: stretch;
  }
  .heading > button {
    width: 100%;
  }
  .metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
  .metrics span {
    font-size: 11px;
  }
  .filters > * {
    width: 100%;
    flex: none !important;
  }
  #query {
    min-width: 0;
  }
  .provider-bar {
    align-items: stretch;
  }
  .provider-bar > span {
    flex-basis: 100%;
  }
  .provider-bar > button {
    width: 100%;
  }
  .search-row {
    flex-direction: column;
    gap: 16px;
  }
  .search-actions {
    min-width: 0;
  }
  .search-row h2 {
    overflow-wrap: anywhere;
  }
  #criteria-editor {
    padding: 16px;
  }
  #criteria-editor .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  #criteria-editor form > .primary {
    width: 100%;
    min-width: 0;
  }
  .choices {
    gap: 8px;
  }
  .choice {
    max-width: 100%;
  }
  .choice span {
    overflow-wrap: anywhere;
  }
  dialog {
    padding: 18px;
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    overflow: auto;
  }
  .company-facts > div {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .jev-decisions > div {
    flex-direction: column;
    gap: 6px;
  }
  .jev-decisions dd {
    text-align: left;
  }
  #toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
  .auth-screen form {
    padding: 24px;
  }
  .table-wrap {
    overflow: visible;
  }
  table,
  tbody {
    display: block;
  }
  thead {
    display: none;
  }
  #rows tr {
    display: block;
    border: 1px solid #dce2da;
    border-radius: 8px;
    background: white;
    margin: 12px 0;
    padding: 8px 12px;
  }
  #rows td {
    display: grid;
    grid-template-columns: 105px minmax(0, 1fr);
    gap: 8px;
    padding: 12px 0;
    overflow-wrap: anywhere;
  }
  #rows td::before {
    content: attr(data-label);
    color: #758077;
    font-size: 11px;
  }
  #rows td:first-child {
    display: block;
  }
  #rows td:first-child::before {
    display: none;
  }
  #rows td:last-child {
    border-bottom: 0;
  }
  .badge {
    justify-self: start;
    white-space: normal;
  }
}

.advanced-options {
  grid-column: 1/-1;
  border-top: 1px solid #dfe5dc;
  padding-top: 16px;
}
.advanced-options > summary {
  cursor: pointer;
  min-height: 44px;
  font-weight: 600;
}
.advanced-options fieldset {
  margin: 0;
}
.search-actions button {
  min-height: 44px;
}
#rows tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
