/* Componenti delle singole pagine, costruiti sui token di trade.css */

/* ============================ LOGIN ============================ */
.loginBody { background: #0E3A2F; }
.containerLogin {
  position: relative; overflow: hidden;
  min-height: 100vh; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 32px 16px;
  background: #0E3A2F; color: #ffffff;
}
.loginBlob { position: absolute; border-radius: 50%; filter: blur(90px); pointer-events: none; }
.loginBlob1 { width: 560px; height: 560px; top: -180px; left: -120px; background: radial-gradient(circle, rgba(149,225,168,0.3) 0%, rgba(149,225,168,0) 70%); animation: auroraA 42s ease-in-out infinite; }
.loginBlob2 { width: 480px; height: 480px; bottom: -160px; right: -100px; background: radial-gradient(circle, rgba(52,148,121,0.4) 0%, rgba(52,148,121,0) 70%); animation: auroraB 52s ease-in-out infinite; }
.loginLogo { height: 50px; position: relative; }
.loginModule { position: relative; }
.loginCard {
  position: relative;
  width: min(400px, 100%);
  display: flex; flex-direction: column; gap: 14px;
  padding: 28px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 100%), #14342a;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
  --app-text: #ffffff; --input-bg: rgba(255,255,255,0.06); --input-border: rgba(255,255,255,0.16); --app-faint: rgba(255,255,255,0.55);
}
.loginTitle { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.loginSub { font-size: 12.5px; color: rgba(255,255,255,0.65); line-height: 1.5; margin-top: -6px; }
.loginBtn { margin-top: 6px; width: 100%; text-decoration: none; display: block; }
.loginMsg { font-size: 12.5px; font-weight: 600; padding: 10px 12px; border-radius: 10px; line-height: 1.4; }
.loginMsg.error { background: rgba(239,116,119,0.16); color: #ff9b9d; border: 1px solid rgba(239,116,119,0.35); }
.loginMsg.warn { background: rgba(246,200,112,0.14); color: #f6c870; border: 1px solid rgba(246,200,112,0.3); }
.loginFoot { position: relative; font-size: 11px; color: rgba(255,255,255,0.45); letter-spacing: 0.4px; }

/* ============================ AVVISI ============================ */
.setupCard, .noticeCard { flex-direction: row; align-items: flex-start; gap: 16px; border-color: rgba(246,200,112,0.35); }
.noticeCard { padding: 14px 18px; align-items: center; }
.setupIcon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: rgba(246,200,112,0.14); color: var(--warn); flex-shrink: 0; }
.warnIcon { width: 36px; height: 36px; }
.setupCard code { font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--app-surface); }
.filterNote { font-size: 12.5px; color: var(--app-muted); display: flex; align-items: center; gap: 10px; }
.narrowCard { max-width: 760px; }
.pageHero { padding: 24px 28px; }
.pageHero .hhGreet { font-size: 24px; }
.subTitle { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; color: var(--app-faint); }

/* ============================ DASHBOARD ============================ */
.metricGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.metricGrid .skelBox { min-height: 150px; }
.metricTile {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px 10px; border-radius: 12px;
  background: var(--surface-bg); border: 1px solid var(--surface-border);
  text-decoration: none; color: inherit; min-width: 0;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.metricTile:hover { background: var(--app-hover); border-color: rgba(149,225,168,0.3); transform: translateY(-1px); }
.mtTop { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 22px; }
.mtGroup { font-size: 10px; font-weight: 700; letter-spacing: 0.9px; text-transform: uppercase; color: var(--app-faint); }
.mtLabel { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.mtDot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(255,255,255,0.06); }
.mtValue { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.mtMeta { font-size: 11px; color: var(--app-faint); line-height: 1.4; min-height: 30px; }
.spark { width: 100%; height: 44px; display: block; }
.sparkEmpty { font-size: 11px; color: var(--app-faint); padding: 12px 0; }

.miniMap { height: 340px; border-radius: 12px; overflow: hidden; border: 1px solid var(--app-line); }
.mapEmpty { height: 100%; display: flex; align-items: center; justify-content: center; }
.legendRow { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.lgChip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--app-muted); }
.swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.sourceGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.srcRow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-bg); border: 1px solid var(--surface-border); min-width: 0; }
.srcMain { min-width: 0; }
.srcRight { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }

/* ============================ MAPPA ============================ */
.tmTiles { filter: var(--map-filter); }
.leaflet-container { background: #0c2620; font-family: inherit; }
.appLight .leaflet-container { background: #e8ebef; }
.leaflet-tooltip { font-family: inherit; font-size: 12px; border-radius: 8px; padding: 6px 9px; line-height: 1.45; }
.leaflet-control-zoom a { background: var(--popover-bg) !important; color: var(--app-text) !important; border-color: var(--app-line) !important; }
.leaflet-control-attribution { background: rgba(0,0,0,0.45) !important; color: rgba(255,255,255,0.75) !important; font-size: 10px; }
.leaflet-control-attribution a { color: #95e1a8 !important; }
.appLight .leaflet-control-attribution { background: rgba(255,255,255,0.8) !important; color: #0E3A2F !important; }
.appLight .leaflet-control-attribution a { color: #1a6b53 !important; }

.mapToolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.mapToolbar .chips { flex: 1; }
.mapSearch { position: relative; width: 260px; max-width: 100%; }
.mapSearch .input { width: 100%; }
.searchResults {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1200;
  background: var(--popover-bg); border: 1px solid var(--app-line); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.35); overflow: hidden;
}
.searchResults button { width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; background: transparent; border: none; text-align: left; cursor: pointer; font-size: 12.5px; }
.searchResults button span { font-size: 11px; color: var(--app-faint); }
.searchResults button:hover { background: var(--app-hover); }
.noHit { padding: 10px 12px; font-size: 12px; color: var(--app-faint); }

.mapLayout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.mapCol { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bigMap { height: 560px; border-radius: 12px; overflow: hidden; border: 1px solid var(--app-line); }
.detailCol {
  position: sticky; top: 0;
  max-height: 760px; overflow-y: auto;
  padding: 16px; border-radius: 12px;
  background: var(--surface-bg); border: 1px solid var(--surface-border);
  display: flex; flex-direction: column; gap: 12px;
}
.detailHint { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--app-faint); font-size: 12.5px; line-height: 1.5; padding: 40px 10px; }
.detTop { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.detName { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.25; word-break: break-word; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12px; }
.kv dt { color: var(--app-faint); font-weight: 600; }
.kv dd { font-weight: 600; word-break: break-word; }
.ser { padding: 12px 0 4px; border-top: 1px solid var(--app-line); display: flex; flex-direction: column; gap: 4px; }
.serTop { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.serName { font-size: 12.5px; font-weight: 700; }
.serVal { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.serAt { font-size: 11px; color: var(--app-faint); line-height: 1.4; }
.serLink { font-size: 11.5px; font-weight: 700; color: var(--app-accent); text-decoration: none; align-self: flex-end; }
.serLink:hover { text-decoration: underline; }

/* Ora e pulsanti sopra, cursore a tutta larghezza sotto: in colonna stretta il cursore restava di pochi pixel */
.timeline {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "when btns" "slider slider";
  gap: 10px 16px; align-items: center;
  padding: 12px 14px; border-radius: 12px; background: var(--surface-bg); border: 1px solid var(--surface-border);
}
.timeline .when { grid-area: when; }
.timeline .tlSlider { grid-area: slider; }
.timeline .tlButtons { grid-area: btns; }
.when { font-size: 15px; font-weight: 800; line-height: 1.2; }
.when small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--app-faint); margin-top: 3px; }
.tlSlider input[type=range] { width: 100%; accent-color: #78f9ad; cursor: pointer; }
.appLight .tlSlider input[type=range] { accent-color: #1a6b53; }
.ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--app-faint); margin-top: 2px; }
.tlButtons { display: flex; gap: 8px; }
.mapControls { justify-content: flex-start; }

.mapLegend {
  min-width: 170px; max-width: 260px;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(16, 36, 29, 0.9); color: #ffffff;
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 11.5px; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.appLight .mapLegend { background: rgba(255,255,255,0.95); color: #0E3A2F; border-color: rgba(14,58,47,0.16); }
.lgTitle { font-weight: 800; margin-bottom: 6px; }
.lgItem { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.scale { display: flex; height: 10px; border-radius: 5px; overflow: hidden; }
.scale span { flex: 1; }
.scaleL { display: flex; justify-content: space-between; gap: 4px; font-size: 9.5px; margin-top: 3px; opacity: 0.85; }
.lgNote { margin-top: 6px; font-size: 10.5px; opacity: 0.75; }

@media (max-width: 1180px) { .mapLayout { grid-template-columns: 1fr; } .detailCol { position: static; max-height: none; } }
@media (max-width: 720px) {
  .timeline { grid-template-columns: 1fr; grid-template-areas: "when" "slider" "btns"; }
  .bigMap { height: 420px; }
  .mapSearch { width: 100%; }
}

/* ============================ ANDAMENTI ============================ */
.chartBox { position: relative; height: 380px; }
.statsGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.statTile { padding: 12px 14px; border-radius: 12px; background: var(--surface-bg); border: 1px solid var(--surface-border); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.statHead { display: flex; align-items: center; gap: 8px; font-size: 12.5px; min-width: 0; }
.statHead b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statKv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12px; margin-top: 6px; }
.statKv dt { color: var(--app-faint); }
.statKv dd { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .chartBox { height: 300px; } }

/* ============================ SEGNALAZIONI ============================ */
.amGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 640px) { .amGrid { grid-template-columns: 1fr 1fr; } }
.amLinks { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.amActions { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--app-line); }
.timelineList { list-style: none; display: flex; flex-direction: column; gap: 0; margin-top: 8px; }
.tlItem { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 0 0 14px; font-size: 12.5px; }
.tlItem::before { content: ''; position: absolute; left: 5px; top: 14px; bottom: 0; width: 1px; background: var(--app-line); }
.tlItem:last-child::before { display: none; }
.tlDot { width: 11px; height: 11px; border-radius: 50%; margin-top: 3px; background: var(--app-muted); }
.tl-aperta .tlDot { background: #ef7477; }
.tl-in_carico .tlDot { background: #7fb4ff; }
.tl-chiusa .tlDot { background: #95e1a8; }
.tl-notifica .tlDot { background: #f6c870; }
.tlNote { margin-top: 4px; padding: 8px 10px; border-radius: 8px; background: var(--app-surface); white-space: pre-wrap; line-height: 1.45; }

/* ============================ FORM IN MODALE ============================ */
.formGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.formGrid .span2 { grid-column: span 2; }
@media (max-width: 560px) { .formGrid { grid-template-columns: 1fr; } .formGrid .span2 { grid-column: auto; } }

/* ============================ FONTI ============================ */
.hubUrl { font-size: 15px; word-break: break-all; }
.wrapErr { white-space: normal; max-width: 280px; font-size: 11px; margin-top: 4px; }
.repTable td.wrap .pill { margin: 2px 2px 2px 0; }
.repTable a { color: var(--app-accent); font-weight: 700; }
