/* Portal.css - stili estratti da Portal.aspx */

      /* ===== Modal conferma salvataggio ===== */
.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15, 23, 42, 0.45);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.modal-box{
  width:min(900px, 96vw);
  max-height:90vh;
  overflow:auto;
  background:#fff;
  border-radius:14px;
  box-shadow:0 20px 60px rgba(0,0,0,.25);
  border:1px solid #e5e7eb;
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 18px;
  border-bottom:1px solid #e5e7eb;
}

.modal-title{
  font-size:18px;
  font-weight:700;
  color:#1f2937;
}

.modal-body{
  padding:16px 18px;
}

.modal-footer{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  padding:16px 18px;
  border-top:1px solid #e5e7eb;
  background:#fafbff;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.summary-card{
  border:1px solid var(--border);
  border-radius:10px;
  padding:10px 12px;
  background:#f8faff;
}

.summary-label{
  font-size:12px;
  color:#6b7280;
  margin-bottom:4px;
}

.summary-value{
  font-size:14px;
  font-weight:600;
  color:#111827;
  word-break:break-word;
}

.summary-preview{
  margin-top:12px;
}

.summary-preview table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}

.summary-preview th,
.summary-preview td{
  border:1px solid #e5e7eb;
  padding:6px 8px;
  text-align:left;
  vertical-align:top;
}

.summary-preview th{
  background:#f3f4f6;
  position:sticky;
  top:0;
}

.summary-note {
    margin-top: 10px;
    font-size: 12px;
    color: #6b7280;
}

:root {
    --bg: #f5f7fb;
    --card: #fff;
    --primary: #2f72ff;
    --accent: #43b581;
    --muted: #66738b;
    --border: #e6e9f2;
}

    html,body{height:100%}
    body{margin:0; background:var(--bg); font-family:Segoe UI, Arial, sans-serif; color:#1b2130}

.wrap {
    width: 80%;
    max-width: none;
    margin: 24px 0;
    padding: 0 12px;
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    align-items: start;
    box-sizing: border-box;
}

#appHeader,
#loginCard {
    grid-column: 1 / -1;
}

#fsMenu {
    grid-column: 1;
}

#secUpload,
#secOperators,
#secExcel,
#secImportBox {
    grid-column: 2;
}

#fsOutput {
    grid-column: 1 / -1 !important;
}

    .card{background:var(--card); border:1px solid var(--border); border-radius:12px; box-shadow:0 6px 24px rgba(0,0,0,.06)}
    .card-body{padding:18px}
    .hero{padding:16px 16px 0}
        .hero img.logo {
            width: 70%;
            max-height: 600px;
            object-fit: cover;
            border-radius: 8px;
            display: block;
            margin-left: auto;
            margin-right: auto;
        }
    .subtitle{margin:8px 0 0; font-weight:600; color:#7c859b; text-align:center; letter-spacing:.02em}
    fieldset{margin:16px 0; padding:12px; border:1px solid var(--border); border-radius:10px}
    legend{padding:0 6px; color:#4a5568; font-weight:600}
    label{display:block; font-size:13px; color:#5a647a; margin:12px 0 6px}
    input[type=text],input[type=password],input[type=file],select{
      width:100%; height:40px; padding:8px 10px; border:1px solid var(--border); border-radius:8px; outline:none;
      background:#fff; box-sizing:border-box;
    }
    textarea{width:100%; min-height:220px; font-family:Consolas, monospace; border:1px solid var(--border); border-radius:8px; padding:10px; box-sizing:border-box}
    .row{margin:10px 0}
    .btn{display:inline-block; border:0; border-radius:10px; padding:10px 16px; cursor:pointer; font-weight:600}
    .btn-primary{background:var(--primary); color:#fff}
    .btn-success{background:var(--accent); color:#fff}
    .btn-ghost{background:#eef2ff; color:#2f3c6e}
    .btn-danger{background:#dc3545; color:#fff}
    .btn + .btn{margin-left:8px}
    .hint{color:var(--muted); font-size:12px}
    .ok{color:#1e9b57; font-weight:600}
    .err{color:#c62828; font-weight:600}
    .hidden{display:none}
    /* tabelle Excel & ImportBox */
    #xlsArea table, #ibArea table{border-collapse:collapse; width:100%}
    #xlsArea th, #xlsArea td, #ibArea th, #ibArea td{border:1px solid var(--border); padding:6px}
    #xlsArea th, #ibArea th{background:#f7f8fc; position:sticky; top:0}

    /* --- Card Funzioni in evidenza --- */
#fsMenu.menu-card > legend{
    padding:3px 10px;
    border-radius:999px;
    background:#2563eb;    /* colore principale */
    color:#fff;
    font-size:12px;
    font-weight:600;
    letter-spacing:0.03em;
    text-transform:uppercase;
}

#fsMenu .menu-row {
    display: none;
}

#fsMenu .menu-select label{
    font-weight:600;
    color:#1f2937;
}

#funcSelect{
    font-size:14px;
    padding:10px 12px;
    border-radius:8px;
    border:1px solid #2563eb;
    background:#ffffff;
}

#fsMenu .menu-info{
  flex:2 1 260px;
  display:flex;
  gap:10px;
  align-items:flex-start;
}

#fsMenu .menu-icon{
  font-size:18px;
  margin-top:20px;
}

#funcSelect{
  font-size:14px;
  padding:10px 12px;
}

.func-desc{
  margin-top:18px;
  font-size:13px;
  line-height:1.4;
  color:var(--muted);

}
/* ----- Barra filtri Import Invoice / ImportBox ----- */
.filter-field{
  display:flex;
  flex-direction:column;
  min-width:160px;
}
.ib-multiselect-display{
  min-width:260px;
  min-height:40px;
  border:1px solid var(--border);
  border-radius:8px;
  background:#fff;
  padding:8px 10px;
  cursor:pointer;
  line-height:22px;
  box-sizing:border-box;
}

#btnLoadTable {
    display: none;
}

#priceDateNative {
    min-width: 160px;
    height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-sizing: border-box;
}

.ib-multiselect-display:after{
  content:'▼';
  float:right;
  font-size:11px;
  color:#666;
}

.ib-multiselect-panel{
  position:absolute;
  top:44px;
  left:0;
  width:320px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:8px;
  box-shadow:0 8px 24px rgba(0,0,0,.12);
  z-index:9999;
}

.ib-store-check{
  display:block;
  padding:4px 2px;
  cursor:pointer;
  border-radius:4px;
}

.ib-store-check:hover{
  background:#f5f7fb;
}

.filters-bar label{
  margin:0 0 4px;
  font-size:12px;
}

.filters-bar input,
.filters-bar select{
  min-width:160px;
}

#btnClearFilters{
  margin-left:auto;
}


/* --------- OUTPUT REVOLUTION --------- */

.output-card{
    margin-top:24px;
}

.output-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    margin-bottom:8px;
}

.output-status{
    padding:4px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:500;
    background:#f1f3f5;
    color:#555;
}

.output-status.status-ok{
    background:#d3f9d8;
    color:#2b8a3e;
}

.output-status.status-error{
    background:#ffe3e3;
    color:#c92a2a;
}

.output-actions .btn{
    font-size:12px;
    padding:4px 10px;
}

.output-tabs{
    display:inline-flex;
    border-radius:999px;
    background:#f1f3f5;
    padding:2px;
    margin-bottom:8px;
}

.out-tab-btn{
    border:none;
    background:transparent;
    padding:4px 12px;
    font-size:12px;
    border-radius:999px;
    cursor:pointer;
    white-space:nowrap;
}

.out-tab-btn.active{
    background:#ffffff;
    box-shadow:0 0 0 1px rgba(0,0,0,0.03);
}

.output-body{
    border-radius:10px;
    border:1px solid #e2e2e2;
    background:#0b1020;
    color:#f8f9fa;
    font-family:"SF Mono","Consolas","Courier New",monospace;
    font-size:12px;
    max-height:260px;
    overflow:auto;
    padding:10px 12px;
}

.out-tab{
    display:none;
}

.out-tab.out-tab-active{
    display:block;
}

#outRaw{
    white-space:pre;
}

#outLog{
    display:flex;
    flex-direction:column-reverse; /* ultime righe in alto */
    gap:4px;
}

.log-line{
    display:flex;
    gap:6px;
    align-items:flex-start;
}

.log-time{
    color:#868e96;
    font-size:11px;
    min-width:52px;
}

.log-context{
    font-size:11px;
    color:#91a7ff;
    border-radius:999px;
    border:1px solid rgba(145,167,255,0.4);
    padding:1px 6px;
}

.log-text{
    flex:1;
    word-break:break-word;
}

.log-error .log-text{
    color:#ffa8a8;
}

/* ===== Griglia ImportBox / Invoice ===== */

#ibArea{
  overflow:auto;
  max-height:420px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#ffffff;
}

/* tabella principale */
#ibArea table.ib-grid{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}

/* header */
#ibArea table.ib-grid thead{
  background:#f7f8fc;
  position:sticky;
  top:0;
  z-index:2;
}

#ibArea table.ib-grid th,
#ibArea table.ib-grid td{
  padding:6px 8px;
  border-bottom:1px solid #e2e6f2;
}

#ibArea table.ib-grid th{
  text-align:left;
  font-weight:600;
  color:#505a7b;
  white-space:nowrap;
}

/* zebra + hover */
#ibArea table.ib-grid tbody tr:nth-child(odd){
  background:#fbfcff;
}

#ibArea table.ib-grid tbody tr:hover{
  background:#eef2ff;
}

/* celle editabili */
#ibArea table.ib-grid td[contenteditable="true"]{
  cursor:text;
}

#ibArea table.ib-grid td[contenteditable="true"]:focus-visible{
  outline:2px solid rgba(47,114,255,0.6);
  outline-offset:-2px;
}

/* colonna checkbox */
.ib-col-select,
.ib-cell-select{
  width:40px;
  text-align:center;
}

/* riga selezionata */
.ib-row-selected{
  background:#e7f5ff !important;
}

/* meta info sopra griglia */
.ib-meta{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:11px;
  color:var(--muted);
  margin:6px 0 4px;
  gap:8px;
  flex-wrap:wrap;
}

.ib-badge{
  padding:2px 8px;
  border-radius:999px;
  background:#f1f3f5;
}

.ib-badge-strong{
  background:#edf2ff;
}
/* ===== Header in alto con logo piccolo ===== */

.app-header{
    position:sticky;
    top:0;
    z-index:50;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:10px 18px;
    margin-bottom:14px;
    background:#f8f9fc;
    border-radius:0 0 12px 12px;
    border-bottom:1px solid #e1e5f2;
    box-shadow:0 1px 4px rgba(15,23,42,0.04);
}

.app-header-left{
    display:flex;
    align-items:center;
    gap:10px;
}

.app-logo-small{
    height:32px;
    width:auto;
    border-radius:6px;
    object-fit:contain;
}

.app-header-text{
    display:flex;
    flex-direction:column;
}

.app-title{
    font-size:15px;
    font-weight:600;
    color:#1f2933;
}

.app-subtitle{
    font-size:11px;
    color:#6b7280;
}

.app-header-right{
    display:flex;
    align-items:center;
    gap:10px;
}

.app-user-label{
    font-size:12px;
    color:#4b5563;
}

/* se già usi .hidden {display:none;} va benissimo, altrimenti: */
.hidden{
    display:none !important;
}

.portal-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.left-menu {
    width: 100%;
    background: #ffffff;
    border: 1px solid #d9e1ee;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    padding: 12px;
}

.left-menu-title {
    font-size: 13px;
    font-weight: 700;
    color: #2f72ff;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.left-menu-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.left-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: #f6f8fc;
    color: #23324d;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
}

    .left-menu-item:hover {
        background: #eaf1ff;
    }

    .left-menu-item.active {
        background: #2f72ff;
        color: #fff;
        font-weight: 600;
    }

.portal-main {
    flex: 1;
    min-width: 0;
}

#funcSelect {
    display: none;
}

.portal-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.left-menu {
    width: 100%;
    background: #ffffff;
    border: 1px solid #d9e1ee;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    padding: 12px;
}

.left-menu-title {
    font-size: 13px;
    font-weight: 700;
    color: #2f72ff;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.left-menu-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.left-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: #f6f8fc;
    color: #23324d;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
}

    .left-menu-item:hover {
        background: #eaf1ff;
    }

    .left-menu-item.active {
        background: #2f72ff;
        color: #fff;
        font-weight: 600;
    }

.portal-main {
    flex: 1;
    min-width: 0;
}

#funcSelect {
    display: none;
}

.left-menu-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.left-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: #f6f8fc;
    color: #23324d;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
}

    .left-menu-item:hover {
        background: #eaf1ff;
    }

    .left-menu-item.active {
        background: #2f72ff;
        color: #fff;
        font-weight: 600;
    }
/* ===== COLORI SEZIONI - VERSIONE EVIDENTE ===== */

#fsMenu {
    grid-column: 1;
    width: 100%;
    box-sizing: border-box;
    background: #dbeafe !important;
    border: 2px solid #60a5fa !important;
    box-shadow: 0 0 0 3px rgba(96,165,250,.15) !important;
}

#secImportBox {
    background: #dcfce7 !important;
    border: 2px solid #4ade80 !important;
    box-shadow: 0 0 0 3px rgba(74,222,128,.15) !important;
}

#fsOutput {
    background: #ede9fe !important;
    border: 2px solid #8b5cf6 !important;
    box-shadow: 0 0 0 3px rgba(139,92,246,.15) !important;
}

#appHeader {
    background: #fff7ed !important;
    border: 2px solid #fb923c !important;
}
/* ===== UPGRADE BOTTONI ===== */

.btn {
    border-radius: 999px; /* pill */
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

    /* hover effetto */
    .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 14px rgba(0,0,0,0.12);
    }

/* blu (aggiungi riga ecc) */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

/* verde (salva) */
.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

/* rosso (elimina) */
.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

/* secondari */
.btn-ghost {
    background: #f1f5f9;
    color: #334155;
}

/* distanza tra bottoni */
.btn + .btn {
    margin-left: 10px;
}

/* ===== BOTTONI DISTINTI ===== */

/* aggiungi riga */
button[onclick*="ibAddRow"] {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

/* seleziona tutto */
button[onclick*="ibSelectAll"] {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
}

/* deseleziona tutto */
button[onclick*="ibDeselectAll"] {
    background: #e5e7eb;
    color: #374151;
}

/* elimina */
button[onclick*="ibDeleteRows"] {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

/* salva */
button[onclick*="ibSave"] {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
}

.ib-loader {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.ib-loader-box {
    background: #fff;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
}

.ib-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

.ib-loader-text {
    font-size: 13px;
    color: #374151;
}

.xls-loader{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.4);
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:99999;
}

.loader-box{
    background:#fff;
    padding:20px 30px;
    border-radius:12px;
    text-align:center;
    box-shadow:0 10px 30px rgba(0,0,0,.2);
}

.spinner{
    width:40px;
    height:40px;
    border:4px solid #ddd;
    border-top:4px solid #2f72ff;
    border-radius:50%;
    animation:spin 1s linear infinite;
    margin:0 auto 10px;
}

.loader-text{
    font-size:14px;
    font-weight:600;
    color:#333;
}

@keyframes spin{
    0%{ transform:rotate(0deg); }
    100%{ transform:rotate(360deg); }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

