:root {
  --primary: #1a365d;
  --primary-light: #2b4c7e;
  --accent: #01ADC5;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar-console { background: var(--primary); padding: 0.75rem 1.5rem; position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; justify-content: space-between; }
.navbar-console .brand { color: #fff; font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.navbar-console .brand span { background: var(--accent); color: #fff; font-size: 0.7rem; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.navbar-console .nav-right { display: flex; align-items: center; gap: 1rem; }
.navbar-console .nav-right .user { color: rgba(255,255,255,0.7); font-size: 0.85rem; }
.navbar-console .nav-right button { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #fff; padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; }
.navbar-console .nav-right button:hover { background: rgba(255,255,255,0.2); }

/* Layout */
.container-main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card-header-custom { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.card-body { padding: 1.5rem; }

/* Stats */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; text-align: center; }
.stat-card .number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .label { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }
.stat-card.attesa .number { color: var(--warning); }
.stat-card.pubblicato .number { color: var(--success); }
.stat-card.dismesso .number { color: var(--text-muted); }

/* Project list */
.project-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); transition: background 0.15s; cursor: pointer; }
.project-item:last-child { border-bottom: none; }
.project-item:hover { background: #f8fafc; }
.project-info h3 { margin: 0 0 0.25rem; font-size: 1rem; font-weight: 600; }
.project-info .meta { color: var(--text-muted); font-size: 0.8rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.project-actions { display: flex; gap: 0.5rem; }

/* Status badges */
.badge-status { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.badge-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; }
.badge-attesa { background: #fef3c7; color: #92400e; }
.badge-attesa::before { background: var(--warning); }
.badge-pubblicato { background: #dcfce7; color: #166534; }
.badge-pubblicato::before { background: var(--success); }
.badge-dismesso { background: #f1f5f9; color: #475569; }
.badge-dismesso::before { background: #94a3b8; }

/* Buttons */
.btn-primary-custom { background: var(--primary); color: #fff; border: none; padding: 8px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 0.85rem; }
.btn-primary-custom:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; border: none; padding: 8px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 0.85rem; }
.btn-accent:hover { opacity: 0.9; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--border); padding: 8px 20px; border-radius: 8px; font-weight: 500; cursor: pointer; font-size: 0.85rem; }
.btn-outline:hover { background: #f8fafc; }
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 8px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 0.85rem; }
.btn-success { background: var(--success); color: #fff; border: none; padding: 8px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 0.85rem; }

/* Login */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--primary); }
.login-card { background: #fff; border-radius: 16px; padding: 3rem; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-card h1 { color: var(--primary); font-size: 1.5rem; margin: 0 0 0.5rem; text-align: center; }
.login-card .subtitle { color: var(--text-muted); text-align: center; margin-bottom: 2rem; font-size: 0.9rem; }
.login-card input { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 8px; font-size: 1rem; margin-bottom: 1rem; outline: none; }
.login-card input:focus { border-color: var(--accent); }
.login-card button { width: 100%; padding: 12px; font-size: 1rem; }
.login-card .error { color: var(--danger); font-size: 0.85rem; margin-top: 0.5rem; display: none; }
.totp-code input { text-align: center; font-size: 1.5rem; letter-spacing: 0.5rem; font-weight: 700; }

/* Detail page */
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; }
.detail-header h1 { margin: 0; font-size: 1.5rem; }
.detail-header .back { color: var(--text-muted); font-size: 0.85rem; display: block; margin-bottom: 0.5rem; }
.detail-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.info-item { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }
.info-item .label { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.info-item .value { font-weight: 600; margin-top: 0.25rem; font-size: 0.95rem; }

/* Revision form */
.revision-form { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; margin-bottom: 2rem; }
.revision-form textarea { width: 100%; min-height: 120px; border: 2px solid var(--border); border-radius: 8px; padding: 12px; font-size: 0.95rem; resize: vertical; font-family: inherit; }
.revision-form textarea:focus { outline: none; border-color: var(--accent); }
.revision-form .form-row { display: flex; gap: 1rem; align-items: flex-end; margin-top: 1rem; }

/* Log terminal */
.log-terminal { background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 1.5rem; font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace; font-size: 0.8rem; line-height: 1.6; max-height: 400px; overflow-y: auto; margin-bottom: 2rem; white-space: pre-wrap; word-break: break-all; }
.log-terminal .log-text { color: #94a3b8; }
.log-terminal .log-tool { color: var(--accent); }
.log-terminal .log-error { color: var(--danger); }
.log-terminal .log-success { color: var(--success); }

/* Revisions table */
.rev-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.rev-table th { text-align: left; padding: 0.75rem 1rem; color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; border-bottom: 2px solid var(--border); }
.rev-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.rev-table tr:hover { background: #f8fafc; }

/* Backups */
.backup-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.backup-item:last-child { border-bottom: none; }

/* Toolbar search/filter */
.toolbar { display: flex; gap: 1rem; margin-bottom: 1.5rem; align-items: center; flex-wrap: wrap; }
.toolbar input { padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; flex: 1; min-width: 200px; }
.toolbar select { padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; background: #fff; }

/* Responsive */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .stat-card .number { font-size: 1.5rem; }
  .project-item { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .detail-info { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; }
}

/* QR Code */
.qr-container { text-align: center; margin: 1.5rem 0; }
.qr-container img { border-radius: 8px; }
.secret-code { background: #f1f5f9; padding: 8px 16px; border-radius: 6px; font-family: monospace; font-size: 0.85rem; margin-top: 1rem; display: inline-block; }

/* Go-live modal */
.modal-golive .form-group { margin-bottom: 1rem; }
.modal-golive label { display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.85rem; }
.modal-golive input[type="text"], .modal-golive input[type="email"] {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem;
}
.modal-golive .check-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }

/* Actions bar */
.actions-bar { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 2rem; }

/* Section title */
.section-title { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--accent); display: inline-block; }

/* Loading spinner */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: #fff; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Dropzone */
.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 1.5rem; text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s; margin-top: 1rem; }
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: rgba(1,173,197,0.04); }
.dropzone-content { pointer-events: none; }
.dropzone-content span { pointer-events: auto; }
.file-list { text-align: left; }
.file-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.file-item:last-of-type { border-bottom: none; }
.file-name { flex: 1; font-size: 0.85rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.file-remove { color: var(--danger); font-size: 1.3rem; font-weight: 700; cursor: pointer; line-height: 1; padding: 0 4px; transition: opacity 0.15s; }
.file-remove:hover { opacity: 0.7; }

/* Prompt Engineer Box */
.prompt-engineer-box { background: linear-gradient(135deg, #f0f9ff 0%, #f5f3ff 100%); border: 1px solid #c7d2fe; border-radius: 12px; margin-bottom: 1rem; overflow: hidden; }
.pe-header { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; background: rgba(255,255,255,0.6); border-bottom: 1px solid #e0e7ff; font-size: 0.85rem; font-weight: 600; color: var(--primary); }
.pe-body { padding: 1rem; display: flex; gap: 0.75rem; align-items: flex-start; }
.pe-body textarea { flex: 1; border: 1px solid #c7d2fe; border-radius: 8px; padding: 10px 14px; font-size: 0.9rem; font-family: inherit; resize: vertical; background: #fff; min-height: 48px; }
.pe-body textarea:focus { outline: none; border-color: var(--accent); }
.pe-body .btn-sm { padding: 10px 20px; font-size: 0.85rem; white-space: nowrap; align-self: flex-end; }
