* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0f0f23; color: #fff; min-height: 100vh; }

/* Login */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: #1a1a2e; padding: 40px; border-radius: 12px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.login-box h1 { text-align: center; margin-bottom: 8px; font-size: 24px; }
.login-box .subtitle { text-align: center; color: #888; margin-bottom: 30px; font-size: 14px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: #ccc; font-size: 14px; }
.form-group input { width: 100%; padding: 12px 16px; border: 1px solid #333; border-radius: 8px; background: #16213e; color: #fff; font-size: 16px; }
.form-group input:focus { outline: none; border-color: #4361ee; }
.btn { width: 100%; padding: 14px; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: #4361ee; color: #fff; }
.btn-primary:hover { background: #3651d4; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-secondary { background: #333; color: #fff; }
.btn-secondary:hover { background: #444; }
.btn-sm { padding: 8px 16px; font-size: 13px; width: auto; }
.error-msg { background: #e74c3c22; border: 1px solid #e74c3c; color: #e74c3c; padding: 12px; border-radius: 8px; margin-bottom: 20px; text-align: center; display: none; }

/* Dashboard */
.dashboard { display: none; }
.header { background: #1a1a2e; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; }
.header h1 { font-size: 20px; }
.header .user-info { display: flex; align-items: center; gap: 16px; }
.header .user-info span { color: #888; font-size: 14px; }

.main-content { display: flex; min-height: calc(100vh - 60px); }
.sidebar { width: 280px; background: #1a1a2e; border-right: 1px solid #333; padding: 20px; }
.sidebar h3 { color: #888; font-size: 12px; text-transform: uppercase; margin-bottom: 12px; }
.app-list { list-style: none; }
.app-list li { padding: 12px 16px; border-radius: 8px; cursor: pointer; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; }
.app-list li:hover { background: #16213e; }
.app-list li.active { background: #4361ee; }
.app-list li .app-name { font-weight: 500; }
.app-list li .app-slug { font-size: 12px; color: #888; }
.app-list li.active .app-slug { color: rgba(255,255,255,0.7); }

.content { flex: 1; padding: 24px; }
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.content-header h2 { font-size: 24px; }

.card { background: #1a1a2e; border-radius: 12px; padding: 24px; margin-bottom: 20px; }
.card h3 { margin-bottom: 16px; font-size: 16px; color: #888; }

.env-list { list-style: none; }
.env-item { display: flex; justify-content: space-between; align-items: center; padding: 16px; background: #16213e; border-radius: 8px; margin-bottom: 8px; }
.env-item .env-info { flex: 1; }
.env-item .env-name { font-weight: 600; margin-bottom: 4px; }
.env-item .env-url { font-size: 13px; color: #888; word-break: break-all; }
.env-item .env-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; }
.env-item .env-meta .meta-item { display: flex; align-items: center; gap: 4px; color: #888; }
.env-item .env-meta .meta-item a { color: #4361ee; text-decoration: none; }
.env-item .env-meta .meta-item a:hover { text-decoration: underline; }
.env-item .env-description { font-size: 12px; color: #aaa; margin-top: 6px; font-style: italic; }
.env-item .env-actions { display: flex; gap: 8px; align-self: flex-start; }

.empty-state { text-align: center; padding: 40px; color: #666; }
.empty-state p { margin-bottom: 16px; }

/* Grupos por Jira */
.env-group { margin-bottom: 24px; }
.env-group-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #16213e; border-radius: 8px 8px 0 0; border-bottom: 2px solid #4361ee; margin-bottom: 0; }
.env-group-header .group-icon { font-size: 18px; }
.env-group-header .group-title { font-weight: 600; font-size: 15px; }
.env-group-header .group-title a { color: #4361ee; text-decoration: none; }
.env-group-header .group-title a:hover { text-decoration: underline; }
.env-group-header .group-count { background: #4361ee; color: #fff; padding: 2px 8px; border-radius: 12px; font-size: 12px; }
.env-group-header .group-responsible { color: #888; font-size: 13px; margin-left: auto; }
.env-group-header .group-actions { margin-left: 12px; }
.env-group-header .group-actions .btn-delete-group { background: transparent; border: 1px solid #e74c3c; color: #e74c3c; padding: 4px 10px; border-radius: 4px; font-size: 11px; cursor: pointer; transition: all 0.2s; }
.env-group-header .group-actions .btn-delete-group:hover { background: #e74c3c; color: #fff; }
.env-group-items { border: 1px solid #333; border-top: none; border-radius: 0 0 8px 8px; overflow: hidden; }
.env-group-items .env-item { border-radius: 0; margin-bottom: 0; border-bottom: 1px solid #333; }
.env-group-items .env-item:last-child { border-bottom: none; }
.env-group.no-jira .env-group-header { background: #1a1a2e; border-bottom-color: #666; }
.env-group.collapsed .env-group-items { display: none; }
.env-group-header .toggle-icon { cursor: pointer; transition: transform 0.2s; }
.env-group.collapsed .toggle-icon { transform: rotate(-90deg); }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #1a1a2e; border-radius: 12px; padding: 24px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-bottom: 20px; }
.modal .form-group { margin-bottom: 16px; }
.modal .btn-group { display: flex; gap: 12px; margin-top: 24px; }
.modal .btn-group .btn { flex: 1; }

/* Code box */
.code-box { background: #16213e; border-radius: 8px; padding: 16px; font-family: monospace; font-size: 13px; overflow-x: auto; margin-top: 12px; border: 1px solid #333; }
.code-box code { color: #4ade80; }

/* Konami display */
.konami-display { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.konami-key { background: #333; padding: 6px 12px; border-radius: 4px; font-size: 12px; font-family: monospace; }

/* Konami Builder */
.konami-builder { margin-top: 12px; }
.konami-sequence { display: flex; gap: 8px; flex-wrap: wrap; min-height: 44px; padding: 12px; background: #16213e; border-radius: 8px; margin-bottom: 12px; align-items: center; }
.konami-sequence .seq-key { background: #4361ee; padding: 8px 14px; border-radius: 6px; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.konami-sequence .seq-key .remove { cursor: pointer; opacity: 0.7; font-size: 12px; }
.konami-sequence .seq-key .remove:hover { opacity: 1; }
.konami-sequence .placeholder { color: #666; font-size: 14px; }
.key-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.key-btn { padding: 12px; border: 1px solid #333; border-radius: 8px; background: #1a1a2e; color: #fff; cursor: pointer; font-size: 18px; transition: all 0.15s; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.key-btn:hover { background: #333; border-color: #4361ee; }
.key-btn .key-label { font-size: 10px; color: #888; }
.key-btn.color-red { border-color: #e74c3c; }
.key-btn.color-green { border-color: #2ecc71; }
.key-btn.color-yellow { border-color: #f1c40f; }
.key-btn.color-blue { border-color: #3498db; }
.clear-seq { margin-top: 8px; }

/* Form error */
.form-error { background: #e74c3c22; border: 1px solid #e74c3c; color: #e74c3c; padding: 12px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }

/* Slug help */
.slug-help { font-size: 11px; color: #666; margin-top: 4px; }

/* Sidebar nav */
.sidebar-nav { display: flex; gap: 4px; margin-bottom: 16px; }
.sidebar-nav-btn { flex: 1; padding: 10px 8px; border: 1px solid #333; border-radius: 8px; background: #16213e; color: #888; font-size: 12px; font-weight: 600; cursor: pointer; text-align: center; transition: all 0.15s; }
.sidebar-nav-btn:hover { background: #1e2a4a; color: #ccc; }
.sidebar-nav-btn.active { background: #4361ee; color: #fff; border-color: #4361ee; }

/* HbbTV JSON Editor */
.json-editor-container { display: none; }
.json-toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.json-toolbar .status { margin-left: auto; font-size: 13px; color: #888; }
.json-toolbar .status.success { color: #2ecc71; }
.json-toolbar .status.error { color: #e74c3c; }
.json-toolbar .status.loading { color: #f1c40f; }
.json-editor { width: 100%; min-height: 500px; padding: 16px; font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace; font-size: 13px; line-height: 1.5; background: #0d1117; color: #c9d1d9; border: 1px solid #333; border-radius: 8px; resize: vertical; tab-size: 2; }
.json-editor:focus { outline: none; border-color: #4361ee; }
.json-editor.invalid { border-color: #e74c3c; }
.json-editor.valid { border-color: #2ecc71; }
.json-meta { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.json-meta-item { background: #16213e; padding: 10px 16px; border-radius: 8px; font-size: 13px; }
.json-meta-item .label { color: #888; font-size: 11px; display: block; margin-bottom: 2px; }
.json-meta-item .value { color: #fff; font-weight: 500; }
.json-validation { padding: 8px 12px; font-size: 12px; border-radius: 6px; margin-top: 8px; }
.json-validation.valid { background: #2ecc7122; color: #2ecc71; }
.json-validation.invalid { background: #e74c3c22; color: #e74c3c; }
.backup-list { list-style: none; margin-top: 12px; }
.backup-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #16213e; border-radius: 6px; margin-bottom: 6px; font-size: 13px; }
.backup-item .backup-name { color: #ccc; font-family: monospace; font-size: 12px; }
.backup-item .backup-date { color: #888; font-size: 12px; }

/* HbbTV view tabs */
.hbbtv-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid #333; }
.hbbtv-tab { padding: 10px 20px; background: none; border: none; color: #888; font-size: 14px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.hbbtv-tab:hover { color: #ccc; }
.hbbtv-tab.active { color: #4361ee; border-bottom-color: #4361ee; }

/* Form editor items */
.hbbtv-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: #16213e; border-radius: 8px; margin-bottom: 8px; border: 1px solid #333; transition: all 0.15s; }
.hbbtv-item:hover { border-color: #4361ee44; }
.hbbtv-item.dragging { opacity: 0.5; border-color: #4361ee; }
.hbbtv-item.drag-over { border-color: #4361ee; border-style: dashed; }
.hbbtv-item-num { color: #555; font-size: 12px; font-weight: 700; min-width: 24px; text-align: center; padding-top: 10px; }
.hbbtv-item-drag { cursor: grab; padding: 8px 4px; color: #555; font-size: 16px; user-select: none; display: flex; align-items: center; }
.hbbtv-item-drag:active { cursor: grabbing; }
.hbbtv-item-drag:hover { color: #4361ee; }
.hbbtv-item-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.hbbtv-item-row { display: flex; gap: 8px; align-items: center; }
.hbbtv-item-fields input { padding: 8px 10px; border: 1px solid #333; border-radius: 6px; background: #0d1117; color: #fff; font-size: 13px; }
.hbbtv-item-fields input:focus { outline: none; border-color: #4361ee; }
.hbbtv-item-fields input.field-title { flex: 1; font-weight: 600; }
.hbbtv-item-fields input.field-url { flex: 1; font-family: monospace; font-size: 12px; color: #8b949e; }
.hbbtv-item-fields select { padding: 8px 10px; border: 1px solid #333; border-radius: 6px; background: #0d1117; color: #fff; font-size: 13px; min-width: 180px; }
.hbbtv-item-fields select:focus { outline: none; border-color: #4361ee; }
.hbbtv-item-actions { display: flex; flex-direction: column; gap: 4px; padding-top: 2px; }
.hbbtv-item-actions button { background: none; border: 1px solid #333; color: #888; width: 28px; height: 28px; border-radius: 4px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; padding: 0; }
.hbbtv-item-actions button:hover { background: #333; color: #fff; }
.hbbtv-item-actions button.btn-del:hover { background: #e74c3c; border-color: #e74c3c; color: #fff; }
.hbbtv-page-fields { display: flex; gap: 12px; margin-bottom: 16px; }
.hbbtv-page-fields .form-group { flex: 1; margin-bottom: 0; }
.hbbtv-page-fields input { width: 100%; padding: 10px 12px; border: 1px solid #333; border-radius: 6px; background: #0d1117; color: #fff; font-size: 14px; }
.hbbtv-page-fields input:focus { outline: none; border-color: #4361ee; }
.hbbtv-item-count { color: #888; font-size: 13px; }
.hbbtv-search { padding: 8px 12px; border: 1px solid #333; border-radius: 6px; background: #0d1117; color: #fff; font-size: 13px; width: 220px; }
.hbbtv-search:focus { outline: none; border-color: #4361ee; }
.hbbtv-item.filtered-out { display: none; }
