/* Naulio look. --accent marks only what a person acts on, as a fill with dark grey on it; never
   text or a thin line on white. Status dots and soft fills stay grey: yellow means a warning. */

:root {
  color-scheme: light dark;
  --bar-full: 1280px; /* the top bar is full here: the air before the menu grows only past it */
  --ink: #26272B;
  --text: #393B41;
  --muted: #66686F;
  --page: #F6F6F7;
  --surface: #FFFFFF;
  --tint: #EFEFF1;
  --hover: #FAFAFB;
  --line: #E3E4E7;
  --line-strong: #CFD1D5;
  --focus: #26272B;
  --bar: #393B41;
  --on-bar: #FFFFFF;
  --bar-muted: #C9CBD0;
  --bar-line: #55575E;
  --bar-chip: #4A4C53;
  --accent: #FFB020;
  --accent-hover: #FFC34D;
  --on-accent: #393B41;
  --bad: #A4231B; --bad-soft: #FBEDEB; --bad-line: #F1D3CF;
  --warn: #8A5A00; --warn-soft: #FFF6E0; --warn-line: #F0E2BC;
  --shadow: rgba(20, 21, 24, .2);
  --radius: 10px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Zalando Sans Expanded", "IBM Plex Sans", system-ui, sans-serif;
  --semi: "Zalando Sans SemiExpanded", "Zalando Sans Expanded", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #FFFFFF;
    --text: #ECEDEF;
    --muted: #B4B6BD;
    --page: #26272B;
    --surface: #313338;
    --tint: #3F4147;
    --hover: #383A40;
    --line: #45474E;
    --line-strong: #5A5C63;
    --focus: #FFFFFF;
    --bar: #1E1F22;
    --bar-line: #3A3C42;
    --bar-chip: #3A3C42;
    --bad: #FF9A8F; --bad-soft: #3D2321; --bad-line: #6B3530;
    --warn: #F2D58A; --warn-soft: #3A3324; --warn-line: #5C4F2E;
    --shadow: rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--text); background: var(--page); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* No cap on the column: running text and form fields have their own. Up to --bar-full the gutters
   are a 1180 px column's, which keeps the chat button off the cards; past it they grow to 96 px. */
.wrap { width: 100%; padding-inline: clamp(28px, (100vw - var(--bar-full)) / 2 + 78px, 96px); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- header */
.topbar { background: var(--bar); color: var(--on-bar); }
.topbar .wrap { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-grid; grid-template-columns: auto auto; column-gap: 9px; align-items: center; color: var(--on-bar); text-decoration: none; padding: 9px 0; }
.brand .symbol { grid-row: span 2; width: 26px; height: 26px; }
.brand .name { font: 800 1.2rem/1 var(--display); }
.brand .by { font: 500 .66rem/1.2 var(--semi); color: var(--bar-muted); }
.symbol .stem { fill: currentColor; }
.symbol .cross { fill: var(--accent); }
.brand:hover .name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.workspace { font: 500 .8rem var(--mono); color: var(--bar-muted); padding-left: 14px; border-left: 1px solid var(--bar-line); margin-left: -10px; }
/* The menu stays one row: if the bar is short of room, the user's box moves under it. */
.mainnav { display: flex; gap: 20px; flex: 1; margin-left: clamp(0px, (100vw - var(--bar-full)) / 4, 64px); }
.mainnav a { white-space: nowrap; color: var(--bar-muted); text-decoration: none; padding: 19px 0 16px; border-bottom: 3px solid transparent; font-weight: 500; }
.mainnav a:hover { color: var(--on-bar); }
.mainnav a[aria-current="page"] { color: var(--on-bar); border-bottom-color: var(--accent); }
.mainnav .count { display: inline-block; min-width: 1.5em; margin-left: 4px; padding: 0 6px; border-radius: 9px; background: var(--bar-chip); color: var(--on-bar); font-size: .75rem; text-align: center; line-height: 1.5; }
.userbox { margin-left: auto; padding-block: 8px; display: flex; align-items: center; gap: 16px; font-size: .875rem; color: var(--bar-muted); }
.userbox strong { color: var(--on-bar); font-weight: 500; }
.userbox a { color: var(--bar-muted); }
.userbox a:hover { color: var(--on-bar); }
.userbox form { margin: 0; }
.linkbutton { background: none; border: 0; padding: 0; font: inherit; color: var(--bar-muted); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.linkbutton:hover { color: var(--on-bar); }

/* ---- page */
main.wrap { flex: 1; padding-top: 36px; padding-bottom: 72px; }
main.wrap > :first-child { margin-top: 0; }
h1 { font-family: var(--display); font-weight: 800; font-size: 1.65rem; letter-spacing: -.01em; line-height: 1.2; text-wrap: balance; margin: 0 0 6px; color: var(--ink); }
h2 { font-family: var(--display); font-size: 1rem; font-weight: 700; margin: 0 0 14px; color: var(--ink); }
h3 { font-size: .95rem; font-weight: 650; margin: 22px 0 10px; }
.lead { color: var(--muted); margin: 0 0 28px; max-width: 70ch; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.pagehead .lead { margin-bottom: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px; margin-bottom: 22px; }
.card > :last-child { margin-bottom: 0; }
section.card { overflow-x: auto; }
section.card { scroll-margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.hint { color: var(--muted); font-size: .875rem; max-width: 80ch; }

/* ---- messages */
.messages { list-style: none; padding: 0; margin: 0 0 24px; }
.messages li { padding: 11px 16px; border-radius: 8px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); }
.messages .success { border-left: 6px solid var(--muted); }
.messages .error { border-left-color: var(--bad); color: var(--bad); background: var(--bad-soft); border-color: var(--bad-line); }
.messages .warning { border-left-color: var(--warn); }
.notice { padding: 11px 16px; border-radius: 8px; margin: 0 0 16px; background: var(--page); border: 1px solid var(--line); }
.notice.bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }

/* ---- tables */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
thead th, tr.head th { font-family: var(--mono); font-size: .74rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom-color: var(--line-strong); white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
table.kv th { width: 30%; font-weight: 500; color: var(--muted); }
table.list tbody tr:hover td { background: var(--hover); }
table.list td a.code { font-family: var(--mono); font-weight: 500; text-decoration: none; color: var(--ink); font-variant-numeric: tabular-nums; }
table.list td a.code:hover { text-decoration: underline; }
/* The whole row opens the job: the code's link covers the row (no JavaScript). */
table.list, table.list tbody tr { position: relative; }
table.list td { -webkit-user-select: text; user-select: text; }
table.list a.rowlink::after { content: ""; position: absolute; inset: 0; }
table.list tbody tr:hover { cursor: pointer; }
table.list tbody tr:focus-within td { background: var(--tint); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
#dati table.kv th, #dati table.kv td { padding: 5px 12px; vertical-align: middle; }
#dati input[type=text], #dati input[type=date], #dati input[type=number], #dati select { padding: 5px 9px; }
tr.missing th, tr.missing td { background: var(--bad-soft); }
tr.low td { background: var(--warn-soft); }
.tablewrap { overflow-x: auto; margin: 0 -26px; padding: 0 26px; }

/* ---- labels: quiet. A dot says who has the next move, never a full colour. */
.status { display: inline-flex; align-items: center; gap: 7px; padding: 2px 10px 2px 9px; border-radius: 999px; background: var(--tint); color: var(--text); font-size: .8rem; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status.us::before { width: 9px; height: 9px; background: var(--text); }
.status.closed { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.status.closed::before { display: none; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--tint); color: var(--text); font-size: .8rem; font-weight: 500; }
.badge.ok { background: var(--tint); color: var(--text); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
/* A label beside text: the same pill as .badge, a step smaller than the text, on its baseline.
   .first when it starts the line (the reason follows it, after a space). */
.flag { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--tint); color: var(--text); font-family: var(--font); font-size: .78rem; font-weight: 500; line-height: 1.6; vertical-align: baseline; white-space: nowrap; margin-left: 6px; }
/* Inside a sentence (a reason, an outgoing email's row): the size of the text around it. */
.flag.first { margin: 0 3px 0 0; font-size: 1em; line-height: inherit; padding: 0 .55em; }
details.draft > summary .badge { font-size: 1em; padding: 0 .55em; margin-right: 3px; }
.flag.muted { color: var(--muted); }
.flag.missing, .flag.bad { background: var(--bad-soft); color: var(--bad); }
.flag.low { background: var(--warn-soft); color: var(--warn); }
.flag.ok { background: var(--tint); color: var(--text); }
tr.missing .flag, tr.low .flag { background: var(--surface); }
.why + .why { margin-top: 6px; }
/* The review form under a quote: fields and button stacked with even gaps. */
form.review { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 10px; }
form.review input[type=text] { max-width: 360px; }
.source { border-bottom: 1px dotted var(--muted); cursor: help; }

/* ---- forms and buttons */
button, input[type=submit], .button { display: inline-block; font: inherit; font-weight: 600; font-size: .9rem; line-height: 1.2; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
button:hover, input[type=submit]:hover, .button:hover { border-color: var(--ink); color: var(--ink); }
button.primary, input[type=submit], .button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover, input[type=submit]:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
button.quiet { background: transparent; }
input[type=text], input[type=search], input[type=date], input[type=number], input[type=password], select, textarea {
  font: inherit; color: var(--text); padding: 8px 10px; width: 100%; max-width: 440px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--ink); }
label { font-weight: 500; }
.errorlist { color: var(--bad); margin: 4px 0; padding-left: 18px; font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.actions form, .inline-form { display: flex; gap: 8px; align-items: center; margin: 0; flex-wrap: wrap; }
.actions input[type=text] { width: 220px; }
.stack > * + * { margin-top: 12px; }
.form-p p { margin: 0 0 16px; }
.form-p label { display: block; margin-bottom: 4px; }
.form-p ul { list-style: none; padding: 0; margin: 4px 0; }
.form-p ul label { font-weight: 400; display: flex; gap: 8px; align-items: baseline; }

/* ---- "Pratiche": the system's state, then the work queue. One row per thing to decide. */
.system { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 28px; padding: 11px 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: .92rem; }
.system .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.system .dot + span { flex: 1 1 320px; }
.system.working { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.system.working .dot { background: var(--warn); animation: pulse 1.4s ease-in-out infinite; }
.system.held { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.system.held .dot { background: var(--bad); }
.system .button { padding: 5px 12px; font-size: .85rem; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .system.working .dot { animation: none; } }
.queue { margin: 0 0 36px; }
.queue h2 { font-size: 1.1rem; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.count { display: inline-block; min-width: 1.6em; padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-family: var(--mono); font-size: .76rem; font-weight: 600; text-align: center; line-height: 1.6; }
.count.quiet { background: var(--tint); color: var(--text); }
.todo { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: var(--radius); }
.todo li { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 14px 22px; }
.todo li + li { border-top: 1px solid var(--line); }
.todo .what strong { display: block; font-size: 1.02rem; font-weight: 600; color: var(--ink); }
.todo .what .who, .todo .what .hint { display: block; font-size: .875rem; color: var(--muted); }
.todo .code, .waiting-list .code { font-family: var(--mono); font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.todo .button { padding: 9px 18px; white-space: nowrap; }
.empty-todo { margin: 0; padding: 18px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); max-width: 80ch; }
.waiting-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: .9rem; }
.waiting-list li { display: grid; grid-template-columns: 120px 1fr auto; gap: 14px; padding: 9px 18px; align-items: baseline; }
.waiting-list li + li { border-top: 1px solid var(--line); }
.waiting-list .code { text-decoration: none; }
.waiting-list .code:hover { text-decoration: underline; }
.waiting-list .line { color: var(--text); }
.waiting-list .whom { color: var(--muted); white-space: nowrap; }
h2.listhead { font-size: 1.1rem; margin: 0 0 12px; }

/* ---- filters */
.filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(4, minmax(130px, 1fr)) auto; gap: 12px; align-items: end; margin-bottom: 18px; }
.filters label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.filters input, .filters select { max-width: none; }
.filters .buttons { display: flex; gap: 8px; align-items: center; }
.resultline { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 10px; font-size: .875rem; color: var(--muted); }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 22px; font-size: .9rem; }
.empty { padding: 36px 0; text-align: center; color: var(--muted); }

/* ---- demo banner */
.demobar { background: var(--warn-soft); border-bottom: 1px solid var(--warn-line); color: var(--warn); font-size: .875rem; }
.demobar .wrap { padding-top: 8px; padding-bottom: 8px; }

/* ---- job page */
details.card { padding-top: 18px; padding-bottom: 18px; }
details.card > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "›"; display: inline-block; width: 1em; font-size: 1.3rem; line-height: 1; color: var(--muted); transition: transform .15s; }
details.card[open] > summary::before { transform: rotate(90deg); }
details.card > summary h2 { margin: 0; }
details.card[open] > summary { margin-bottom: 14px; }
dl.summary { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 14px 0 0; }
dl.summary div { display: flex; flex-direction: column; }
dl.summary dt { font-family: var(--mono); font-size: .7rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
dl.summary dd { margin: 0; font-weight: 500; color: var(--ink); }
details.draft.done > summary { color: var(--muted); }
form.archive { margin-top: 18px; }
.jobhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; margin-bottom: 22px; }
.jobhead .meta { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--muted); font-size: .9rem; margin-top: 8px; }
.jobhead .meta strong { color: var(--text); font-weight: 500; }
.nextstep { border: 1px solid var(--line-strong); border-left: 4px solid var(--line-strong); }
.nextstep.yours { border-left: 6px solid var(--accent); }
.nextstep .tag { font-family: var(--mono); font-size: .72rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nextstep.yours .tag { color: var(--ink); }
.nextstep p.text { font-size: 1.02rem; margin: 6px 0 14px; max-width: 78ch; color: var(--ink); }
.jobhead h1 .status { vertical-align: middle; font-family: var(--font); margin-left: 6px; }
.nextstep .back { margin: 14px 0 0; font-size: .875rem; }
.nextstep .closing textarea { width: 260px; resize: vertical; min-height: 38px; }
.nextstep .answers { margin: 0 0 14px; max-width: 78ch; }
.nextstep pre.body.answer { max-height: 12em; margin: 6px 0; }
/* The job as a story: numbered parts, what the system did as a checklist. */
h2.part { display: flex; align-items: center; gap: 10px; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 34px 0 12px; }
h2.part span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: var(--surface); font-size: .75rem; letter-spacing: 0; }
h2.part.now { color: var(--ink); }
h2.part.now span { background: var(--accent); color: var(--on-accent); }
.arrived p { margin: 0 0 6px; }
.arrived details { border: 0; padding: 4px 0 0; }
ol.story { list-style: none; margin: 0; padding: 0; }
ol.story li { position: relative; padding: 3px 0 3px 28px; }
ol.story li::before { content: "✓"; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--tint); color: var(--text); font-size: .72rem; font-weight: 700; display: grid; place-items: center; }
ol.story li.waiting::before { content: ""; background: var(--surface); border: 2px solid var(--warn); width: 14px; height: 14px; top: 5px; }
ol.story li.waiting > span:first-child { color: var(--warn); }
.note { color: var(--muted); font-size: .875rem; font-weight: 400; }
details.howto { border: 0; padding: 0; margin: 0 0 14px; font-size: .875rem; }
details.howto summary { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.people { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 16px; }
.people label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.people select { width: 240px; }
details.edit-draft { margin: 0 0 12px; }
details.edit-draft > summary { cursor: pointer; color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
details.edit-draft textarea { width: 100%; box-sizing: border-box; font: 13px/1.5 var(--mono); padding: 12px 14px; margin: 8px 0; }
pre.body { max-width: 100ch; white-space: pre-wrap; word-break: break-word; background: var(--page); padding: 14px 16px; border-radius: 8px; font: 13px/1.5 var(--mono); max-height: 40em; overflow: auto; margin: 12px 0; border: 1px solid var(--line); }
details:not(.card) { border-bottom: 1px solid var(--line); padding: 10px 0; }
details:not(.card):last-of-type { border-bottom: 0; }
details summary { cursor: pointer; }
details:not(.card)[open] > summary { margin-bottom: 6px; }
ol.timeline { list-style: none; padding: 0; margin: 0; }
ol.timeline > li { position: relative; border-left: 2px solid var(--line); padding: 2px 0 16px 18px; margin-left: 5px; }
ol.timeline > li::before { content: ""; position: absolute; left: -6px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
ol.timeline > li.email-in::before { border-color: var(--ink); }
ol.timeline > li.email-out::before { border-color: var(--text); background: var(--text); }
ol.timeline details { border: 0; padding: 4px 0 0; }
.when { color: var(--muted); font-family: var(--mono); font-size: .76rem; margin-right: 8px; font-variant-numeric: tabular-nums; }
dl.details { margin: 6px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; font-size: .875rem; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; }

/* ---- Come funziona */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 22px 52px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 34px; height: 34px; border-radius: 50%; background: var(--text); color: var(--surface); font-weight: 700; display: grid; place-items: center; }
.steps li strong { display: block; color: var(--ink); }
.steps .sys, .steps .who { font-weight: 600; color: var(--ink); }
.steps .sys { color: var(--ink); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; margin-bottom: 22px; }
.cols .card { margin: 0; }
ul.plain { padding-left: 18px; margin: 0; }
ul.plain li + li { margin-top: 6px; }

/* ---- Da smistare: each email with its button in sight */
.sortable { padding: 14px 0; border-bottom: 1px solid var(--line); }
.sortable:last-of-type { border-bottom: 0; }
.sorthead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.sortable .why { margin: 8px 0 4px; font-size: .9rem; }
.sortable form.actions { display: block; margin-top: 10px; }
.sortable form.actions .hint { margin: 0 0 8px; }
.sortable form.actions button + button { margin-left: 8px; }
.sortable details { border: 0; padding: 4px 0 0; font-size: .9rem; }
dl.glossary { margin: 0; display: grid; gap: 10px; }
dl.glossary dt { font-weight: 600; color: var(--ink); }
dl.glossary dd { margin: 0; color: var(--muted); }
.steps li, ul.plain li, dl.glossary dd, ol.story li, .arrived p, .sortable .why, .messages li { max-width: 90ch; }

/* ---- footer */
.foot { border-top: 1px solid var(--line); padding: 18px 0 22px; font-size: .8rem; color: var(--muted); }
.foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.byline { display: inline-flex; align-items: center; gap: 6px; font: 500 .8rem var(--semi); color: var(--text); white-space: nowrap; }
/* The Amplio Flow symbol in one colour, the text's, in both themes. */
.af-mark { display: inline-block; width: 13px; height: 16px; background: currentColor; -webkit-mask: url(amplioflow-mark.svg) center / contain no-repeat; mask: url(amplioflow-mark.svg) center / contain no-repeat; }

/* ---- login */
body.login { background: var(--bar); color: var(--on-bar); justify-content: center; align-items: center; padding: 24px; }
.loginbox { width: 100%; max-width: 380px; }
.loginbox .card { background: var(--surface); color: var(--text); border: 0; padding: 32px 32px 28px; }
.loginbox .brand { padding: 0; column-gap: 12px; row-gap: 6px; margin-bottom: 18px; }
.loginbox .brand .symbol { width: 40px; height: 40px; }
.loginbox .brand .name { font-size: 2.1rem; }
.loginbox .brand .by { font-size: .85rem; }
.loginbox .workspace { display: block; margin: 0 0 6px; padding: 0; border: 0; }
.loginbox .tagline { color: var(--bar-muted); margin: 0 0 26px; font-size: .9rem; }
.loginbox label { display: block; margin-bottom: 4px; font-size: .875rem; }
.loginbox input[type=text], .loginbox input[type=password] { max-width: none; margin-bottom: 16px; }
.loginbox input[type=submit] { width: 100%; padding: 11px 16px; margin-top: 6px; }

/* Below this the menu no longer fits beside the name and the user: it gets its own row. */
@media (max-width: 1240px) {
  .topbar .wrap { gap: 6px 16px; padding-top: 10px; padding-bottom: 6px; }
  .brand { flex: none; }
  .workspace { flex: 1; margin-left: 0; }
  .mainnav { order: 3; flex-basis: 100%; flex-wrap: wrap; gap: 2px 18px; }
  .mainnav a { padding: 6px 0; }
}

@media (max-width: 860px) {
  .wrap { padding-inline: 16px; }
  .userbox { gap: 10px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .search { grid-column: 1 / -1; }
  .card { padding: 18px 16px; }
  .tablewrap { margin: 0 -16px; padding: 0 16px; }
  table.list .hide-sm { display: none; }
  .todo li { grid-template-columns: 1fr; padding: 14px 16px; }
  .todo li .button { justify-self: start; }
  .waiting-list li { grid-template-columns: 1fr; gap: 2px; }
}

/* The assistant's chat (assistant/templates/assistant/_widget.html): a button bottom right, in
   the page's empty margin, that opens a compact chat; a bottom sheet on a phone. Without the
   script #assistente opens it (:target); with it, the .open class. */
.assistant-fab { position: fixed; right: 22px; bottom: 22px; z-index: 40; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--bar); color: var(--on-bar); box-shadow: 0 6px 20px var(--shadow); }
.assistant-fab .symbol { width: 30px; height: 30px; }
.assistant-fab:hover { transform: translateY(-1px); box-shadow: 0 8px 24px var(--shadow); }
.assistant-fab:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
/* On the edge of the circle, at its top right (45°). */
.assistant-fab.waiting::after { content: ""; position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--bar-muted); border: 2px solid var(--page); animation: pulse 1.4s ease-in-out infinite; }
.assistant-chat { display: none; position: fixed; right: 22px; bottom: 88px; z-index: 50; width: 380px; max-height: min(620px, calc(100vh - 112px)); flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 44px var(--shadow); overflow: hidden; }
/* The footer's right end sits under the button: keep it clear. */
body:has(> .assistant-fab) .foot { padding-bottom: 92px; }
.assistant-chat.open, .assistant-chat:not(.js):target { display: flex; }
.assistant-chat .chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; background: var(--bar); color: var(--on-bar); }
.assistant-chat .chat-head strong { display: block; font-size: .95rem; color: var(--on-bar); }
.assistant-chat .chat-head .context { display: block; font-size: .8rem; color: var(--bar-muted); }
.assistant-chat .chat-close { color: var(--on-bar); text-decoration: none; font-size: 1.5rem; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.assistant-chat .chat-close:hover { color: var(--on-bar); background: var(--bar-chip); }
.assistant-chat .chat-log { list-style: none; margin: 0; padding: 14px 16px 6px; overflow-y: auto; flex: 1 1 auto; display: flex; flex-direction: column; gap: 14px; background: var(--page); min-height: 72px; }
.assistant-chat .chat-head, .assistant-chat .refusal, .assistant-chat .ask, .assistant-chat .hint { flex: none; }
.assistant-chat .empty { color: var(--muted); font-size: .9rem; }
.assistant-chat .empty p { margin: 0; }
.assistant-chat .empty .scope { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--line); background: var(--surface); border-radius: 0 8px 8px 0; font-size: .85rem; text-align: left; }
.assistant-chat .turn { display: flex; flex-direction: column; gap: 6px; }
.assistant-chat .bubble { margin: 0; padding: 8px 12px; border-radius: 12px; max-width: 92%; overflow-wrap: anywhere; }
.assistant-chat .mine { align-self: flex-end; background: var(--bar); color: var(--on-bar); border-bottom-right-radius: 4px; font-weight: 500; }
.assistant-chat .mine .when { display: block; font-size: .72rem; color: var(--bar-muted); font-weight: 400; }
.assistant-chat .reply { align-self: flex-start; max-width: 100%; }
.assistant-chat .reply .bubble { max-width: 100%; }
.assistant-chat .answer { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; white-space: pre-line; }
.assistant-chat .noanswer { background: var(--bad-soft); color: var(--bad); border-bottom-left-radius: 4px; }
.assistant-chat .waiting .reply { padding: 9px 12px; border-radius: 12px; border-bottom-left-radius: 4px; background: var(--tint); }
.assistant-chat .pending { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--text); }
.assistant-chat .pending .elapsed { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.assistant-chat .slow { margin: 6px 0 0; color: var(--muted); font-size: .875rem; }
.assistant-chat .dots { display: inline-flex; gap: 4px; flex: none; }
.assistant-chat .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .35; }
.assistant-chat .waiting .dots i { animation: thinking 1.2s ease-in-out infinite; }
.assistant-chat .waiting .dots i:nth-child(2) { animation-delay: .2s; }
.assistant-chat .waiting .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes thinking { 0%, 80%, 100% { opacity: .35; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .assistant-chat .waiting .dots i { animation: none; opacity: 1; }
  .assistant-fab.waiting::after { animation: none; }
  .assistant-fab:hover { transform: none; }
}
.assistant-chat .elsewhere { margin: 0; padding: 8px 16px; background: var(--warn-soft); color: var(--warn); font-size: .875rem; flex: none; }
.assistant-chat .refusal { margin: 0; padding: 8px 16px; background: var(--bad-soft); color: var(--bad); font-size: .9rem; }
.assistant-chat .ask { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 4px; border-top: 1px solid var(--line); }
.assistant-chat .suggested { display: flex; flex-wrap: wrap; gap: 6px; }
.assistant-chat .suggested button { padding: 5px 10px; font-size: .8rem; font-weight: 500; }
.assistant-chat .own { display: flex; gap: 8px; align-items: flex-end; }
.assistant-chat .own textarea { flex: 1; resize: none; min-height: 44px; max-width: none; }
.assistant-chat .hint { margin: 0; padding: 4px 16px 12px; font-size: .78rem; color: var(--muted); }
.assistant-chat button:disabled, .assistant-chat textarea:disabled { opacity: .5; cursor: default; }
/* A short window (a phone on its side, a zoomed laptop): the form stays whole, the buttons go
   (the textarea was cut off at 390 px high). */
@media (max-height: 560px) {
  .assistant-chat { bottom: 12px; max-height: calc(100vh - 24px); }
  .assistant-chat .suggested, .assistant-chat .hint { display: none; }
  .assistant-chat .chat-log { min-height: 48px; }
}
@media (max-width: 640px) {
  .assistant-fab { right: 16px; bottom: 16px; }
  .assistant-chat { left: 0; right: 0; bottom: 0; width: 100%; max-height: 88vh; border-radius: 16px 16px 0 0; border-width: 1px 0 0; }
}

.notice.preview { background: var(--warn-soft); border-color: var(--warn-line); }
table.kv.new-job th, table.kv.new-job td { padding: 6px 12px; vertical-align: middle; }
table.kv.new-job input:not([type=checkbox]), table.kv.new-job select, table.kv.new-job textarea { width: 100%; max-width: 420px; box-sizing: border-box; }
table.kv.new-job .range { display: flex; align-items: center; gap: 8px; max-width: 420px; }
table.kv.new-job .range input { flex: 1; min-width: 0; }
table.kv.new-job .checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
table.kv.new-job .checks label { font-weight: 400; }
.new-job-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.new-job-actions button:disabled, .new-job-actions button:disabled:hover { opacity: .5; cursor: not-allowed; background: var(--accent); border-color: var(--accent); }
