* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #0f1117; color: #e0e0e0; min-height: 100vh; }

/* ── Login ── */
.login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f1117, #1a1d2e); }
.login-box { background: #1e2130; padding: 40px; border-radius: 12px; width: 360px; box-shadow: 0 8px 32px rgba(0,0,0,.5); text-align: center; }
.login-box h1 { font-size: 28px; color: #6c8ee0; margin-bottom: 8px; }
.login-sub { color: #666; margin-bottom: 28px; font-size: 14px; }
.login-box input { width: 100%; padding: 12px 14px; margin-bottom: 14px; background: #252840; border: 1px solid #333; border-radius: 8px; color: #e0e0e0; font-size: 14px; outline: none; }
.login-box input:focus { border-color: #6c8ee0; }
.login-box button { width: 100%; padding: 12px; background: #6c8ee0; border: none; border-radius: 8px; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; transition: background .2s; }
.login-box button:hover { background: #5a7acf; }
.error-msg { color: #e05c5c; font-size: 13px; margin-top: 10px; min-height: 20px; }

/* ── Layout ── */
.hidden { display: none !important; }
.app { display: flex; min-height: 100vh; }

.sidebar { width: 220px; background: #1a1d2e; display: flex; flex-direction: column; padding: 20px 0; border-right: 1px solid #252840; flex-shrink: 0; }
.logo { font-size: 18px; font-weight: 700; color: #6c8ee0; padding: 0 20px 24px; letter-spacing: 1px; }
.nav-item { display: block; padding: 12px 20px; color: #8a90a8; text-decoration: none; font-size: 14px; transition: all .15s; border-left: 3px solid transparent; }
.nav-item:hover, .nav-item.active { color: #e0e0e0; background: #252840; border-left-color: #6c8ee0; }
.sidebar-footer { margin-top: auto; padding: 20px; }
.btn-logout { width: 100%; padding: 10px; background: #2a2d3e; border: 1px solid #333; border-radius: 6px; color: #8a90a8; cursor: pointer; font-size: 13px; transition: all .15s; }
.btn-logout:hover { background: #e05c5c; color: #fff; border-color: #e05c5c; }

.content { flex: 1; padding: 28px; overflow-y: auto; }
.tab-content { display: none; }
.tab-content.active { display: block; }
h2 { font-size: 22px; font-weight: 600; margin-bottom: 22px; color: #e8e8f0; }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: #1e2130; border-radius: 10px; padding: 20px; border-left: 4px solid #6c8ee0; }
.stat-card.green { border-left-color: #5cb85c; }
.stat-card.red { border-left-color: #e05c5c; }
.stat-card.orange { border-left-color: #e0945c; }
.stat-card.blue { border-left-color: #5cc8e0; }
.stat-card.purple { border-left-color: #a05ce0; }
.stat-num { font-size: 32px; font-weight: 700; color: #fff; }
.stat-label { font-size: 12px; color: #666; margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

.info-box { background: #1e2130; border-radius: 10px; padding: 20px; }
.info-box h3 { font-size: 16px; margin-bottom: 12px; color: #6c8ee0; }
.info-box p { font-size: 13px; color: #8a90a8; margin-bottom: 8px; }
.info-box code { background: #252840; padding: 3px 8px; border-radius: 4px; color: #a0d0ff; font-size: 12px; word-break: break-all; }

/* ── Tab header ── */
.tab-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.tab-header div { display: flex; gap: 10px; }
.search-bar { margin-bottom: 14px; }
.search-bar input { width: 300px; padding: 9px 14px; background: #1e2130; border: 1px solid #333; border-radius: 8px; color: #e0e0e0; font-size: 14px; outline: none; }
.search-bar input:focus { border-color: #6c8ee0; }

/* ── Buttons ── */
.btn-primary { padding: 9px 18px; background: #6c8ee0; border: none; border-radius: 7px; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s; }
.btn-primary:hover { background: #5a7acf; }
.btn-secondary { padding: 9px 18px; background: #2a2d3e; border: 1px solid #444; border-radius: 7px; color: #c0c0d0; font-size: 13px; cursor: pointer; transition: all .15s; }
.btn-secondary:hover { background: #333650; border-color: #666; }
.btn-danger { padding: 9px 18px; background: #e05c5c; border: none; border-radius: 7px; color: #fff; font-size: 13px; cursor: pointer; }
.btn-danger:hover { background: #c94444; }
.btn-sm { padding: 6px 12px; background: #2a2d3e; border: 1px solid #444; border-radius: 5px; color: #c0c0d0; font-size: 12px; cursor: pointer; margin-left: 6px; white-space: nowrap; }
.btn-sm:hover { background: #6c8ee0; color: #fff; border-color: #6c8ee0; }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; background: #1e2130; border-radius: 10px; overflow: hidden; font-size: 13px; }
.data-table th { background: #252840; padding: 12px 14px; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #8a90a8; border-bottom: 1px solid #333; }
.data-table td { padding: 11px 14px; border-bottom: 1px solid #252840; vertical-align: middle; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #252840; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-active { background: #1a3a1a; color: #5cb85c; }
.badge-disabled { background: #3a1a1a; color: #e05c5c; }
.badge-expired { background: #3a2a1a; color: #e0945c; }
.badge-trial { background: #1a2a3a; color: #5cc8e0; }

.action-btns { display: flex; gap: 6px; }
.action-btns button { padding: 5px 10px; font-size: 11px; border-radius: 5px; cursor: pointer; border: 1px solid; font-weight: 500; }
.btn-edit { background: #1e3050; border-color: #4060a0; color: #7090d0; }
.btn-edit:hover { background: #6c8ee0; border-color: #6c8ee0; color: #fff; }
.btn-del { background: #3a1a1a; border-color: #804040; color: #e07070; }
.btn-del:hover { background: #e05c5c; border-color: #e05c5c; color: #fff; }
.btn-link { background: #1a3a2a; border-color: #407050; color: #70c090; }
.btn-link:hover { background: #5cb85c; border-color: #5cb85c; color: #fff; }
.btn-renew { background: #2a1a3a; border-color: #604080; color: #9060c0; }
.btn-renew:hover { background: #a05ce0; border-color: #a05ce0; color: #fff; }

/* ── Modals ── */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: #1e2130; border-radius: 12px; padding: 28px; width: 460px; max-width: 95vw; max-height: 90vh; overflow-y: auto; border: 1px solid #333; }
.modal-box.wide { width: 680px; }
.modal-box.small { width: 360px; }
.modal-box h3 { font-size: 18px; margin-bottom: 20px; color: #e8e8f0; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; color: #8a90a8; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .4px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 10px 12px; background: #252840; border: 1px solid #333;
  border-radius: 7px; color: #e0e0e0; font-size: 14px; outline: none;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: #6c8ee0; }
.form-row textarea { resize: vertical; font-family: monospace; }
.form-row.checkbox-row label { display: flex; align-items: center; gap: 8px; font-size: 14px; text-transform: none; letter-spacing: 0; cursor: pointer; }
.form-row.checkbox-row input[type=checkbox] { width: auto; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; }
.copy-row button { padding: 10px 14px; background: #2a2d3e; border: 1px solid #444; border-radius: 7px; color: #c0c0d0; cursor: pointer; font-size: 13px; white-space: nowrap; }
.copy-row button:hover { background: #6c8ee0; color: #fff; border-color: #6c8ee0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

.checkbox-list { background: #252840; border: 1px solid #333; border-radius: 7px; max-height: 160px; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.checkbox-list label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #c0c0d0; cursor: pointer; }
.checkbox-list input[type=checkbox] { width: auto; }

/* ── Dead badge ── */
.dead-badge { display: inline-block; background: #e05c5c; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 10px; margin-left: 6px; vertical-align: middle; }

/* ── TMDB ── */
.tmdb-search-box { background: #1a2a3a; border: 1px solid #2a4a6a; border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.tmdb-results { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 280px; overflow-y: auto; }
.tmdb-result-item { display: flex; gap: 12px; padding: 10px; background: #252840; border-radius: 8px; cursor: pointer; border: 2px solid transparent; transition: all .15s; }
.tmdb-result-item:hover { border-color: #6c8ee0; background: #1e2240; }
.tmdb-result-item img { width: 45px; height: 65px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.tmdb-result-info { flex: 1; }
.tmdb-result-title { font-weight: 600; color: #e0e0f0; font-size: 14px; margin-bottom: 4px; }
.tmdb-result-meta { font-size: 12px; color: #8a90a8; margin-bottom: 4px; }
.tmdb-result-overview { font-size: 12px; color: #666; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Trial button ── */
.btn-trial { padding: 9px 14px; background: #1a3a2a; border: 1px solid #3a7050; border-radius: 7px; color: #70d0a0; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-trial:hover { background: #5cb85c; border-color: #5cb85c; color: #fff; }

/* ── Upload tabs ── */
.upload-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: #1a1d2e; border-radius: 10px; padding: 6px; }
.upload-tab { flex: 1; padding: 10px; background: transparent; border: none; border-radius: 7px; color: #8a90a8; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; }
.upload-tab.active { background: #6c8ee0; color: #fff; }
.upload-tab:hover:not(.active) { background: #252840; color: #e0e0e0; }
.utab-content { }

/* ── Upload zone ── */
.upload-area { border: 2px dashed #3a3d5e; border-radius: 14px; padding: 48px 24px; text-align: center; cursor: pointer; transition: all .2s; background: #1a1d2e; margin-bottom: 16px; }
.upload-area:hover, .upload-area.drag-over { border-color: #6c8ee0; background: #1e2240; }
.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-title { font-size: 18px; font-weight: 600; color: #e0e0f0; margin-bottom: 6px; }
.upload-sub { font-size: 13px; color: #8a90a8; margin-bottom: 4px; }
.upload-preview { background: #1e2130; border-radius: 10px; padding: 18px; border: 1px solid #333; }
.preview-file { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #252840; border-radius: 8px; font-size: 14px; }
.preview-file span:first-child { color: #e0e0f0; font-weight: 600; flex: 1; }

/* ── File list ── */
.file-list { background: #1e2130; border-radius: 10px; border: 1px solid #333; overflow: hidden; margin-bottom: 4px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #252840; font-size: 13px; }
.file-item:last-child { border-bottom: none; }
.file-item .fi-icon { font-size: 18px; flex-shrink: 0; }
.file-item .fi-name { flex: 1; color: #e0e0f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .fi-size { color: #666; font-size: 12px; white-space: nowrap; }
.file-item .fi-remove { background: none; border: none; color: #e05c5c; cursor: pointer; font-size: 16px; padding: 0 4px; }
.file-list-header { padding: 8px 14px; background: #252840; font-size: 12px; color: #8a90a8; display: flex; justify-content: space-between; }

.upload-result { background: #1a3a1a; border: 1px solid #3a7a3a; border-radius: 10px; padding: 18px 22px; font-size: 14px; color: #80d080; line-height: 1.8; }
.upload-result.error { background: #3a1a1a; border-color: #7a3a3a; color: #d08080; }
.progress-bar { height: 8px; background: #252840; border-radius: 4px; overflow: hidden; margin-top: 12px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #6c8ee0, #5cb85c); border-radius: 4px; width: 0; transition: width .3s; animation: progress-anim 1.5s infinite; }
@keyframes progress-anim { 0%{width:10%} 50%{width:80%} 100%{width:95%} }

/* ── Trial badge ── */
.trial-badge { background: linear-gradient(135deg, #1a3a2a, #0f2a1a); border: 1px solid #5cb85c; border-radius: 8px; padding: 12px 18px; margin-bottom: 18px; text-align: center; font-size: 15px; font-weight: 600; color: #5cb85c; }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; right: 24px; background: #252840; color: #e0e0e0; padding: 12px 20px; border-radius: 8px; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.5); border-left: 4px solid #6c8ee0; z-index: 9999; }
.toast.success { border-left-color: #5cb85c; }
.toast.error { border-left-color: #e05c5c; }
