@font-face {
  font-family: "Hubot Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/hubot-sans-v5-latin-regular.aaa55cc49fcc.woff2") format("woff2");
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/instrument-sans-v4-latin-regular.c178fc5e2d41.woff2") format("woff2");
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/instrument-sans-v4-latin-500.552cbb998bb6.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --gcp-orange: #e8862d;
  --gcp-orange-dark: #8a3f00;
  --gcp-ink: #111111;
  --gcp-charcoal: #555555;
  --gcp-grey: #777777;
  --gcp-border: #d0d0d0;
  --gcp-panel: #f5f5f5;
  --gcp-soft: #ededed;
  --gcp-white: #ffffff;
  --gcp-danger: #b42318;
  --gcp-success: #176b55;
  --gcp-warning: #8a5d00;
  --highlight: rgba(250, 204, 21, 0.46);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--gcp-panel);
  color: var(--gcp-ink);
  font-family: "Instrument Sans", Arial, sans-serif;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }

a { color: inherit; }

.brand-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px clamp(18px, 4vw, 56px);
  background: var(--gcp-orange);
  border-bottom: 1px solid rgba(17, 17, 17, 0.12);
}

.brand-logo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  width: 206px;
  height: auto;
}

.brand-logo img { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }

.header-title { min-width: 0; color: var(--gcp-ink); }
.header-title h1 { margin: 0; font: 400 20px/1.2 "Hubot Sans", Arial, sans-serif; }
.header-title p { margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(17, 17, 17, 0.7); font-size: 13px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.header-actions form { margin: 0; }

.action,
.primary-action,
.secondary-action {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.primary-action { border: 2px solid var(--gcp-orange); background: var(--gcp-orange); color: var(--gcp-ink); }
.primary-action:hover { background: var(--gcp-white); color: var(--gcp-orange-dark); }
.primary-action[aria-disabled="true"] { background: var(--gcp-soft); border-color: var(--gcp-border); color: var(--gcp-charcoal); cursor: not-allowed; }
.secondary-action { border-color: rgba(17, 17, 17, 0.32); background: var(--gcp-white); color: var(--gcp-ink); }
.secondary-action:hover { border-color: var(--gcp-ink); }
.action:focus-visible, .primary-action:focus-visible, .secondary-action:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(232, 134, 45, 0.3); outline-offset: 2px; }

.app-shell { max-width: 1440px; margin: 0 auto; padding: 30px clamp(18px, 4vw, 56px) 48px; }
.page-heading { margin-bottom: 22px; }
.page-heading h2 { margin: 0; font: 400 28px/1.2 "Hubot Sans", Arial, sans-serif; }
.page-heading p { margin: 7px 0 0; color: var(--gcp-grey); }

.dashboard-grid { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
.tool-panel { border: 1px solid var(--gcp-border); border-radius: 12px; background: var(--gcp-white); padding: 20px; }
.tool-panel h3 { margin: 0 0 16px; font-size: 17px; font-weight: 500; }
.tool-panel-wide { min-width: 0; padding: 0; overflow: hidden; }
.tool-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--gcp-border); }
.tool-panel-header h3 { margin: 0; }

.field-label { display: block; margin: 0 0 7px; font-weight: 500; }
.field-help { margin: 8px 0 0; color: var(--gcp-grey); font-size: 13px; line-height: 1.45; }
input[type="file"] { width: 100%; padding: 9px; border: 1px dashed var(--gcp-grey); border-radius: 6px; background: var(--gcp-white); }
.submit-action { width: 100%; margin-top: 18px; border: 0; background: var(--gcp-orange); color: var(--gcp-ink); }
.submit-action:hover { background: #f09a4d; }

.runs-table { width: 100%; border-collapse: collapse; }
.runs-table th, .runs-table td { padding: 12px 14px; border-bottom: 1px solid var(--gcp-border); text-align: left; vertical-align: top; font-size: 13px; }
.runs-table th { color: var(--gcp-grey); font-size: 11px; font-weight: 500; text-transform: uppercase; }
.filename { max-width: 260px; overflow-wrap: anywhere; }
/* Il processo espone stati, non percentuali: la barra resta indeterminata durante l'analisi. */
.run-progress-group { display: grid; gap: 10px; min-width: 120px; max-width: 200px; }
.run-progress-group .status { justify-self: start; }
.run-progress { height: 8px; overflow: hidden; border-radius: 999px; background: var(--gcp-soft); }
.run-progress span { display: block; height: 100%; border-radius: inherit; background: var(--gcp-orange); }
.run-progress.is-running span { width: 35%; animation: run-loading 1.6s ease-in-out infinite alternate; }
.run-progress.is-complete span { width: 100%; background: var(--gcp-success); }
@keyframes run-loading { from { transform: translateX(0); } to { transform: translateX(185%); } }
@media (prefers-reduced-motion: reduce) { .run-progress.is-running span { animation: none; margin-inline: auto; } }
.run-links { display: flex; flex-direction: column; gap: 8px; min-width: 155px; }
.run-links a { min-height: 42px; padding: 9px 14px; white-space: nowrap; }
.retention-note { margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--gcp-border); color: var(--gcp-charcoal); font-size: 13px; line-height: 1.5; }
.delete-run-form { margin-top: 10px; }
.delete-run { width: 100%; min-height: 42px; color: var(--gcp-danger); }
.delete-run:hover { border-color: var(--gcp-danger); background: #fff2f0; }
.history-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 16px; }
.status { display: inline-flex; min-width: 88px; justify-content: center; padding: 5px 8px; border-radius: 999px; background: #e3f3ed; color: var(--gcp-success); font-size: 11px; font-weight: 500; }
.status.failed { background: #fee4e2; color: var(--gcp-danger); }
.status.queued, .status.running { background: #fff1c7; color: var(--gcp-warning); }
.muted { color: var(--gcp-grey); }
.message { margin: 0 0 14px; padding: 10px 12px; border-left: 4px solid var(--gcp-success); background: #e9f5f1; color: var(--gcp-success); }
.message.error, .errors { border-color: var(--gcp-danger); color: var(--gcp-danger); }

.review-body { height: 100vh; overflow: hidden; }
.review-body .brand-header { height: 76px; }
.review-workspace { height: calc(100vh - 76px); min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(440px, 0.85fr); overflow: hidden; }
.document-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--gcp-border); background: #e9ebed; }
.viewer-toolbar { min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 18px; padding: 7px 14px; border-bottom: 1px solid var(--gcp-border); background: var(--gcp-white); }
.toolbar-group { display: flex; align-items: center; gap: 10px; }
.icon-button { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--gcp-border); border-radius: 5px; background: var(--gcp-white); color: var(--gcp-ink); font-size: 20px; cursor: pointer; }
.icon-button:disabled { opacity: 0.38; cursor: not-allowed; }
#page-label { min-width: 116px; text-align: center; color: var(--gcp-charcoal); font-size: 13px; }
.zoom-reset { width: 58px; height: 34px; padding: 0; border: 1px solid var(--gcp-border); border-radius: 5px; background: var(--gcp-white); color: var(--gcp-charcoal); font-size: 12px; cursor: pointer; }
.page-stage { flex: 1; min-height: 0; display: flex; overflow: auto; padding: 16px; }
.page-frame { position: relative; flex: 0 0 auto; width: min(100%, 920px); margin: auto; background: var(--gcp-white); box-shadow: 0 3px 16px rgba(17, 17, 17, 0.16); line-height: 0; }
#pdf-canvas { display: block; width: 100%; height: auto; }
#highlights { position: absolute; inset: 0; pointer-events: none; }
.highlight { position: absolute; border-radius: 2px; outline: 2px solid rgba(202, 138, 4, 0.82); background: var(--highlight); }

.review-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--gcp-white); }
.review-tabs { flex: 0 0 auto; min-height: 50px; display: flex; align-items: stretch; gap: 6px; padding: 0 16px; border-bottom: 1px solid var(--gcp-border); }
.review-tab { border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--gcp-grey); font-weight: 500; cursor: pointer; }
.review-tab.active { border-color: var(--gcp-orange); color: var(--gcp-ink); }
.sort-control { display: flex; align-items: center; margin-left: auto; }
.sort-control button { min-height: 30px; padding: 5px 9px; border: 1px solid var(--gcp-border); background: var(--gcp-white); color: var(--gcp-grey); cursor: pointer; }
.sort-control button:first-child { border-radius: 5px 0 0 5px; }
.sort-control button:last-child { border-left: 0; border-radius: 0 5px 5px 0; }
.sort-control button[aria-pressed="true"] { background: var(--gcp-charcoal); color: var(--gcp-white); }
.add-entry { align-self: center; min-height: 30px; padding: 5px 9px; border: 1px solid var(--gcp-orange); border-radius: 5px; background: var(--gcp-orange); color: var(--gcp-ink); font-weight: 500; cursor: pointer; }
.save-state { align-self: center; color: var(--gcp-grey); font-size: 12px; }
.save-state.dirty { color: var(--gcp-warning); }
.save-state.saved { color: var(--gcp-success); }
#items { min-height: 0; flex: 1; overflow-y: auto; overflow-x: hidden; }
.review-item { --topic-color: #64748b; border-left: 4px solid var(--topic-color); border-bottom: 1px solid var(--gcp-border); background: var(--gcp-white); }
.review-item.active { background: #fff9f3; }
.item-summary { width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 14px 18px 12px 14px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.item-summary:hover { background: rgba(232, 134, 45, 0.07); }
.item-number { flex: 0 0 34px; color: var(--topic-color); font-size: 13px; font-weight: 500; }
.item-summary-text { min-width: 0; flex: 1; }
.item-title { display: block; font-weight: 500; line-height: 1.35; }
.item-topic { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: var(--gcp-grey); font-size: 12px; }
.topic-swatch { width: 8px; height: 8px; flex: 0 0 8px; background: var(--topic-color); }
.item-detail { display: none; padding: 2px 18px 18px 58px; }
.review-item.active .item-detail { display: block; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.editor-field { min-width: 0; }
.editor-field.full { grid-column: 1 / -1; }
.editor-field label { display: block; margin-bottom: 5px; color: var(--gcp-grey); font-size: 11px; font-weight: 500; text-transform: uppercase; }
.editor-field input, .editor-field select, .editor-field textarea { width: 100%; border: 1px solid var(--gcp-border); border-radius: 5px; background: var(--gcp-white); color: var(--gcp-ink); }
.editor-field input, .editor-field select { min-height: 36px; padding: 7px 9px; }
.editor-field textarea { min-height: 132px; resize: vertical; padding: 9px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.editor-actions { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
.save-item { min-height: 34px; padding: 6px 11px; border: 1px solid var(--gcp-orange); border-radius: 5px; background: var(--gcp-orange); color: var(--gcp-ink); font-weight: 500; cursor: pointer; }
.save-item:disabled { border-color: var(--gcp-border); background: var(--gcp-soft); color: var(--gcp-grey); cursor: default; }
.delete-item, .cancel-item { min-height: 34px; padding: 6px 11px; border: 1px solid var(--gcp-border); border-radius: 5px; background: var(--gcp-white); color: var(--gcp-charcoal); cursor: pointer; }
.delete-item { color: var(--gcp-danger); }
.item-feedback { color: var(--gcp-grey); font-size: 12px; }
.sources-label { margin: 14px 0 7px; color: var(--gcp-grey); font-size: 11px; font-weight: 500; text-transform: uppercase; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.source { padding: 5px 7px; border: 1px solid #a8b6c5; border-radius: 4px; background: var(--gcp-white); color: #294f75; font-size: 12px; font-weight: 500; cursor: pointer; }
.source[aria-pressed="true"] { border-color: #294f75; background: #294f75; color: var(--gcp-white); }
.evidence { flex: 0 0 auto; min-height: 74px; max-height: 20vh; overflow-y: auto; padding: 11px 18px; border-top: 1px solid var(--gcp-border); background: #fafafa; }
.evidence-label { color: var(--gcp-grey); font-size: 11px; font-weight: 500; text-transform: uppercase; }
#evidence-text { margin: 5px 0 0; color: var(--gcp-charcoal); font-size: 12px; line-height: 1.4; white-space: pre-wrap; }
.empty { padding: 24px; color: var(--gcp-grey); }

.login-body { min-height: 100vh; background: var(--gcp-white); }
.login-layout { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 32px 20px; }
.login-panel { width: min(440px, 100%); padding: 28px; border: 1px solid var(--gcp-border); border-top: 5px solid var(--gcp-orange); border-radius: 8px; background: var(--gcp-white); }
.login-panel h2 { margin: 0 0 10px; font: 400 26px/1.2 "Hubot Sans", Arial, sans-serif; }
.login-panel p { margin: 0; color: var(--gcp-charcoal); line-height: 1.5; }
.login-panel .primary-action { width: 100%; margin-top: 24px; }
.login-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.login-actions form { margin: 0; }
.login-actions .primary-action, .login-actions .secondary-action { width: 100%; margin: 0; }

/* Stessa cornice dell'hub; la revisione conserva lo spazio per il PDF. */
:root { --page-gutter: clamp(1.25rem, 5vw, 6rem); }
.hub-body { background: radial-gradient(circle at 100% 0%, rgba(232,134,45,.08), transparent 30rem), var(--gcp-white); color: var(--gcp-charcoal); line-height: 1.55; }
.hub-body .brand-header { min-height: clamp(5.25rem, 8svh, 6.25rem); padding: 0 max(var(--page-gutter), calc((100% - 1440px) / 2)); border: 0; }
.hub-body .brand-logo { width: auto; min-height: 4.25rem; padding: .65rem 1rem; border: 1px solid var(--gcp-border); border-radius: 10px; background: var(--gcp-white); box-shadow: 0 12px 30px rgba(17,17,17,.12); transform: translateY(50%); }
.hub-body .brand-logo img { width: min(11.5rem, 30vw); mix-blend-mode: normal; }
.hub-body .header-title { margin-left: auto; }
.hub-body .header-actions { margin-left: 0; }
.hub-body .app-shell { width: min(calc(100% - 2 * var(--page-gutter)), 1440px); padding: 0 0 3rem; }
.app-intro { padding-block: clamp(4.75rem, 8vh, 5.5rem) 2.5rem; }
.app-eyebrow { margin: 0 0 .5rem; color: var(--gcp-orange-dark); font-size: .78rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
.app-intro h1 { max-width: 980px; margin: 0 0 .75rem; color: var(--gcp-ink); font: 400 clamp(2.75rem, 6vw, 5.4rem)/1.02 "Hubot Sans", Arial, sans-serif; letter-spacing: -.025em; overflow-wrap: anywhere; text-wrap: balance; }
.app-intro h1::after { content: ""; display: block; width: 76px; height: 5px; margin-top: 1.25rem; border-radius: 999px; background: var(--gcp-orange); }
.app-lede { max-width: 760px; margin: 0; font-size: clamp(1.05rem, 1.6vw, 1.28rem); }
.hub-body .dashboard-grid { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 20px; }
.review-body .brand-logo { width: 100px; padding: 6px 10px; border-radius: 8px; background: var(--gcp-white); }
.review-body .brand-logo img { max-height: 52px; object-fit: contain; mix-blend-mode: normal; }
.review-body .header-actions .primary-action { background: var(--gcp-white); border-color: var(--gcp-white); }
.viewer-toolbar { flex-wrap: wrap; }
.skip-link { position: fixed; top: .75rem; left: .75rem; z-index: 100; padding: .65rem .9rem; border-radius: 8px; background: var(--gcp-ink); color: var(--gcp-white); transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }
@media (max-width: 980px) { .hub-body .dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  :root { --page-gutter: 1.25rem; }
  .hub-body .header-title { display: none; }
  .hub-body .brand-header { flex-wrap: nowrap; align-items: center; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

@media (max-width: 980px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .review-body { height: auto; overflow: auto; }
  .review-workspace { height: auto; min-height: calc(100vh - 76px); grid-template-columns: 1fr; overflow: visible; }
  .document-pane { height: 64vh; border-right: 0; border-bottom: 1px solid var(--gcp-border); }
  .review-pane { height: 72vh; }
}

@media (max-width: 680px) {
  .brand-header { align-items: flex-start; flex-wrap: wrap; gap: 9px 14px; }
  .brand-logo { width: 170px; }
  .header-title { order: 3; flex: 1 0 100%; }
  .header-actions { margin-left: auto; }
  .header-actions .secondary-action { padding-inline: 9px; }
  .header-actions .action-label { display: none; }
  .app-shell { padding-top: 20px; }
  .runs-table, .runs-table tbody, .runs-table tr, .runs-table td { display: block; width: 100%; }
  .runs-table thead { display: none; }
  .runs-table tr { padding: 12px 0; border-bottom: 1px solid var(--gcp-border); }
  .runs-table td { padding-block: 6px; border: 0; }
  .runs-table .filename { max-width: none; font-weight: 500; }
  .run-progress-group { max-width: none; }
  .run-links { margin-top: 8px; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-field.full { grid-column: auto; }
  .item-detail { padding-left: 18px; }
  .review-tabs { overflow-x: auto; padding-inline: 12px; }
  .review-tab, .sort-control button, .add-entry { flex: 0 0 auto; white-space: nowrap; }
  .add-entry { width: 34px; padding: 0; overflow: hidden; font-size: 0; }
  .add-entry::before { content: "+"; font-size: 20px; }
  .save-state { display: none; }
  .review-body .brand-header { height: auto; }
  .review-workspace { min-height: 100vh; }
}
