/* ============================================================
   Tax LIFO Admin — UI v2 (dark first, light optional)
   ============================================================ */

:root {
  /* dark theme defaults */
  --bg:        #0d1117;
  --bg-soft:   #11161d;
  --surface:   #161b22;
  --surface-2: #1c232c;
  --line:      #30363d;
  --line-soft: #21262d;
  --ink:       #e6edf3;
  --ink-soft:  #adbac7;
  --muted:     #768390;
  --accent:    #2f81f7;
  --accent-2:  #58a6ff;
  --positive:  #3fb950;
  --negative:  #f85149;
  --warning:   #d29922;
  --info:      #6e7681;
  --shadow:    0 1px 0 rgba(255,255,255,0.04), 0 6px 18px rgba(0,0,0,0.5);
  --shadow-soft: 0 1px 0 rgba(255,255,255,0.03), 0 2px 8px rgba(0,0,0,0.35);
  --radius:    10px;
  --radius-sm: 6px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg:        #f6f8fa;
  --bg-soft:   #eef1f5;
  --surface:   #ffffff;
  --surface-2: #f6f8fa;
  --line:      #d0d7de;
  --line-soft: #e6ebf0;
  --ink:       #1f2328;
  --ink-soft:  #424a53;
  --muted:     #59636e;
  --accent:    #0969da;
  --accent-2:  #218bff;
  --positive:  #1a7f37;
  --negative:  #cf222e;
  --warning:   #9a6700;
  --info:      #59636e;
  --shadow:    0 1px 0 rgba(0,0,0,0.04), 0 6px 18px rgba(140,149,159,0.16);
  --shadow-soft: 0 1px 0 rgba(0,0,0,0.03), 0 2px 8px rgba(140,149,159,0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "SF Pro Text", "Inter", "Roboto", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

/* ============== Topbar ============== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(22,27,34,0.96), rgba(22,27,34,0.92));
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
[data-theme="light"] .topbar {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.95));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 10px; height: 10px;
  border-radius: 999px;
  background: var(--positive);
  box-shadow: 0 0 0 3px rgba(63,185,80,0.18);
}
nav.main {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}
nav.main a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
nav.main a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
nav.main a.active { color: var(--ink); background: var(--surface-2); }
.topbar .right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.theme-toggle {
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--accent); }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.live-pill .pulse {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--positive);
  animation: pulse 1.6s ease-out infinite;
}
.live-pill.error .pulse { background: var(--negative); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(63,185,80,0.55); }
  70% { box-shadow: 0 0 0 10px rgba(63,185,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(63,185,80,0); }
}

/* ============== Page ============== */
.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}
h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 4px 0 18px;
  letter-spacing: -0.2px;
}
h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--ink);
}
.muted, p.muted { color: var(--muted); font-size: 13px; }

/* ============== KPI cards ============== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s, border-color 0.15s;
}
.kpi:hover { transform: translateY(-1px); border-color: var(--accent); }
.kpi .label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.kpi .value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.kpi .value .unit { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* ============== Charts ============== */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  box-shadow: var(--shadow-soft);
}
.chart-card.wide { grid-column: 1 / -1; }
.chart-card .title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chart-card .title .meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.chart-card .chart-wrap {
  position: relative;
  height: 220px;
}
.chart-card.tall .chart-wrap { height: 320px; }
.chart-card .empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
}

/* ============== Sections / Cards ============== */
section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-soft);
}
section.flush { padding: 0; overflow: hidden; }
section.flush h2 { padding: 14px 16px 0; margin-top: 0; }
section.flush table { border: 0; border-radius: 0; }

.narrow {
  max-width: 480px;
  margin: 30px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.narrow h1 { margin-top: 0; }

/* ============== Tables ============== */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
}
section.flush table { border: 0; border-radius: 0; }
thead th {
  background: var(--surface-2);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  text-align: right;
}
thead th:first-child { text-align: left; }
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  vertical-align: middle;
}
tbody td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.live-updated { background: rgba(47,129,247,0.08); transition: background 0.3s; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.symbol { font-weight: 600; color: var(--ink); }
.regime, .badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.regime[data-regime="ALTA_VOLATILITA"] { background: rgba(210,153,34,0.12); color: var(--warning); border-color: rgba(210,153,34,0.32); }
.regime[data-regime="RANGE"] { background: rgba(47,129,247,0.10); color: var(--accent-2); border-color: rgba(47,129,247,0.30); }
.regime[data-regime="TREND_RIALZISTA"] { background: rgba(63,185,80,0.10); color: var(--positive); border-color: rgba(63,185,80,0.30); }
.regime[data-regime="TREND_RIBASSISTA"] { background: rgba(248,81,73,0.10); color: var(--negative); border-color: rgba(248,81,73,0.30); }
.regime[data-regime="DUMP_PERICOLOSO"] { background: rgba(248,81,73,0.18); color: var(--negative); border-color: var(--negative); }
.regime[data-regime="MERCATO_PIATTO"] { background: var(--surface-2); color: var(--muted); border-color: var(--line); }

.badge.success { background: rgba(63,185,80,0.12); color: var(--positive); border-color: rgba(63,185,80,0.30); }
.badge.danger  { background: rgba(248,81,73,0.12); color: var(--negative); border-color: rgba(248,81,73,0.30); }
.badge.warn    { background: rgba(210,153,34,0.12); color: var(--warning);  border-color: rgba(210,153,34,0.30); }
.badge.info    { background: rgba(47,129,247,0.10); color: var(--accent-2); border-color: rgba(47,129,247,0.30); }

.positive { color: var(--positive); font-weight: 600; }
.negative { color: var(--negative); font-weight: 600; }

/* ============== Forms ============== */
.form, .filters {
  display: grid;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.form.wide {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
}
input, textarea, select, button {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47,129,247,0.20);
}
button {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  padding: 10px 18px;
}
button:hover { background: var(--accent-2); border-color: var(--accent-2); }
button.secondary { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
button.secondary:hover { background: var(--surface); border-color: var(--accent); }
button.danger { background: var(--negative); border-color: var(--negative); }

/* ============== Alerts ============== */
.alert {
  background: rgba(210,153,34,0.10);
  color: var(--warning);
  border: 1px solid rgba(210,153,34,0.32);
  border-left: 3px solid var(--warning);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 13px;
}
.error { color: var(--negative); margin: 8px 0; font-size: 13px; }
.info  { color: var(--accent-2); margin: 8px 0; font-size: 13px; }

/* ============== Stats grid (legacy) ============== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stats .metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}
.stats .metric span { display: block; color: var(--muted); font-size: 11px; letter-spacing: 0.6px; text-transform: uppercase; }
.stats .metric strong { font-size: 20px; font-weight: 700; }

/* ============== Misc ============== */
.muted-row td { color: var(--muted); font-style: italic; }
.spacer { height: 12px; }
.hr { height: 1px; background: var(--line); margin: 18px 0; border: 0; }

.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.detail-grid .kv {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.detail-grid .kv .k { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-grid .kv .v { font-size: 14px; font-weight: 600; }

pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow: auto;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ============== Hamburger button (mobile) ============== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px; height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  gap: 4px;
  margin-left: auto;
  transition: all 0.15s;
}
.hamburger:hover { border-color: var(--accent); }
.hamburger span {
  display: block;
  width: 18px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.hamburger.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============== Dropdown nav (Manuale) ============== */
nav.main details.dropdown {
  position: relative;
  display: inline-block;
}
nav.main details.dropdown summary {
  list-style: none;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  white-space: nowrap;
  user-select: none;
}
nav.main details.dropdown summary::-webkit-details-marker { display: none; }
nav.main details.dropdown summary:hover { color: var(--ink); background: var(--surface-2); }
nav.main details[open] summary { color: var(--ink); background: var(--surface-2); }
nav.main .dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
nav.main .dropdown-menu a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
}
nav.main .dropdown-menu a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }


/* ============== Phase 2 lab tables ============== */
/* 2026-05-12 22:12 Europe/Rome - precedente: Ultimi trade/segnali usavano .chart-grid generico e potevano sovrapporsi con tabelle larghe */
.phase2-tables-grid {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
/* 2026-05-12 22:12 Europe/Rome - precedente: card senza min-width/overflow dedicati nella dashboard Fase 2 */
.phase2-table-card {
  min-width: 0;
  overflow: hidden;
}
/* 2026-05-12 22:12 Europe/Rome - precedente: tabelle Fase 2 senza wrapper scrollabile */
.phase2-table-scroll {
  width: 100%;
  overflow-x: auto;
}
/* 2026-05-12 22:12 Europe/Rome - precedente: tabella larga poteva uscire dalla card */
.phase2-table-scroll table {
  min-width: 820px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}


/* 2026-05-12 22:20 Europe/Rome - precedente: a >=1180px le tabelle Fase 2 potevano andare su due colonne; ora trade e segnali sono sempre full-width */
.phase2-tables-stack {
  grid-template-columns: minmax(0, 1fr);
}
/* 2026-05-12 22:20 Europe/Rome - precedente: le card Fase 2 non forzavano l'occupazione dell'intera riga */
.phase2-tables-stack .phase2-table-card {
  grid-column: 1 / -1;
}


/* ============== Mobile overflow fix ============== */
/* 2026-05-13 15:10 Europe/Rome - precedente: nessun wrapper globale; tabelle e contenitori larghi potevano uscire dallo schermo mobile senza scroll */
.page,
section,
.chart-card,
.kpi,
.detail-grid,
.chart-grid {
  min-width: 0;
}

/* 2026-05-13 15:10 Europe/Rome - precedente: section.flush usava overflow hidden e le tabelle non avevano un'area scroll dedicata */
.table-scroll,
.phase2-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
}

/* 2026-05-13 15:10 Europe/Rome - precedente: table width 100% provava a comprimere colonne numeriche invece di mantenere lettura orizzontale */
.table-scroll > table {
  width: max-content;
  min-width: 100%;
}

/* 2026-05-13 15:10 Europe/Rome - precedente: celle tabella potevano andare a capo rendendo il report illeggibile su display stretto */
.table-scroll th,
.table-scroll td,
.phase2-table-scroll th,
.phase2-table-scroll td {
  white-space: nowrap;
}

/* 2026-05-13 15:10 Europe/Rome - precedente: le card con tabelle a padding 0 non lasciavano un bordo visibile allo scroll mobile */
.chart-card > .table-scroll,
section.flush > .table-scroll {
  border-top: 1px solid var(--line-soft);
}

/* 2026-05-13 15:10 Europe/Rome - precedente: scrollbar poco percepibile in tema dark su mobile/desktop */
.table-scroll::-webkit-scrollbar,
.phase2-table-scroll::-webkit-scrollbar {
  height: 10px;
}
.table-scroll::-webkit-scrollbar-thumb,
.phase2-table-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}
.table-scroll::-webkit-scrollbar-track,
.phase2-table-scroll::-webkit-scrollbar-track {
  background: var(--surface-2);
}

/* 2026-05-13 15:10 Europe/Rome - precedente: KPI con testi lunghi potevano forzare larghezza superiore al viewport */
.kpi .value,
.kpi .sub,
.bot-pnl-line {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* 2026-05-13 15:10 Europe/Rome - precedente: chart grid con minmax 420px poteva creare overflow tra tablet stretto e mobile */
.chart-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
}

@media (max-width: 768px) {
  /* 2026-05-13 15:10 Europe/Rome - precedente: repeat(2, 1fr) non proteggeva da contenuti KPI larghi */
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 2026-05-13 15:10 Europe/Rome - precedente: contenitori chart/card potevano mantenere larghezze interne non scrollabili */
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-card { overflow: hidden; }
  /* 2026-05-13 15:10 Europe/Rome - precedente: tabelle su mobile senza larghezza minima leggibile */
  .table-scroll > table { min-width: 720px; }
}

@media (max-width: 420px) {
  /* 2026-05-13 15:10 Europe/Rome - precedente: sotto 420px due KPI affiancati erano troppo compressi */
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ============== Responsive ============== */
@media (max-width: 768px) {
  .topbar { gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
  .brand { font-size: 14px; }
  .page { padding: 14px; }
  h1 { font-size: 20px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi .value { font-size: 18px; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-card .chart-wrap { height: 240px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 8px 10px; }

  /* Mobile nav drawer */
  .hamburger { display: flex; }
  nav.main {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    z-index: 49;
    flex: none;
  }
  nav.main.open { display: flex; }
  nav.main a {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    border: 1px solid transparent;
  }
  nav.main a:hover { border-color: var(--line); }

  /* Dropdown si comporta come accordion full-width */
  nav.main details.dropdown { display: block; }
  nav.main details.dropdown summary { padding: 10px 12px; font-size: 14px; }
  nav.main .dropdown-menu {
    position: static;
    border: 0;
    box-shadow: none;
    padding: 4px 0 4px 16px;
    background: transparent;
  }
  nav.main .dropdown-menu a { padding: 8px 12px; font-size: 13px; }

  /* Right toolbar resta visibile a destra */
  .topbar .right { margin-left: 0; gap: 6px; }
  .live-pill { font-size: 11px; padding: 3px 8px; }
  .theme-toggle { padding: 5px 8px; font-size: 12px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar .right .live-pill { display: none; }
}

/* ============== Final mobile overrides ============== */
/* 2026-05-13 15:17 Europe/Rome - precedente: il blocco responsive storico sotto poteva sovrascrivere minmax(0,1fr) sui KPI */
@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-card { min-width: 0; overflow: hidden; }
  .table-scroll > table { min-width: 720px; }
}

/* 2026-05-13 15:17 Europe/Rome - precedente: il blocco max-width 480px non copriva display molto stretti con testi KPI lunghi */
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ============== Kimi decisions compact table ============== */
/* 2026-05-13 15:22 Europe/Rome - precedente: Ultime decisioni IA usava la larghezza phase2 generica e Motivo creava troppo spazio dopo Rischio */
.kimi-decisions-table {
  min-width: 680px;
}

/* 2026-05-13 15:22 Europe/Rome - precedente: Rischio/API si espandevano nella tabella; ora restano colonne compatte */
.kimi-decisions-table th:nth-child(8),
.kimi-decisions-table td:nth-child(8),
.kimi-decisions-table th:nth-child(9),
.kimi-decisions-table td:nth-child(9) {
  width: 1%;
  max-width: 110px;
}

/* 2026-05-13 15:22 Europe/Rome - precedente: testo rischio lungo poteva allargare tutta la tabella */
.kimi-decisions-table .risk-cell {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  /* 2026-05-13 15:22 Europe/Rome - precedente: tabella decisioni IA ereditava min-width 720px anche dopo la rimozione Motivo */
  .table-scroll > .kimi-decisions-table,
  .phase2-table-scroll > .kimi-decisions-table {
    min-width: 640px;
  }
}

