*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f172a; --bg2: #1e293b; --bg3: #334155;
  --text: #e2e8f0; --text2: #94a3b8;
  --primary: #3b82f6; --primary-h: #2563eb;
  --green: #22c55e; --red: #ef4444; --yellow: #eab308;
  --radius: 8px; --shadow: 0 1px 3px rgba(0,0,0,.3);
}
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.btn, button:not(.btn-link) { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: var(--radius); font-size: 14px; cursor: pointer; background: var(--primary); color: #fff; transition: background .15s; }
.btn:hover, button:not(.btn-link):hover { background: var(--primary-h); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--green); }
.btn-success:hover { background: #16a34a; }
.btn-outline { background: transparent; border: 1px solid var(--bg3); color: var(--text); }
.btn-outline:hover { background: var(--bg3); }
.btn-link { background: none; border: none; color: var(--text2); cursor: pointer; font-size: 14px; padding: 4px 8px; }
.btn-link:hover { color: var(--text); text-decoration: underline; }
nav { background: var(--bg2); border-bottom: 1px solid var(--bg3); padding: 0 24px; position: sticky; top: 0; z-index: 100; }
.nav-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; height: 52px; gap: 24px; }
.nav-brand { font-weight: 700; font-size: 18px; color: var(--text) !important; }
.nav-links { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.nav-links a { color: var(--text2); font-size: 14px; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.hidden { display: none !important; }
#content { max-width: 1400px; margin: 0 auto; padding: 32px 24px; }
.loading { text-align: center; padding: 80px 0; color: var(--text2); }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 24px; font-weight: 700; }
.card { background: var(--bg2); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--bg3); font-size: 14px; }
th { color: var(--text2); font-weight: 600; }
tr:hover td { background: var(--bg3); }
.status-online { color: var(--green); font-weight: 600; }
.status-offline { color: var(--text2); }
.status-error { color: var(--red); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--bg3); border-radius: var(--radius); background: var(--bg); color: var(--text); font-size: 14px; }
.form-group input:focus, .form-group select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #450a0a; border: 1px solid var(--red); color: #fca5a5; }
.alert-success { background: #052e16; border: 1px solid var(--green); color: #86efac; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.detail-label { font-size: 12px; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.detail-value { font-size: 15px; margin-bottom: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-online { background: #052e16; color: var(--green); }
.badge-offline { background: #1e293b; color: var(--text2); }
.badge-error { background: #450a0a; color: var(--red); }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: var(--bg2); border-radius: var(--radius); padding: 24px; min-width: 400px; max-width: 600px; max-height: 80vh; overflow-y: auto; }
.modal h2 { margin-bottom: 16px; font-size: 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.empty-state { text-align: center; padding: 40px; color: var(--text2); }
.item-list { list-style: none; }
.item-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--bg3); font-size: 14px; }
.item-list li:last-child { border-bottom: none; }
.stream-frame { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); border: 1px solid var(--bg3); }
.login-page { max-width: 400px; margin: 80px auto; }
.login-page h1 { text-align: center; margin-bottom: 24px; }
.code { font-family: monospace; font-size: 13px; background: var(--bg); padding: 2px 6px; border-radius: 4px; }
.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 0 4px; }
.pagination span { font-size: 13px; color: var(--text2); }
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; }
.filter-input { width: 100%; max-width: 320px; padding: 8px 12px; border: 1px solid var(--bg3); border-radius: var(--radius); background: var(--bg); color: var(--text); font-size: 14px; }
.filter-input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
/* Tabs */
.tabs { display:flex; gap:4px; margin-bottom:20px; background:var(--bg2); border-radius:8px; padding:4px; flex-wrap:wrap; }
.tab { padding:8px 16px; border:none; border-radius:6px; cursor:pointer; font-size:14px; font-weight:500; background:transparent; color:var(--text2); transition:all .2s; }
.tab.active { background:var(--primary); color:#fff; }
.tab:hover:not(.active) { background:var(--bg3); }

/* Settings */
.settings-section { margin-bottom:24px; }
.settings-section h3 { font-size:15px; font-weight:600; margin-bottom:12px; padding-bottom:8px; border-bottom:1px solid var(--bg3); }

/* Clickable row */
.clickable-row { cursor:pointer; }
.clickable-row:hover td { background:var(--bg3); }

/* Asaas status */
.status-badge { display:inline-flex; align-items:center; gap:6px; padding:4px 12px; border-radius:12px; font-size:13px; font-weight:500; }
.status-badge.active { background:#052e16; color:#86efac; border:1px solid #22c55e; }
.status-badge.past_due { background:#451a03; color:#fdba74; border:1px solid #f97316; }
.status-badge.canceled { background:#450a0a; color:#fca5a5; border:1px solid #ef4444; }

@media (max-width: 768px) {
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .nav-links { gap: 8px; }
  .nav-links a, .nav-links button { font-size: 12px; }
}
