* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f5f6fa; color: #2d3436; line-height: 1.6; }
a { color: #0984e3; text-decoration: none; }
a:hover { text-decoration: underline; }

.navbar { background: #2d3436; padding: 0 2rem; display: flex; align-items: center; gap: 2rem; height: 56px; }
.navbar .brand { color: #fff; font-weight: 700; font-size: 1.1rem; }
.navbar a { color: #b2bec3; font-size: 0.9rem; padding: 0.5rem 0; }
.navbar a:hover, .navbar a.active { color: #fff; text-decoration: none; }

.container { max-width: 1400px; margin: 0 auto; padding: 2rem 1.5rem; }
h1 { font-size: 1.5rem; margin-bottom: 1.5rem; color: #2d3436; }
h2 { font-size: 1.2rem; margin-bottom: 1rem; color: #636e72; }

.tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 2px solid #dfe6e9; }
.tab { padding: 0.75rem 1.25rem; color: #636e72; font-size: 0.9rem; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.tab:hover { color: #2d3436; text-decoration: none; }
.tab.active { color: #0984e3; border-bottom-color: #0984e3; }
.tab-count { display: inline-block; background: #dfe6e9; color: #636e72; padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.75rem; margin-left: 0.3rem; }
.tab.active .tab-count { background: #0984e3; color: #fff; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: #fff; border-radius: 8px; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.stat-card .label { font-size: 0.8rem; color: #636e72; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.25rem; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; color: #2d3436; }
.stat-card.alta .value { color: #d63031; }
.stat-card.media .value { color: #e17055; }
.stat-card.bassa .value { color: #fdcb6e; }
.stat-card.abbandono .value { color: #636e72; }
.stat-card.contattabili .value { color: #00b894; }
.stat-card.recuperare .value { color: #6c5ce7; }
.stat-card.successo .value { color: #00b894; }
.stat-card.rifiutato .value { color: #d63031; }

.filters { background: #fff; border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.filters .filter-group { display: flex; flex-direction: column; gap: 0.25rem; }
.filters label { font-size: 0.75rem; color: #636e72; text-transform: uppercase; letter-spacing: 0.5px; }
.filters select { padding: 0.4rem 0.6rem; border: 1px solid #dfe6e9; border-radius: 4px; font-size: 0.85rem; background: #fff; }
.filters button { padding: 0.4rem 1rem; background: #0984e3; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 0.85rem; height: 32px; }
.filters button:hover { background: #0873c7; }
.filters .btn-reset { background: #b2bec3; }
.filters .btn-reset:hover { background: #636e72; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
thead th { background: #dfe6e9; padding: 0.75rem 0.75rem; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: #636e72; position: sticky; top: 0; white-space: nowrap; }
tbody td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #f1f2f6; font-size: 0.82rem; vertical-align: top; }
tbody tr:hover { background: #f8f9fa; }
.count-badge { display: inline-block; min-width: 20px; text-align: center; padding: 0.15rem 0.4rem; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.count-badge.has { background: #00b894; color: #fff; }
.count-badge.none { background: #dfe6e9; color: #636e72; }

.priority-badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.priority-badge.alta { background: #ffeef0; color: #d63031; }
.priority-badge.media { background: #fff3e6; color: #e17055; }
.priority-badge.bassa { background: #fef9e7; color: #b7950b; }
.priority-badge.abbandono { background: #f0f0f0; color: #636e72; }
.priority-badge.escluso { background: #e8e8e8; color: #999; }

.contact-items { display: flex; flex-direction: column; gap: 0.2rem; }
.contact-item { line-height: 1.3; }
.contact-link { font-size: 0.8rem; word-break: break-all; }
.contact-link-email { color: #0984e3; }
.contact-link-phone { color: #00b894; }
.th-center, .td-center { text-align: center; }

.actions-cell { white-space: nowrap; }
.actions-vertical { display: flex; flex-direction: column; gap: 0.25rem; }
.btn-sm { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 4px; border: none; cursor: pointer; font-size: 0.75rem; font-weight: 600; margin: 0.1rem; }
.btn-action-green { background: #00b894; color: #fff; }
.btn-action-green:hover { background: #00a381; }
.btn-action-blue { background: #0984e3; color: #fff; }
.btn-action-blue:hover { background: #0873c7; }
.btn-action-red { background: #d63031; color: #fff; }
.btn-action-red:hover { background: #b71c1c; }
.btn-action-gray { background: #b2bec3; color: #fff; }
.btn-action-gray:hover { background: #636e72; }

.flag-row { margin: 0.15rem 0; }
.flag-label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; cursor: pointer; }
.flag-label input[type="checkbox"] { cursor: pointer; width: 14px; height: 14px; }

.note-input { width: 100%; min-width: 120px; padding: 0.3rem 0.5rem; border: 1px solid #dfe6e9; border-radius: 4px; font-size: 0.8rem; font-family: inherit; }
.note-input:focus { outline: none; border-color: #0984e3; }
.manual-input { width: 100%; min-width: 140px; padding: 0.35rem 0.5rem; border: 1px solid #dfe6e9; border-radius: 4px; font-size: 0.8rem; font-family: inherit; background: #fafafa; }
.manual-input:focus { outline: none; border-color: #00b894; background: #fff; }
.manual-input:not(:placeholder-shown) { background: #e8f8f5; border-color: #00b894; }

.text-muted { color: #b2bec3; font-size: 0.8rem; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.detail-card { background: #fff; border-radius: 8px; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.detail-card h3 { font-size: 0.9rem; color: #636e72; text-transform: uppercase; margin-bottom: 0.75rem; letter-spacing: 0.5px; }
.detail-row { display: flex; justify-content: space-between; padding: 0.4rem 0; border-bottom: 1px solid #f1f2f6; }
.detail-row:last-child { border-bottom: none; }
.detail-row .key { color: #636e72; font-size: 0.85rem; }
.detail-row .val { font-weight: 600; font-size: 0.85rem; }

.reasons-list { list-style: none; padding: 0; }
.reasons-list li { padding: 0.4rem 0; border-bottom: 1px solid #f1f2f6; font-size: 0.85rem; }
.reasons-list li:last-child { border-bottom: none; }
.reasons-list li::before { content: "\2022"; color: #e17055; margin-right: 0.5rem; }

.contacts-list { list-style: none; padding: 0; }
.contacts-list li { padding: 0.3rem 0; font-size: 0.85rem; }

.actions { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.btn { display: inline-block; padding: 0.5rem 1.25rem; border-radius: 6px; border: none; cursor: pointer; font-size: 0.85rem; font-weight: 600; }
.btn-primary { background: #0984e3; color: #fff; }
.btn-primary:hover { background: #0873c7; }
.btn-secondary { background: #dfe6e9; color: #2d3436; }
.btn-secondary:hover { background: #b2bec3; }
.btn-danger { background: #d63031; color: #fff; }
.btn-danger:hover { background: #b71c1c; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.alert { padding: 1rem 1.25rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-info { background: #e3f2fd; color: #1565c0; }
.alert-success { background: #e8f5e9; color: #2e7d32; }
.alert-warning { background: #fff3e0; color: #e65100; }
.alert-error { background: #ffeef0; color: #d63031; }

.placeholder-section { background: #fff; border-radius: 8px; padding: 3rem 2rem; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.placeholder-section h2 { color: #b2bec3; }
.placeholder-section p { color: #636e72; margin-top: 0.5rem; }

.task-panel { background: #fff; border-radius: 8px; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 1.5rem; }
.task-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.task-header h3 { margin: 0; }
.task-status-text { margin-bottom: 0.75rem; font-size: 0.9rem; }
.status-running { color: #0984e3; font-weight: 600; }
.status-success { color: #00b894; font-weight: 600; }
.status-error { color: #d63031; font-weight: 600; }

.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid #dfe6e9; border-top-color: #0984e3; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress-bar-container { background: #dfe6e9; border-radius: 6px; height: 12px; overflow: hidden; margin-bottom: 0.5rem; }
.progress-bar { background: linear-gradient(90deg, #0984e3, #00b894); height: 100%; border-radius: 6px; transition: width 0.5s ease; min-width: 2px; }
.progress-info { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; color: #636e72; margin-bottom: 0.75rem; }
.current-domain { font-weight: 600; color: #0984e3; background: #e3f2fd; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.8rem; }

.live-feed { margin-top: 0.75rem; }
.live-feed-header { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: #636e72; margin-bottom: 0.35rem; }
.task-panel pre, .live-feed pre { background: #2d3436; color: #dfe6e9; padding: 1rem; border-radius: 4px; font-size: 0.78rem; max-height: 350px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }

.empty-state { text-align: center; padding: 3rem; color: #636e72; }
.result-count { font-size: 0.85rem; color: #636e72; margin-bottom: 0.75rem; }

.search-bar-wrap { margin-bottom: 0.75rem; }
.domain-search-input { width: 100%; max-width: 400px; padding: 0.5rem 0.85rem; border: 1px solid #dfe6e9; border-radius: 6px; font-size: 0.9rem; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.domain-search-input:focus { border-color: #0984e3; box-shadow: 0 0 0 3px rgba(9,132,227,0.12); }

.btn-refresh { font-size: 0.75rem; padding: 0.3rem 0.9rem; background: #0984e3; color: #fff; border: none; border-radius: 4px; cursor: pointer; vertical-align: middle; margin-left: 0.75rem; }
.btn-refresh:hover { background: #0773c5; }
.btn-refresh:disabled { background: #b2bec3; cursor: default; }

.stat-updated { animation: stat-flash 1.5s ease; }
@keyframes stat-flash { 0% { color: inherit; } 20% { color: #0984e3; } 100% { color: inherit; } }

.dashboard-last-update { margin-top: 1.5rem; font-size: 0.8rem; color: #b2bec3; text-align: right; }

.navbar-logout { margin-left: auto; color: #b2bec3 !important; font-size: 0.85rem; }
.navbar-logout:hover { color: #fff !important; }

.btn-detail { font-size: 1rem; text-decoration: none; opacity: 0.7; transition: opacity 0.15s; }
.btn-detail:hover { opacity: 1; }
.domain-link { color: #0984e3; font-weight: 500; }
.domain-link:hover { text-decoration: underline; }

.login-body { background: #f0f2f5; display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; }
.login-wrapper { width: 100%; max-width: 380px; padding: 1rem; }
.login-card { background: #fff; border-radius: 10px; padding: 2.5rem 2rem; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.login-logo { font-size: 1.6rem; font-weight: 700; color: #2d3436; text-align: center; margin-bottom: 0.35rem; }
.login-subtitle { text-align: center; color: #636e72; font-size: 0.9rem; margin-bottom: 1.75rem; }
.login-error { background: #fff0f0; border: 1px solid #fab1a0; color: #d63031; padding: 0.6rem 0.9rem; border-radius: 5px; font-size: 0.875rem; margin-bottom: 1rem; }
.login-field { margin-bottom: 1.25rem; }
.login-field label { display: block; font-size: 0.82rem; font-weight: 600; color: #636e72; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.4rem; }
.login-field input { width: 100%; box-sizing: border-box; padding: 0.65rem 0.85rem; border: 1px solid #dfe6e9; border-radius: 5px; font-size: 1rem; outline: none; transition: border-color 0.2s; }
.login-field input:focus { border-color: #0984e3; box-shadow: 0 0 0 3px rgba(9,132,227,0.12); }
.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap input { padding-right: 2.75rem; }
.toggle-pw { position: absolute; right: 0.6rem; background: none; border: none; cursor: pointer; color: #b2bec3; padding: 0.2rem; display: flex; align-items: center; }
.toggle-pw:hover { color: #636e72; }
.login-remember { margin-bottom: 1.25rem; }
.remember-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: #636e72; cursor: pointer; }
.remember-label input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: #0984e3; }
.login-btn { width: 100%; padding: 0.75rem; background: #0984e3; color: #fff; border: none; border-radius: 5px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.login-btn:hover { background: #0773c5; }

@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filters { flex-direction: column; }
    .navbar { padding: 0 1rem; gap: 1rem; overflow-x: auto; }
    .tabs { overflow-x: auto; }
    .tab { white-space: nowrap; font-size: 0.8rem; padding: 0.6rem 0.75rem; }
}

.section-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; }
.section-card h2 { margin: 0 0 0.4rem 0; font-size: 1.1rem; color: #2d3436; }
.section-desc { margin: 0 0 1rem 0; font-size: 0.875rem; color: #636e72; }
.section-desc code { background: #f0f2f5; padding: 0.1rem 0.35rem; border-radius: 3px; font-size: 0.82rem; }

.single-domain-form { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.form-input { flex: 1; min-width: 200px; max-width: 380px; padding: 0.6rem 0.85rem; border: 1px solid #dfe6e9; border-radius: 5px; font-size: 0.95rem; outline: none; transition: border-color 0.2s; }
.form-input:focus { border-color: #0984e3; box-shadow: 0 0 0 3px rgba(9,132,227,0.12); }

.master-upload-form { display: flex; flex-direction: column; gap: 1rem; }
.radio-group { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.radio-label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; color: #2d3436; cursor: pointer; }
.radio-label input[type="radio"] { accent-color: #0984e3; width: 15px; height: 15px; }
.upload-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.file-label { display: inline-flex; align-items: center; padding: 0.6rem 1rem; background: #f0f2f5; border: 1px solid #dfe6e9; border-radius: 5px; cursor: pointer; font-size: 0.875rem; color: #2d3436; transition: background 0.15s; }
.file-label:hover { background: #e0e4e8; }
.file-label input[type="file"] { display: none; }
.upload-result { padding: 0.65rem 1rem; border-radius: 5px; font-size: 0.875rem; font-weight: 500; }
.upload-success { background: #f0fff4; border: 1px solid #00b894; color: #00b894; }
.upload-error { background: #fff0f0; border: 1px solid #d63031; color: #d63031; }

.btn-stop { background: #d63031; color: #fff; border: none; border-radius: 5px; padding: 0.4rem 1rem; font-size: 0.85rem; font-weight: 600; cursor: pointer; margin-left: auto; transition: background 0.2s; }
.btn-stop:hover { background: #b71c1c; }
.btn-stop:disabled { background: #e17055; cursor: default; }
.task-header { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.task-header h3 { margin: 0; flex: 1; }
.status-stopped { color: #d63031; font-weight: 600; }
