body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: #f7f9fc;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top on smaller screens */
    min-height: 100vh; /* Ensure page fills screen height */
    padding: 20px; /* Consistent padding */
    font-size: 16px; /* Default font size, adjust as needed */
}

.container {
    background: #ffffff;
    padding: 1.5rem 2rem;
    border-radius: 16px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    max-width: 900px; 
    width: 80%;
}

h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.6rem;
    color: #2c3e50;
}
h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: #555;
    font-weight: 400;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* More columns on wider screens */
    gap: 1.5rem; /* Reduced gap */
    margin-bottom: 1.5rem;
}
.grid-commissions {
    display: grid;
    /* Adjust columns based on content within each section */
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
    align-items: end; /* Align items to the bottom for better checkbox alignment */
}
label {
    position: relative; /* Tooltip text positions relative to label */
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem; /* Smaller labels */
}
input[type="number"], input[type="checkbox"] {
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 0.9rem; /* Smaller input font */
    box-sizing: border-box; /* Include padding in width */
}
input[type="number"] {
    width: 100%;
}
input[type="checkbox"] {
    width: auto; /* Checkbox width */
    height: 1rem; /* Adjust checkbox size if needed */
    margin-right: 0.5rem;
    cursor: pointer;
    accent-color: #4f46e5; /* Color the checkmark */
    vertical-align: bottom; /* Align checkbox better with label */
    margin-bottom: 0.6rem; /* Align with input bottom */
}
input:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}
label.inline-label {
    display: inline-block; /* For checkbox label */
    font-weight: normal;
    margin-bottom: 0.6rem; /* Align with input bottom */
}
input[type="number"].commission-input {
    background-color: #f0f9ff; /* Light blue background for commission inputs */
}
button {
    padding: 0.7rem 1rem;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 1rem;
    margin-right: 0.5rem; /* Spacing between buttons */
}
button:hover {
    background: #4338ca;
}
button.secondary {
    background: #6c757d;
}
button.secondary:hover {
    background: #5a6268;
}
.results {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: 12px;
    background: #f1f5f9;
    font-size: 0.9rem; /* Smaller results font */
}
.results h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #333;
}
.results table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.results th, .results td {
    border: 1px solid #dde;
    padding: 0.6rem;
    text-align: right;
}
.results th {
    background-color: #e9ecef;
    text-align: left;
    font-weight: 600;
}
.results td:first-child {
    font-weight: 600;
    text-align: left;
}
hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 1.5rem 0;
}
.commission-panel {
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    background-color: #fafafa;
}
.commission-panel h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem; /* Slightly larger panel title */
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.75rem;
}
.commission-panel h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #444;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}
.platform-section {
    margin-bottom: 1.5rem;
}
.platform-section:last-child {
    margin-bottom: 0;
}
/* Style numbers aligning right in table */
td.num {
    font-family: monospace;
    text-align: right;
}
.sub-option { /* Container for the checkbox */
    margin-top: 2rem;
    margin-bottom: 0.5rem; /* Space before next input row */
}

/* --- Tooltip Styles --- */
.tooltip-icon {
    display: inline-block;
    margin-left: 5px;
    margin-top: -3px;
    font-weight: bold;
    color: #4f46e5; /* Match button color */
    cursor: help;
    font-size: 0.9em;
    border: 1px solid #adb5bd;
    border-radius: 50%;
    width: 1.2em; /* Make it slightly wider */
    height: 1.2em;
    line-height: 1.2em; /* Vertically center '?' */
    text-align: center;
    background-color: #f1f3f5;
    user-select: none; /* Prevent text selection of '?' */
    position: relative; /* Needed if tooltip positioning is relative to icon */
    vertical-align: middle; /* Align better with text */
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: 250px;
    background-color: #343a40;
    color: #fff;
    text-align: left;
    font-weight: normal;
    font-size: 0.85em;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 10;
    bottom: 130%;
    left: 50%;
    margin-left: -125px; /* Half of width */
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #343a40 transparent transparent transparent;
}

.tooltip-text.visible {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease;
}



@media (max-width: 768px) {
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .responsive-table {
    display: table;
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    min-width: 600px; /* <--- questo è importante! */
  }

  .responsive-table th,
  .responsive-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 8px;
    border: 1px solid #ccc;
  }
}
