body {
  font-family: "Segoe UI", sans-serif;
  background: #f7f8fa;
  margin: 0;
  padding: 0;
}

/* Selettori da cambiare */
/* .toolbar -> .qrb-toolbar */
/* .toolbar button -> .qrb-toolbar button */

.qrb-toolbar { /* Sostituisce .toolbar */
 background: #fff;
 padding: 10px;
 border-bottom: 1px solid #ccc;
 display: flex;
 gap: 4px; /* Riduci il gap per uniformità con i pulsanti specifici sotto */
 align-items: center;
 position: sticky;
 top: 0;
 flex-wrap: wrap; /* Aggiungi un wrap nel caso la barra sia troppo lunga */
}

/* Sostituisce .toolbar button */
.qrb-toolbar button {
  border: none;
  background: #f0f0f0; /* Manteniamo lo sfondo per i pulsanti di base */
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 6px;
  transition: 0.2s;
  font-size: 16px; /* Aggiunto per uniformità */
}
.qrb-toolbar button:hover { background: #ddd; }


/* Regole che hai già, ma che sovrascrivono (o dovrebbero sovrascrivere) quelle sopra */
/* Rimuovi la sezione inferiore duplicata e confusa (che aveva background: none;) e mantieni solo questa: */
/*
.qrb-toolbar button {
  border: none;
  background: none; <-- Rimuovi questo per usare lo stile sopra (con #f0f0f0)
  padding: 6px 8px;
  cursor: pointer;
  font-size: 16px;
}
.qrb-toolbar button:hover {
  background-color: #e0e0e0;
}
*/
#qrbEditor {
  background: #fff;
  width: 90%;
  margin: 20px auto;
  min-height: 350px;
  padding: 15px;
  border-radius: 10px;
  border: 1px solid #ccc;
  outline: none;
}

#qrbEditor table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
}
#qrbEditor td {
  border: 1px solid #bbb;
  padding: 8px;
  min-height: 30px;
}
#qrbEditor td:focus-within {
  outline: 2px solid #0078D7;
}

.save-btn { margin-left: auto; background: #0078D7; color: white; }

/* pannello AI */
.ai-panel {
  position: fixed;
  right: -400px;
  top: 0;
  width: 400px;
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 5px rgba(0,0,0,0.1);
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}
.ai-panel.open { right: 0; }
.ai-panel header {
  background: #0078D7;
  color: white;
  padding: 15px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ai-panel textarea {
  flex: 1;
  margin: 10px;
  padding: 10px;
  border: 1px solid #ccc;
  resize: none;
}
.ai-panel .response {
  padding: 10px;
  border-top: 1px solid #ccc;
  height: 150px;
  overflow-y: auto;
}
.qrb-toolbar button {
    border: none;
    background: none;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 16px;
}
.qrb-toolbar button:hover {
    background-color: #e0e0e0;
}
.qrb-toolbar input[type=color] {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    cursor: pointer;
}
.qrb-divider {
    display: inline-block;
    width: 1px;
    height: 24px;
    background-color: #ccc;
    margin: 0 6px;
}
.qrb-editor:focus {
    outline: 2px solid #4CAF50;
}
/* --- Popover e Color Pickers --- */

.qrb-popover {
    position: absolute;
    z-index: 1000;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 10px;
    border-radius: 6px;
    width: 220px;
    /* La posizione 'left' verrà calcolata dinamicamente dal JS */
}

.qrb-popover h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.qrb-popover hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 10px 0;
}

.qrb-popover label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    cursor: default;
}

.qrb-color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.qrb-popover input[type="color"] {
    width: 50px;
    height: 25px;
    padding: 0;
    border: none;
    cursor: pointer;
    background: transparent;
}

.qrb-color-btn {
    display: inline-block;
    width: 20px; /* leggermente più grandi */
    height: 20px;
    border: 1px solid #ccc;
    cursor: pointer;
    border-radius: 4px;
    transition: transform 0.1s, box-shadow 0.1s;
    line-height: 20px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: #333;
}

.qrb-color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
}

/* --- Menu contestuale per la tabella (Aggiunto in qrb_table.js) --- */
.qrb-table-menu {
    position: absolute;
    z-index: 999; /* Alto z-index per stare sopra l'editor */
    background: #444; /* Sfondo scuro */
    padding: 5px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    display: flex; /* Flex per allineare i pulsanti */
    align-items: center;
    gap: 8px;
    transform: translateY(-100%) translateY(-10px); /* Sposta sopra la tabella, con un piccolo margine */
}

.qrb-table-menu button {
    background: none;
    border: none;
    color: white;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.qrb-table-menu button:hover {
    background: #666;
}

.qrb-divider-menu {
    width: 1px;
    height: 20px;
    background-color: #666;
    margin: 0 4px;
}