* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #111; color: #e0e0e0; }

/* Login */
.login-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: #1a1a1a; padding: 40px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.4); width: 360px; text-align: center; border: 1px solid #2a2a2a; }
.login-box h1 { font-size: 24px; margin-bottom: 8px; color: #4d9fff; }
.login-box p { font-size: 13px; color: #777; margin-bottom: 24px; }
.login-box input { width: 100%; padding: 12px; border: 1px solid #333; border-radius: 6px; font-size: 14px; margin-bottom: 16px; background: #222; color: #e0e0e0; }
.login-box input::placeholder { color: #666; }
.login-box button { width: 100%; padding: 12px; background: #0071dc; color: #fff; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.login-box button:hover { background: #0084ff; }
.login-error { color: #ff6b6b; font-size: 13px; margin-bottom: 12px; display: none; }

/* Dashboard */
.dashboard { display: none; max-width: 1100px; margin: 0 auto; padding: 24px; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.header h1 { font-size: 22px; color: #4d9fff; }
.header .subtitle { font-size: 13px; color: #777; margin-top: 2px; }

/* Top navigation (shared across License Admin / Relay / Sniper) */
.topnav { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid #2a2a2a; }
.topnav a { font-size: 14px; color: #999; text-decoration: none; padding: 10px 18px;
            border-bottom: 2px solid transparent; margin-bottom: -1px; }
.topnav a:hover { color: #e0e0e0; }
.topnav a.active { color: #4d9fff; border-bottom-color: #0071dc; font-weight: 600; }

/* Section card (shared) */
.section { background: #1a1a1a; border-radius: 8px; border: 1px solid #2a2a2a;
           padding: 20px; margin-bottom: 24px; }
.section h2 { font-size: 15px; font-weight: 600; color: #4d9fff;
              margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid #2a2a2a; }

/* Inline form rows (shared) */
.form-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 12px; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 11px; color: #777; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select {
    padding: 8px 10px; background: #222; border: 1px solid #333;
    border-radius: 5px; color: #e0e0e0; font-size: 13px; min-width: 140px;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: #0071dc; }
.form-group input[type="datetime-local"] { min-width: 200px; }
.form-group input[type="number"] { min-width: 100px; }
.form-group textarea {
    padding: 8px 10px; background: #222; border: 1px solid #333;
    border-radius: 5px; color: #e0e0e0; font: 12px ui-monospace, monospace;
    width: 100%; min-height: 90px; resize: vertical;
}
.form-group textarea:focus { outline: none; border-color: #0071dc; }

/* Buttons (shared) */
.btn { padding: 8px 16px; border: none; border-radius: 5px; font-size: 13px;
       font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 0.15s; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: #0071dc; color: #fff; }
.btn-primary:hover { background: #0084ff; }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: #222; border: 1px solid #333; color: #ccc; }
.btn-ghost:hover { background: #2a2a2a; }

/* Notification bar (shared) */
#notif { display: none; padding: 10px 16px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }
#notif.ok { background: #1a2e1a; border: 1px solid #2d5a2d; color: #6bcf6b; display: block; }
#notif.err { background: #2e1a1a; border: 1px solid #5a2d2d; color: #ef4444; display: block; }

/* Cookie health badges (shared — Sniper page) */
.cookie-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cookie-badge { font-size: 11px; padding: 3px 9px; border-radius: 4px;
                font-family: ui-monospace, monospace; border: 1px solid #333; }
.cookie-badge.ok { background: #1a2e1a; border-color: #2d5a2d; color: #6bcf6b; }
.cookie-badge.bad { background: #2e1a1a; border-color: #5a2d2d; color: #ef4444; }
.cookie-meta { font-size: 12px; color: #777; margin-top: 8px; }
.cookie-meta.stale { color: #f59e0b; }

/* Monospace output panel (shared — diagnostics / preflight) */
.out-panel { margin-top: 12px; padding: 10px; background: #1f2937; color: #d1d5db;
             border-radius: 6px; font: 11px ui-monospace, monospace; white-space: pre-wrap; }
.header button { padding: 8px 16px; background: #222; border: 1px solid #333; border-radius: 6px; cursor: pointer; font-size: 13px; color: #ccc; }
.header button:hover { background: #2a2a2a; border-color: #444; }

/* Stats bar */
.stats-bar { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-card { flex: 1; background: #1a1a1a; padding: 16px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.3); text-align: center; border: 1px solid #2a2a2a; }
.stat-card .value { font-size: 28px; font-weight: 700; color: #4d9fff; }
.stat-card .label { font-size: 12px; color: #777; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* Install link */
.install-link { background: #1a1a1a; padding: 12px 16px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.3); margin-bottom: 24px; display: flex; align-items: center; gap: 12px; border: 1px solid #2a2a2a; font-size: 13px; }
.install-link span { color: #777; white-space: nowrap; }
.install-link code { flex: 1; font-size: 13px; color: #4d9fff; word-break: break-all; }
.install-link button { padding: 6px 14px; background: #0071dc; color: #fff; border: none; border-radius: 4px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.install-link button:hover { background: #0084ff; }

/* Create form */
.create-form { background: #1a1a1a; padding: 16px 20px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.3); margin-bottom: 24px; display: flex; gap: 12px; align-items: center; border: 1px solid #2a2a2a; }
.create-form input { flex: 1; padding: 10px; border: 1px solid #333; border-radius: 6px; font-size: 14px; background: #222; color: #e0e0e0; }
.create-form input::placeholder { color: #666; }
.create-form button { padding: 10px 20px; background: #0071dc; color: #fff; border: none; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.create-form button:hover { background: #0084ff; }
.new-key-result { background: #1a2e1a; border: 1px solid #2d5a2d; padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; display: none; align-items: center; gap: 12px; }
.new-key-result code { font-size: 15px; font-weight: 600; color: #6bcf6b; flex: 1; word-break: break-all; }
.new-key-result button { padding: 6px 14px; background: #28a745; color: #fff; border: none; border-radius: 4px; font-size: 13px; cursor: pointer; }

/* Table */
.table-wrapper { background: #1a1a1a; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.3); overflow: hidden; border: 1px solid #2a2a2a; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: #1e1e1e; padding: 12px; text-align: left; font-weight: 600; color: #999; border-bottom: 2px solid #2a2a2a; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
tbody td { padding: 12px; border-bottom: 1px solid #222; vertical-align: middle; }
tbody tr { cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: #1e1e1e; }

.key-cell { font-family: monospace; font-size: 12px; color: #999; }
.key-full { display: none; }
.key-truncated { cursor: pointer; }
.key-truncated:hover { color: #4d9fff; }

.status-active { color: #4caf50; font-weight: 600; }
.status-revoked { color: #ff6b6b; font-weight: 600; }

.devices-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.devices-ok { background: #1a2e1a; color: #6bcf6b; }
.devices-full { background: #2e2a1a; color: #e0b44d; }

.action-btn { padding: 4px 12px; border: none; border-radius: 4px; font-size: 12px; font-weight: 600; cursor: pointer; }
.action-btn.revoke { background: #2e1a1a; color: #ff6b6b; }
.action-btn.revoke:hover { background: #3e2020; }
.action-btn.activate { background: #1a2e1a; color: #4caf50; }
.action-btn.activate:hover { background: #1e3a1e; }
.action-btn.delete { background: #2e1a1a; color: #ff6b6b; margin-left: 4px; }
.action-btn.delete:hover { background: #4a1a1a; }

/* Expanded row */
.expanded-row { display: none; }
.expanded-row td { padding: 0; }
.expanded-content { padding: 16px 20px; background: #151515; border-bottom: 2px solid #2a2a2a; }
.expanded-content h4 { font-size: 13px; margin-bottom: 8px; color: #999; }
.full-key-display { font-family: monospace; font-size: 14px; background: #222; padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; border: 1px solid #333; }
.full-key-display code { flex: 1; word-break: break-all; color: #e0e0e0; }
.full-key-display button { padding: 4px 10px; font-size: 11px; background: #0071dc; color: #fff; border: none; border-radius: 4px; cursor: pointer; }

.devices-list { margin-bottom: 12px; }
.device-item { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-size: 12px; border-bottom: 1px solid #222; }
.device-item:last-child { border-bottom: none; }
.device-item .device-id { font-family: monospace; color: #999; flex: 1; }
.device-item .device-meta { color: #666; }
.device-item button { padding: 2px 8px; font-size: 11px; background: #2e1a1a; color: #ff6b6b; border: none; border-radius: 3px; cursor: pointer; }
.reset-devices-btn { padding: 4px 12px; font-size: 11px; background: #e67e22; color: #fff; border: none; border-radius: 4px; cursor: pointer; margin-bottom: 12px; }

.usage-list { max-height: 200px; overflow-y: auto; font-size: 12px; }
.usage-item { padding: 4px 0; border-bottom: 1px solid #222; color: #999; display: flex; gap: 16px; }
.usage-item:last-child { border-bottom: none; }

.time-ago { color: #666; font-size: 12px; }
