:root {
  --polimi:   #1a3d6d;
  --ink:      #16191d;
  --muted:    #5c6672;
  --line:     #dfe3e8;
  --bg:       #f6f7f9;
  --pass:     #1f7a3d;
  --pass-bg:  #e8f5ec;
  --fail:     #a3271f;
  --fail-bg:  #fdeceb;
  --warn:     #8a6100;
  --warn-bg:  #fdf4e0;
  --radius:   6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

header {
  background: var(--polimi);
  color: #fff;
  padding: 1.6rem 1.25rem;
}
header h1 { margin: 0; font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em; }
header .sub { margin: .25rem 0 0; opacity: .85; font-size: .9rem; }

main { max-width: 780px; margin: 0 auto; padding: 1.25rem; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.1rem;
}
.card h2 { margin: 0 0 .8rem; font-size: 1.02rem; font-weight: 600; }

.row { display: flex; align-items: center; gap: .75rem; margin-bottom: .7rem; flex-wrap: wrap; }
.row label { min-width: 9.5rem; font-size: .9rem; color: var(--muted); }

select, input[type=file], textarea, button {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .45rem .6rem;
  background: #fff;
  color: var(--ink);
}
select { flex: 1; min-width: 12rem; }
textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; }
input[type=file] { width: 100%; padding: .5rem; }

button {
  background: var(--polimi);
  color: #fff;
  border-color: var(--polimi);
  cursor: pointer;
  padding: .55rem 1.1rem;
  margin-top: .8rem;
  font-weight: 500;
}
button:hover { filter: brightness(1.12); }
button:disabled { opacity: .5; cursor: default; }

.hint { font-size: .86rem; color: var(--muted); margin: .6rem 0 .4rem; }
code { background: var(--bg); padding: .05rem .3rem; border-radius: 3px; font-size: .88em; }
a { color: var(--polimi); }

.notice, .banner {
  border-radius: var(--radius);
  padding: .8rem 1rem;
  font-size: .89rem;
  margin-bottom: 1.1rem;
  border: 1px solid;
}
.notice { background: #fff; border-color: var(--line); color: var(--muted); }
.banner.draft { background: var(--warn-bg); border-color: #e5c97a; color: var(--warn); margin: .4rem 0 0; }

/* Outcomes ----------------------------------------------------------- */

.summary {
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1.1rem;
  border: 1px solid;
  font-weight: 600;
}
.summary.ok   { background: var(--pass-bg); border-color: #a8d8b9; color: var(--pass); }
.summary.bad  { background: var(--fail-bg); border-color: #eab6b2; color: var(--fail); }

.totals { display: flex; gap: 1.4rem; flex-wrap: wrap; margin-top: .5rem; font-weight: 400; font-size: .9rem; color: var(--ink); }
.totals span strong { display: block; font-size: 1.15rem; }

button.export {
  background: #fff;
  color: var(--polimi);
  border-color: var(--polimi);
  padding: .4rem .8rem;
  margin: 0 0 1.1rem;
  font-size: .86rem;
  font-weight: 500;
}

ul.rules { list-style: none; padding: 0; margin: 0; }
ul.rules li {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 4px;
  padding: .65rem .85rem;
  margin-bottom: .55rem;
  background: #fff;
}
ul.rules li.pass    { border-left-color: var(--pass); background: var(--pass-bg); }
ul.rules li.fail    { border-left-color: var(--fail); background: var(--fail-bg); }
ul.rules li.skip    { border-left-color: var(--line); opacity: .65; }
ul.rules li.unknown { border-left-color: var(--warn); background: var(--warn-bg); }
ul.rules li.conditional { border-left-color: var(--warn); background: var(--warn-bg); }

.rule-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.rule-msg { flex: 1; }
.rule-val { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; white-space: nowrap; }
.rule-meta { font-size: .8rem; color: var(--muted); margin-top: .3rem; }

.rule-badge {
  display: inline-block;
  font-size: .72rem; font-weight: 700; letter-spacing: .03em;
  padding: .1rem .45rem; border-radius: 999px; white-space: nowrap;
  margin-right: .5rem;
}
.pass    .rule-badge { background: var(--pass); color: #fff; }
.fail    .rule-badge { background: var(--fail); color: #fff; }
.conditional .rule-badge,
.unknown .rule-badge { background: var(--warn); color: #fff; }
.skip    .rule-badge { background: var(--line); color: var(--muted); }

table.parsing { width: 100%; border-collapse: collapse; font-size: .86rem; margin-top: .5rem; }
table.parsing th, table.parsing td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); }
table.parsing th { color: var(--muted); font-weight: 500; }

details { margin-top: .9rem; }
summary { cursor: pointer; font-size: .9rem; font-weight: 500; }

footer { max-width: 780px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; font-size: .84rem; color: var(--muted); }

@media (max-width: 560px) {
  .row label { min-width: 100%; }
  .rule-head { flex-direction: column; gap: .2rem; }
  .rule-val { white-space: normal; }
}
